aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compile.c4
1 files changed, 4 insertions, 0 deletions
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) {