diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-04-16 14:02:39 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-04-16 14:02:39 -0400 |
| commit | 35339e2aa028942d297f15521c26e1400fe1eca2 (patch) | |
| tree | 0d02d1a53c4e37a190bfcb48d2601db937bcb0fb | |
| parent | 1e283dd31048e2d21c22784b1a438836ffbea7c4 (diff) | |
Fix globals issue
| -rw-r--r-- | compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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) { |
