multiple-stacked-definitions-rs-static-privatename-identifier-alt.js (3320B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-static-privatename-identifier-alt.case 3 // - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template 4 /*--- 5 description: Valid Static PrivateName (multiple stacked fields definitions through ASI) 6 esid: prod-FieldDefinition 7 features: [class-static-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 static FieldDefinition ; 16 ; 17 18 FieldDefinition : 19 ClassElementName Initializer _opt 20 21 ClassElementName : 22 PropertyName 23 PrivateName 24 25 PrivateName :: 26 # IdentifierName 27 28 IdentifierName :: 29 IdentifierStart 30 IdentifierName IdentifierPart 31 32 IdentifierStart :: 33 UnicodeIDStart 34 $ 35 _ 36 \ UnicodeEscapeSequence 37 38 IdentifierPart:: 39 UnicodeIDContinue 40 $ 41 \ UnicodeEscapeSequence 42 <ZWNJ> <ZWJ> 43 44 UnicodeIDStart:: 45 any Unicode code point with the Unicode property "ID_Start" 46 47 UnicodeIDContinue:: 48 any Unicode code point with the Unicode property "ID_Continue" 49 50 51 NOTE 3 52 The sets of code points with Unicode properties "ID_Start" and 53 "ID_Continue" include, respectively, the code points with Unicode 54 properties "Other_ID_Start" and "Other_ID_Continue". 55 56 ---*/ 57 58 59 var C = class { 60 static #$; static #_; static #\u{6F}; static #℘; static #ZW__NJ; static #ZW__J 61 foo = "foobar" 62 bar = "barbaz"; 63 static $(value) { 64 this.#$ = value; 65 return this.#$; 66 } 67 static _(value) { 68 this.#_ = value; 69 return this.#_; 70 } 71 static o(value) { 72 this.#\u{6F} = value; 73 return this.#\u{6F}; 74 } 75 static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD 76 this.#℘ = value; 77 return this.#℘; 78 } 79 static ZW__NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD 80 this.#ZW__NJ = value; 81 return this.#ZW__NJ; 82 } 83 static ZW__J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD 84 this.#ZW__J = value; 85 return this.#ZW__J; 86 } 87 } 88 89 var c = new C(); 90 91 assert.sameValue(c.foo, "foobar"); 92 assert( 93 !Object.prototype.hasOwnProperty.call(C, "foo"), 94 "foo doesn't appear as an own property on the C constructor" 95 ); 96 assert( 97 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 98 "foo doesn't appear as an own property on the C prototype" 99 ); 100 101 verifyProperty(c, "foo", { 102 value: "foobar", 103 enumerable: true, 104 configurable: true, 105 writable: true, 106 }); 107 108 assert.sameValue(c.bar, "barbaz"); 109 assert( 110 !Object.prototype.hasOwnProperty.call(C, "bar"), 111 "bar doesn't appear as an own property on the C constructor" 112 ); 113 assert( 114 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 115 "bar doesn't appear as an own property on the C prototype" 116 ); 117 118 verifyProperty(c, "bar", { 119 value: "barbaz", 120 enumerable: true, 121 configurable: true, 122 writable: true, 123 }); 124 125 assert.sameValue(C.$(1), 1); 126 assert.sameValue(C._(1), 1); 127 assert.sameValue(C.o(1), 1); 128 assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD 129 assert.sameValue(C.ZW__NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD 130 assert.sameValue(C.ZW__J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD 131 132 133 reportCompare(0, 0);