Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-symbol-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/computed-symbol-names.case
3 // - src/class-elements/productions/cls-decl-regular-definitions.template
4 /*---
5 description: Computed property symbol names (regular fields defintion)
6 esid: prod-FieldDefinition
7 features: [class-fields-public, Symbol, computed-property-names, class]
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 = Symbol();
23 var y = Symbol();
24
25
26
27 class C {
28 [x]; [y] = 42
29
30 }
31
32 var c = new C();
33
34 assert(
35 !Object.prototype.hasOwnProperty.call(C.prototype, x),
36 "Symbol x doesn't appear as an own property on C prototype"
37 );
38 assert(
39 !Object.prototype.hasOwnProperty.call(C, x),
40 "Symbol x doesn't appear as an own property on C constructor"
41 );
42
43 verifyProperty(c, x, {
44 value: undefined,
45 enumerable: true,
46 writable: true,
47 configurable: true
48 });
49
50 assert(
51 !Object.prototype.hasOwnProperty.call(C.prototype, y),
52 "Symbol y doesn't appear as an own property on C prototype"
53 );
54 assert(
55 !Object.prototype.hasOwnProperty.call(C, y),
56 "Symbol y doesn't appear as an own property on C constructor"
57 );
58
59 verifyProperty(c, y, {
60 value: 42,
61 enumerable: true,
62 writable: true,
63 configurable: true
64 });
65
66 assert(
67 !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
68 "x doesn't appear as an own property on C prototype"
69 );
70 assert(
71 !Object.prototype.hasOwnProperty.call(C, "x"),
72 "x doesn't appear as an own property on C constructor"
73 );
74 assert(
75 !Object.prototype.hasOwnProperty.call(c, "x"),
76 "x doesn't appear as an own property on C instance"
77 );
78
79 assert(
80 !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
81 "y doesn't appear as an own property on C prototype"
82 );
83 assert(
84 !Object.prototype.hasOwnProperty.call(C, "y"),
85 "y doesn't appear as an own property on C constructor"
86 );
87 assert(
88 !Object.prototype.hasOwnProperty.call(c, "y"),
89 "y doesn't appear as an own property on C instance"
90 );
91
92 reportCompare(0, 0);