From 35339e2aa028942d297f15521c26e1400fe1eca2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 16 Apr 2024 14:02:39 -0400 Subject: Fix globals issue --- compile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compile.c b/compile.c index ecde6bfe..27b4a442 100644 --- a/compile.c +++ b/compile.c @@ -2054,7 +2054,11 @@ module_code_t compile_file(ast_t *ast) Table$str_set(env->imports, name, env); for (ast_list_t *stmt = Match(ast, Block)->statements; stmt; stmt = stmt->next) { + // Hack: make sure global is bound as foo$var: + if (stmt->ast->tag == Declare) + env->scope_prefix = heap_strf("%s$", name); bind_statement(env, stmt->ast); + env->scope_prefix = NULL; } for (ast_list_t *stmt = Match(ast, Block)->statements; stmt; stmt = stmt->next) { if (stmt->ast->tag == Declare) { -- cgit v1.2.3