From b1f7b0cccc6986ca107d9eeb1c7d5e5e5a32dc49 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Sun, 30 Apr 2023 03:11:00 -0300 Subject: gas: Compile variable expression with scope support This patch adds the variable compilation and uses a scope (a stack of map) to lookup for identities. Today we use a vector + ref_entry structs in order to achieve the scope implementation. The ref_entry lacks memory management, we are still no sure who will be the owner of the pointer. We also want to replace the scope a hashtable_t type as soon as we get one. Signed-off-by: Johnny Richard Co-authored-by: Carlos Maniero --- src/ast.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index 1131bbf..55b65fa 100644 --- a/src/ast.c +++ b/src/ast.c @@ -54,17 +54,14 @@ ast_node_destroy(ast_node_t *node) case AST_VARIABLE_DECLARATION: ast_node_destroy(node->data.variable_declaration.value); break; - case AST_LITERAL: - break; case AST_RETURN_STMT: ast_node_destroy(node->data.return_stmt.argument); break; + case AST_LITERAL: case AST_IDENTIFIER: - break; case AST_UNKOWN_NODE: + case AST_VARIABLE: break; - default: - assert(false && "unmapped free strategy"); } free(node); } -- cgit v1.2.3