Debian Codegraph @

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

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