Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/fields-new-sc-line-method-literal-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-fields/literal-names.case
3 // - src/class-fields/productions/cls-expr-new-sc-line-method.template
4 /*---
5 description: Literal property names (field definitions followed by a method in a new line with a semicolon)
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 const fn = function() {}
23
24
25
26 var C = class {
27 a; b = 42;
28 c = fn;
29 m() { return 42; }
30
31 }
32
33 var c = new C();
34
35 assert.sameValue(c.m(), 42);
36 assert.sameValue(c.m, C.prototype.m);
37 assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
38
39 verifyProperty(C.prototype, "m", {
40 enumerable: false,
41 configurable: true,
42 writable: true,
43 });
44
45 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
46 assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
47
48 verifyProperty(c, "a", {
49 value: undefined,
50 enumerable: true,
51 writable: true,
52 configurable: true
53 });
54
55 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
56 assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
57
58 verifyProperty(c, "b", {
59 value: 42,
60 enumerable: true,
61 writable: true,
62 configurable: true
63 });
64
65 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
66 assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
67
68 verifyProperty(c, "c", {
69 value: fn,
70 enumerable: true,
71 writable: true,
72 configurable: true
73 });
74