diff options
| author | gingerBill <bill@gingerbill.org> | 2024-08-14 11:28:49 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-08-14 11:28:49 +0100 |
| commit | fd5376ba88ef6ad8dcb4657d3159c7eee737a2af (patch) | |
| tree | 987d1e33f5fa68aa1804dadac2eb484f0c23ef1a /src/checker.cpp | |
| parent | 78fa675c1a56e2aa2e28c52415dd21d3c8970366 (diff) | |
Allow `@(require_results)` on `foreign` blocks
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 3c4b5ddc0..6571f696a 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3212,6 +3212,12 @@ gb_internal DECL_ATTRIBUTE_PROC(foreign_block_decl_attribute) { } c->foreign_context.visibility_kind = kind; return true; + } else if (name == "require_results") { + if (value != nullptr) { + error(elem, "Expected no value for '%.*s'", LIT(name)); + } + c->foreign_context.require_results = true; + return true; } return false; @@ -4300,6 +4306,7 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) { } ast_node(pl, ProcLit, init); e = alloc_entity_procedure(d->scope, token, nullptr, pl->tags); + d->foreign_require_results = c->foreign_context.require_results; if (fl != nullptr) { GB_ASSERT(fl->kind == Ast_Ident); e->Procedure.foreign_library_ident = fl; |