Files
Zachary D. Rowitsch a2e12f3d37 Add JavaScript eval() support with direct/indirect semantics
Implement eval() as a sentinel-intercepted builtin that parses and
executes code strings at runtime with proper scope and strict mode
handling. Direct eval inherits caller scope (vars leak in non-strict),
while indirect and strict eval contain declarations via function scope.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 23:36:06 -05:00

11 lines
201 B
JavaScript

// eval() strict mode — var containment
var leaked = false;
eval("'use strict'; var strictVar = 99");
try {
strictVar;
leaked = true;
} catch (e) {
leaked = false;
}
console.log(leaked);