diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-05-17 16:13:55 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-05-17 16:13:55 -0400 |
| commit | 13e7d04a74f7ad0b9b9dc96f681d091b65dce5ec (patch) | |
| tree | 321c63e528b939beab2f6f2c46192ab507546735 /src/typecheck.c | |
| parent | 8febea9aebe05644731bb68c297d3d13649a8dcb (diff) | |
Add `modules.ini` file for import aliases, as well as default aliases
for the built-in modules.
Diffstat (limited to 'src/typecheck.c')
| -rw-r--r-- | src/typecheck.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/typecheck.c b/src/typecheck.c index c80f6b2a..60cef3fc 100644 --- a/src/typecheck.c +++ b/src/typecheck.c @@ -182,12 +182,13 @@ static env_t *load_module(env_t *env, ast_t *module_ast) return load_module_env(env, ast); } case USE_MODULE: { + const char *name = module_alias(module_ast); glob_t tm_files; - if (glob(String(TOMO_PREFIX"/share/tomo_"TOMO_VERSION"/installed/", use->path, "/[!._0-9]*.tm"), GLOB_TILDE, NULL, &tm_files) != 0) + if (glob(String(TOMO_PREFIX"/share/tomo_"TOMO_VERSION"/installed/", name, "/[!._0-9]*.tm"), GLOB_TILDE, NULL, &tm_files) != 0) code_err(module_ast, "Could not find library"); env_t *module_env = fresh_scope(env); - Table$str_set(env->imports, use->path, module_env); + Table$str_set(env->imports, name, module_env); for (size_t i = 0; i < tm_files.gl_pathc; i++) { const char *filename = tm_files.gl_pathv[i]; |
