aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-05 13:22:30 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-05 13:22:30 -0500
commitee0f45e2959484d390c30a8a1430a0f040f56631 (patch)
treefaadc463825f7f658463bc19a3622eb305a0e301 /compile.c
parentc2245c85700d5854bb323ffda8dd767c57786dd9 (diff)
Rename type AST nodes
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/compile.c b/compile.c
index f5df7fbd..f7bfbd1b 100644
--- a/compile.c
+++ b/compile.c
@@ -11,7 +11,7 @@
CORD compile_type(type_ast_t *t)
{
switch (t->tag) {
- case TypeVar: return CORD_cat(Match(t, TypeVar)->var.name, "_t");
+ case VarTypeAST: return CORD_cat(Match(t, VarTypeAST)->var.name, "_t");
default: errx(1, "Not implemented");
}
}
@@ -239,13 +239,13 @@ CORD compile(ast_t *ast)
auto def = Match(ast, TypeDef);
CORD code;
switch (def->type->tag) {
- case TypeVar: {
+ case VarTypeAST: {
CORD_sprintf(&code, "typedef %r %s_t;\n", compile_type(def->type), def->var.name);
break;
}
- case TypeStruct: {
+ case StructTypeAST: {
CORD_sprintf(&code, "typedef struct %s_s %s_t;\nstruct %s_s {\n", def->var.name, def->var.name, def->var.name);
- for (arg_list_t *field = Match(def->type, TypeStruct)->fields; field; field = field->next) {
+ for (arg_list_t *field = Match(def->type, StructTypeAST)->fields; field; field = field->next) {
CORD_sprintf(&code, "%r%r %s;\n", code, compile_type(field->type), field->var.name);
}
code = CORD_cat(code, "};\n");