blob: 3012e4bfe9aee9e0b23841a7324598b959a0ec7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// |reftest| skip-if(!xulRuntime.shell)
// Are private fields enabled?
let privateFields = false;
try {
Function('class C { #x; }');
privateFields = true;
} catch (exc) {
assertEq(exc instanceof SyntaxError, true);
}
if (!privateFields) {
assertThrowsInstanceOf(() => eval(`class A { #x }`), SyntaxError);
assertThrowsInstanceOf(() => eval(`class A { #x=10 }`), SyntaxError);
} else {
assertThrowsInstanceOf(() => eval(`class A { #x; #x; }`), SyntaxError);
}
// No computed private fields
assertThrowsInstanceOf(
() => eval(`var x = "foo"; class A { #[x] = 20; }`), SyntaxError);
if (typeof reportCompare === 'function') reportCompare(0, 0);
|