Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/computed-names.case
3 // - src/class-elements/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: [class-fields-public, computed-property-names, class, 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(
37 !Object.prototype.hasOwnProperty.call(c, "m"),
38 "m doesn't appear as an own property on the C instance"
39 );
40
41 verifyProperty(C.prototype, "m", {
42 enumerable: false,
43 configurable: true,
44 writable: true,
45 });
46
47 assert(
48 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
49 "b doesn't appear as an own property on C prototype"
50 );
51 assert(
52 !Object.prototype.hasOwnProperty.call(C, "b"),
53 "b doesn't appear as an own property on C constructor"
54 );
55
56 verifyProperty(c, "b", {
57 value: 42,
58 enumerable: true,
59 writable: true,
60 configurable: true
61 });
62
63 assert(
64 !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
65 "x doesn't appear as an own property on C prototype"
66 );
67 assert(
68 !Object.prototype.hasOwnProperty.call(C, "x"),
69 "x doesn't appear as an own property on C constructor"
70 );
71 assert(
72 !Object.prototype.hasOwnProperty.call(c, "x"),
73 "x doesn't appear as an own property on C instance"
74 );
75
76 assert(
77 !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
78 "10 doesn't appear as an own property on C prototype"
79 );
80 assert(
81 !Object.prototype.hasOwnProperty.call(C, "10"),
82 "10 doesn't appear as an own property on C constructor"
83 );
84
85 verifyProperty(c, "10", {
86 value: "meep",
87 enumerable: true,
88 writable: true,
89 configurable: true
90 });
91
92 assert(
93 !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
94 "'not initialized' doesn't appear as an own property on C prototype"
95 );
96 assert(
97 !Object.prototype.hasOwnProperty.call(C, "not initialized"),
98 "'not initialized' doesn't appear as an own property on C constructor"
99 );
100
101 verifyProperty(c, "not initialized", {
102 value: undefined,
103 enumerable: true,
104 writable: true,
105 configurable: true
106 });
107
108 reportCompare(0, 0);