diff options
Diffstat (limited to 'src/compile/functions.c')
| -rw-r--r-- | src/compile/functions.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compile/functions.c b/src/compile/functions.c index 77393ab2..cadd0453 100644 --- a/src/compile/functions.c +++ b/src/compile/functions.c @@ -630,7 +630,10 @@ 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); + assert(var); code_err(var, "This variable was assigned to, but never read from."); } } |
