MIR: lexical scoping + builder vars modules
This commit is contained in:
@ -21,7 +21,7 @@ Assignment to an identifier resolves as follows:
|
||||
|
||||
1) If a `local` declaration with the same name exists in the current block, update that binding.
|
||||
2) Otherwise, search outward through enclosing blocks and update the first found binding.
|
||||
3) If no binding exists in any enclosing scope, create a new binding in the current scope.
|
||||
3) If no binding exists in any enclosing scope, it is an error (undeclared variable). Declare it with `local`.
|
||||
|
||||
This matches intuitive block‑scoped semantics (Lua‑like), and differs from Python where inner blocks do not create a new scope (function scope), and assignment would create a local unless `nonlocal`/`global` is used.
|
||||
|
||||
@ -63,4 +63,3 @@ The above semantics are enforced consistently across:
|
||||
- LLVM harness/EXE: parity tests validate identical exit codes/behavior.
|
||||
|
||||
See also: quick/integration smokes `scope_assign_vm.sh`, `vm_llvm_scope_assign.sh`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user