Fixed a bug in the SymbolsTable where it wouldn't update its size.

This commit is contained in:
2022-10-03 20:11:04 -05:00
parent cd1258a724
commit 1f7989533b
2 changed files with 6 additions and 77 deletions
+2 -1
View File
@@ -52,7 +52,7 @@ Symbol* TryGetSymbol(char* name, SymbolTable* table) {
}
Symbol* AddSymbolToTable(char* name, void* value, int length, SymbolTable* table) {
if (!name || !value || !table || length == 0) return NULL;
//if (!name || !value || !table || length == 0) return NULL;
for(int i = 0; i < table->Size; i++) {
if (strcmp(table->Symbols[i]->Name, name) == 0) {
@@ -78,6 +78,7 @@ Symbol* AddSymbolToTable(char* name, void* value, int length, SymbolTable* table
Symbol* symbol = CreateSymbol(name, value, length);
table->Symbols[table->Size] = symbol;
table->Size++;
return symbol;
}