From 369c601a560f9c081e2bc04e4f4fe5a8b7b1a6a0 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 16 Apr 2024 13:50:07 -0400 Subject: Invert escaping so user symbols get prepended with "$" and builtin symbols don't --- typecheck.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'typecheck.c') 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; -- cgit v1.2.3