Begin work on semantically type checking asm templates

This commit is contained in:
gingerBill
2026-08-09 18:24:56 +01:00
parent 5e49e6c1a5
commit 5ac28cdecd
8 changed files with 769 additions and 29 deletions

View File

@@ -1834,6 +1834,9 @@ retry:;
expr = we->cond->tav.value.value_bool ? we->x : we->y;
goto retry;
case_end;
case_ast_node(label, AsmLabelDecl, expr);
return entity_of_node(label->name);
case_end;
}
return nullptr;
}
@@ -5060,6 +5063,17 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) {
if (fl != nullptr) {
error(name, "Procedure groups are not allowed within a foreign block");
}
} else if (init->kind == Ast_AsmTemplate) {
if (c->scope->flags&ScopeFlag_Type) {
error(name, "Asm templates are not allowed within a struct");
continue;
}
ast_node(at, AsmTemplate, init);
e = alloc_entity_asm_template(d->scope, token, nullptr, init);
if (fl != nullptr) {
error(name, "Asm templates are not allowed within a foreign block");
}
d->init_expr = init;
} else {
e = alloc_entity_constant(d->scope, token, nullptr, empty_exact_value);
}