aboutsummaryrefslogtreecommitdiff
path: root/structs.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-11 12:29:48 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-11 12:29:48 -0400
commit210179ee672a0c3799328a54e886f574b3823e3d (patch)
tree25ddb95503c537c19b9fdb7614df2f16c4012d21 /structs.c
parentdee3742b48e27ef36637d004163286d3352b0763 (diff)
Optional enums (deprecated custom tag values)
Diffstat (limited to 'structs.c')
-rw-r--r--structs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/structs.c b/structs.c
index ab5efafb..cc3de838 100644
--- a/structs.c
+++ b/structs.c
@@ -121,7 +121,7 @@ void compile_struct_def(env_t *env, ast_t *ast)
assert(t && t->tag == StructType);
auto struct_ = Match(t, StructType);
if (def->fields) {
- CORD typeinfo = CORD_asprintf("public const TypeInfo %r = {%zu, %zu, {.tag=CustomInfo, .CustomInfo={",
+ CORD typeinfo = CORD_asprintf("public const TypeInfo %r = {%zu, %zu, {.tag=StructInfo, .CustomInfo={",
full_name, type_size(t), type_align(t));
typeinfo = CORD_all(typeinfo, ".as_text=(void*)", full_name, "$as_text, ");
@@ -156,8 +156,8 @@ void compile_struct_def(env_t *env, ast_t *ast)
typeinfo = CORD_cat(typeinfo, "}}};\n");
env->code->typeinfos = CORD_all(env->code->typeinfos, typeinfo);
} else {
- // If there are no fields, we can use an EmptyStruct typeinfo, which generates less code:
- CORD typeinfo = CORD_asprintf("public const TypeInfo %r = {%zu, %zu, {.tag=EmptyStruct, .EmptyStruct.name=%r}};\n",
+ // If there are no fields, we can use an EmptyStructInfo typeinfo, which generates less code:
+ CORD typeinfo = CORD_asprintf("public const TypeInfo %r = {%zu, %zu, {.tag=EmptyStructInfo, .EmptyStructInfo.name=%r}};\n",
full_name, type_size(t), type_align(t), CORD_quoted(def->name));
env->code->typeinfos = CORD_all(env->code->typeinfos, typeinfo);
}