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