mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Add bytecode tests verifying identifier resolution produces correct register-backed locals, global lookups, argument indices, and environment lookups for eval/with/captured cases. Add runtime tests for destructuring assignment patterns with expression defaults: class expressions (named/anonymous), function expressions, arrow functions, nested destructuring, eval in defaults, MemberExpression targets with setter functions, and class name scoping.
23 lines
407 B
JavaScript
23 lines
407 B
JavaScript
// Test that simple local variables (let/const) are promoted to register-backed
|
|
// locals. The bytecode should use GetLocal/SetLocal, not GetBinding/SetBinding.
|
|
|
|
function simple_let() {
|
|
let x = 1;
|
|
return x;
|
|
}
|
|
|
|
function simple_const() {
|
|
const y = 2;
|
|
return y;
|
|
}
|
|
|
|
function multiple_locals() {
|
|
let a = 1;
|
|
let b = 2;
|
|
return a + b;
|
|
}
|
|
|
|
simple_let();
|
|
simple_const();
|
|
multiple_locals();
|