same-line-async-method-rs-private-getter-alt.js (3065B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/class-elements/rs-private-getter-alt.case 4 // - src/class-elements/productions/cls-decl-after-same-line-async-method.template 5 /*--- 6 description: Valid PrivateName as private getter (field definitions after an async method in the same line) 7 esid: prod-FieldDefinition 8 features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions] 9 flags: [generated, async] 10 includes: [propertyHelper.js] 11 info: | 12 ClassElement : 13 MethodDefinition 14 ... 15 ; 16 17 MethodDefinition : 18 ... 19 get ClassElementName ( ){ FunctionBody } 20 ... 21 22 ClassElementName : 23 PropertyName 24 PrivateName 25 26 PrivateName :: 27 # IdentifierName 28 29 IdentifierName :: 30 IdentifierStart 31 IdentifierName IdentifierPart 32 33 IdentifierStart :: 34 UnicodeIDStart 35 $ 36 _ 37 \ UnicodeEscapeSequence 38 39 IdentifierPart:: 40 UnicodeIDContinue 41 $ 42 \ UnicodeEscapeSequence 43 <ZWNJ> <ZWJ> 44 45 UnicodeIDStart:: 46 any Unicode code point with the Unicode property "ID_Start" 47 48 UnicodeIDContinue:: 49 any Unicode code point with the Unicode property "ID_Continue" 50 51 NOTE 3 52 The sets of code points with Unicode properties "ID_Start" and 53 "ID_Continue" include, respectively, the code points with Unicode 54 properties "Other_ID_Start" and "Other_ID_Continue". 55 56 ---*/ 57 58 59 class C { 60 async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW__NJ_; #ZW__J_; 61 get #$() { 62 return this.#$_; 63 } 64 get #_() { 65 return this.#__; 66 } 67 get #\u{6F}() { 68 return this.#\u{6F}_; 69 } 70 get #℘() { 71 return this.#℘_; 72 } 73 get #ZW__NJ() { 74 return this.#ZW__NJ_; 75 } 76 get #ZW__J() { 77 return this.#ZW__J_; 78 } 79 ; 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( 110 !Object.prototype.hasOwnProperty.call(c, "m"), 111 "m doesn't appear as an own property on the C instance" 112 ); 113 assert.sameValue(c.m, C.prototype.m); 114 115 verifyProperty(C.prototype, "m", { 116 enumerable: false, 117 configurable: true, 118 writable: true, 119 }, {restore: true}); 120 121 c.m().then(function(v) { 122 assert.sameValue(v, 42); 123 124 function assertions() { 125 // Cover $DONE handler for async cases. 126 function $DONE(error) { 127 if (error) { 128 throw new Test262Error('Test262:AsyncTestFailure') 129 } 130 } 131 assert.sameValue(c.$(1), 1); 132 assert.sameValue(c._(1), 1); 133 assert.sameValue(c.\u{6F}(1), 1); 134 assert.sameValue(c.℘(1), 1); 135 assert.sameValue(c.ZW__NJ(1), 1); 136 assert.sameValue(c.ZW__J(1), 1); 137 } 138 139 return Promise.resolve(assertions()); 140 }).then($DONE, $DONE);