aboutsummaryrefslogtreecommitdiff
path: root/src/compile/functions.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-12-23 15:28:53 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-12-23 15:28:53 -0500
commit4771d6394d84eefaa45b661c1af8e20ac092a225 (patch)
tree6c0f08c7a6386eb454ef5b3a9059b84883a9ecdb /src/compile/functions.c
parent0ea6cdf216ca765039f3c01f5b32dc1103265b58 (diff)
parent1a62de25c448d2661864ba25a98686ed506e66af (diff)
Merge branch 'dev'
Diffstat (limited to 'src/compile/functions.c')
-rw-r--r--src/compile/functions.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compile/functions.c b/src/compile/functions.c
index ec37c0ad..01377a89 100644
--- a/src/compile/functions.c
+++ b/src/compile/functions.c
@@ -630,6 +630,8 @@ static void check_unused_vars(env_t *env, arg_ast_t *args, ast_t *body) {
const char *name;
} *entry = unused.entries.data + i * unused.entries.stride;
if (streq(entry->name, "_")) continue;
+ // Global/file scoped vars are okay to mutate without reading
+ if (get_binding(env, entry->name) != NULL) continue;
ast_t *var = Table$str_get(assigned_vars, entry->name);
code_err(var, "This variable was assigned to, but never read from.");
}