mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-14 01:34:35 +00:00
Correctly type check asm template parameters
This commit is contained in:
@@ -2419,6 +2419,8 @@ gb_internal void check_asm_template(CheckerContext *ctx, Entity *entity, DeclInf
|
||||
Type *type = alloc_type_proc(ate->param_scope, params, params->Tuple.variables.count, results, results->Tuple.variables.count, false, pt->calling_convention);
|
||||
type->Proc.diverging = pt->diverging;
|
||||
|
||||
entity->type = type;
|
||||
|
||||
check_asm_specs(ctx, ate->param_scope, at->specs, &ate->decls);
|
||||
{ // check clobbers
|
||||
for (Ast *clobber_ : at->clobbers) {
|
||||
|
||||
@@ -5933,7 +5933,8 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
|
||||
add_entity_use(c, op_expr, e);
|
||||
expr_entity = e;
|
||||
|
||||
if (e != nullptr && (e->kind == Entity_Procedure || e->kind == Entity_ProcGroup) && selector->kind == Ast_Ident) {
|
||||
if (e != nullptr && (e->kind == Entity_Procedure || e->kind == Entity_ProcGroup || e->kind == Entity_AsmTemplate) &&
|
||||
selector->kind == Ast_Ident) {
|
||||
gbString sel_str = expr_to_string(selector);
|
||||
error(node, "'%s' is not declared by '%.*s'", sel_str, LIT(e->token.string));
|
||||
gb_string_free(sel_str);
|
||||
@@ -6304,6 +6305,10 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
|
||||
case Entity_Nil:
|
||||
operand->mode = Addressing_Value;
|
||||
break;
|
||||
|
||||
case Entity_AsmTemplate:
|
||||
operand->mode = Addressing_Value;
|
||||
break;
|
||||
}
|
||||
|
||||
add_type_and_value(c, operand->expr, operand->mode, operand->type, operand->value);
|
||||
|
||||
Reference in New Issue
Block a user