From 558c8588ee2aa772442837be16a7ed19a36cc753 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 5 Mar 2024 12:55:38 -0500 Subject: Fix default values for structs --- typecheck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'typecheck.c') diff --git a/typecheck.c b/typecheck.c index 98597330..165e74dd 100644 --- a/typecheck.c +++ b/typecheck.c @@ -121,7 +121,7 @@ void bind_statement(env_t *env, ast_t *statement) type_t *type = Type(StructType, .name=def->name, .fields=fields, .opaque=true); // placeholder Table_str_set(env->types, def->name, type); for (arg_ast_t *field_ast = def->fields; field_ast; field_ast = field_ast->next) { - type_t *field_t = parse_type_ast(env, field_ast->type); + type_t *field_t = get_arg_ast_type(env, field_ast); if ((field_t->tag == StructType && Match(field_t, StructType)->opaque) || (field_t->tag == EnumType && Match(field_t, EnumType)->opaque)) code_err(field_ast->type, "This type is recursive and would create an infinitely sized struct. Try using a pointer."); @@ -150,7 +150,7 @@ void bind_statement(env_t *env, ast_t *statement) for (tag_ast_t *tag_ast = def->tags; tag_ast; tag_ast = tag_ast->next) { arg_t *fields = NULL; for (arg_ast_t *field_ast = tag_ast->fields; field_ast; field_ast = field_ast->next) { - type_t *field_t = parse_type_ast(env, field_ast->type); + type_t *field_t = get_arg_ast_type(env, field_ast); if ((field_t->tag == StructType && Match(field_t, StructType)->opaque) || (field_t->tag == EnumType && Match(field_t, EnumType)->opaque)) code_err(field_ast->type, "This type is recursive and would create an infinitely sized struct. Try using a pointer."); -- cgit v1.2.3