| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/class-elements/rs-private-method.case |
| 3 |
// - src/class-elements/productions/cls-decl-after-same-line-method.template |
| 4 |
/*--- |
| 5 |
description: Valid PrivateName as private method (field definitions after a method in the same line) |
| 6 |
esid: prod-FieldDefinition |
| 7 |
features: [class-methods-private, class-fields-private, class, class-fields-public] |
| 8 |
flags: [generated] |
| 9 |
includes: [propertyHelper.js] |
| 10 |
info: | |
| 11 |
ClassElement : |
| 12 |
MethodDefinition |
| 13 |
... |
| 14 |
; |
| 15 |
|
| 16 |
MethodDefinition : |
| 17 |
ClassElementName ( UniqueFormalParameters ) { FunctionBody } |
| 18 |
... |
| 19 |
|
| 20 |
ClassElementName : |
| 21 |
PropertyName |
| 22 |
PrivateName |
| 23 |
|
| 24 |
PrivateName :: |
| 25 |
# IdentifierName |
| 26 |
|
| 27 |
IdentifierName :: |
| 28 |
IdentifierStart |
| 29 |
IdentifierName IdentifierPart |
| 30 |
|
| 31 |
IdentifierStart :: |
| 32 |
UnicodeIDStart |
| 33 |
$ |
| 34 |
_ |
| 35 |
\ UnicodeEscapeSequence |
| 36 |
|
| 37 |
IdentifierPart:: |
| 38 |
UnicodeIDContinue |
| 39 |
$ |
| 40 |
\ UnicodeEscapeSequence |
| 41 |
<ZWNJ> <ZWJ> |
| 42 |
|
| 43 |
UnicodeIDStart:: |
| 44 |
any Unicode code point with the Unicode property "ID_Start" |
| 45 |
|
| 46 |
UnicodeIDContinue:: |
| 47 |
any Unicode code point with the Unicode property "ID_Continue" |
| 48 |
|
| 49 |
NOTE 3 |
| 50 |
The sets of code points with Unicode properties "ID_Start" and |
| 51 |
"ID_Continue" include, respectively, the code points with Unicode |
| 52 |
properties "Other_ID_Start" and "Other_ID_Continue". |
| 53 |
|
| 54 |
---*/ |
| 55 |
|
| 56 |
|
| 57 |
class C { |
| 58 |
m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_; |
| 59 |
#$() { |
| 60 |
return this.#$_; |
| 61 |
} |
| 62 |
#_() { |
| 63 |
return this.#__; |
| 64 |
} |
| 65 |
#\u{6F}() { |
| 66 |
return this.#\u{6F}_; |
| 67 |
} |
| 68 |
#\u2118() { |
| 69 |
return this.#\u2118_; |
| 70 |
} |
| 71 |
#ZW_\u200C_NJ() { |
| 72 |
return this.#ZW_\u200C_NJ_; |
| 73 |
} |
| 74 |
#ZW_\u200D_J() { |
| 75 |
return this.#ZW_\u200D_J_; |
| 76 |
} |
| 77 |
; |
| 78 |
$(value) { |
| 79 |
this.#$_ = value; |
| 80 |
return this.#$(); |
| 81 |
} |
| 82 |
_(value) { |
| 83 |
this.#__ = value; |
| 84 |
return this.#_(); |
| 85 |
} |
| 86 |
\u{6F}(value) { |
| 87 |
this.#\u{6F}_ = value; |
| 88 |
return this.#\u{6F}(); |
| 89 |
} |
| 90 |
\u2118(value) { |
| 91 |
this.#\u2118_ = value; |
| 92 |
return this.#\u2118(); |
| 93 |
} |
| 94 |
ZW_\u200C_NJ(value) { |
| 95 |
this.#ZW_\u200C_NJ_ = value; |
| 96 |
return this.#ZW_\u200C_NJ(); |
| 97 |
} |
| 98 |
ZW_\u200D_J(value) { |
| 99 |
this.#ZW_\u200D_J_ = value; |
| 100 |
return this.#ZW_\u200D_J(); |
| 101 |
} |
| 102 |
|
| 103 |
} |
| 104 |
|
| 105 |
var c = new C(); |
| 106 |
|
| 107 |
assert.sameValue(c.m(), 42); |
| 108 |
assert( |
| 109 |
!Object.prototype.hasOwnProperty.call(c, "m"), |
| 110 |
"m doesn't appear as an own property on the C instance" |
| 111 |
); |
| 112 |
assert.sameValue(c.m, C.prototype.m); |
| 113 |
|
| 114 |
verifyProperty(C.prototype, "m", { |
| 115 |
enumerable: false, |
| 116 |
configurable: true, |
| 117 |
writable: true, |
| 118 |
}); |
| 119 |
|
| 120 |
assert.sameValue(c.$(1), 1); |
| 121 |
assert.sameValue(c._(1), 1); |
| 122 |
assert.sameValue(c.\u{6F}(1), 1); |
| 123 |
assert.sameValue(c.\u2118(1), 1); |
| 124 |
assert.sameValue(c.ZW_\u200C_NJ(1), 1); |
| 125 |
assert.sameValue(c.ZW_\u200D_J(1), 1); |
| 126 |
|
| 127 |
reportCompare(0, 0); |