multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js (2931B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.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 #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW__NJ = 1; static #ZW__J = 1 61 foo = "foobar" 62 bar = "barbaz"; 63 static $() { 64 return C.#$; 65 } 66 static _() { 67 return C.#_; 68 } 69 static \u{6F}() { 70 return C.#\u{6F}; 71 } 72 static ℘() { 73 return C.#℘; 74 } 75 static ZW__NJ() { 76 return C.#ZW__NJ; 77 } 78 static ZW__J() { 79 return C.#ZW__J; 80 } 81 } 82 83 var c = new C(); 84 85 assert.sameValue(c.foo, "foobar"); 86 assert( 87 !Object.prototype.hasOwnProperty.call(C, "foo"), 88 "foo doesn't appear as an own property on the C constructor" 89 ); 90 assert( 91 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 92 "foo doesn't appear as an own property on the C prototype" 93 ); 94 95 verifyProperty(c, "foo", { 96 value: "foobar", 97 enumerable: true, 98 configurable: true, 99 writable: true, 100 }); 101 102 assert.sameValue(c.bar, "barbaz"); 103 assert( 104 !Object.prototype.hasOwnProperty.call(C, "bar"), 105 "bar doesn't appear as an own property on the C constructor" 106 ); 107 assert( 108 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 109 "bar doesn't appear as an own property on the C prototype" 110 ); 111 112 verifyProperty(c, "bar", { 113 value: "barbaz", 114 enumerable: true, 115 configurable: true, 116 writable: true, 117 }); 118 119 assert.sameValue(C.$(), 1); 120 assert.sameValue(C._(), 1); 121 assert.sameValue(C.\u{6F}(), 1); 122 assert.sameValue(C.℘(), 1); 123 assert.sameValue(C.ZW__NJ(), 1); 124 assert.sameValue(C.ZW__J(), 1); 125 126 127 reportCompare(0, 0);