diff options
| author | gingerBill <bill@gingerbill.org> | 2023-02-01 23:41:13 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-02-01 23:41:13 +0000 |
| commit | 2e4d6d257754b8f91790aac19574d8b7a3d27dc1 (patch) | |
| tree | a78e8a922ee6f2bd5d8386746eefab5cfc022309 /src/checker.cpp | |
| parent | 51ae21a0291e5af62ef9306c75902468654c88b9 (diff) | |
Fix `when` within `foreign` blocks at the file scope
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 6b666a033..d79069769 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3924,6 +3924,7 @@ gb_internal void correct_type_aliases_in_scope(CheckerContext *c, Scope *s) { } } +gb_internal bool collect_file_decl(CheckerContext *ctx, Ast *decl); // NOTE(bill): If file_scopes == nullptr, this will act like a local scope gb_internal void check_collect_entities(CheckerContext *c, Slice<Ast *> const &nodes) { @@ -4005,6 +4006,13 @@ gb_internal void check_collect_entities(CheckerContext *c, Slice<Ast *> const &n check_collect_entities_from_when_stmt(c, &decl->WhenStmt); } } + } else if (c->foreign_context.curr_library) { + for_array(decl_index, nodes) { + Ast *decl = nodes[decl_index]; + if (decl->kind == Ast_WhenStmt) { + collect_file_decl(c, decl); + } + } } } |