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.
31 lines
707 B
JavaScript
31 lines
707 B
JavaScript
// Test that variables used in destructuring assignment patterns are correctly
|
|
// resolved as locals/globals after synthesize_binding_pattern re-parsing.
|
|
|
|
function array_destructuring_with_class_default() {
|
|
var x;
|
|
[x = class C {}] = [undefined];
|
|
return x;
|
|
}
|
|
|
|
function object_destructuring_with_function_default() {
|
|
var x;
|
|
({ x = function () {} } = {});
|
|
return x;
|
|
}
|
|
|
|
function setter_parameter_resolution() {
|
|
var setValue;
|
|
[
|
|
{
|
|
set y(val) {
|
|
setValue = val;
|
|
},
|
|
}.y,
|
|
] = [23];
|
|
return setValue;
|
|
}
|
|
|
|
array_destructuring_with_class_default();
|
|
object_destructuring_with_function_default();
|
|
setter_parameter_resolution();
|