\t -> ' ' L reimar

This commit is contained in:
SimonFJ20 2024-04-06 17:29:21 +02:00
parent 61849ac58d
commit 76bce4efef

View File

@ -64,7 +64,8 @@ int string_symbol_map_set(StringSymbolMap* map, size_t key_hash, Symbol value)
int statements_symbols_vec_construct(StatementsSymbolsVec* vec) int statements_symbols_vec_construct(StatementsSymbolsVec* vec)
{ {
const size_t start_capacity = 4; const size_t start_capacity = 4;
StatementsSymbols* data = malloc(start_capacity * sizeof(StatementsSymbols)); StatementsSymbols* data
= malloc(start_capacity * sizeof(StatementsSymbols));
if (data == NULL) { if (data == NULL) {
return -1; 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) { 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) { if (new_data == NULL) {
return -1; return -1;
} }
@ -121,10 +124,7 @@ void checker_construct(Checker* checker)
statements_symbols_vec_construct(&checker->statements_symbols); statements_symbols_vec_construct(&checker->statements_symbols);
} }
void checker_destroy(Checker* checker) void checker_destroy(Checker* checker) { (void)checker; }
{
(void)checker;
}
bool checker_failed(const Checker* checker) { return checker->failed; } 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) { for (size_t i = 0; i < node->statements.length; ++i) {
checker_check_statement(checker, &table, node->statements.data[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, .table = table,
.statements = node, .statements = node,
}); });
} }
void checker_check_statement(
void checker_check_statement(Checker* checker, SymbolTable* table, ASTNode* node) Checker* checker, SymbolTable* table, ASTNode* node)
{ {
switch (node->node_type) { switch (node->node_type) {
case ASTNodeType_Block: case ASTNodeType_Block: