Files
ladybird/Tests/LibJS/Bytecode/input/var-binding-access.js
Andreas Kling fdd7809bd1 Tests/LibJS: Add a big pile of AST, bytecode, and runtime tests
Created these while experimenting with LibJS. Might as well bring them
into the tree and increase our coverage.
2026-02-17 20:44:57 +01:00

24 lines
465 B
JavaScript

// Test that var-declared identifiers use GetInitializedBinding (no TDZ check)
// while let/const-declared identifiers use GetBinding (with TDZ check).
function var_access() {
var x = 1;
// Capture x to prevent local optimization.
(function () {
x;
});
return x;
}
function let_access() {
let x = 1;
// Capture x to prevent local optimization.
(function () {
x;
});
return x;
}
var_access();
let_access();