Fix bug in symbol_table_add where it did not increment the length
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| #include "symbols.h" | ||||
| #include "../error.h" | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| @@ -59,11 +60,15 @@ error_t *symbol_table_get_node_info(ast_node_t *node, symbol_kind_t *kind, | ||||
|     case NODE_LABEL: | ||||
|         *kind = SYMBOL_LOCAL; | ||||
|         *name = node->children[0]->token_entry->token.value; | ||||
|         break; | ||||
|         return nullptr; | ||||
|     case NODE_LABEL_REFERENCE: | ||||
|         *kind = SYMBOL_REFERENCE; | ||||
|         *name = node->token_entry->token.value; | ||||
|         break; | ||||
|         return nullptr; | ||||
|     case NODE_IMPORT_DIRECTIVE: | ||||
|         assert(false && "not implemented"); | ||||
|     case NODE_EXPORT_DIRECTIVE: | ||||
|         assert(false && "not implemented"); | ||||
|     // TODO: when .import and .export directives are created add them here | ||||
|     default: | ||||
|         return err_symbol_table_invalid_node; | ||||
| @@ -117,6 +122,8 @@ error_t *symbol_table_add(symbol_table_t *table, char *name, symbol_kind_t kind, | ||||
|         .node = node, | ||||
|     }; | ||||
|  | ||||
|     table->len += 1; | ||||
|  | ||||
|     return nullptr; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user