diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-17 15:27:34 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-17 15:27:34 -0400 |
| commit | 4188d627c6869cb6b443ae3b6dece40486f4a039 (patch) | |
| tree | 018d309e84cd752c93a3b55770fcd979e0d35c54 /src/environment.c | |
| parent | 82466a2f9507ad6991c5a275d2be97691ef58db6 (diff) | |
Bugfix: added support for Tomo identifiers that are C keywords
Diffstat (limited to 'src/environment.c')
| -rw-r--r-- | src/environment.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/src/environment.c b/src/environment.c index 3faad24d..f43e8daf 100644 --- a/src/environment.c +++ b/src/environment.c @@ -5,6 +5,7 @@ #include <sys/stat.h> #include "environment.h" +#include "naming.h" #include "parse.h" #include "stdlib/datatypes.h" #include "stdlib/paths.h" @@ -543,30 +544,6 @@ env_t *global_env(bool source_mapping) return env; } -Text_t CONSTFUNC namespace_name(env_t *env, namespace_t *ns, Text_t name) -{ - for (; ns; ns = ns->parent) - name = Texts(ns->name, "$", name); - if (env->id_suffix.length > 0) - name = Texts(name, env->id_suffix); - return name; -} - -Text_t get_id_suffix(const char *filename) -{ - assert(filename); - Path_t path = Path$from_str(filename); - Path_t build_dir = Path$sibling(path, Text(".build")); - if (mkdir(Path$as_c_string(build_dir), 0755) != 0) { - if (!Path$is_directory(build_dir, true)) - err(1, "Could not make .build directory"); - } - Path_t id_file = Path$child(build_dir, Texts(Path$base_name(path), Text$from_str(".id"))); - OptionalText_t id = Path$read(id_file); - if (id.length < 0) err(1, "Could not read ID file: ", id_file); - return Texts(Text("$"), id); -} - env_t *load_module_env(env_t *env, ast_t *ast) { const char *name = ast->file->filename; |
