Skip to content

Comments

Interpreter: fix strict refs/vars enforcement in eval STRING#227

Merged
fglock merged 1 commit intomasterfrom
fix-interpreter-strictures
Feb 24, 2026
Merged

Interpreter: fix strict refs/vars enforcement in eval STRING#227
fglock merged 1 commit intomasterfrom
fix-interpreter-strictures

Conversation

@fglock
Copy link
Owner

@fglock fglock commented Feb 24, 2026

Interpreter: fix strict refs/vars enforcement in eval STRING

  • Add LOAD_SYMBOLIC_SCALAR_NONSTRICT (338) and STORE_SYMBOLIC_SCALAR_NONSTRICT (339)
    opcodes so BytecodeCompiler emits the strict variant when strict refs is active
    and the non-strict variant otherwise, matching JVM compiler behaviour.

  • Fix BytecodeCompiler.enterScope/exitScope to call emitterContext.symbolTable
    .enterScope()/.exitScope() so pragma flags are properly scoped to blocks,
    preventing use 5.012 inside a block from leaking strict into surrounding code.

  • Add strict vars check in compileVariableReference for the undeclared-global
    path so Global-symbol errors are thrown at interpreter compile time.

Results:
comp/use.t interpreter: 40 -> 44 passing
op/die.t interpreter: 19 -> 25 passing (only pre-existing TODO test 26 remains)

- Add LOAD_SYMBOLIC_SCALAR_NONSTRICT (338) and STORE_SYMBOLIC_SCALAR_NONSTRICT (339)
  opcodes so BytecodeCompiler emits the strict variant when strict refs is active
  and the non-strict variant otherwise, matching JVM compiler behaviour.

- Fix BytecodeCompiler.enterScope/exitScope to call emitterContext.symbolTable
  .enterScope()/.exitScope() so pragma flags (strict/feature/warning) are
  properly scoped to blocks — prevents use 5.012 inside {…} from leaking strict
  into the surrounding code.

- Add strict vars check in compileVariableReference for the undeclared-global
  path so Global-symbol errors are thrown at interpreter compile time.

Results:
  comp/use.t interpreter: 40 → 44 passing
  op/die.t interpreter:   19 → 25 passing (only pre-existing TODO test 26 remains)
@fglock fglock merged commit 3496e65 into master Feb 24, 2026
2 checks passed
@fglock fglock deleted the fix-interpreter-strictures branch February 24, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant