aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-17 13:44:01 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-17 13:44:01 -0400
commite98f6854f5995c42d16641cee0281dacde4cc25c (patch)
tree1d02575949b9335a36853d0c00bc4e92a5b5e8bb /typecheck.c
parent35339e2aa028942d297f15521c26e1400fe1eca2 (diff)
Use leading underscore for file-local variables and functions instead of
"private" keyword
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/typecheck.c b/typecheck.c
index 518b7ce4..efc105af 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -109,7 +109,8 @@ void bind_statement(env_t *env, ast_t *statement)
auto def = Match(statement, FunctionDef);
type_t *type = get_function_def_type(env, statement);
const char *name = Match(def->name, Var)->name;
- CORD code = CORD_all(env->file_prefix, env->scope_prefix, name);
+ bool is_private = (name[0] == '_');
+ CORD code = is_private ? CORD_cat("$", name) : CORD_all(env->file_prefix, env->scope_prefix, name);
set_binding(env, name, new(binding_t, .type=type, .code=code));
break;
}