| 1 |
/* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 |
|
| 5 |
// Instance method named "static", with and without escape sequence. |
| 6 |
assertEq((new class { |
| 7 |
static() { return "method-static-no-escape"; } |
| 8 |
}).static(), "method-static-no-escape"); |
| 9 |
|
| 10 |
assertEq((new class { |
| 11 |
st\u0061tic() { return "method-static-escape"; } |
| 12 |
}).static(), "method-static-escape"); |
| 13 |
|
| 14 |
// Instance getter named "static", with and without escape sequence. |
| 15 |
assertEq((new class { |
| 16 |
get static() { return "getter-static-no-escape"; } |
| 17 |
}).static, "getter-static-no-escape"); |
| 18 |
|
| 19 |
assertEq((new class { |
| 20 |
get static() { return "getter-static-escape"; } |
| 21 |
}).static, "getter-static-escape"); |
| 22 |
|
| 23 |
// Static method named "static", with and without escape sequence. |
| 24 |
assertEq(class { |
| 25 |
static static() { return "static-method-static-no-escape"; } |
| 26 |
}.static(), "static-method-static-no-escape"); |
| 27 |
|
| 28 |
assertEq(class { |
| 29 |
static st\u0061tic() { return "static-method-static-escape"; } |
| 30 |
}.static(), "static-method-static-escape"); |
| 31 |
|
| 32 |
// Static getter named "static", with and without escape sequence. |
| 33 |
assertEq(class { |
| 34 |
static get static() { return "static-getter-static-no-escape"; } |
| 35 |
}.static, "static-getter-static-no-escape"); |
| 36 |
|
| 37 |
assertEq(class { |
| 38 |
static get st\u0061tic() { return "static-getter-static-escape"; } |
| 39 |
}.static, "static-getter-static-escape"); |
| 40 |
|
| 41 |
|
| 42 |
// The static modifier itself must not contain any escape sequences. |
| 43 |
assertThrowsInstanceOf(() => eval(String.raw` |
| 44 |
class C { |
| 45 |
st\u0061tic m() {} |
| 46 |
} |
| 47 |
`), SyntaxError); |
| 48 |
|
| 49 |
assertThrowsInstanceOf(() => eval(String.raw` |
| 50 |
class C { |
| 51 |
st\u0061tic get m() {} |
| 52 |
} |
| 53 |
`), SyntaxError); |
| 54 |
|
| 55 |
if (typeof reportCompare === "function") |
| 56 |
reportCompare(0, 0, "ok"); |