multiple-definitions-rs-privatename-identifier-alt.js (3542B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-privatename-identifier-alt.case 3 // - src/class-elements/productions/cls-expr-multiple-definitions.template 4 /*--- 5 description: Valid PrivateName (multiple fields definitions) 6 esid: prod-FieldDefinition 7 features: [class-fields-private, class, class-fields-public] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 ClassElement : 12 MethodDefinition 13 static MethodDefinition 14 FieldDefinition ; 15 ; 16 17 FieldDefinition : 18 ClassElementName Initializer _opt 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 50 NOTE 3 51 The sets of code points with Unicode properties "ID_Start" and 52 "ID_Continue" include, respectively, the code points with Unicode 53 properties "Other_ID_Start" and "Other_ID_Continue". 54 55 ---*/ 56 57 58 var C = class { 59 foo = "foobar"; 60 m() { return 42 } 61 #$; #_; #\u{6F}; #℘; #ZW__NJ; #ZW__J 62 m2() { return 39 } 63 bar = "barbaz"; 64 $(value) { 65 this.#$ = value; 66 return this.#$; 67 } 68 _(value) { 69 this.#_ = value; 70 return this.#_; 71 } 72 \u{6F}(value) { 73 this.#\u{6F} = value; 74 return this.#\u{6F}; 75 } 76 ℘(value) { 77 this.#℘ = value; 78 return this.#℘; 79 } 80 ZW__NJ(value) { 81 this.#ZW__NJ = value; 82 return this.#ZW__NJ; 83 } 84 ZW__J(value) { 85 this.#ZW__J = value; 86 return this.#ZW__J; 87 } 88 } 89 90 var c = new C(); 91 92 assert.sameValue(c.m(), 42); 93 assert( 94 !Object.prototype.hasOwnProperty.call(c, "m"), 95 "m doesn't appear as an own property on the C instance" 96 ); 97 assert.sameValue(c.m, C.prototype.m); 98 99 verifyProperty(C.prototype, "m", { 100 enumerable: false, 101 configurable: true, 102 writable: true, 103 }); 104 105 assert.sameValue(c.m2(), 39); 106 assert( 107 !Object.prototype.hasOwnProperty.call(c, "m2"), 108 "m2 doesn't appear as an own property on the C instance" 109 ); 110 assert.sameValue(c.m2, C.prototype.m2); 111 112 verifyProperty(C.prototype, "m2", { 113 enumerable: false, 114 configurable: true, 115 writable: true, 116 }); 117 118 assert.sameValue(c.foo, "foobar"); 119 assert( 120 !Object.prototype.hasOwnProperty.call(C, "foo"), 121 "foo doesn't appear as an own property on the C constructor" 122 ); 123 assert( 124 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 125 "foo doesn't appear as an own property on the C prototype" 126 ); 127 128 verifyProperty(c, "foo", { 129 value: "foobar", 130 enumerable: true, 131 configurable: true, 132 writable: true, 133 }); 134 135 assert.sameValue(c.bar, "barbaz"); 136 assert( 137 !Object.prototype.hasOwnProperty.call(C, "bar"), 138 "bar doesn't appear as an own property on the C constructor" 139 ); 140 assert( 141 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 142 "bar doesn't appear as an own property on the C prototype" 143 ); 144 145 verifyProperty(c, "bar", { 146 value: "barbaz", 147 enumerable: true, 148 configurable: true, 149 writable: true, 150 }); 151 152 assert.sameValue(c.$(1), 1); 153 assert.sameValue(c._(1), 1); 154 assert.sameValue(c.\u{6F}(1), 1); 155 assert.sameValue(c.℘(1), 1); 156 assert.sameValue(c.ZW__NJ(1), 1); 157 assert.sameValue(c.ZW__J(1), 1); 158 159 160 reportCompare(0, 0);