@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,5 +1,4 @@
1
- var ForNode_1, ForOfNode_1, ForInNode_1, ForAwaitOfNode_1;
2
- import { __decorate, __metadata } from "tslib";
1
+ import { __esDecorate, __runInitializers } from "tslib";
3
2
  import { AbstractExpressionNode, ReturnValue } from '../../abstract.js';
4
3
  import { Deserializer } from '../../deserialize/deserialize.js';
5
4
  import { TerminateReturnType } from '../control/terminate.js';
@@ -8,297 +7,358 @@ import { TerminateReturnType } from '../control/terminate.js';
8
7
  * If the condition is falsy, another statement can be executed.
9
8
  *
10
9
  */
11
- let ForNode = ForNode_1 = class ForNode extends AbstractExpressionNode {
12
- static fromJSON(node, deserializer) {
13
- return new ForNode_1(deserializer(node.body), node.init && deserializer(node.init), node.test && deserializer(node.test), node.update && deserializer(node.update), node.range, node.loc);
14
- }
15
- static visit(node, visitNode) {
16
- visitNode(node.body);
17
- node.init && visitNode(node.init);
18
- node.test && visitNode(node.test);
19
- node.update && visitNode(node.update);
20
- }
21
- constructor(body, init, test, update, range, loc) {
22
- super(range, loc);
23
- this.body = body;
24
- this.init = init;
25
- this.test = test;
26
- this.update = update;
27
- }
28
- getBody() {
29
- return this.body;
30
- }
31
- getInit() {
32
- return this.init;
33
- }
34
- getTest() {
35
- return this.test;
36
- }
37
- getUpdate() {
38
- return this.update;
39
- }
40
- set(stack, value) {
41
- throw new Error(`ForNode#set() has no implementation.`);
42
- }
43
- get(stack) {
44
- const forBlock = stack.pushBlockScope();
45
- for (this.init?.get(stack); this.test?.get(stack) ?? true; this.update?.get(stack)) {
46
- const result = this.body.get(stack);
47
- // useless case, as it at the end of for statement
48
- // an array/block statement, should return last signal
49
- if (result instanceof TerminateReturnType) {
50
- if (result.type === 'continue') {
51
- continue;
10
+ let ForNode = (() => {
11
+ let _classDecorators = [Deserializer('ForStatement')];
12
+ let _classDescriptor;
13
+ let _classExtraInitializers = [];
14
+ let _classThis;
15
+ let _classSuper = AbstractExpressionNode;
16
+ var ForNode = class extends _classSuper {
17
+ static { _classThis = this; }
18
+ static {
19
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
20
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
21
+ ForNode = _classThis = _classDescriptor.value;
22
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
23
+ __runInitializers(_classThis, _classExtraInitializers);
24
+ }
25
+ body;
26
+ init;
27
+ test;
28
+ update;
29
+ static fromJSON(node, deserializer) {
30
+ return new ForNode(deserializer(node.body), node.init && deserializer(node.init), node.test && deserializer(node.test), node.update && deserializer(node.update), node.range, node.loc);
31
+ }
32
+ static visit(node, visitNode) {
33
+ visitNode(node.body);
34
+ node.init && visitNode(node.init);
35
+ node.test && visitNode(node.test);
36
+ node.update && visitNode(node.update);
37
+ }
38
+ constructor(body, init, test, update, range, loc) {
39
+ super(range, loc);
40
+ this.body = body;
41
+ this.init = init;
42
+ this.test = test;
43
+ this.update = update;
44
+ }
45
+ getBody() {
46
+ return this.body;
47
+ }
48
+ getInit() {
49
+ return this.init;
50
+ }
51
+ getTest() {
52
+ return this.test;
53
+ }
54
+ getUpdate() {
55
+ return this.update;
56
+ }
57
+ set(stack, value) {
58
+ throw new Error(`ForNode#set() has no implementation.`);
59
+ }
60
+ get(stack) {
61
+ const forBlock = stack.pushBlockScope();
62
+ for (this.init?.get(stack); this.test?.get(stack) ?? true; this.update?.get(stack)) {
63
+ const result = this.body.get(stack);
64
+ // useless case, as it at the end of for statement
65
+ // an array/block statement, should return last signal
66
+ if (result instanceof TerminateReturnType) {
67
+ if (result.type === 'continue') {
68
+ continue;
69
+ }
70
+ else {
71
+ break;
72
+ }
52
73
  }
53
- else {
54
- break;
74
+ if (result instanceof ReturnValue) {
75
+ stack.clearTo(forBlock);
76
+ return result;
55
77
  }
56
78
  }
57
- if (result instanceof ReturnValue) {
58
- stack.clearTo(forBlock);
59
- return result;
60
- }
79
+ stack.clearTo(forBlock);
80
+ return void 0;
81
+ }
82
+ dependency(computed) {
83
+ let dependency = this.body.dependency(computed);
84
+ this.init && (dependency = dependency.concat(this.init.dependency(computed)));
85
+ this.test && (dependency = dependency.concat(this.test.dependency(computed)));
86
+ this.update && (dependency = dependency.concat(this.update.dependency(computed)));
87
+ return dependency;
88
+ }
89
+ dependencyPath(computed) {
90
+ let dependencyPath = this.body.dependencyPath(computed);
91
+ this.init && (dependencyPath = dependencyPath.concat(this.init.dependencyPath(computed)));
92
+ this.test && (dependencyPath = dependencyPath.concat(this.test.dependencyPath(computed)));
93
+ this.update && (dependencyPath = dependencyPath.concat(this.update.dependencyPath(computed)));
94
+ return dependencyPath;
95
+ }
96
+ toString() {
97
+ return `for (${this.init?.toString()};${this.test?.toString()};${this.init?.toString()}) ${this.body.toString()}`;
61
98
  }
62
- stack.clearTo(forBlock);
63
- return void 0;
64
- }
65
- dependency(computed) {
66
- let dependency = this.body.dependency(computed);
67
- this.init && (dependency = dependency.concat(this.init.dependency(computed)));
68
- this.test && (dependency = dependency.concat(this.test.dependency(computed)));
69
- this.update && (dependency = dependency.concat(this.update.dependency(computed)));
70
- return dependency;
71
- }
72
- dependencyPath(computed) {
73
- let dependencyPath = this.body.dependencyPath(computed);
74
- this.init && (dependencyPath = dependencyPath.concat(this.init.dependencyPath(computed)));
75
- this.test && (dependencyPath = dependencyPath.concat(this.test.dependencyPath(computed)));
76
- this.update && (dependencyPath = dependencyPath.concat(this.update.dependencyPath(computed)));
77
- return dependencyPath;
78
- }
79
- toString() {
80
- return `for (${this.init?.toString()};${this.test?.toString()};${this.init?.toString()}) ${this.body.toString()}`;
81
- }
82
- toJson() {
83
- return {
84
- body: this.body.toJSON(),
85
- init: this.init?.toJSON(),
86
- test: this.test?.toJSON(),
87
- update: this.update?.toJSON(),
88
- };
89
- }
90
- };
91
- ForNode = ForNode_1 = __decorate([
92
- Deserializer('ForStatement'),
93
- __metadata("design:paramtypes", [Object, Object, Object, Object, Array, Object])
94
- ], ForNode);
99
+ toJson() {
100
+ return {
101
+ body: this.body.toJSON(),
102
+ init: this.init?.toJSON(),
103
+ test: this.test?.toJSON(),
104
+ update: this.update?.toJSON(),
105
+ };
106
+ }
107
+ };
108
+ return ForNode = _classThis;
109
+ })();
95
110
  export { ForNode };
96
- let ForOfNode = ForOfNode_1 = class ForOfNode extends AbstractExpressionNode {
97
- static fromJSON(node, deserializer) {
98
- return new ForOfNode_1(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
99
- }
100
- static visit(node, visitNode) {
101
- visitNode(node.left);
102
- visitNode(node.right);
103
- visitNode(node.body);
104
- }
105
- constructor(left, right, body, range, loc) {
106
- super(range, loc);
107
- this.left = left;
108
- this.right = right;
109
- this.body = body;
110
- }
111
- getLeft() {
112
- return this.left;
113
- }
114
- getRight() {
115
- return this.right;
116
- }
117
- getBody() {
118
- return this.body;
119
- }
120
- set(stack, value) {
121
- throw new Error(`ForOfNode#set() has no implementation.`);
122
- }
123
- get(stack) {
124
- const iterable = this.right.get(stack);
125
- for (const iterator of iterable) {
126
- const forBlock = stack.pushBlockScope();
127
- this.left.declareVariable(stack, iterator);
128
- const result = this.body.get(stack);
129
- // useless case, as it at the end of for statement
130
- // an array/block statement, should return last signal
131
- if (result instanceof TerminateReturnType) {
132
- if (result.type === 'continue') {
133
- continue;
111
+ let ForOfNode = (() => {
112
+ let _classDecorators = [Deserializer('ForOfStatement')];
113
+ let _classDescriptor;
114
+ let _classExtraInitializers = [];
115
+ let _classThis;
116
+ let _classSuper = AbstractExpressionNode;
117
+ var ForOfNode = class extends _classSuper {
118
+ static { _classThis = this; }
119
+ static {
120
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
121
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
122
+ ForOfNode = _classThis = _classDescriptor.value;
123
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
124
+ __runInitializers(_classThis, _classExtraInitializers);
125
+ }
126
+ left;
127
+ right;
128
+ body;
129
+ static fromJSON(node, deserializer) {
130
+ return new ForOfNode(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
131
+ }
132
+ static visit(node, visitNode) {
133
+ visitNode(node.left);
134
+ visitNode(node.right);
135
+ visitNode(node.body);
136
+ }
137
+ constructor(left, right, body, range, loc) {
138
+ super(range, loc);
139
+ this.left = left;
140
+ this.right = right;
141
+ this.body = body;
142
+ }
143
+ getLeft() {
144
+ return this.left;
145
+ }
146
+ getRight() {
147
+ return this.right;
148
+ }
149
+ getBody() {
150
+ return this.body;
151
+ }
152
+ set(stack, value) {
153
+ throw new Error(`ForOfNode#set() has no implementation.`);
154
+ }
155
+ get(stack) {
156
+ const iterable = this.right.get(stack);
157
+ for (const iterator of iterable) {
158
+ const forBlock = stack.pushBlockScope();
159
+ this.left.declareVariable(stack, iterator);
160
+ const result = this.body.get(stack);
161
+ // useless case, as it at the end of for statement
162
+ // an array/block statement, should return last signal
163
+ if (result instanceof TerminateReturnType) {
164
+ if (result.type === 'continue') {
165
+ continue;
166
+ }
167
+ else {
168
+ break;
169
+ }
134
170
  }
135
- else {
136
- break;
171
+ else if (result instanceof ReturnValue) {
172
+ stack.clearTo(forBlock);
173
+ return result;
137
174
  }
138
- }
139
- else if (result instanceof ReturnValue) {
140
175
  stack.clearTo(forBlock);
141
- return result;
142
176
  }
143
- stack.clearTo(forBlock);
177
+ return void 0;
178
+ }
179
+ dependency(computed) {
180
+ return this.right.dependency(computed);
181
+ }
182
+ dependencyPath(computed) {
183
+ return this.right.dependencyPath(computed);
184
+ }
185
+ toString() {
186
+ return `for (${this.left?.toString()} of ${this.right.toString()}) ${this.body.toString()}`;
187
+ }
188
+ toJson() {
189
+ return {
190
+ left: this.left.toJSON(),
191
+ right: this.right.toJSON(),
192
+ body: this.body.toJSON(),
193
+ };
144
194
  }
145
- return void 0;
146
- }
147
- dependency(computed) {
148
- return this.right.dependency(computed);
149
- }
150
- dependencyPath(computed) {
151
- return this.right.dependencyPath(computed);
152
- }
153
- toString() {
154
- return `for (${this.left?.toString()} of ${this.right.toString()}) ${this.body.toString()}`;
155
- }
156
- toJson() {
157
- return {
158
- left: this.left.toJSON(),
159
- right: this.right.toJSON(),
160
- body: this.body.toJSON(),
161
- };
162
- }
163
- };
164
- ForOfNode = ForOfNode_1 = __decorate([
165
- Deserializer('ForOfStatement'),
166
- __metadata("design:paramtypes", [Object, Object, Object, Array, Object])
167
- ], ForOfNode);
195
+ };
196
+ return ForOfNode = _classThis;
197
+ })();
168
198
  export { ForOfNode };
169
- let ForInNode = ForInNode_1 = class ForInNode extends AbstractExpressionNode {
170
- static fromJSON(node, deserializer) {
171
- return new ForInNode_1(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
172
- }
173
- static visit(node, visitNode) {
174
- visitNode(node.left);
175
- visitNode(node.right);
176
- visitNode(node.body);
177
- }
178
- // variable of iterable
179
- constructor(left, right, body, range, loc) {
180
- super(range, loc);
181
- this.left = left;
182
- this.right = right;
183
- this.body = body;
184
- }
185
- getLeft() {
186
- return this.left;
187
- }
188
- getRight() {
189
- return this.right;
190
- }
191
- getBody() {
192
- return this.body;
193
- }
194
- set(stack, value) {
195
- throw new Error(`ForOfNode#set() has no implementation.`);
196
- }
197
- get(stack) {
198
- const iterable = this.right.get(stack);
199
- for (const iterator in iterable) {
200
- const forBlock = stack.pushBlockScope();
201
- this.left.declareVariable(stack, iterator);
202
- const result = this.body.get(stack);
203
- // useless case, as it at the end of for statement
204
- // an array/block statement, should return last signal
205
- if (result instanceof TerminateReturnType) {
206
- if (result.type === 'continue') {
207
- continue;
199
+ let ForInNode = (() => {
200
+ let _classDecorators = [Deserializer('ForInStatement')];
201
+ let _classDescriptor;
202
+ let _classExtraInitializers = [];
203
+ let _classThis;
204
+ let _classSuper = AbstractExpressionNode;
205
+ var ForInNode = class extends _classSuper {
206
+ static { _classThis = this; }
207
+ static {
208
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
209
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
210
+ ForInNode = _classThis = _classDescriptor.value;
211
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
212
+ __runInitializers(_classThis, _classExtraInitializers);
213
+ }
214
+ left;
215
+ right;
216
+ body;
217
+ static fromJSON(node, deserializer) {
218
+ return new ForInNode(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
219
+ }
220
+ static visit(node, visitNode) {
221
+ visitNode(node.left);
222
+ visitNode(node.right);
223
+ visitNode(node.body);
224
+ }
225
+ // variable of iterable
226
+ constructor(left, right, body, range, loc) {
227
+ super(range, loc);
228
+ this.left = left;
229
+ this.right = right;
230
+ this.body = body;
231
+ }
232
+ getLeft() {
233
+ return this.left;
234
+ }
235
+ getRight() {
236
+ return this.right;
237
+ }
238
+ getBody() {
239
+ return this.body;
240
+ }
241
+ set(stack, value) {
242
+ throw new Error(`ForOfNode#set() has no implementation.`);
243
+ }
244
+ get(stack) {
245
+ const iterable = this.right.get(stack);
246
+ for (const iterator in iterable) {
247
+ const forBlock = stack.pushBlockScope();
248
+ this.left.declareVariable(stack, iterator);
249
+ const result = this.body.get(stack);
250
+ // useless case, as it at the end of for statement
251
+ // an array/block statement, should return last signal
252
+ if (result instanceof TerminateReturnType) {
253
+ if (result.type === 'continue') {
254
+ continue;
255
+ }
256
+ else {
257
+ break;
258
+ }
208
259
  }
209
- else {
210
- break;
260
+ else if (result instanceof ReturnValue) {
261
+ stack.clearTo(forBlock);
262
+ return result;
211
263
  }
212
- }
213
- else if (result instanceof ReturnValue) {
214
264
  stack.clearTo(forBlock);
215
- return result;
216
265
  }
217
- stack.clearTo(forBlock);
266
+ return void 0;
267
+ }
268
+ dependency(computed) {
269
+ return this.right.dependency(computed);
218
270
  }
219
- return void 0;
220
- }
221
- dependency(computed) {
222
- return this.right.dependency(computed);
223
- }
224
- dependencyPath(computed) {
225
- return this.right.dependencyPath(computed);
226
- }
227
- toString() {
228
- return `for (${this.left.toString()} in ${this.right.toString()}) ${this.body.toString()}`;
229
- }
230
- toJson() {
231
- return {
232
- left: this.left.toJSON(),
233
- right: this.right.toJSON(),
234
- body: this.body.toJSON(),
235
- };
236
- }
237
- };
238
- ForInNode = ForInNode_1 = __decorate([
239
- Deserializer('ForInStatement'),
240
- __metadata("design:paramtypes", [Object, Object, Object, Array, Object])
241
- ], ForInNode);
271
+ dependencyPath(computed) {
272
+ return this.right.dependencyPath(computed);
273
+ }
274
+ toString() {
275
+ return `for (${this.left.toString()} in ${this.right.toString()}) ${this.body.toString()}`;
276
+ }
277
+ toJson() {
278
+ return {
279
+ left: this.left.toJSON(),
280
+ right: this.right.toJSON(),
281
+ body: this.body.toJSON(),
282
+ };
283
+ }
284
+ };
285
+ return ForInNode = _classThis;
286
+ })();
242
287
  export { ForInNode };
243
- let ForAwaitOfNode = ForAwaitOfNode_1 = class ForAwaitOfNode extends AbstractExpressionNode {
244
- static fromJSON(node, deserializer) {
245
- return new ForAwaitOfNode_1(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
246
- }
247
- static visit(node, visitNode) {
248
- visitNode(node.left);
249
- visitNode(node.right);
250
- visitNode(node.body);
251
- }
252
- // variable of iterable
253
- constructor(left, right, body, range, loc) {
254
- super(range, loc);
255
- this.left = left;
256
- this.right = right;
257
- this.body = body;
258
- }
259
- getLeft() {
260
- return this.left;
261
- }
262
- getRight() {
263
- return this.right;
264
- }
265
- getBody() {
266
- return this.body;
267
- }
268
- set(stack, value) {
269
- throw new Error(`ForAwaitOfNode#set() has no implementation.`);
270
- }
271
- get(stack) {
272
- const iterable = this.right.get(stack);
273
- const forAwaitBody = (iterator) => {
274
- const forBlock = stack.pushBlockScope();
275
- this.left.declareVariable(stack, iterator);
276
- const result = this.body.get(stack);
277
- stack.clearTo(forBlock);
278
- return result;
279
- };
280
- stack.forAwaitAsyncIterable = { iterable, forAwaitBody };
281
- }
282
- dependency(computed) {
283
- return this.right.dependency(computed);
284
- }
285
- dependencyPath(computed) {
286
- return this.right.dependencyPath(computed);
287
- }
288
- toString() {
289
- return `for (${this.left?.toString()} of ${this.right.toString()}) ${this.body.toString()}`;
290
- }
291
- toJson() {
292
- return {
293
- left: this.left.toJSON(),
294
- right: this.right.toJSON(),
295
- body: this.body.toJSON(),
296
- };
297
- }
298
- };
299
- ForAwaitOfNode = ForAwaitOfNode_1 = __decorate([
300
- Deserializer('ForAwaitOfStatement'),
301
- __metadata("design:paramtypes", [Object, Object, Object, Array, Object])
302
- ], ForAwaitOfNode);
288
+ let ForAwaitOfNode = (() => {
289
+ let _classDecorators = [Deserializer('ForAwaitOfStatement')];
290
+ let _classDescriptor;
291
+ let _classExtraInitializers = [];
292
+ let _classThis;
293
+ let _classSuper = AbstractExpressionNode;
294
+ var ForAwaitOfNode = class extends _classSuper {
295
+ static { _classThis = this; }
296
+ static {
297
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
298
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
299
+ ForAwaitOfNode = _classThis = _classDescriptor.value;
300
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
301
+ __runInitializers(_classThis, _classExtraInitializers);
302
+ }
303
+ left;
304
+ right;
305
+ body;
306
+ static fromJSON(node, deserializer) {
307
+ return new ForAwaitOfNode(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
308
+ }
309
+ static visit(node, visitNode) {
310
+ visitNode(node.left);
311
+ visitNode(node.right);
312
+ visitNode(node.body);
313
+ }
314
+ // variable of iterable
315
+ constructor(left, right, body, range, loc) {
316
+ super(range, loc);
317
+ this.left = left;
318
+ this.right = right;
319
+ this.body = body;
320
+ }
321
+ getLeft() {
322
+ return this.left;
323
+ }
324
+ getRight() {
325
+ return this.right;
326
+ }
327
+ getBody() {
328
+ return this.body;
329
+ }
330
+ set(stack, value) {
331
+ throw new Error(`ForAwaitOfNode#set() has no implementation.`);
332
+ }
333
+ get(stack) {
334
+ const iterable = this.right.get(stack);
335
+ const forAwaitBody = (iterator) => {
336
+ const forBlock = stack.pushBlockScope();
337
+ this.left.declareVariable(stack, iterator);
338
+ const result = this.body.get(stack);
339
+ stack.clearTo(forBlock);
340
+ return result;
341
+ };
342
+ stack.forAwaitAsyncIterable = { iterable, forAwaitBody };
343
+ }
344
+ dependency(computed) {
345
+ return this.right.dependency(computed);
346
+ }
347
+ dependencyPath(computed) {
348
+ return this.right.dependencyPath(computed);
349
+ }
350
+ toString() {
351
+ return `for (${this.left?.toString()} of ${this.right.toString()}) ${this.body.toString()}`;
352
+ }
353
+ toJson() {
354
+ return {
355
+ left: this.left.toJSON(),
356
+ right: this.right.toJSON(),
357
+ body: this.body.toJSON(),
358
+ };
359
+ }
360
+ };
361
+ return ForAwaitOfNode = _classThis;
362
+ })();
303
363
  export { ForAwaitOfNode };
304
364
  //# sourceMappingURL=for.js.map