From 4188d627c6869cb6b443ae3b6dece40486f4a039 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 17 Aug 2025 15:27:34 -0400 Subject: Bugfix: added support for Tomo identifiers that are C keywords --- src/structs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/structs.c') diff --git a/src/structs.c b/src/structs.c index 3e51f81b..873300c5 100644 --- a/src/structs.c +++ b/src/structs.c @@ -4,11 +4,12 @@ #include #include "ast.h" -#include "stdlib/text.h" #include "compile.h" #include "environment.h" -#include "typecheck.h" +#include "naming.h" +#include "stdlib/text.h" #include "stdlib/util.h" +#include "typecheck.h" Text_t compile_struct_typeinfo(env_t *env, type_t *t, const char *name, arg_ast_t *fields, bool is_secret, bool is_opaque) { @@ -60,7 +61,7 @@ Text_t compile_struct_header(env_t *env, ast_t *ast) else if (field->value) code_err(field->value, "This is an opaque type, so it can't be used as a struct field type"); } - fields = Texts(fields, compile_declaration(field_t, Text$from_str(field->name)), + fields = Texts(fields, compile_declaration(field_t, valid_c_name(field->name)), field_t->tag == BoolType ? Text(":1") : EMPTY_TEXT, ";\n"); } Text_t struct_code = def->external ? EMPTY_TEXT : Texts(type_code, " {\n", fields, "};\n"); -- cgit v1.2.3