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