multiple-stacked-definitions-rs-private-setter-alt.js (3302B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-private-setter-alt.case 3 // - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template 4 /*--- 5 description: Valid PrivateName as private setter (multiple stacked fields definitions through ASI) 6 esid: prod-FieldDefinition 7 features: [class-methods-private, class-fields-private, class, class-fields-public] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 ClassElement : 12 MethodDefinition 13 ... 14 ; 15 16 MethodDefinition : 17 ... 18 set ClassElementName ( PropertySetParameterList ) { FunctionBody } 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 NOTE 3 50 The sets of code points with Unicode properties "ID_Start" and 51 "ID_Continue" include, respectively, the code points with Unicode 52 properties "Other_ID_Start" and "Other_ID_Continue". 53 54 ---*/ 55 56 57 var C = class { 58 #$_; #__; #\u{6F}_; #℘_; #ZW__NJ_; #ZW__J_; 59 set #$(value) { 60 this.#$_ = value; 61 } 62 set #_(value) { 63 this.#__ = value; 64 } 65 set #\u{6F}(value) { 66 this.#\u{6F}_ = value; 67 } 68 set #℘(value) { 69 this.#℘_ = value; 70 } 71 set #ZW__NJ(value) { 72 this.#ZW__NJ_ = value; 73 } 74 set #ZW__J(value) { 75 this.#ZW__J_ = value; 76 } 77 78 foo = "foobar" 79 bar = "barbaz"; 80 $(value) { 81 this.#$ = value; 82 return this.#$_; 83 } 84 _(value) { 85 this.#_ = value; 86 return this.#__; 87 } 88 \u{6F}(value) { 89 this.#\u{6F} = value; 90 return this.#\u{6F}_; 91 } 92 ℘(value) { 93 this.#℘ = value; 94 return this.#℘_; 95 } 96 ZW__NJ(value) { 97 this.#ZW__NJ = value; 98 return this.#ZW__NJ_; 99 } 100 ZW__J(value) { 101 this.#ZW__J = value; 102 return this.#ZW__J_; 103 } 104 105 } 106 107 var c = new C(); 108 109 assert.sameValue(c.foo, "foobar"); 110 assert( 111 !Object.prototype.hasOwnProperty.call(C, "foo"), 112 "foo doesn't appear as an own property on the C constructor" 113 ); 114 assert( 115 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 116 "foo doesn't appear as an own property on the C prototype" 117 ); 118 119 verifyProperty(c, "foo", { 120 value: "foobar", 121 enumerable: true, 122 configurable: true, 123 writable: true, 124 }); 125 126 assert.sameValue(c.bar, "barbaz"); 127 assert( 128 !Object.prototype.hasOwnProperty.call(C, "bar"), 129 "bar doesn't appear as an own property on the C constructor" 130 ); 131 assert( 132 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 133 "bar doesn't appear as an own property on the C prototype" 134 ); 135 136 verifyProperty(c, "bar", { 137 value: "barbaz", 138 enumerable: true, 139 configurable: true, 140 writable: true, 141 }); 142 143 assert.sameValue(c.$(1), 1); 144 assert.sameValue(c._(1), 1); 145 assert.sameValue(c.\u{6F}(1), 1); 146 assert.sameValue(c.℘(1), 1); 147 assert.sameValue(c.ZW__NJ(1), 1); 148 assert.sameValue(c.ZW__J(1), 1); 149 150 reportCompare(0, 0);