Debian Codegraph @

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