@ibyar/expressions 0.8.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/README.md +48 -1
  2. package/api/abstract.d.ts +1 -0
  3. package/api/abstract.d.ts.map +1 -0
  4. package/api/abstract.js +12 -0
  5. package/api/abstract.js.map +1 -1
  6. package/api/class/class.d.ts +1 -0
  7. package/api/class/class.d.ts.map +1 -0
  8. package/api/class/class.js +603 -472
  9. package/api/class/class.js.map +1 -1
  10. package/api/class/decorator.d.ts +1 -0
  11. package/api/class/decorator.d.ts.map +1 -0
  12. package/api/class/decorator.js +53 -41
  13. package/api/class/decorator.js.map +1 -1
  14. package/api/computing/call.d.ts +1 -0
  15. package/api/computing/call.d.ts.map +1 -0
  16. package/api/computing/call.js +83 -69
  17. package/api/computing/call.js.map +1 -1
  18. package/api/computing/debugger.d.ts +1 -0
  19. package/api/computing/debugger.d.ts.map +1 -0
  20. package/api/computing/debugger.js +40 -28
  21. package/api/computing/debugger.js.map +1 -1
  22. package/api/computing/new.d.ts +1 -0
  23. package/api/computing/new.d.ts.map +1 -0
  24. package/api/computing/new.js +81 -68
  25. package/api/computing/new.js.map +1 -1
  26. package/api/computing/rest.d.ts +1 -0
  27. package/api/computing/rest.d.ts.map +1 -0
  28. package/api/computing/rest.js +54 -42
  29. package/api/computing/rest.js.map +1 -1
  30. package/api/computing/return.d.ts +1 -0
  31. package/api/computing/return.d.ts.map +1 -0
  32. package/api/computing/return.js +52 -40
  33. package/api/computing/return.js.map +1 -1
  34. package/api/computing/spread.d.ts +1 -0
  35. package/api/computing/spread.d.ts.map +1 -0
  36. package/api/computing/spread.js +70 -58
  37. package/api/computing/spread.js.map +1 -1
  38. package/api/computing/throw.d.ts +1 -0
  39. package/api/computing/throw.d.ts.map +1 -0
  40. package/api/computing/throw.js +216 -175
  41. package/api/computing/throw.js.map +1 -1
  42. package/api/computing/yield.d.ts +1 -0
  43. package/api/computing/yield.d.ts.map +1 -0
  44. package/api/computing/yield.js +60 -47
  45. package/api/computing/yield.js.map +1 -1
  46. package/api/definition/array.d.ts +1 -0
  47. package/api/definition/array.d.ts.map +1 -0
  48. package/api/definition/array.js +147 -122
  49. package/api/definition/array.js.map +1 -1
  50. package/api/definition/bind.d.ts +1 -0
  51. package/api/definition/bind.d.ts.map +1 -0
  52. package/api/definition/bind.js +85 -70
  53. package/api/definition/bind.js.map +1 -1
  54. package/api/definition/comment.d.ts +1 -0
  55. package/api/definition/comment.d.ts.map +1 -0
  56. package/api/definition/comment.js +44 -32
  57. package/api/definition/comment.js.map +1 -1
  58. package/api/definition/function.d.ts +1 -0
  59. package/api/definition/function.d.ts.map +1 -0
  60. package/api/definition/function.js +500 -443
  61. package/api/definition/function.js.map +1 -1
  62. package/api/definition/member.d.ts +1 -0
  63. package/api/definition/member.d.ts.map +1 -0
  64. package/api/definition/member.js +104 -89
  65. package/api/definition/member.js.map +1 -1
  66. package/api/definition/object.d.ts +1 -0
  67. package/api/definition/object.d.ts.map +1 -0
  68. package/api/definition/object.js +243 -200
  69. package/api/definition/object.js.map +1 -1
  70. package/api/definition/statement.d.ts +1 -0
  71. package/api/definition/statement.d.ts.map +1 -0
  72. package/api/definition/statement.js +56 -44
  73. package/api/definition/statement.js.map +1 -1
  74. package/api/definition/values.d.ts +1 -0
  75. package/api/definition/values.d.ts.map +1 -0
  76. package/api/definition/values.js +228 -160
  77. package/api/definition/values.js.map +1 -1
  78. package/api/deserialize/deserialize.d.ts +2 -1
  79. package/api/deserialize/deserialize.d.ts.map +1 -0
  80. package/api/deserialize/deserialize.js +5 -7
  81. package/api/deserialize/deserialize.js.map +1 -1
  82. package/api/deserialize/type-store.d.ts +1 -0
  83. package/api/deserialize/type-store.d.ts.map +1 -0
  84. package/api/expression.d.ts +1 -0
  85. package/api/expression.d.ts.map +1 -0
  86. package/api/index.d.ts +1 -0
  87. package/api/index.d.ts.map +1 -0
  88. package/api/module/common.d.ts +1 -0
  89. package/api/module/common.d.ts.map +1 -0
  90. package/api/module/common.js +63 -50
  91. package/api/module/common.js.map +1 -1
  92. package/api/module/export.d.ts +1 -0
  93. package/api/module/export.d.ts.map +1 -0
  94. package/api/module/export.js +343 -290
  95. package/api/module/export.js.map +1 -1
  96. package/api/module/import.d.ts +1 -0
  97. package/api/module/import.d.ts.map +1 -0
  98. package/api/module/import.js +318 -253
  99. package/api/module/import.js.map +1 -1
  100. package/api/operators/assignment.d.ts +1 -0
  101. package/api/operators/assignment.d.ts.map +1 -0
  102. package/api/operators/assignment.js +88 -75
  103. package/api/operators/assignment.js.map +1 -1
  104. package/api/operators/await.d.ts +1 -0
  105. package/api/operators/await.d.ts.map +1 -0
  106. package/api/operators/await.js +54 -42
  107. package/api/operators/await.js.map +1 -1
  108. package/api/operators/binary.d.ts +1 -0
  109. package/api/operators/binary.d.ts.map +1 -0
  110. package/api/operators/binary.js +78 -64
  111. package/api/operators/binary.js.map +1 -1
  112. package/api/operators/chaining.d.ts +1 -0
  113. package/api/operators/chaining.d.ts.map +1 -0
  114. package/api/operators/chaining.js +56 -44
  115. package/api/operators/chaining.js.map +1 -1
  116. package/api/operators/comma.d.ts +1 -0
  117. package/api/operators/comma.d.ts.map +1 -0
  118. package/api/operators/comma.js +53 -41
  119. package/api/operators/comma.js.map +1 -1
  120. package/api/operators/grouping.d.ts +1 -0
  121. package/api/operators/grouping.d.ts.map +1 -0
  122. package/api/operators/grouping.js +51 -39
  123. package/api/operators/grouping.js.map +1 -1
  124. package/api/operators/logical.d.ts +1 -0
  125. package/api/operators/logical.d.ts.map +1 -0
  126. package/api/operators/logical.js +51 -37
  127. package/api/operators/logical.js.map +1 -1
  128. package/api/operators/pipeline.d.ts +1 -0
  129. package/api/operators/pipeline.d.ts.map +1 -0
  130. package/api/operators/pipeline.js +95 -81
  131. package/api/operators/pipeline.js.map +1 -1
  132. package/api/operators/ternary.d.ts +1 -0
  133. package/api/operators/ternary.d.ts.map +1 -0
  134. package/api/operators/ternary.js +69 -55
  135. package/api/operators/ternary.js.map +1 -1
  136. package/api/operators/types.d.ts +1 -0
  137. package/api/operators/types.d.ts.map +1 -0
  138. package/api/operators/unary.d.ts +1 -0
  139. package/api/operators/unary.d.ts.map +1 -0
  140. package/api/operators/unary.js +97 -82
  141. package/api/operators/unary.js.map +1 -1
  142. package/api/operators/update.d.ts +1 -0
  143. package/api/operators/update.d.ts.map +1 -0
  144. package/api/operators/update.js +78 -62
  145. package/api/operators/update.js.map +1 -1
  146. package/api/program.d.ts +1 -0
  147. package/api/program.d.ts.map +1 -0
  148. package/api/program.js +53 -40
  149. package/api/program.js.map +1 -1
  150. package/api/statement/control/block.d.ts +1 -0
  151. package/api/statement/control/block.d.ts.map +1 -0
  152. package/api/statement/control/block.js +65 -53
  153. package/api/statement/control/block.js.map +1 -1
  154. package/api/statement/control/empty.d.ts +1 -1
  155. package/api/statement/control/empty.d.ts.map +1 -0
  156. package/api/statement/control/empty.js +43 -33
  157. package/api/statement/control/empty.js.map +1 -1
  158. package/api/statement/control/if.d.ts +1 -0
  159. package/api/statement/control/if.d.ts.map +1 -0
  160. package/api/statement/control/if.js +79 -65
  161. package/api/statement/control/if.js.map +1 -1
  162. package/api/statement/control/switch.d.ts +1 -0
  163. package/api/statement/control/switch.d.ts.map +1 -0
  164. package/api/statement/control/switch.js +180 -141
  165. package/api/statement/control/switch.js.map +1 -1
  166. package/api/statement/control/terminate.d.ts +1 -2
  167. package/api/statement/control/terminate.d.ts.map +1 -0
  168. package/api/statement/control/terminate.js +117 -78
  169. package/api/statement/control/terminate.js.map +1 -1
  170. package/api/statement/control/with.d.ts +1 -0
  171. package/api/statement/control/with.d.ts.map +1 -0
  172. package/api/statement/control/with.js +72 -59
  173. package/api/statement/control/with.js.map +1 -1
  174. package/api/statement/declarations/declares.d.ts +1 -0
  175. package/api/statement/declarations/declares.d.ts.map +1 -0
  176. package/api/statement/declarations/declares.js +148 -121
  177. package/api/statement/declarations/declares.js.map +1 -1
  178. package/api/statement/iterations/for.d.ts +1 -0
  179. package/api/statement/iterations/for.d.ts.map +1 -0
  180. package/api/statement/iterations/for.js +337 -277
  181. package/api/statement/iterations/for.js.map +1 -1
  182. package/api/statement/iterations/while.d.ts +1 -0
  183. package/api/statement/iterations/while.d.ts.map +1 -0
  184. package/api/statement/iterations/while.js +152 -125
  185. package/api/statement/iterations/while.js.map +1 -1
  186. package/api/utils.d.ts +1 -0
  187. package/api/utils.d.ts.map +1 -0
  188. package/index.d.ts +1 -0
  189. package/index.d.ts.map +1 -0
  190. package/package.json +5 -5
  191. package/scope/builder.d.ts +27 -0
  192. package/scope/builder.d.ts.map +1 -0
  193. package/scope/builder.js +73 -0
  194. package/scope/builder.js.map +1 -0
  195. package/scope/event.d.ts +1 -0
  196. package/scope/event.d.ts.map +1 -0
  197. package/scope/finalizer.d.ts +1 -0
  198. package/scope/finalizer.d.ts.map +1 -0
  199. package/scope/index.d.ts +1 -0
  200. package/scope/index.d.ts.map +1 -0
  201. package/scope/pool.d.ts +1 -0
  202. package/scope/pool.d.ts.map +1 -0
  203. package/scope/proxy.d.ts +1 -0
  204. package/scope/proxy.d.ts.map +1 -0
  205. package/scope/proxy.js +1 -0
  206. package/scope/proxy.js.map +1 -1
  207. package/scope/scope.d.ts +1 -0
  208. package/scope/scope.d.ts.map +1 -0
  209. package/scope/scope.js +17 -11
  210. package/scope/scope.js.map +1 -1
  211. package/scope/stack.d.ts +1 -0
  212. package/scope/stack.d.ts.map +1 -0
  213. package/scope/stack.js +22 -14
  214. package/scope/stack.js.map +1 -1
  215. package/v8/enums.d.ts +1 -0
  216. package/v8/enums.d.ts.map +1 -0
  217. package/v8/enums.js +11 -11
  218. package/v8/enums.js.map +1 -1
  219. package/v8/factory.d.ts +1 -0
  220. package/v8/factory.d.ts.map +1 -0
  221. package/v8/factory.js +3 -1
  222. package/v8/factory.js.map +1 -1
  223. package/v8/index.d.ts +1 -0
  224. package/v8/index.d.ts.map +1 -0
  225. package/v8/inline.d.ts +1 -0
  226. package/v8/inline.d.ts.map +1 -0
  227. package/v8/inline.js +9 -5
  228. package/v8/inline.js.map +1 -1
  229. package/v8/language.d.ts +1 -0
  230. package/v8/language.d.ts.map +1 -0
  231. package/v8/node.d.ts +1 -0
  232. package/v8/node.d.ts.map +1 -0
  233. package/v8/parser.d.ts +1 -0
  234. package/v8/parser.d.ts.map +1 -0
  235. package/v8/parser.js +5 -5
  236. package/v8/parser.js.map +1 -1
  237. package/v8/stream.d.ts +1 -0
  238. package/v8/stream.d.ts.map +1 -0
  239. package/v8/stream.js +17 -7
  240. package/v8/stream.js.map +1 -1
  241. package/v8/token.d.ts +1 -0
  242. package/v8/token.d.ts.map +1 -0
  243. package/v8/token.js +363 -358
  244. package/v8/token.js.map +1 -1
  245. package/visit/index.d.ts +1 -0
  246. package/visit/index.d.ts.map +1 -0
  247. package/visit/visitor.d.ts +1 -0
  248. package/visit/visitor.d.ts.map +1 -0
  249. package/v8/nodes.d.ts +0 -0
  250. package/v8/nodes.js +0 -2
  251. package/v8/nodes.js.map +0 -1
@@ -1,45 +1,45 @@
1
- var Super_1, MetaProperty_1, PrivateIdentifier_1, StaticBlock_1, MethodDefinition_1, PropertyDefinition_1, AccessorProperty_1, ClassBody_1, ClassDeclaration_1, ClassExpression_1;
2
- import { __decorate, __metadata } from "tslib";
1
+ import { __esDecorate, __runInitializers } from "tslib";
3
2
  import { AbstractExpressionNode } from '../abstract.js';
4
3
  import { Deserializer } from '../deserialize/deserialize.js';
5
4
  import { Identifier } from '../definition/values.js';
6
- import { FunctionExpression } from '../definition/function.js';
7
5
  import { BlockStatement } from '../statement/control/block.js';
8
6
  import { CallExpression } from '../computing/call.js';
9
7
  const TEMP_CLASS_NAME = Symbol('TempClassName');
10
8
  const PRIVATE_SYMBOL = Symbol('#');
11
9
  ;
12
10
  class ClassInitializer {
13
- constructor() {
14
- /**
15
- * register class public static properties and methods
16
- */
17
- this.staticInitializer = {};
18
- /**
19
- * register class private static properties and methods
20
- */
21
- this.staticPrivateInitializer = {};
22
- /**
23
- * register static initialization block
24
- */
25
- this.staticInitializerBlock = [];
26
- /**
27
- * register super parameter resolver
28
- */
29
- this.superParameterResolver = (params) => params;
30
- /**
31
- * register in class property
32
- */
33
- this.instanceMethod = {};
34
- /**
35
- * register method in instance private space
36
- */
37
- this.privateInstanceMethod = {};
38
- /**
39
- * register property in instance itself
40
- */
41
- this.instanceInitializer = [];
42
- }
11
+ /**
12
+ * register class public static properties and methods
13
+ */
14
+ staticInitializer = {};
15
+ /**
16
+ * register class private static properties and methods
17
+ */
18
+ staticPrivateInitializer = {};
19
+ /**
20
+ * register static initialization block
21
+ */
22
+ staticInitializerBlock = [];
23
+ /**
24
+ * register class constructor function
25
+ */
26
+ instanceConstructor;
27
+ /**
28
+ * register super parameter resolver
29
+ */
30
+ superParameterResolver = (params) => params;
31
+ /**
32
+ * register in class property
33
+ */
34
+ instanceMethod = {};
35
+ /**
36
+ * register method in instance private space
37
+ */
38
+ privateInstanceMethod = {};
39
+ /**
40
+ * register property in instance itself
41
+ */
42
+ instanceInitializer = [];
43
43
  addStaticInitializer(key, attributes) {
44
44
  Reflect.set(this.staticInitializer, key, attributes);
45
45
  }
@@ -86,36 +86,48 @@ class ClassInitializer {
86
86
  /**
87
87
  * A `super` pseudo-expression.
88
88
  */
89
- let Super = Super_1 = class Super extends AbstractExpressionNode {
90
- static fromJSON(node) {
91
- return new Super_1(node.range, node.loc);
92
- }
93
- constructor(range, loc) {
94
- super(range, loc);
95
- }
96
- set(stack, value) {
97
- throw new Error('Super.#set() Method not implemented.');
98
- }
99
- get(stack, thisContext) {
100
- return stack.get('super');
101
- }
102
- dependency(computed) {
103
- throw new Error('Super.#dependency() Method not implemented.');
104
- }
105
- dependencyPath(computed) {
106
- throw new Error('Super.#dependencyPath() Method not implemented.');
107
- }
108
- toString() {
109
- return `super`;
110
- }
111
- toJson() {
112
- return {};
113
- }
114
- };
115
- Super = Super_1 = __decorate([
116
- Deserializer('Super'),
117
- __metadata("design:paramtypes", [Array, Object])
118
- ], Super);
89
+ let Super = (() => {
90
+ let _classDecorators = [Deserializer('Super')];
91
+ let _classDescriptor;
92
+ let _classExtraInitializers = [];
93
+ let _classThis;
94
+ let _classSuper = AbstractExpressionNode;
95
+ var Super = class extends _classSuper {
96
+ static { _classThis = this; }
97
+ static {
98
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
99
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
100
+ Super = _classThis = _classDescriptor.value;
101
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
102
+ __runInitializers(_classThis, _classExtraInitializers);
103
+ }
104
+ static fromJSON(node) {
105
+ return new Super(node.range, node.loc);
106
+ }
107
+ constructor(range, loc) {
108
+ super(range, loc);
109
+ }
110
+ set(stack, value) {
111
+ throw new Error('Super.#set() Method not implemented.');
112
+ }
113
+ get(stack, thisContext) {
114
+ return stack.get('super');
115
+ }
116
+ dependency(computed) {
117
+ throw new Error('Super.#dependency() Method not implemented.');
118
+ }
119
+ dependencyPath(computed) {
120
+ throw new Error('Super.#dependencyPath() Method not implemented.');
121
+ }
122
+ toString() {
123
+ return `super`;
124
+ }
125
+ toJson() {
126
+ return {};
127
+ }
128
+ };
129
+ return Super = _classThis;
130
+ })();
119
131
  export { Super };
120
132
  /**
121
133
  * MetaProperty node represents
@@ -124,102 +136,147 @@ export { Super };
124
136
  *
125
137
  * In the future, it will represent other meta properties as well.
126
138
  */
127
- let MetaProperty = MetaProperty_1 = class MetaProperty extends AbstractExpressionNode {
128
- static fromJSON(node, deserializer) {
129
- return new MetaProperty_1(deserializer(node.meta), deserializer(node.property), node.range, node.loc);
130
- }
131
- static visit(node, visitNode) {
132
- visitNode(node.meta);
133
- visitNode(node.property);
134
- }
135
- constructor(meta, property, range, loc) {
136
- super(range, loc);
137
- this.meta = meta;
138
- this.property = property;
139
- }
140
- getMeta() {
141
- return this.meta;
142
- }
143
- getProperty() {
144
- return this.property;
145
- }
146
- get(stack) {
147
- const metaRef = this.meta.get(stack);
148
- if (metaRef === undefined || metaRef === null) {
149
- throw new TypeError(`Cannot read meta property '${this.property.toString()}' of ${metaRef}, reading [${this.toString()}]`);
139
+ let MetaProperty = (() => {
140
+ let _classDecorators = [Deserializer('MetaProperty')];
141
+ let _classDescriptor;
142
+ let _classExtraInitializers = [];
143
+ let _classThis;
144
+ let _classSuper = AbstractExpressionNode;
145
+ var MetaProperty = class extends _classSuper {
146
+ static { _classThis = this; }
147
+ static {
148
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
149
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
150
+ MetaProperty = _classThis = _classDescriptor.value;
151
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
152
+ __runInitializers(_classThis, _classExtraInitializers);
150
153
  }
151
- return this.property.get(stack, metaRef);
152
- }
153
- set(stack, value) {
154
- throw new Error(`MetaProperty#set() has no implementation.`);
155
- }
156
- dependency(computed) {
157
- return [];
158
- }
159
- dependencyPath(computed) {
160
- return [];
161
- }
162
- toString() {
163
- return `${this.meta.toString()}.${this.property.toString()}`;
164
- }
165
- toJson() {
166
- return {
167
- meta: this.meta.toJSON(),
168
- property: this.property.toJSON(),
169
- };
170
- }
171
- };
172
- MetaProperty = MetaProperty_1 = __decorate([
173
- Deserializer('MetaProperty'),
174
- __metadata("design:paramtypes", [Identifier, Identifier, Array, Object])
175
- ], MetaProperty);
154
+ meta;
155
+ property;
156
+ static fromJSON(node, deserializer) {
157
+ return new MetaProperty(deserializer(node.meta), deserializer(node.property), node.range, node.loc);
158
+ }
159
+ static visit(node, visitNode) {
160
+ visitNode(node.meta);
161
+ visitNode(node.property);
162
+ }
163
+ constructor(meta, property, range, loc) {
164
+ super(range, loc);
165
+ this.meta = meta;
166
+ this.property = property;
167
+ }
168
+ getMeta() {
169
+ return this.meta;
170
+ }
171
+ getProperty() {
172
+ return this.property;
173
+ }
174
+ get(stack) {
175
+ const metaRef = this.meta.get(stack);
176
+ if (metaRef === undefined || metaRef === null) {
177
+ throw new TypeError(`Cannot read meta property '${this.property.toString()}' of ${metaRef}, reading [${this.toString()}]`);
178
+ }
179
+ return this.property.get(stack, metaRef);
180
+ }
181
+ set(stack, value) {
182
+ throw new Error(`MetaProperty#set() has no implementation.`);
183
+ }
184
+ dependency(computed) {
185
+ return [];
186
+ }
187
+ dependencyPath(computed) {
188
+ return [];
189
+ }
190
+ toString() {
191
+ return `${this.meta.toString()}.${this.property.toString()}`;
192
+ }
193
+ toJson() {
194
+ return {
195
+ meta: this.meta.toJSON(),
196
+ property: this.property.toJSON(),
197
+ };
198
+ }
199
+ };
200
+ return MetaProperty = _classThis;
201
+ })();
176
202
  export { MetaProperty };
177
203
  /**
178
204
  * A private identifier refers to private class elements. For a private name `#a`, its name is `a`.
179
205
  */
180
- let PrivateIdentifier = PrivateIdentifier_1 = class PrivateIdentifier extends Identifier {
181
- static fromJSON(node) {
182
- return new PrivateIdentifier_1(node.name, node.range, node.loc);
183
- }
184
- get(stack, thisContext) {
185
- return thisContext[PRIVATE_SYMBOL][this.name];
186
- }
187
- set(stack, value) {
188
- const thisContext = stack.lastScope().getContext();
189
- return thisContext[PRIVATE_SYMBOL][this.name] = value;
190
- }
191
- toString() {
192
- return `#${this.name}`;
193
- }
194
- };
195
- PrivateIdentifier = PrivateIdentifier_1 = __decorate([
196
- Deserializer('PrivateIdentifier')
197
- ], PrivateIdentifier);
206
+ let PrivateIdentifier = (() => {
207
+ let _classDecorators = [Deserializer('PrivateIdentifier')];
208
+ let _classDescriptor;
209
+ let _classExtraInitializers = [];
210
+ let _classThis;
211
+ let _classSuper = Identifier;
212
+ var PrivateIdentifier = class extends _classSuper {
213
+ static { _classThis = this; }
214
+ static {
215
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
216
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
217
+ PrivateIdentifier = _classThis = _classDescriptor.value;
218
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
219
+ __runInitializers(_classThis, _classExtraInitializers);
220
+ }
221
+ static fromJSON(node) {
222
+ return new PrivateIdentifier(node.name, node.range, node.loc);
223
+ }
224
+ get(stack, thisContext) {
225
+ return thisContext[PRIVATE_SYMBOL][this.name];
226
+ }
227
+ set(stack, value) {
228
+ const thisContext = stack.lastScope().getContext();
229
+ return thisContext[PRIVATE_SYMBOL][this.name] = value;
230
+ }
231
+ toString() {
232
+ return `#${this.name}`;
233
+ }
234
+ };
235
+ return PrivateIdentifier = _classThis;
236
+ })();
198
237
  export { PrivateIdentifier };
199
238
  /**
200
239
  * A static block static { } is a block statement serving as an additional static initializer.
201
240
  */
202
- let StaticBlock = StaticBlock_1 = class StaticBlock extends BlockStatement {
203
- static fromJSON(node, deserializer) {
204
- return new StaticBlock_1(deserializer(node.body), node.range, node.loc);
205
- }
206
- get(stack, classInitializer) {
207
- classInitializer?.addStaticInitializerBlock(super.get(stack));
208
- }
209
- toString() {
210
- return `static ${super.toString()}`;
211
- }
212
- toJson() {
213
- return {
214
- body: this.body.map(node => node.toJSON())
215
- };
216
- }
217
- };
218
- StaticBlock = StaticBlock_1 = __decorate([
219
- Deserializer('StaticBlock')
220
- ], StaticBlock);
241
+ let StaticBlock = (() => {
242
+ let _classDecorators = [Deserializer('StaticBlock')];
243
+ let _classDescriptor;
244
+ let _classExtraInitializers = [];
245
+ let _classThis;
246
+ let _classSuper = BlockStatement;
247
+ var StaticBlock = class extends _classSuper {
248
+ static { _classThis = this; }
249
+ static {
250
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
251
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
252
+ StaticBlock = _classThis = _classDescriptor.value;
253
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
254
+ __runInitializers(_classThis, _classExtraInitializers);
255
+ }
256
+ static fromJSON(node, deserializer) {
257
+ return new StaticBlock(deserializer(node.body), node.range, node.loc);
258
+ }
259
+ get(stack, classInitializer) {
260
+ classInitializer?.addStaticInitializerBlock(super.get(stack));
261
+ }
262
+ toString() {
263
+ return `static ${super.toString()}`;
264
+ }
265
+ toJson() {
266
+ return {
267
+ body: this.body.map(node => node.toJSON())
268
+ };
269
+ }
270
+ };
271
+ return StaticBlock = _classThis;
272
+ })();
221
273
  export { StaticBlock };
222
274
  export class AbstractDefinition extends AbstractExpressionNode {
275
+ key;
276
+ decorators;
277
+ computed;
278
+ value;
279
+ 'static';
223
280
  constructor(key, decorators, computed, isStatic, value, range, loc) {
224
281
  super(range, loc);
225
282
  this.key = key;
@@ -269,291 +326,346 @@ export class AbstractDefinition extends AbstractExpressionNode {
269
326
  /**
270
327
  * - When key is a PrivateIdentifier, computed must be false and kind can not be "constructor".
271
328
  */
272
- let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends AbstractDefinition {
273
- static fromJSON(node, deserializer) {
274
- return new MethodDefinition_1(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static, node.range, node.loc);
275
- }
276
- static visit(node, visitNode) {
277
- visitNode(node.key);
278
- visitNode(node.value);
279
- node.decorators.forEach(visitNode);
280
- }
281
- constructor(kind, key, value, decorators, computed, isStatic, range, loc) {
282
- super(key, decorators, computed, isStatic, value, range, loc);
283
- this.kind = kind;
284
- }
285
- getKind() {
286
- return this.kind;
287
- }
288
- getValue() {
289
- return this.value;
290
- }
291
- get(stack, initializer) {
292
- if (this.kind === 'constructor') {
293
- this.initConstructor(stack, initializer);
294
- return;
329
+ let MethodDefinition = (() => {
330
+ let _classDecorators = [Deserializer('MethodDefinition')];
331
+ let _classDescriptor;
332
+ let _classExtraInitializers = [];
333
+ let _classThis;
334
+ let _classSuper = AbstractDefinition;
335
+ var MethodDefinition = class extends _classSuper {
336
+ static { _classThis = this; }
337
+ static {
338
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
339
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
340
+ MethodDefinition = _classThis = _classDescriptor.value;
341
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
342
+ __runInitializers(_classThis, _classExtraInitializers);
295
343
  }
296
- const name = this.getKeyName(stack);
297
- const value = this.value?.get(stack);
298
- const attributes = this.getPropertyAttributes(value);
299
- if (this.isStatic() && this.isPrivate()) {
300
- initializer.addStaticPrivateInitializer(name, attributes);
344
+ kind;
345
+ static fromJSON(node, deserializer) {
346
+ return new MethodDefinition(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static, node.range, node.loc);
301
347
  }
302
- else if (this.isStatic()) {
303
- initializer.addStaticInitializer(name, attributes);
348
+ static visit(node, visitNode) {
349
+ visitNode(node.key);
350
+ visitNode(node.value);
351
+ node.decorators.forEach(visitNode);
304
352
  }
305
- else if (this.isPrivate()) {
306
- initializer.addPrivateInstanceMethod(name, attributes);
353
+ afterInstanceConstruct;
354
+ constructor(kind, key, value, decorators, computed, isStatic, range, loc) {
355
+ super(key, decorators, computed, isStatic, value, range, loc);
356
+ this.kind = kind;
307
357
  }
308
- else {
309
- initializer.addInstanceMethod(name, attributes);
358
+ getKind() {
359
+ return this.kind;
310
360
  }
311
- }
312
- getPropertyAttributes(value) {
313
- switch (this.kind) {
314
- case 'set': return {
315
- writable: true,
316
- configurable: true,
317
- enumerable: false,
318
- set: value,
319
- };
320
- case 'get': return {
321
- writable: true,
322
- configurable: true,
323
- enumerable: false,
324
- get: value,
325
- };
326
- default:
327
- case 'method': return {
328
- writable: true,
329
- configurable: true,
330
- enumerable: false,
331
- value: value
332
- };
361
+ getValue() {
362
+ return this.value;
333
363
  }
334
- }
335
- initConstructor(stack, initializer) {
336
- const body = this.value.getBody().getBody();
337
- let superIndex = body
338
- .findIndex(call => call instanceof CallExpression && call.getCallee() instanceof Super);
339
- const blockAfterSuper = new BlockStatement(body.slice(superIndex + 1));
340
- initializer.setConstructor(function (params) {
341
- const scope = stack.pushBlockScope();
342
- blockAfterSuper.get(stack);
343
- stack.clearTo(scope);
344
- });
345
- if (superIndex >= 0) {
346
- const blockBeforeSuper = new BlockStatement(body.slice(0, superIndex));
347
- const superCall = body[superIndex];
348
- const cstrExpr = this;
349
- initializer.setParameterResolver(function (params) {
364
+ get(stack, initializer) {
365
+ if (this.kind === 'constructor') {
366
+ this.initConstructor(stack, initializer);
367
+ return;
368
+ }
369
+ const name = this.getKeyName(stack);
370
+ const value = this.value?.get(stack);
371
+ const attributes = this.getPropertyAttributes(value);
372
+ if (this.isStatic() && this.isPrivate()) {
373
+ initializer.addStaticPrivateInitializer(name, attributes);
374
+ }
375
+ else if (this.isStatic()) {
376
+ initializer.addStaticInitializer(name, attributes);
377
+ }
378
+ else if (this.isPrivate()) {
379
+ initializer.addPrivateInstanceMethod(name, attributes);
380
+ }
381
+ else {
382
+ initializer.addInstanceMethod(name, attributes);
383
+ }
384
+ }
385
+ getPropertyAttributes(value) {
386
+ switch (this.kind) {
387
+ case 'set': return {
388
+ writable: true,
389
+ configurable: true,
390
+ enumerable: false,
391
+ set: value,
392
+ };
393
+ case 'get': return {
394
+ writable: true,
395
+ configurable: true,
396
+ enumerable: false,
397
+ get: value,
398
+ };
399
+ default:
400
+ case 'method': return {
401
+ writable: true,
402
+ configurable: true,
403
+ enumerable: false,
404
+ value: value
405
+ };
406
+ }
407
+ }
408
+ initConstructor(stack, initializer) {
409
+ const body = this.value.getBody().getBody();
410
+ let superIndex = body
411
+ .findIndex(call => call instanceof CallExpression && call.getCallee() instanceof Super);
412
+ const blockAfterSuper = new BlockStatement(body.slice(superIndex + 1));
413
+ initializer.setConstructor(function (params) {
350
414
  const scope = stack.pushBlockScope();
351
- cstrExpr.value.defineFunctionArguments(stack, params);
352
- blockBeforeSuper.get(stack);
353
- const parameters = superCall.getCallParameters(stack);
415
+ blockAfterSuper.get(stack);
354
416
  stack.clearTo(scope);
355
- return parameters;
356
417
  });
418
+ if (superIndex >= 0) {
419
+ const blockBeforeSuper = new BlockStatement(body.slice(0, superIndex));
420
+ const superCall = body[superIndex];
421
+ const cstrExpr = this;
422
+ initializer.setParameterResolver(function (params) {
423
+ const scope = stack.pushBlockScope();
424
+ cstrExpr.value.defineFunctionArguments(stack, params);
425
+ blockBeforeSuper.get(stack);
426
+ const parameters = superCall.getCallParameters(stack);
427
+ stack.clearTo(scope);
428
+ return parameters;
429
+ });
430
+ }
357
431
  }
358
- }
359
- toString() {
360
- let str = this.decorators.map(decorator => decorator.toString()).join(' ');
361
- if (str.length) {
362
- str += ' ';
363
- }
364
- if (this.static) {
365
- str += 'static ';
366
- }
367
- const methodName = this.key.toString();
368
- switch (this.kind) {
369
- case 'get':
370
- str += 'get ' + methodName;
371
- break;
372
- case 'set':
373
- str += 'set ' + methodName;
374
- break;
375
- case 'method':
376
- if (this.value.getAsync() && this.value.getGenerator()) {
377
- str += 'async *';
378
- }
379
- else if (this.value.getAsync()) {
380
- str += 'async ';
381
- }
382
- else if (this.value.getGenerator()) {
383
- str += '*';
384
- }
385
- str += methodName;
386
- break;
387
- case 'constructor':
388
- str += 'constructor';
389
- break;
390
- default:
391
- break;
432
+ toString() {
433
+ let str = this.decorators.map(decorator => decorator.toString()).join(' ');
434
+ if (str.length) {
435
+ str += ' ';
436
+ }
437
+ if (this.static) {
438
+ str += 'static ';
439
+ }
440
+ const methodName = this.key.toString();
441
+ switch (this.kind) {
442
+ case 'get':
443
+ str += 'get ' + methodName;
444
+ break;
445
+ case 'set':
446
+ str += 'set ' + methodName;
447
+ break;
448
+ case 'method':
449
+ if (this.value.getAsync() && this.value.getGenerator()) {
450
+ str += 'async *';
451
+ }
452
+ else if (this.value.getAsync()) {
453
+ str += 'async ';
454
+ }
455
+ else if (this.value.getGenerator()) {
456
+ str += '*';
457
+ }
458
+ str += methodName;
459
+ break;
460
+ case 'constructor':
461
+ str += 'constructor';
462
+ break;
463
+ default:
464
+ break;
465
+ }
466
+ str += this.value.paramsAndBodyToString();
467
+ return str;
392
468
  }
393
- str += this.value.paramsAndBodyToString();
394
- return str;
395
- }
396
- toJson() {
397
- return {
398
- kind: this.kind,
399
- key: this.key.toJSON(),
400
- value: this.value.toJSON(),
401
- decorators: this.decorators.map(decorator => decorator.toJSON()),
402
- computed: this.computed,
403
- static: this.static,
404
- };
405
- }
406
- };
407
- MethodDefinition = MethodDefinition_1 = __decorate([
408
- Deserializer('MethodDefinition'),
409
- __metadata("design:paramtypes", [String, Object, FunctionExpression, Array, Boolean, Boolean, Array, Object])
410
- ], MethodDefinition);
469
+ toJson() {
470
+ return {
471
+ kind: this.kind,
472
+ key: this.key.toJSON(),
473
+ value: this.value.toJSON(),
474
+ decorators: this.decorators.map(decorator => decorator.toJSON()),
475
+ computed: this.computed,
476
+ static: this.static,
477
+ };
478
+ }
479
+ };
480
+ return MethodDefinition = _classThis;
481
+ })();
411
482
  export { MethodDefinition };
412
483
  /**
413
484
  * - When key is a PrivateIdentifier, computed must be false.
414
485
  */
415
- let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends AbstractDefinition {
416
- static fromJSON(node, deserializer) {
417
- return new PropertyDefinition_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value), node.range, node.loc);
418
- }
419
- static visit(node, visitNode) {
420
- visitNode(node.key);
421
- node.value && visitNode(node.value);
422
- }
423
- constructor(key, decorators, computed, isStatic, value, range, loc) {
424
- super(key, decorators, computed, isStatic, value, range, loc);
425
- }
426
- get(stack, initializer) {
427
- const name = this.getKeyName(stack);
428
- if (!this.isStatic()) {
429
- initializer.addInstanceInitializer(() => ({ isPrivate: this.isPrivate(), key: name, value: this.value?.get(stack) }));
430
- return;
486
+ let PropertyDefinition = (() => {
487
+ let _classDecorators = [Deserializer('PropertyDefinition')];
488
+ let _classDescriptor;
489
+ let _classExtraInitializers = [];
490
+ let _classThis;
491
+ let _classSuper = AbstractDefinition;
492
+ var PropertyDefinition = class extends _classSuper {
493
+ static { _classThis = this; }
494
+ static {
495
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
496
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
497
+ PropertyDefinition = _classThis = _classDescriptor.value;
498
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
499
+ __runInitializers(_classThis, _classExtraInitializers);
431
500
  }
432
- const value = this.value?.get(stack);
433
- const attributes = { writable: true, configurable: true, enumerable: true, value };
434
- if (this.isPrivate()) {
435
- initializer.addStaticPrivateInitializer(name, attributes);
501
+ static fromJSON(node, deserializer) {
502
+ return new PropertyDefinition(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value), node.range, node.loc);
436
503
  }
437
- else {
438
- initializer.addStaticInitializer(name, attributes);
504
+ static visit(node, visitNode) {
505
+ visitNode(node.key);
506
+ node.value && visitNode(node.value);
439
507
  }
440
- }
441
- toString() {
442
- const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
443
- const name = this.computed ? `[${this.key.toString()}]` : this.key.toString();
444
- return `${decorators.length ? decorators + ' ' : ''}${this.static ? 'static ' : ''}${name}${this.value ? ` = ${this.value.toString()}` : ''};`;
445
- }
446
- toJson() {
447
- return {
448
- key: this.key.toJSON(),
449
- value: this.value?.toJSON(),
450
- decorators: this.decorators.map(decorator => decorator.toJSON()),
451
- computed: this.computed,
452
- static: this.static,
453
- };
454
- }
455
- };
456
- PropertyDefinition = PropertyDefinition_1 = __decorate([
457
- Deserializer('PropertyDefinition'),
458
- __metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object, Array, Object])
459
- ], PropertyDefinition);
508
+ constructor(key, decorators, computed, isStatic, value, range, loc) {
509
+ super(key, decorators, computed, isStatic, value, range, loc);
510
+ }
511
+ get(stack, initializer) {
512
+ const name = this.getKeyName(stack);
513
+ if (!this.isStatic()) {
514
+ initializer.addInstanceInitializer(() => ({ isPrivate: this.isPrivate(), key: name, value: this.value?.get(stack) }));
515
+ return;
516
+ }
517
+ const value = this.value?.get(stack);
518
+ const attributes = { writable: true, configurable: true, enumerable: true, value };
519
+ if (this.isPrivate()) {
520
+ initializer.addStaticPrivateInitializer(name, attributes);
521
+ }
522
+ else {
523
+ initializer.addStaticInitializer(name, attributes);
524
+ }
525
+ }
526
+ toString() {
527
+ const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
528
+ const name = this.computed ? `[${this.key.toString()}]` : this.key.toString();
529
+ return `${decorators.length ? decorators + ' ' : ''}${this.static ? 'static ' : ''}${name}${this.value ? ` = ${this.value.toString()}` : ''};`;
530
+ }
531
+ toJson() {
532
+ return {
533
+ key: this.key.toJSON(),
534
+ value: this.value?.toJSON(),
535
+ decorators: this.decorators.map(decorator => decorator.toJSON()),
536
+ computed: this.computed,
537
+ static: this.static,
538
+ };
539
+ }
540
+ };
541
+ return PropertyDefinition = _classThis;
542
+ })();
460
543
  export { PropertyDefinition };
461
- let AccessorProperty = AccessorProperty_1 = class AccessorProperty extends AbstractDefinition {
462
- static fromJSON(node, deserializer) {
463
- return new AccessorProperty_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0, node.range, node.loc);
464
- }
465
- static visit(node, visitNode) {
466
- visitNode(node.key);
467
- node.value && visitNode(node.value);
468
- node.decorators.forEach(visitNode);
469
- }
470
- constructor(key, decorators, computed, isStatic, value, range, loc) {
471
- super(key, decorators, computed, isStatic, value, range, loc);
472
- }
473
- get(stack, initializer) {
474
- const name = this.getKeyName(stack);
475
- const accessorAttributes = {
476
- writable: false,
477
- configurable: true,
478
- enumerable: false,
479
- set: function (value) {
480
- this[PRIVATE_SYMBOL][name] = value;
481
- },
482
- get: function () {
483
- return this[PRIVATE_SYMBOL][name];
484
- },
485
- };
486
- if (!this.isStatic()) {
487
- initializer.addInstanceInitializer(() => ({ isPrivate: true, key: name, value: this.value?.get(stack) }));
488
- initializer.addInstanceMethod(name, accessorAttributes);
489
- return;
544
+ let AccessorProperty = (() => {
545
+ let _classDecorators = [Deserializer('AccessorProperty')];
546
+ let _classDescriptor;
547
+ let _classExtraInitializers = [];
548
+ let _classThis;
549
+ let _classSuper = AbstractDefinition;
550
+ var AccessorProperty = class extends _classSuper {
551
+ static { _classThis = this; }
552
+ static {
553
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
554
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
555
+ AccessorProperty = _classThis = _classDescriptor.value;
556
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
557
+ __runInitializers(_classThis, _classExtraInitializers);
490
558
  }
491
- const value = this.value?.get(stack);
492
- const valueAttribute = { writable: true, configurable: true, enumerable: true, value };
493
- initializer.addStaticInitializer(name, accessorAttributes);
494
- initializer.addStaticPrivateInitializer(name, valueAttribute);
495
- }
496
- toString() {
497
- const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
498
- const name = this.computed ? `[${this.key.toString()}]` : this.key.toString();
499
- return `${decorators.length ? decorators.concat(' ') : ''}${this.static ? 'static ' : ''}accessor ${name}${this.value ? ` = ${this.value.toString()}` : ''};`;
500
- }
501
- toJson() {
502
- return {
503
- key: this.key.toJSON(),
504
- decorators: this.decorators.map(decorator => decorator.toJSON()),
505
- computed: this.computed,
506
- static: this.static,
507
- value: this.value?.toJSON(),
508
- };
509
- }
510
- };
511
- AccessorProperty = AccessorProperty_1 = __decorate([
512
- Deserializer('AccessorProperty'),
513
- __metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object, Array, Object])
514
- ], AccessorProperty);
559
+ static fromJSON(node, deserializer) {
560
+ return new AccessorProperty(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0, node.range, node.loc);
561
+ }
562
+ static visit(node, visitNode) {
563
+ visitNode(node.key);
564
+ node.value && visitNode(node.value);
565
+ node.decorators.forEach(visitNode);
566
+ }
567
+ constructor(key, decorators, computed, isStatic, value, range, loc) {
568
+ super(key, decorators, computed, isStatic, value, range, loc);
569
+ }
570
+ get(stack, initializer) {
571
+ const name = this.getKeyName(stack);
572
+ const accessorAttributes = {
573
+ writable: false,
574
+ configurable: true,
575
+ enumerable: false,
576
+ set: function (value) {
577
+ this[PRIVATE_SYMBOL][name] = value;
578
+ },
579
+ get: function () {
580
+ return this[PRIVATE_SYMBOL][name];
581
+ },
582
+ };
583
+ if (!this.isStatic()) {
584
+ initializer.addInstanceInitializer(() => ({ isPrivate: true, key: name, value: this.value?.get(stack) }));
585
+ initializer.addInstanceMethod(name, accessorAttributes);
586
+ return;
587
+ }
588
+ const value = this.value?.get(stack);
589
+ const valueAttribute = { writable: true, configurable: true, enumerable: true, value };
590
+ initializer.addStaticInitializer(name, accessorAttributes);
591
+ initializer.addStaticPrivateInitializer(name, valueAttribute);
592
+ }
593
+ toString() {
594
+ const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
595
+ const name = this.computed ? `[${this.key.toString()}]` : this.key.toString();
596
+ return `${decorators.length ? decorators.concat(' ') : ''}${this.static ? 'static ' : ''}accessor ${name}${this.value ? ` = ${this.value.toString()}` : ''};`;
597
+ }
598
+ toJson() {
599
+ return {
600
+ key: this.key.toJSON(),
601
+ decorators: this.decorators.map(decorator => decorator.toJSON()),
602
+ computed: this.computed,
603
+ static: this.static,
604
+ value: this.value?.toJSON(),
605
+ };
606
+ }
607
+ };
608
+ return AccessorProperty = _classThis;
609
+ })();
515
610
  export { AccessorProperty };
516
- let ClassBody = ClassBody_1 = class ClassBody extends AbstractExpressionNode {
517
- static fromJSON(node, deserializer) {
518
- return new ClassBody_1(node.body.map(deserializer), node.range, node.loc);
519
- }
520
- static visit(node, visitNode) {
521
- node.body.forEach(visitNode);
522
- }
523
- constructor(body, range, loc) {
524
- super(range, loc);
525
- this.body = body;
526
- }
527
- getBody() {
528
- return this.body;
529
- }
530
- set(stack, value) {
531
- throw new Error('Method not implemented.');
532
- }
533
- get(stack, initializer) {
534
- this.body.forEach(definition => definition.get(stack, initializer));
535
- }
536
- dependency(computed) {
537
- throw new Error('Method not implemented.');
538
- }
539
- dependencyPath(computed) {
540
- throw new Error('Method not implemented.');
541
- }
542
- toString() {
543
- return this.body.map(definition => `\t${definition.toString()}`).join('\n');
544
- }
545
- toJson() {
546
- return {
547
- body: this.body.map(method => method.toJSON())
548
- };
549
- }
550
- };
551
- ClassBody = ClassBody_1 = __decorate([
552
- Deserializer('ClassBody'),
553
- __metadata("design:paramtypes", [Array, Array, Object])
554
- ], ClassBody);
611
+ let ClassBody = (() => {
612
+ let _classDecorators = [Deserializer('ClassBody')];
613
+ let _classDescriptor;
614
+ let _classExtraInitializers = [];
615
+ let _classThis;
616
+ let _classSuper = AbstractExpressionNode;
617
+ var ClassBody = class extends _classSuper {
618
+ static { _classThis = this; }
619
+ static {
620
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
621
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
622
+ ClassBody = _classThis = _classDescriptor.value;
623
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
624
+ __runInitializers(_classThis, _classExtraInitializers);
625
+ }
626
+ body;
627
+ static fromJSON(node, deserializer) {
628
+ return new ClassBody(node.body.map(deserializer), node.range, node.loc);
629
+ }
630
+ static visit(node, visitNode) {
631
+ node.body.forEach(visitNode);
632
+ }
633
+ constructor(body, range, loc) {
634
+ super(range, loc);
635
+ this.body = body;
636
+ }
637
+ getBody() {
638
+ return this.body;
639
+ }
640
+ set(stack, value) {
641
+ throw new Error('Method not implemented.');
642
+ }
643
+ get(stack, initializer) {
644
+ this.body.forEach(definition => definition.get(stack, initializer));
645
+ }
646
+ dependency(computed) {
647
+ throw new Error('Method not implemented.');
648
+ }
649
+ dependencyPath(computed) {
650
+ throw new Error('Method not implemented.');
651
+ }
652
+ toString() {
653
+ return this.body.map(definition => `\t${definition.toString()}`).join('\n');
654
+ }
655
+ toJson() {
656
+ return {
657
+ body: this.body.map(method => method.toJSON())
658
+ };
659
+ }
660
+ };
661
+ return ClassBody = _classThis;
662
+ })();
555
663
  export { ClassBody };
556
664
  export class Class extends AbstractExpressionNode {
665
+ body;
666
+ decorators;
667
+ id;
668
+ superClass;
557
669
  constructor(body, decorators, id, superClass, range, loc) {
558
670
  super(range, loc);
559
671
  this.body = body;
@@ -594,22 +706,17 @@ export class Class extends AbstractExpressionNode {
594
706
  return ClassConstructor;
595
707
  }
596
708
  createClass(parentClass, className, initializer) {
597
- var _a, _b, _c, _d;
598
709
  const nameClassDeclaration = {
599
- [className]: (_d = class extends parentClass {
600
- constructor(...params) {
601
- const parameters = initializer.getSuperArguments(params);
602
- super(...parameters);
603
- this[_c] = {};
604
- initializer.initInstance(this);
605
- }
606
- },
607
- _a = Symbol.toStringTag,
608
- _b = PRIVATE_SYMBOL,
609
- _c = PRIVATE_SYMBOL,
610
- _d[_a] = className,
611
- _d[_b] = {},
612
- _d)
710
+ [className]: class extends parentClass {
711
+ static [Symbol.toStringTag] = className;
712
+ static [PRIVATE_SYMBOL] = {};
713
+ [PRIVATE_SYMBOL] = {};
714
+ constructor(...params) {
715
+ const parameters = initializer.getSuperArguments(params);
716
+ super(...parameters);
717
+ initializer.initInstance(this);
718
+ }
719
+ }
613
720
  };
614
721
  return nameClassDeclaration[className];
615
722
  }
@@ -639,53 +746,77 @@ export class Class extends AbstractExpressionNode {
639
746
  };
640
747
  }
641
748
  }
642
- let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class {
643
- static fromJSON(node, deserializer) {
644
- return new ClassDeclaration_1(deserializer(node.body), node.decorators.map(deserializer), deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
645
- }
646
- static visit(node, visitNode) {
647
- visitNode(node.body);
648
- node.decorators.forEach(visitNode);
649
- visitNode(node.id);
650
- node.superClass && visitNode(node.superClass);
651
- }
652
- constructor(body, decorators, id, superClass, range, loc) {
653
- super(body, decorators, id, superClass, range, loc);
654
- }
655
- declareVariable(stack, propertyValue) {
656
- stack.declareVariable(this.id.getName(), propertyValue);
657
- }
658
- getDeclarationName() {
659
- return this.id.getDeclarationName();
660
- }
661
- get(stack) {
662
- const classConstructor = super.get(stack);
663
- this.id.declareVariable(stack, classConstructor);
664
- return classConstructor;
665
- }
666
- };
667
- ClassDeclaration = ClassDeclaration_1 = __decorate([
668
- Deserializer('ClassDeclaration'),
669
- __metadata("design:paramtypes", [ClassBody, Array, Identifier, Object, Array, Object])
670
- ], ClassDeclaration);
749
+ let ClassDeclaration = (() => {
750
+ let _classDecorators = [Deserializer('ClassDeclaration')];
751
+ let _classDescriptor;
752
+ let _classExtraInitializers = [];
753
+ let _classThis;
754
+ let _classSuper = Class;
755
+ var ClassDeclaration = class extends _classSuper {
756
+ static { _classThis = this; }
757
+ static {
758
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
759
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
760
+ ClassDeclaration = _classThis = _classDescriptor.value;
761
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
762
+ __runInitializers(_classThis, _classExtraInitializers);
763
+ }
764
+ static fromJSON(node, deserializer) {
765
+ return new ClassDeclaration(deserializer(node.body), node.decorators.map(deserializer), deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
766
+ }
767
+ static visit(node, visitNode) {
768
+ visitNode(node.body);
769
+ node.decorators.forEach(visitNode);
770
+ visitNode(node.id);
771
+ node.superClass && visitNode(node.superClass);
772
+ }
773
+ constructor(body, decorators, id, superClass, range, loc) {
774
+ super(body, decorators, id, superClass, range, loc);
775
+ }
776
+ declareVariable(stack, propertyValue) {
777
+ stack.declareVariable(this.id.getName(), propertyValue);
778
+ }
779
+ getDeclarationName() {
780
+ return this.id.getDeclarationName();
781
+ }
782
+ get(stack) {
783
+ const classConstructor = super.get(stack);
784
+ this.id.declareVariable(stack, classConstructor);
785
+ return classConstructor;
786
+ }
787
+ };
788
+ return ClassDeclaration = _classThis;
789
+ })();
671
790
  export { ClassDeclaration };
672
- let ClassExpression = ClassExpression_1 = class ClassExpression extends Class {
673
- static fromJSON(node, deserializer) {
674
- return new ClassExpression_1(deserializer(node.body), node.decorators.map(deserializer), node.id && deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
675
- }
676
- static visit(node, visitNode) {
677
- visitNode(node.body);
678
- node.decorators.forEach(visitNode);
679
- node.id && visitNode(node.id);
680
- node.superClass && visitNode(node.superClass);
681
- }
682
- constructor(body, decorators, id, superClass, range, loc) {
683
- super(body, decorators, id, superClass, range, loc);
684
- }
685
- };
686
- ClassExpression = ClassExpression_1 = __decorate([
687
- Deserializer('ClassExpression'),
688
- __metadata("design:paramtypes", [ClassBody, Array, Identifier, Object, Array, Object])
689
- ], ClassExpression);
791
+ let ClassExpression = (() => {
792
+ let _classDecorators = [Deserializer('ClassExpression')];
793
+ let _classDescriptor;
794
+ let _classExtraInitializers = [];
795
+ let _classThis;
796
+ let _classSuper = Class;
797
+ var ClassExpression = class extends _classSuper {
798
+ static { _classThis = this; }
799
+ static {
800
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
801
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
802
+ ClassExpression = _classThis = _classDescriptor.value;
803
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
804
+ __runInitializers(_classThis, _classExtraInitializers);
805
+ }
806
+ static fromJSON(node, deserializer) {
807
+ return new ClassExpression(deserializer(node.body), node.decorators.map(deserializer), node.id && deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
808
+ }
809
+ static visit(node, visitNode) {
810
+ visitNode(node.body);
811
+ node.decorators.forEach(visitNode);
812
+ node.id && visitNode(node.id);
813
+ node.superClass && visitNode(node.superClass);
814
+ }
815
+ constructor(body, decorators, id, superClass, range, loc) {
816
+ super(body, decorators, id, superClass, range, loc);
817
+ }
818
+ };
819
+ return ClassExpression = _classThis;
820
+ })();
690
821
  export { ClassExpression };
691
822
  //# sourceMappingURL=class.js.map