diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-27 12:46:14 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-27 12:46:14 -0500 |
| commit | 55d44fe9f235b7916e3184c9a6da8922fd60b056 (patch) | |
| tree | d43483f976c793a240c839f076c9301b221e0682 /environment.c | |
| parent | 1e6df09900ebb0f3f1d2d3deb57e25ee463b50e4 (diff) | |
Tweaks
Diffstat (limited to 'environment.c')
| -rw-r--r-- | environment.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/environment.c b/environment.c index 60857c2c..0f0e18d2 100644 --- a/environment.c +++ b/environment.c @@ -19,6 +19,7 @@ static type_t *namespace_type(const char *name, table_t *ns) struct {const char *name; binding_t *binding; } *entry = Table_entry(ns, i); fields = new(arg_t, .next=fields, .name=entry->name, .type=entry->binding->type); } + name = heap_strf("%s_namespace", name); return Type(StructType, .name=name, .fields=fields); } @@ -65,7 +66,8 @@ env_t *new_compilation_unit(void) for (size_t i = 0; i < sizeof(global_types)/sizeof(global_types[0]); i++) { table_t *ns = new(table_t); *ns = global_types[i].namespace; - Table_str_set(env->globals, global_types[i].name, new(binding_t, .type=namespace_type(global_types[i].name, ns))); + binding_t *binding = new(binding_t, .type=namespace_type(global_types[i].name, ns)); + Table_str_set(env->globals, global_types[i].name, binding); Table_str_set(env->types, global_types[i].name, global_types[i].type); } |
