diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-04-16 13:50:07 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-04-16 13:50:07 -0400 |
| commit | 369c601a560f9c081e2bc04e4f4fe5a8b7b1a6a0 (patch) | |
| tree | aeaa5f7a1af83e25de99187f6e4c31e0609de65b /typecheck.c | |
| parent | 98b93bb15922974feb06103bea06ec305e17b2ce (diff) | |
Invert escaping so user symbols get prepended with "$" and builtin
symbols don't
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/typecheck.c b/typecheck.c index 35bdef19..518b7ce4 100644 --- a/typecheck.c +++ b/typecheck.c @@ -101,7 +101,7 @@ void bind_statement(env_t *env, ast_t *statement) bind_statement(env, decl->value); type_t *type = get_type(env, decl->value); const char *name = Match(decl->var, Var)->name; - CORD code = CORD_cat(env->scope_prefix, name); + CORD code = CORD_cat(env->scope_prefix ? env->scope_prefix : "$", name); set_binding(env, name, new(binding_t, .type=type, .code=code)); break; } @@ -673,8 +673,8 @@ type_t *get_type(env_t *env, ast_t *ast) type_t *iter_t = get_type(env, reduction->iter); type_t *value_t = iteration_value_type(iter_t); env_t *scope = fresh_scope(env); - set_binding(scope, "$reduction", new(binding_t, .type=value_t, .code="$reduction")); - set_binding(scope, "$iter_value", new(binding_t, .type=value_t, .code="$iter_value")); + set_binding(scope, "$reduction", new(binding_t, .type=value_t, .code="reduction")); + set_binding(scope, "$iter_value", new(binding_t, .type=value_t, .code="iter_value")); type_t *t = get_type(scope, reduction->combination); if (!reduction->fallback) return t; |
