same-line-gen-rs-private-method-alt.js (2745B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/rs-private-method-alt.case 3 // - src/class-elements/productions/cls-expr-same-line-generator.template 4 /*--- 5 description: Valid PrivateName as private method (field definitions followed by a generator method in the same line) 6 esid: prod-FieldDefinition 7 features: [class-methods-private, class-fields-private, class, class-fields-public, generators] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 ClassElement : 12 MethodDefinition 13 ... 14 ; 15 16 MethodDefinition : 17 ClassElementName ( UniqueFormalParameters ) { FunctionBody } 18 ... 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 #$() { 60 return this.#$_; 61 } 62 #_() { 63 return this.#__; 64 } 65 #\u{6F}() { 66 return this.#\u{6F}_; 67 } 68 #℘() { 69 return this.#℘_; 70 } 71 #ZW__NJ() { 72 return this.#ZW__NJ_; 73 } 74 #ZW__J() { 75 return this.#ZW__J_; 76 } 77 ; *m() { return 42; } 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 ℘(value) { 91 this.#℘_ = value; 92 return this.#℘(); 93 } 94 ZW__NJ(value) { 95 this.#ZW__NJ_ = value; 96 return this.#ZW__NJ(); 97 } 98 ZW__J(value) { 99 this.#ZW__J_ = value; 100 return this.#ZW__J(); 101 } 102 103 } 104 105 var c = new C(); 106 107 assert.sameValue(c.m().next().value, 42); 108 assert.sameValue(c.m, C.prototype.m); 109 assert( 110 !Object.prototype.hasOwnProperty.call(c, "m"), 111 "m doesn't appear as an own property on the C instance" 112 ); 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.℘(1), 1); 124 assert.sameValue(c.ZW__NJ(1), 1); 125 assert.sameValue(c.ZW__J(1), 1); 126 127 reportCompare(0, 0);