Type constructors are global

This commit is contained in:
Bruce Hill 2024-02-24 14:41:59 -05:00
parent 08d1a6b971
commit e2520d817c

View File

@ -122,7 +122,7 @@ void bind_statement(env_t *env, ast_t *statement)
if (!type) code_err(statement, "I couldn't get this type");
type_t *constructor_t = Type(FunctionType, .args=Match(type, StructType)->fields, .ret=type);
set_binding(env, def->name, new(binding_t, .type=constructor_t));
Table_str_set(env->globals, def->name, new(binding_t, .type=constructor_t));
break;
}
case EnumDef: {