From 2e4d6d257754b8f91790aac19574d8b7a3d27dc1 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 1 Feb 2023 23:41:13 +0000 Subject: Fix `when` within `foreign` blocks at the file scope --- src/checker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/checker.cpp') 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 const &nodes) { @@ -4005,6 +4006,13 @@ gb_internal void check_collect_entities(CheckerContext *c, Slice 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); + } + } } } -- cgit v1.2.3