Skip to content

Commit a8d108c

Browse files
marcomarquesdcBeyondMagic
authored andcommitted
Update symbol_table.c
Implementar a nova assinatura e guardar o ponteiro.
1 parent a2c1c63 commit a8d108c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/symbol_table.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void symbol_table_pop_scope(SymbolTable *table)
109109
table->depth--;
110110
}
111111

112-
int symbol_table_add(SymbolTable *table, const char *name, TypeKind type, int is_array, size_t array_size, TypeKind element_type)
112+
int symbol_table_add(SymbolTable *table, const char *name, TypeKind type, int is_array, size_t array_size, TypeKind element_type, AstStmt *stmt_ref)
113113
{
114114
if (!table || table->depth == 0 || !name)
115115
{
@@ -129,6 +129,19 @@ int symbol_table_add(SymbolTable *table, const char *name, TypeKind type, int is
129129
scope->items[scope->count].is_array = is_array ? 1 : 0;
130130
scope->items[scope->count].array_size = array_size;
131131
scope->items[scope->count].element_type = element_type;
132+
133+
// Adicione esta linha:
134+
scope->items[scope->count].stmt_ref = stmt_ref;
135+
136+
scope->count++;
137+
return 1;
138+
}
139+
ensure_capacity((void **)&scope->items, sizeof(Symbol), &scope->capacity, scope->count + 1);
140+
scope->items[scope->count].name = dup_string(name);
141+
scope->items[scope->count].type = type;
142+
scope->items[scope->count].is_array = is_array ? 1 : 0;
143+
scope->items[scope->count].array_size = array_size;
144+
scope->items[scope->count].element_type = element_type;
132145
scope->count++;
133146
return 1;
134147
}

0 commit comments

Comments
 (0)