js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-yield-expression.js
raw symbols SCIP| 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-declaration-accessors.template |
| 4 | /*--- |
| 5 | description: Computed property name from yield expression (ComputedPropertyName in ClassDeclaration) |
| 6 | esid: prod-ComputedPropertyName |
| 7 | features: [computed-property-names] |
| 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 | class C { |
| 40 | get [yield 9]() { |
| 41 | return 9; |
| 42 | } |
| 43 | |
| 44 | set [yield 9](v) { |
| 45 | return 9; |
| 46 | } |
| 47 | |
| 48 | static get [yield 9]() { |
| 49 | return 9; |
| 50 | } |
| 51 | |
| 52 | static set [yield 9](v) { |
| 53 | return 9; |
| 54 | } |
| 55 | }; |
| 56 | |
| 57 | let c = new C(); |
| 58 | |
| 59 | assert.sameValue( |
| 60 | c[yield 9], |
| 61 | 9 |
| 62 | ); |
| 63 | assert.sameValue( |
| 64 | c[yield 9] = 9, |
| 65 | 9 |
| 66 | ); |
| 67 | |
| 68 | assert.sameValue( |
| 69 | C[yield 9], |
| 70 | 9 |
| 71 | ); |
| 72 | assert.sameValue( |
| 73 | C[yield 9] = 9, |
| 74 | 9 |
| 75 | ); |
| 76 | assert.sameValue( |
| 77 | c[String(yield 9)], |
| 78 | 9 |
| 79 | ); |
| 80 | assert.sameValue( |
| 81 | c[String(yield 9)] = 9, |
| 82 | 9 |
| 83 | ); |
| 84 | |
| 85 | assert.sameValue( |
| 86 | C[String(yield 9)], |
| 87 | 9 |
| 88 | ); |
| 89 | assert.sameValue( |
| 90 | C[String(yield 9)] = 9, |
| 91 | 9 |
| 92 | ); |
| 93 | |
| 94 | } |
| 95 | var iter = g(); |
| 96 | while (iter.next().done === false) ; |
| 97 | |
| 98 | reportCompare(0, 0); |