\t -> ' ' L reimar
This commit is contained in:
parent
61849ac58d
commit
76bce4efef
21
checker.c
21
checker.c
@ -64,7 +64,8 @@ int string_symbol_map_set(StringSymbolMap* map, size_t key_hash, Symbol value)
|
||||
int statements_symbols_vec_construct(StatementsSymbolsVec* vec)
|
||||
{
|
||||
const size_t start_capacity = 4;
|
||||
StatementsSymbols* data = malloc(start_capacity * sizeof(StatementsSymbols));
|
||||
StatementsSymbols* data
|
||||
= malloc(start_capacity * sizeof(StatementsSymbols));
|
||||
if (data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -83,10 +84,12 @@ void statements_symbols_vec_destroy(StatementsSymbolsVec* vec)
|
||||
}
|
||||
}
|
||||
|
||||
int statements_symbols_vec_push(StatementsSymbolsVec* vec, StatementsSymbols pair)
|
||||
int statements_symbols_vec_push(
|
||||
StatementsSymbolsVec* vec, StatementsSymbols pair)
|
||||
{
|
||||
if (vec->length + 1 > vec->capacity) {
|
||||
StatementsSymbols* new_data = realloc(vec->data, vec->capacity * 2 * sizeof(StatementsSymbols));
|
||||
StatementsSymbols* new_data
|
||||
= realloc(vec->data, vec->capacity * 2 * sizeof(StatementsSymbols));
|
||||
if (new_data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -121,10 +124,7 @@ void checker_construct(Checker* checker)
|
||||
statements_symbols_vec_construct(&checker->statements_symbols);
|
||||
}
|
||||
|
||||
void checker_destroy(Checker* checker)
|
||||
{
|
||||
(void)checker;
|
||||
}
|
||||
void checker_destroy(Checker* checker) { (void)checker; }
|
||||
|
||||
bool checker_failed(const Checker* checker) { return checker->failed; }
|
||||
|
||||
@ -143,14 +143,15 @@ void checker_check_statements(Checker* checker, ASTNode* node)
|
||||
for (size_t i = 0; i < node->statements.length; ++i) {
|
||||
checker_check_statement(checker, &table, node->statements.data[i]);
|
||||
}
|
||||
statements_symbols_vec_push(&checker->statements_symbols, (StatementsSymbols) {
|
||||
statements_symbols_vec_push(&checker->statements_symbols,
|
||||
(StatementsSymbols) {
|
||||
.table = table,
|
||||
.statements = node,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void checker_check_statement(Checker* checker, SymbolTable* table, ASTNode* node)
|
||||
void checker_check_statement(
|
||||
Checker* checker, SymbolTable* table, ASTNode* node)
|
||||
{
|
||||
switch (node->node_type) {
|
||||
case ASTNodeType_Block:
|
||||
|
Loading…
Reference in New Issue
Block a user