Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/fields-new-sc-line-gen-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-new-sc-line-generator.template
4 /*---
5 description: Computed property names (field definitions followed by a method in a new line with a semicolon)
6 esid: prod-FieldDefinition
7 features: [computed-property-names, class, class-fields-public, generators]
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 *m() { return 42; }
29
30 }
31
32 var c = new C();
33
34 assert.sameValue(c.m().next().value, 42);
35 assert.sameValue(c.m, C.prototype.m);
36 assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
37
38 verifyProperty(C.prototype, "m", {
39 enumerable: false,
40 configurable: true,
41 writable: true,
42 });
43
44 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
45 assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
46
47 verifyProperty(c, "b", {
48 value: 42,
49 enumerable: true,
50 writable: true,
51 configurable: true
52 });
53
54 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
55 assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
56 assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
57
58 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false);
59 assert.sameValue(Object.hasOwnProperty.call(C, "10"), false);
60
61 verifyProperty(c, "10", {
62 value: "meep",
63 enumerable: true,
64 writable: true,
65 configurable: true
66 });
67
68 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false);
69 assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false);
70
71 verifyProperty(c, "not initialized", {
72 value: undefined,
73 enumerable: true,
74 writable: true,
75 configurable: true
76 });