snix/tvix/eval/src/compiler
sterni bd4da5f444 fix(tvix/eval): don't mark locals as used in resolve_local
resolve_local isn't exclusively used to compile variable access, so we
shouldn't automatically mark a local as used when it's called.
Specifically, the optimiser would call `is_user_defined`, causing locals
to be marked as used even when they weren't, erroneously silencing the
unused local variable warning.

For resolve_upvalue I've opted not to do the same, instead renaming the
function to make its behavior clearer. The reason for this is that
resolve_upvalue is only used in the code for the purpose of compiling
variable access and mark_used for upvalues would be needlessly
expensive, as it requires recursing through enclosing contexts.

Supersedes / alternative to cl/12708.

Change-Id: Ib4a4a9dfcecf710ab2766b03d0a0cc09245c2d0a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12869
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2024-12-31 21:30:31 +00:00
..
bindings.rs fix(tvix/eval): don't mark locals as used in resolve_local 2024-12-31 21:30:31 +00:00
import.rs feat(tvix/eval): Allow passing in an env to evaluation 2024-07-05 16:39:34 +00:00
mod.rs refactor(tvix/eval): ensure VM operations fit in a single byte 2024-08-19 11:02:50 +00:00
optimiser.rs refactor(tvix/eval): remove redundant clone 2023-02-16 22:42:14 +00:00
scope.rs fix(tvix/eval): don't mark locals as used in resolve_local 2024-12-31 21:30:31 +00:00