diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-29 13:28:39 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-29 13:28:39 -0500 |
| commit | 8171a38b7130849e3049a4ea15a4fd06c154d9b0 (patch) | |
| tree | 7ec4b204e6600ac3dc553d9caadfc722d04d0c8c /compile.c | |
| parent | 764d9fe73b0c9da918d2ecf2c4031219a1fac5be (diff) | |
Add type namespaces
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -146,7 +146,12 @@ CORD compile(env_t *env, ast_t *ast) switch (ast->tag) { case Nil: return CORD_asprintf("$Null(%r)", compile_type_ast(Match(ast, Nil)->type)); case Bool: return Match(ast, Bool)->b ? "yes" : "no"; - case Var: return Match(ast, Var)->name; + case Var: { + binding_t *b = get_binding(env, Match(ast, Var)->name); + if (b) + return b->code ? b->code : Match(ast, Var)->name; + code_err(ast, "I don't know of any variable by this name"); + } case Int: return CORD_asprintf("I%ld(%ld)", Match(ast, Int)->bits, Match(ast, Int)->i); case Num: { // HACK: since the cord library doesn't support the '%a' specifier, this workaround |
