mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Created these while experimenting with LibJS. Might as well bring them into the tree and increase our coverage.
24 lines
465 B
JavaScript
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();
|