multiple-definitions-rs-static-privatename-identifier-by-classname.js (3696B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-static-privatename-identifier-by-classname.case 3 // - src/class-elements/productions/cls-expr-multiple-definitions.template 4 /*--- 5 description: Valid Static PrivateName (multiple fields definitions) 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 foo = "foobar"; 61 m() { return 42 } 62 static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J 63 m2() { return 39 } 64 bar = "barbaz"; 65 static $(value) { 66 C.#$ = value; 67 return C.#$; 68 } 69 static _(value) { 70 C.#_ = value; 71 return C.#_; 72 } 73 static \u{6F}(value) { 74 C.#\u{6F} = value; 75 return C.#\u{6F}; 76 } 77 static \u2118(value) { 78 C.#\u2118 = value; 79 return C.#\u2118; 80 } 81 static ZW_\u200C_NJ(value) { 82 C.#ZW_\u200C_NJ = value; 83 return C.#ZW_\u200C_NJ; 84 } 85 static ZW_\u200D_J(value) { 86 C.#ZW_\u200D_J = value; 87 return C.#ZW_\u200D_J; 88 } 89 } 90 91 var c = new C(); 92 93 assert.sameValue(c.m(), 42); 94 assert( 95 !Object.prototype.hasOwnProperty.call(c, "m"), 96 "m doesn't appear as an own property on the C instance" 97 ); 98 assert.sameValue(c.m, C.prototype.m); 99 100 verifyProperty(C.prototype, "m", { 101 enumerable: false, 102 configurable: true, 103 writable: true, 104 }); 105 106 assert.sameValue(c.m2(), 39); 107 assert( 108 !Object.prototype.hasOwnProperty.call(c, "m2"), 109 "m2 doesn't appear as an own property on the C instance" 110 ); 111 assert.sameValue(c.m2, C.prototype.m2); 112 113 verifyProperty(C.prototype, "m2", { 114 enumerable: false, 115 configurable: true, 116 writable: true, 117 }); 118 119 assert.sameValue(c.foo, "foobar"); 120 assert( 121 !Object.prototype.hasOwnProperty.call(C, "foo"), 122 "foo doesn't appear as an own property on the C constructor" 123 ); 124 assert( 125 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 126 "foo doesn't appear as an own property on the C prototype" 127 ); 128 129 verifyProperty(c, "foo", { 130 value: "foobar", 131 enumerable: true, 132 configurable: true, 133 writable: true, 134 }); 135 136 assert.sameValue(c.bar, "barbaz"); 137 assert( 138 !Object.prototype.hasOwnProperty.call(C, "bar"), 139 "bar doesn't appear as an own property on the C constructor" 140 ); 141 assert( 142 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 143 "bar doesn't appear as an own property on the C prototype" 144 ); 145 146 verifyProperty(c, "bar", { 147 value: "barbaz", 148 enumerable: true, 149 configurable: true, 150 writable: true, 151 }); 152 153 assert.sameValue(C.$(1), 1); 154 assert.sameValue(C._(1), 1); 155 assert.sameValue(C.\u{6F}(1), 1); 156 assert.sameValue(C.\u2118(1), 1); 157 assert.sameValue(C.ZW_\u200C_NJ(1), 1); 158 assert.sameValue(C.ZW_\u200D_J(1), 1); 159 160 161 reportCompare(0, 0);