diff options
| author | gingerBill <bill@gingerbill.org> | 2019-10-13 12:38:23 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-10-13 12:38:23 +0100 |
| commit | 2a6d9e8927ad1eb1e5f3a79fc9ed068a02cbfdfc (patch) | |
| tree | 1e771afe3e07425e536b3519818306a6d4e022ff /src/checker.cpp | |
| parent | fa81061db0d08a508ab8bbedfcf7bf5ad1e27daa (diff) | |
`#panic`; Minor change to demo.odin; Fix `#assert` bug at file scope
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index f30273439..8ce9d8ec2 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3367,8 +3367,9 @@ bool collect_file_decls(CheckerContext *ctx, Array<Ast *> const &decls) { if (es->expr->kind == Ast_CallExpr) { ast_node(ce, CallExpr, es->expr); if (ce->proc->kind == Ast_BasicDirective) { - Operand o = {}; - check_expr(ctx, &o, es->expr); + if (ctx->collect_delayed_decls) { + array_add(&ctx->scope->delayed_directives, es->expr); + } } } case_end; @@ -3525,12 +3526,18 @@ void check_import_entities(Checker *c) { for_array(i, pkg->files) { AstFile *f = pkg->files[i]; CheckerContext ctx = c->init_ctx; - add_curr_ast_file(&ctx, f); + for_array(j, f->scope->delayed_imports) { Ast *decl = f->scope->delayed_imports[j]; check_add_import_decl(&ctx, decl); } + } + for_array(i, pkg->files) { + AstFile *f = pkg->files[i]; + CheckerContext ctx = c->init_ctx; + add_curr_ast_file(&ctx, f); + for_array(j, f->scope->delayed_directives) { Ast *expr = f->scope->delayed_directives[j]; Operand o = {}; |