mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 09:27:00 +02:00
Add 39 test cases exercising AST dump output and scope analysis. Tests cover local/global identifier marking, eval/with poisoning, destructuring, closures, hoisting, classes, generators, and more.
39 lines
749 B
JavaScript
39 lines
749 B
JavaScript
// Class name is visible inside the class body but not outside (for class expressions).
|
|
var C = class MyClass {
|
|
method() {
|
|
return MyClass;
|
|
}
|
|
};
|
|
|
|
// Class declaration name IS visible in the enclosing scope.
|
|
function uses_class() {
|
|
class Foo {
|
|
method() {
|
|
return new Foo();
|
|
}
|
|
}
|
|
return new Foo();
|
|
}
|
|
|
|
// Computed property keys are evaluated in the class scope.
|
|
function computed_key() {
|
|
let key = "hello";
|
|
class Bar {
|
|
[key]() {
|
|
return 1;
|
|
}
|
|
}
|
|
return new Bar();
|
|
}
|
|
|
|
// Static methods and fields.
|
|
function static_members() {
|
|
class Baz {
|
|
static x = 1;
|
|
static method() {
|
|
return Baz.x;
|
|
}
|
|
}
|
|
return Baz.method();
|
|
}
|