Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/fields-multiple-stacked-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-stacked-definitions.template
4 /*---
5 description: Computed property names (multiple stacked fields definitions through ASI)
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 [x] = 42; [10] = "meep"; ["not initialized"]
28 foo = "foobar"
29 bar = "barbaz";
30
31 }
32
33 var c = new C();
34
35 assert.sameValue(c.foo, "foobar");
36 assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
37 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
38
39 verifyProperty(c, "foo", {
40 value: "foobar",
41 enumerable: true,
42 configurable: true,
43 writable: true,
44 });
45
46 assert.sameValue(c.bar, "barbaz");
47 assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
48 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
49
50 verifyProperty(c, "bar", {
51 value: "barbaz",
52 enumerable: true,
53 configurable: true,
54 writable: true,
55 });
56
57 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
58 assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
59
60 verifyProperty(c, "b", {
61 value: 42,
62 enumerable: true,
63 writable: true,
64 configurable: true
65 });
66
67 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
68 assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
69 assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
70
71 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false);
72 assert.sameValue(Object.hasOwnProperty.call(C, "10"), false);
73
74 verifyProperty(c, "10", {
75 value: "meep",
76 enumerable: true,
77 writable: true,
78 configurable: true
79 });
80
81 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false);
82 assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false);
83
84 verifyProperty(c, "not initialized", {
85 value: undefined,
86 enumerable: true,
87 writable: true,
88 configurable: true
89 });