Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/fields-multiple-definitions-computed-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-fields/computed-names.case
3 // - src/class-fields/productions/cls-expr-multiple-definitions.template
4 /*---
5 description: Computed property names (multiple fields definitions)
6 esid: prod-FieldDefinition
7 features: [computed-property-names, class, class-fields-public]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 ClassElement:
12 ...
13 FieldDefinition ;
14
15 FieldDefinition:
16 ClassElementName Initializer_opt
17
18 ClassElementName:
19 PropertyName
20
21 ---*/
22 var x = "b";
23
24
25
26 var C = class {
27 foo = "foobar";
28 m() { return 42 }
29 [x] = 42; [10] = "meep"; ["not initialized"]
30 m2() { return 39 }
31 bar = "barbaz";
32
33 }
34
35 var c = new C();
36
37 assert.sameValue(c.m(), 42);
38 assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
39 assert.sameValue(c.m, C.prototype.m);
40
41 verifyProperty(C.prototype, "m", {
42 enumerable: false,
43 configurable: true,
44 writable: true,
45 });
46
47 assert.sameValue(c.m2(), 39);
48 assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false);
49 assert.sameValue(c.m2, C.prototype.m2);
50
51 verifyProperty(C.prototype, "m2", {
52 enumerable: false,
53 configurable: true,
54 writable: true,
55 });
56
57 assert.sameValue(c.foo, "foobar");
58 assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
59 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
60
61 verifyProperty(c, "foo", {
62 value: "foobar",
63 enumerable: true,
64 configurable: true,
65 writable: true,
66 });
67
68 assert.sameValue(c.bar, "barbaz");
69 assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
70 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
71
72 verifyProperty(c, "bar", {
73 value: "barbaz",
74 enumerable: true,
75 configurable: true,
76 writable: true,
77 });
78
79 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
80 assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
81
82 verifyProperty(c, "b", {
83 value: 42,
84 enumerable: true,
85 writable: true,
86 configurable: true
87 });
88
89 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
90 assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
91 assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
92
93 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false);
94 assert.sameValue(Object.hasOwnProperty.call(C, "10"), false);
95
96 verifyProperty(c, "10", {
97 value: "meep",
98 enumerable: true,
99 writable: true,
100 configurable: true
101 });
102
103 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false);
104 assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false);
105
106 verifyProperty(c, "not initialized", {
107 value: undefined,
108 enumerable: true,
109 writable: true,
110 configurable: true
111 });