js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-false.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/computed-property-names/computed-property-name-from-condition-expression-false.case |
| 3 | // - src/computed-property-names/evaluation/class-declaration-accessors.template |
| 4 | /*--- |
| 5 | description: Computed property name from condition 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 | |
| 37 | |
| 38 | class C { |
| 39 | get [false ? 1 : 2]() { |
| 40 | return 1; |
| 41 | } |
| 42 | |
| 43 | set [false ? 1 : 2](v) { |
| 44 | return 1; |
| 45 | } |
| 46 | |
| 47 | static get [false ? 1 : 2]() { |
| 48 | return 1; |
| 49 | } |
| 50 | |
| 51 | static set [false ? 1 : 2](v) { |
| 52 | return 1; |
| 53 | } |
| 54 | }; |
| 55 | |
| 56 | let c = new C(); |
| 57 | |
| 58 | assert.sameValue( |
| 59 | c[false ? 1 : 2], |
| 60 | 1 |
| 61 | ); |
| 62 | assert.sameValue( |
| 63 | c[false ? 1 : 2] = 1, |
| 64 | 1 |
| 65 | ); |
| 66 | |
| 67 | assert.sameValue( |
| 68 | C[false ? 1 : 2], |
| 69 | 1 |
| 70 | ); |
| 71 | assert.sameValue( |
| 72 | C[false ? 1 : 2] = 1, |
| 73 | 1 |
| 74 | ); |
| 75 | assert.sameValue( |
| 76 | c[String(false ? 1 : 2)], |
| 77 | 1 |
| 78 | ); |
| 79 | assert.sameValue( |
| 80 | c[String(false ? 1 : 2)] = 1, |
| 81 | 1 |
| 82 | ); |
| 83 | |
| 84 | assert.sameValue( |
| 85 | C[String(false ? 1 : 2)], |
| 86 | 1 |
| 87 | ); |
| 88 | assert.sameValue( |
| 89 | C[String(false ? 1 : 2)] = 1, |
| 90 | 1 |
| 91 | ); |
| 92 | |
| 93 | reportCompare(0, 0); |