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> |
||
|---|---|---|
| .. | ||
| bindings.rs | ||
| import.rs | ||
| mod.rs | ||
| optimiser.rs | ||
| scope.rs | ||