From 30f448a4900a5f7bd1caea1d7ff76bd593d5751b Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Mon, 13 Jun 2022 20:35:45 +0200 Subject: [PATCH] Fix codegen scope names --- ccodegen.cpp | 2 +- main.cpp | 1 + typechecking.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ccodegen.cpp b/ccodegen.cpp index 55eb59f..b05f924 100644 --- a/ccodegen.cpp +++ b/ccodegen.cpp @@ -172,7 +172,7 @@ function void gen_expr(Ast_Expr *ast){ switch(ast->kind){ CASE(IDENT, Atom){ - gen_scope_name(node->parent_scope); + gen_scope_name(node->resolved_decl->parent_scope); gen("%s", node->intern_val.str); BREAK(); } diff --git a/main.cpp b/main.cpp index 9f1eecf..7db51b1 100644 --- a/main.cpp +++ b/main.cpp @@ -50,6 +50,7 @@ want to export all the symbols, we can namespace them optionally. [ ] - Some way to take slice of data [ ] - slices should be properly displayed in debugger [ ] - elif +[ ] - Hex 0x42 [ ] - #assert that handles constants at compile time and vars at runtime [ ] - Comma notation when declaring variables thing1, thing2: S32 diff --git a/typechecking.cpp b/typechecking.cpp index 5474c1c..c0b14cf 100644 --- a/typechecking.cpp +++ b/typechecking.cpp @@ -645,6 +645,7 @@ resolve_field_access(Ast_Expr *node, Ast_Scope *context){ Ast_Scope *scope = context ? context : node->parent_scope; Search_Flag flag = context ? SEARCH_ONLY_CURRENT_SCOPE : 0; Ast_Decl *decl = resolve_name(scope, node->pos, ident->intern_val, flag); + ident->resolved_decl = decl; if(decl->kind == AST_FILE_NAMESPACE || decl->kind == AST_MODULE_NAMESPACE){ assert(next); return resolve_field_access(next, decl->scope);