diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-03-08 13:39:27 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-03-08 13:39:27 -0500 |
| commit | 55b4528da67403e3909398dc08446244c07eee3e (patch) | |
| tree | 9510d8b3a71cd41189dff344de0f97eef6b78de3 | |
| parent | 0e9dbb4f8a145022cba56de7692d4fe56aad7a3f (diff) | |
Tweak environment order of operations and resolutions
| -rw-r--r-- | environment.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/environment.c b/environment.c index 1f8d5745..06e1a032 100644 --- a/environment.c +++ b/environment.c @@ -171,13 +171,14 @@ env_t *new_compilation_unit(void) } for (size_t i = 0; i < sizeof(global_types)/sizeof(global_types[0]); i++) { - table_t *namespace = new(table_t); + table_t *namespace = new(table_t, .fallback=env->globals); + Table_str_set(env->type_namespaces, global_types[i].name, namespace); + env_t *ns_env = namespace_env(env, global_types[i].name); $ARRAY_FOREACH(global_types[i].namespace, j, ns_entry_t, entry, { - type_t *type = parse_type_string(env, entry.type_str); + type_t *type = parse_type_string(ns_env, entry.type_str); binding_t *b = new(binding_t, .code=entry.code, .type=type); Table_str_set(namespace, entry.name, b); }, {}) - Table_str_set(env->type_namespaces, global_types[i].name, namespace); } return env; |
