Debian Codegraph @

js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-assignment.js

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