cpn-class-expr-fields-computed-property-name-from-yield-expression.js (1282B)
1 // This file was procedurally generated from the following sources: 2 // - src/computed-property-names/computed-property-name-from-yield-expression.case 3 // - src/computed-property-names/evaluation/class-expression-fields.template 4 /*--- 5 description: Computed property name from yield expression (ComputedPropertyName in ClassExpression) 6 esid: prod-ComputedPropertyName 7 features: [computed-property-names, class-fields-public, class-static-fields-public] 8 flags: [generated] 9 info: | 10 ClassExpression: 11 classBindingIdentifier opt ClassTail 12 13 ClassTail: 14 ClassHeritage opt { ClassBody opt } 15 16 ClassBody: 17 ClassElementList 18 19 ClassElementList: 20 ClassElement 21 22 ClassElement: 23 MethodDefinition 24 25 MethodDefinition: 26 PropertyName ... 27 get PropertyName ... 28 set PropertyName ... 29 30 PropertyName: 31 ComputedPropertyName 32 33 ComputedPropertyName: 34 [ AssignmentExpression ] 35 ---*/ 36 function * g() { 37 38 39 let C = class { 40 [yield 9] = 9; 41 42 static [yield 9] = 9; 43 }; 44 45 let c = new C(); 46 47 assert.sameValue( 48 c[yield 9], 49 9 50 ); 51 assert.sameValue( 52 C[yield 9], 53 9 54 ); 55 assert.sameValue( 56 c[String(yield 9)], 57 9 58 ); 59 assert.sameValue( 60 C[String(yield 9)], 61 9 62 ); 63 64 } 65 var iter = g(); 66 while (iter.next().done === false) ; 67 68 reportCompare(0, 0);