Debian Codegraph @

js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-identifier.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/computed-property-names/computed-property-name-from-identifier.case
3 // - src/computed-property-names/evaluation/class-expression-fields.template
4 /*---
5 description: Computed property name from string literal (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 let x = 1;
37
38
39
40 let C = class {
41 [x] = '2';
42
43 static [x] = '2';
44 };
45
46 let c = new C();
47
48 assert.sameValue(
49 c[x],
50 '2'
51 );
52 assert.sameValue(
53 C[x],
54 '2'
55 );
56 assert.sameValue(
57 c[String(x)],
58 '2'
59 );
60 assert.sameValue(
61 C[String(x)],
62 '2'
63 );
64
65 reportCompare(0, 0);