Allow @(require_results) on foreign blocks

This commit is contained in:
gingerBill
2024-08-14 11:28:49 +01:00
parent 78fa675c1a
commit fd5376ba88
3 changed files with 14 additions and 1 deletions

View File

@@ -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;