after-same-line-method-rs-private-setter.js (2813B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-private-setter.case 3 // - src/class-elements/productions/cls-decl-after-same-line-method.template 4 /*--- 5 description: Valid PrivateName as private setter (field definitions after a method in the same line) 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 class C { 58 m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_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 #\u2118(value) { 69 this.#\u2118_ = value; 70 } 71 set #ZW_\u200C_NJ(value) { 72 this.#ZW_\u200C_NJ_ = value; 73 } 74 set #ZW_\u200D_J(value) { 75 this.#ZW_\u200D_J_ = value; 76 } 77 ; 78 $(value) { 79 this.#$ = value; 80 return this.#$_; 81 } 82 _(value) { 83 this.#_ = value; 84 return this.#__; 85 } 86 \u{6F}(value) { 87 this.#\u{6F} = value; 88 return this.#\u{6F}_; 89 } 90 \u2118(value) { 91 this.#\u2118 = value; 92 return this.#\u2118_; 93 } 94 ZW_\u200C_NJ(value) { 95 this.#ZW_\u200C_NJ = value; 96 return this.#ZW_\u200C_NJ_; 97 } 98 ZW_\u200D_J(value) { 99 this.#ZW_\u200D_J = value; 100 return this.#ZW_\u200D_J_; 101 } 102 103 } 104 105 var c = new C(); 106 107 assert.sameValue(c.m(), 42); 108 assert( 109 !Object.prototype.hasOwnProperty.call(c, "m"), 110 "m doesn't appear as an own property on the C instance" 111 ); 112 assert.sameValue(c.m, C.prototype.m); 113 114 verifyProperty(C.prototype, "m", { 115 enumerable: false, 116 configurable: true, 117 writable: true, 118 }); 119 120 assert.sameValue(c.$(1), 1); 121 assert.sameValue(c._(1), 1); 122 assert.sameValue(c.\u{6F}(1), 1); 123 assert.sameValue(c.\u2118(1), 1); 124 assert.sameValue(c.ZW_\u200C_NJ(1), 1); 125 assert.sameValue(c.ZW_\u200D_J(1), 1); 126 127 reportCompare(0, 0);