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