Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-fields/literal-names.case
3 // - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template
4 /*---
5 description: Literal property names (multiple stacked fields definitions through ASI)
6 esid: prod-FieldDefinition
7 features: [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 const fn = function() {}
23
24
25
26 var C = class {
27 a; b = 42;
28 c = fn
29 foo = "foobar"
30 bar = "barbaz";
31
32 }
33
34 var c = new C();
35
36 assert.sameValue(c.foo, "foobar");
37 assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
38 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
39
40 verifyProperty(c, "foo", {
41 value: "foobar",
42 enumerable: true,
43 configurable: true,
44 writable: true,
45 });
46
47 assert.sameValue(c.bar, "barbaz");
48 assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
49 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
50
51 verifyProperty(c, "bar", {
52 value: "barbaz",
53 enumerable: true,
54 configurable: true,
55 writable: true,
56 });
57
58 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
59 assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
60
61 verifyProperty(c, "a", {
62 value: undefined,
63 enumerable: true,
64 writable: true,
65 configurable: true
66 });
67
68 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
69 assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
70
71 verifyProperty(c, "b", {
72 value: 42,
73 enumerable: true,
74 writable: true,
75 configurable: true
76 });
77
78 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
79 assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
80
81 verifyProperty(c, "c", {
82 value: fn,
83 enumerable: true,
84 writable: true,
85 configurable: true
86 });
87