Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-fields/string-literal-names.case
3 // - src/class-fields/productions/cls-expr-multiple-definitions.template
4 /*---
5 description: String literal names (multiple fields definitions)
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
23
24 var C = class {
25 foo = "foobar";
26 m() { return 42 }
27 'a'; "b"; 'c' = 39;
28 "d" = 42
29 m2() { return 39 }
30 bar = "barbaz";
31
32 }
33
34 var c = new C();
35
36 assert.sameValue(c.m(), 42);
37 assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
38 assert.sameValue(c.m, C.prototype.m);
39
40 verifyProperty(C.prototype, "m", {
41 enumerable: false,
42 configurable: true,
43 writable: true,
44 });
45
46 assert.sameValue(c.m2(), 39);
47 assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false);
48 assert.sameValue(c.m2, C.prototype.m2);
49
50 verifyProperty(C.prototype, "m2", {
51 enumerable: false,
52 configurable: true,
53 writable: true,
54 });
55
56 assert.sameValue(c.foo, "foobar");
57 assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
58 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
59
60 verifyProperty(c, "foo", {
61 value: "foobar",
62 enumerable: true,
63 configurable: true,
64 writable: true,
65 });
66
67 assert.sameValue(c.bar, "barbaz");
68 assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
69 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
70
71 verifyProperty(c, "bar", {
72 value: "barbaz",
73 enumerable: true,
74 configurable: true,
75 writable: true,
76 });
77
78 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
79 assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
80
81 verifyProperty(c, "a", {
82 value: undefined,
83 enumerable: true,
84 writable: true,
85 configurable: true
86 });
87
88 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
89 assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
90
91 verifyProperty(c, "b", {
92 value: undefined,
93 enumerable: true,
94 writable: true,
95 configurable: true
96 });
97
98 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
99 assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
100
101 verifyProperty(c, "c", {
102 value: 39,
103 enumerable: true,
104 writable: true,
105 configurable: true
106 });
107
108 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false);
109 assert.sameValue(Object.hasOwnProperty.call(C, "d"), false);
110
111 verifyProperty(c, "d", {
112 value: 42,
113 enumerable: true,
114 writable: true,
115 configurable: true
116 });