diff options
| author | avanspector <avanspector@gmail.com> | 2024-08-26 19:59:15 +0200 |
|---|---|---|
| committer | avanspector <avanspector@gmail.com> | 2024-08-26 19:59:15 +0200 |
| commit | d7e977069a96916627d2f0b8e9ae848279a22784 (patch) | |
| tree | 6ab42c4fc0a347d53d4dd30aa46e2bd3c41f19dc /src/checker.cpp | |
| parent | f56b895c05e955856e633408f5ceeebc8594da4f (diff) | |
Update checker.cpp
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 637659582..35b84c155 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3174,7 +3174,7 @@ gb_internal DECL_ATTRIBUTE_PROC(foreign_block_decl_attribute) { return true; } else if (name == "link_prefix") { if (ev.kind == ExactValue_String) { - String link_prefix = ev.value_string; + String link_prefix = string_trim_whitespace(ev.value_string); if (link_prefix.len != 0 && !is_foreign_name_valid(link_prefix)) { error(elem, "Invalid link prefix: '%.*s'", LIT(link_prefix)); } else { @@ -3186,7 +3186,7 @@ gb_internal DECL_ATTRIBUTE_PROC(foreign_block_decl_attribute) { return true; } else if (name == "link_suffix") { if (ev.kind == ExactValue_String) { - String link_suffix = ev.value_string; + String link_suffix = string_trim_whitespace(ev.value_string); if (link_suffix.len != 0 && !is_foreign_name_valid(link_suffix)) { error(elem, "Invalid link suffix: '%.*s'", LIT(link_suffix)); } else { @@ -4474,6 +4474,8 @@ gb_internal void correct_type_aliases_in_scope(CheckerContext *c, Scope *s) { } } +bool is_collect_entities_post = false; + // 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) { AstFile *curr_file = nullptr; @@ -4532,7 +4534,9 @@ gb_internal void check_collect_entities(CheckerContext *c, Slice<Ast *> const &n case_end; case_ast_node(fb, ForeignBlockDecl, decl); - check_add_foreign_block_decl(c, decl); + if (is_collect_entities_post) { + check_add_foreign_block_decl(c, decl); + } case_end; default: @@ -6437,6 +6441,10 @@ gb_internal void check_parsed_files(Checker *c) { TIME_SECTION("export entities - post"); check_export_entities(c); + TIME_SECTION("collect entities - post"); + is_collect_entities_post = true; + check_collect_entities_all(c); + TIME_SECTION("add entities from packages"); check_merge_queues_into_arrays(c); |