aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-01 17:54:49 +0000
committergingerBill <bill@gingerbill.org>2021-03-01 17:54:49 +0000
commit667aa3671e585fb348a2e05ddf0992c637b40ec4 (patch)
treea5b8102f5dea54caaee41c4dd240fef8ffc1c131 /src/check_expr.cpp
parentb428e9ee142659de62064a0c6829b998b9446375 (diff)
Fix Addressing for SOA on store; Add intrinsics.type_struct_field_count(T)
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index f3a042bd9..a31f1c871 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -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) {