Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-string-literal-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/string-literal-names.case
3 // - src/class-elements/productions/cls-decl-new-sc-line-generator.template
4 /*---
5 description: String literal names (field definitions followed by a method in a new line with a semicolon)
6 esid: prod-FieldDefinition
7 features: [class-fields-public, 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
23
24 class C {
25 'a'; "b"; 'c' = 39;
26 "d" = 42;
27 *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(
36 !Object.prototype.hasOwnProperty.call(c, "m"),
37 "m doesn't appear as an own property on the C instance"
38 );
39
40 verifyProperty(C.prototype, "m", {
41 enumerable: false,
42 configurable: true,
43 writable: true,
44 });
45
46 assert(
47 !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
48 "a does not appear as an own property on C prototype"
49 );
50 assert(
51 !Object.prototype.hasOwnProperty.call(C, "a"),
52 "a does not appear as an own property on C constructor"
53 );
54
55 verifyProperty(c, "a", {
56 value: undefined,
57 enumerable: true,
58 writable: true,
59 configurable: true
60 });
61
62 assert(
63 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
64 "b does not appear as an own property on C prototype"
65 );
66 assert(
67 !Object.prototype.hasOwnProperty.call(C, "b"),
68 "b does not appear as an own property on C constructor"
69 );
70
71 verifyProperty(c, "b", {
72 value: undefined,
73 enumerable: true,
74 writable: true,
75 configurable: true
76 });
77
78 assert(
79 !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
80 "c does not appear as an own property on C prototype"
81 );
82 assert(
83 !Object.prototype.hasOwnProperty.call(C, "c"),
84 "c does not appear as an own property on C constructor"
85 );
86
87 verifyProperty(c, "c", {
88 value: 39,
89 enumerable: true,
90 writable: true,
91 configurable: true
92 });
93
94 assert(
95 !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
96 "d does not appear as an own property on C prototype"
97 );
98 assert(
99 !Object.prototype.hasOwnProperty.call(C, "d"),
100 "d does not appear as an own property on C constructor"
101 );
102
103 verifyProperty(c, "d", {
104 value: 42,
105 enumerable: true,
106 writable: true,
107 configurable: true
108 });
109
110 reportCompare(0, 0);