Fix Addressing for SOA on store; Add intrinsics.type_struct_field_count(T)

This commit is contained in:
gingerBill
2021-03-01 17:54:49 +00:00
parent b428e9ee14
commit 667aa3671e
5 changed files with 68 additions and 12 deletions

View File

@@ -5768,6 +5768,20 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
}
break;
case BuiltinProc_type_struct_field_count:
operand->value = exact_value_i64(0);
if (operand->mode != Addressing_Type) {
error(operand->expr, "Expected a struct type for '%.*s'", LIT(builtin_name));
} else if (!is_type_struct(operand->type)) {
error(operand->expr, "Expected a struct type for '%.*s'", LIT(builtin_name));
} else {
Type *bt = base_type(operand->type);
operand->value = exact_value_i64(bt->Struct.fields.count);
}
operand->mode = Addressing_Constant;
operand->type = t_untyped_integer;
break;
case BuiltinProc_type_proc_parameter_count:
operand->value = exact_value_i64(0);
if (operand->mode != Addressing_Type) {