| 1 |
// |reftest| async |
| 2 |
// This file was procedurally generated from the following sources: |
| 3 |
// - src/class-elements/rs-field-identifier-initializer.case |
| 4 |
// - src/class-elements/productions/cls-decl-after-same-line-async-method.template |
| 5 |
/*--- |
| 6 |
description: Valid FieldDefinition (field definitions after an async method in the same line) |
| 7 |
esid: prod-FieldDefinition |
| 8 |
features: [class-fields-public, class, async-functions] |
| 9 |
flags: [generated, async] |
| 10 |
includes: [propertyHelper.js] |
| 11 |
info: | |
| 12 |
ClassElement : |
| 13 |
... |
| 14 |
FieldDefinition ; |
| 15 |
; |
| 16 |
|
| 17 |
FieldDefinition : |
| 18 |
ClassElementName Initializer _opt |
| 19 |
|
| 20 |
ClassElementName : |
| 21 |
PropertyName |
| 22 |
|
| 23 |
PropertyName : |
| 24 |
LiteralPropertyName |
| 25 |
ComputedPropertyName |
| 26 |
|
| 27 |
LiteralPropertyName : |
| 28 |
IdentifierName |
| 29 |
|
| 30 |
IdentifierName :: |
| 31 |
IdentifierStart |
| 32 |
IdentifierName IdentifierPart |
| 33 |
|
| 34 |
IdentifierStart :: |
| 35 |
UnicodeIDStart |
| 36 |
$ |
| 37 |
_ |
| 38 |
\ UnicodeEscapeSequence |
| 39 |
|
| 40 |
IdentifierPart:: |
| 41 |
UnicodeIDContinue |
| 42 |
$ |
| 43 |
\ UnicodeEscapeSequence |
| 44 |
<ZWNJ> <ZWJ> |
| 45 |
|
| 46 |
UnicodeIDStart:: |
| 47 |
any Unicode code point with the Unicode property "ID_Start" |
| 48 |
|
| 49 |
UnicodeIDContinue:: |
| 50 |
any Unicode code point with the Unicode property "ID_Continue" |
| 51 |
|
| 52 |
|
| 53 |
NOTE 3 |
| 54 |
The sets of code points with Unicode properties "ID_Start" and |
| 55 |
"ID_Continue" include, respectively, the code points with Unicode |
| 56 |
properties "Other_ID_Start" and "Other_ID_Continue". |
| 57 |
|
| 58 |
---*/ |
| 59 |
|
| 60 |
|
| 61 |
class C { |
| 62 |
async m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; |
| 63 |
|
| 64 |
} |
| 65 |
|
| 66 |
var c = new C(); |
| 67 |
|
| 68 |
assert( |
| 69 |
!Object.prototype.hasOwnProperty.call(c, "m"), |
| 70 |
"m doesn't appear as an own property on the C instance" |
| 71 |
); |
| 72 |
assert.sameValue(c.m, C.prototype.m); |
| 73 |
|
| 74 |
verifyProperty(C.prototype, "m", { |
| 75 |
enumerable: false, |
| 76 |
configurable: true, |
| 77 |
writable: true, |
| 78 |
}, {restore: true}); |
| 79 |
|
| 80 |
c.m().then(function(v) { |
| 81 |
assert.sameValue(v, 42); |
| 82 |
|
| 83 |
function assertions() { |
| 84 |
// Cover $DONE handler for async cases. |
| 85 |
function $DONE(error) { |
| 86 |
if (error) { |
| 87 |
throw new Test262Error('Test262:AsyncTestFailure') |
| 88 |
} |
| 89 |
} |
| 90 |
assert.sameValue(c.$, 1); |
| 91 |
assert.sameValue(c._, 1); |
| 92 |
assert.sameValue(c.\u{6F}, 1); |
| 93 |
assert.sameValue(c.\u2118, 1); |
| 94 |
assert.sameValue(c.ZW_\u200C_NJ, 1); |
| 95 |
assert.sameValue(c.ZW_\u200D_J, 1); |
| 96 |
} |
| 97 |
|
| 98 |
return Promise.resolve(assertions()); |
| 99 |
}).then($DONE, $DONE); |