@ibyar/expressions 0.8.5 → 1.0.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 (243) hide show
  1. package/api/abstract.d.ts +1 -0
  2. package/api/abstract.d.ts.map +1 -0
  3. package/api/abstract.js +12 -0
  4. package/api/abstract.js.map +1 -1
  5. package/api/class/class.d.ts +1 -0
  6. package/api/class/class.d.ts.map +1 -0
  7. package/api/class/class.js +563 -482
  8. package/api/class/class.js.map +1 -1
  9. package/api/class/decorator.d.ts +1 -0
  10. package/api/class/decorator.d.ts.map +1 -0
  11. package/api/class/decorator.js +49 -42
  12. package/api/class/decorator.js.map +1 -1
  13. package/api/computing/call.d.ts +1 -0
  14. package/api/computing/call.d.ts.map +1 -0
  15. package/api/computing/call.js +79 -70
  16. package/api/computing/call.js.map +1 -1
  17. package/api/computing/debugger.d.ts +1 -0
  18. package/api/computing/debugger.d.ts.map +1 -0
  19. package/api/computing/debugger.js +36 -29
  20. package/api/computing/debugger.js.map +1 -1
  21. package/api/computing/new.d.ts +1 -0
  22. package/api/computing/new.d.ts.map +1 -0
  23. package/api/computing/new.js +77 -69
  24. package/api/computing/new.js.map +1 -1
  25. package/api/computing/rest.d.ts +1 -0
  26. package/api/computing/rest.d.ts.map +1 -0
  27. package/api/computing/rest.js +50 -43
  28. package/api/computing/rest.js.map +1 -1
  29. package/api/computing/return.d.ts +1 -0
  30. package/api/computing/return.d.ts.map +1 -0
  31. package/api/computing/return.js +48 -41
  32. package/api/computing/return.js.map +1 -1
  33. package/api/computing/spread.d.ts +1 -0
  34. package/api/computing/spread.d.ts.map +1 -0
  35. package/api/computing/spread.js +66 -59
  36. package/api/computing/spread.js.map +1 -1
  37. package/api/computing/throw.d.ts +1 -0
  38. package/api/computing/throw.d.ts.map +1 -0
  39. package/api/computing/throw.js +204 -178
  40. package/api/computing/throw.js.map +1 -1
  41. package/api/computing/yield.d.ts +1 -0
  42. package/api/computing/yield.d.ts.map +1 -0
  43. package/api/computing/yield.js +56 -48
  44. package/api/computing/yield.js.map +1 -1
  45. package/api/definition/array.d.ts +1 -0
  46. package/api/definition/array.d.ts.map +1 -0
  47. package/api/definition/array.js +139 -124
  48. package/api/definition/array.js.map +1 -1
  49. package/api/definition/bind.d.ts +1 -0
  50. package/api/definition/bind.d.ts.map +1 -0
  51. package/api/definition/bind.js +81 -71
  52. package/api/definition/bind.js.map +1 -1
  53. package/api/definition/comment.d.ts +1 -0
  54. package/api/definition/comment.d.ts.map +1 -0
  55. package/api/definition/comment.js +40 -33
  56. package/api/definition/comment.js.map +1 -1
  57. package/api/definition/function.d.ts +1 -0
  58. package/api/definition/function.d.ts.map +1 -0
  59. package/api/definition/function.js +484 -447
  60. package/api/definition/function.js.map +1 -1
  61. package/api/definition/member.d.ts +1 -0
  62. package/api/definition/member.d.ts.map +1 -0
  63. package/api/definition/member.js +100 -90
  64. package/api/definition/member.js.map +1 -1
  65. package/api/definition/object.d.ts +1 -0
  66. package/api/definition/object.d.ts.map +1 -0
  67. package/api/definition/object.js +230 -202
  68. package/api/definition/object.js.map +1 -1
  69. package/api/definition/statement.d.ts +1 -0
  70. package/api/definition/statement.d.ts.map +1 -0
  71. package/api/definition/statement.js +52 -45
  72. package/api/definition/statement.js.map +1 -1
  73. package/api/definition/values.d.ts +1 -0
  74. package/api/definition/values.d.ts.map +1 -0
  75. package/api/definition/values.js +210 -167
  76. package/api/definition/values.js.map +1 -1
  77. package/api/deserialize/deserialize.d.ts +2 -1
  78. package/api/deserialize/deserialize.d.ts.map +1 -0
  79. package/api/deserialize/deserialize.js +5 -7
  80. package/api/deserialize/deserialize.js.map +1 -1
  81. package/api/deserialize/type-store.d.ts +1 -0
  82. package/api/deserialize/type-store.d.ts.map +1 -0
  83. package/api/expression.d.ts +1 -0
  84. package/api/expression.d.ts.map +1 -0
  85. package/api/index.d.ts +1 -0
  86. package/api/index.d.ts.map +1 -0
  87. package/api/module/common.d.ts +1 -0
  88. package/api/module/common.d.ts.map +1 -0
  89. package/api/module/common.js +59 -51
  90. package/api/module/common.js.map +1 -1
  91. package/api/module/export.d.ts +1 -0
  92. package/api/module/export.d.ts.map +1 -0
  93. package/api/module/export.js +327 -294
  94. package/api/module/export.js.map +1 -1
  95. package/api/module/import.d.ts +1 -0
  96. package/api/module/import.d.ts.map +1 -0
  97. package/api/module/import.js +298 -258
  98. package/api/module/import.js.map +1 -1
  99. package/api/operators/assignment.d.ts +1 -0
  100. package/api/operators/assignment.d.ts.map +1 -0
  101. package/api/operators/assignment.js +84 -75
  102. package/api/operators/assignment.js.map +1 -1
  103. package/api/operators/await.d.ts +1 -0
  104. package/api/operators/await.d.ts.map +1 -0
  105. package/api/operators/await.js +50 -43
  106. package/api/operators/await.js.map +1 -1
  107. package/api/operators/binary.d.ts +1 -0
  108. package/api/operators/binary.d.ts.map +1 -0
  109. package/api/operators/binary.js +74 -64
  110. package/api/operators/binary.js.map +1 -1
  111. package/api/operators/chaining.d.ts +1 -0
  112. package/api/operators/chaining.d.ts.map +1 -0
  113. package/api/operators/chaining.js +52 -45
  114. package/api/operators/chaining.js.map +1 -1
  115. package/api/operators/comma.d.ts +1 -0
  116. package/api/operators/comma.d.ts.map +1 -0
  117. package/api/operators/comma.js +49 -42
  118. package/api/operators/comma.js.map +1 -1
  119. package/api/operators/grouping.d.ts +1 -0
  120. package/api/operators/grouping.d.ts.map +1 -0
  121. package/api/operators/grouping.js +47 -40
  122. package/api/operators/grouping.js.map +1 -1
  123. package/api/operators/logical.d.ts +1 -0
  124. package/api/operators/logical.d.ts.map +1 -0
  125. package/api/operators/logical.js +47 -37
  126. package/api/operators/logical.js.map +1 -1
  127. package/api/operators/pipeline.d.ts +1 -0
  128. package/api/operators/pipeline.d.ts.map +1 -0
  129. package/api/operators/pipeline.js +91 -82
  130. package/api/operators/pipeline.js.map +1 -1
  131. package/api/operators/ternary.d.ts +1 -0
  132. package/api/operators/ternary.d.ts.map +1 -0
  133. package/api/operators/ternary.js +65 -56
  134. package/api/operators/ternary.js.map +1 -1
  135. package/api/operators/types.d.ts +1 -0
  136. package/api/operators/types.d.ts.map +1 -0
  137. package/api/operators/unary.d.ts +1 -0
  138. package/api/operators/unary.d.ts.map +1 -0
  139. package/api/operators/unary.js +93 -82
  140. package/api/operators/unary.js.map +1 -1
  141. package/api/operators/update.d.ts +1 -0
  142. package/api/operators/update.d.ts.map +1 -0
  143. package/api/operators/update.js +74 -62
  144. package/api/operators/update.js.map +1 -1
  145. package/api/program.d.ts +1 -0
  146. package/api/program.d.ts.map +1 -0
  147. package/api/program.js +49 -41
  148. package/api/program.js.map +1 -1
  149. package/api/statement/control/block.d.ts +1 -0
  150. package/api/statement/control/block.d.ts.map +1 -0
  151. package/api/statement/control/block.js +61 -54
  152. package/api/statement/control/block.js.map +1 -1
  153. package/api/statement/control/empty.d.ts +1 -1
  154. package/api/statement/control/empty.d.ts.map +1 -0
  155. package/api/statement/control/empty.js +39 -34
  156. package/api/statement/control/empty.js.map +1 -1
  157. package/api/statement/control/if.d.ts +1 -0
  158. package/api/statement/control/if.d.ts.map +1 -0
  159. package/api/statement/control/if.js +75 -66
  160. package/api/statement/control/if.js.map +1 -1
  161. package/api/statement/control/switch.d.ts +1 -0
  162. package/api/statement/control/switch.d.ts.map +1 -0
  163. package/api/statement/control/switch.js +168 -144
  164. package/api/statement/control/switch.js.map +1 -1
  165. package/api/statement/control/terminate.d.ts +1 -2
  166. package/api/statement/control/terminate.d.ts.map +1 -0
  167. package/api/statement/control/terminate.js +105 -81
  168. package/api/statement/control/terminate.js.map +1 -1
  169. package/api/statement/control/with.d.ts +1 -0
  170. package/api/statement/control/with.d.ts.map +1 -0
  171. package/api/statement/control/with.js +68 -60
  172. package/api/statement/control/with.js.map +1 -1
  173. package/api/statement/declarations/declares.d.ts +1 -0
  174. package/api/statement/declarations/declares.d.ts.map +1 -0
  175. package/api/statement/declarations/declares.js +140 -123
  176. package/api/statement/declarations/declares.js.map +1 -1
  177. package/api/statement/iterations/for.d.ts +1 -0
  178. package/api/statement/iterations/for.d.ts.map +1 -0
  179. package/api/statement/iterations/for.js +320 -280
  180. package/api/statement/iterations/for.js.map +1 -1
  181. package/api/statement/iterations/while.d.ts +1 -0
  182. package/api/statement/iterations/while.d.ts.map +1 -0
  183. package/api/statement/iterations/while.js +144 -127
  184. package/api/statement/iterations/while.js.map +1 -1
  185. package/api/utils.d.ts +1 -0
  186. package/api/utils.d.ts.map +1 -0
  187. package/index.d.ts +1 -0
  188. package/index.d.ts.map +1 -0
  189. package/package.json +5 -5
  190. package/scope/event.d.ts +1 -0
  191. package/scope/event.d.ts.map +1 -0
  192. package/scope/finalizer.d.ts +1 -0
  193. package/scope/finalizer.d.ts.map +1 -0
  194. package/scope/index.d.ts +1 -0
  195. package/scope/index.d.ts.map +1 -0
  196. package/scope/pool.d.ts +1 -0
  197. package/scope/pool.d.ts.map +1 -0
  198. package/scope/proxy.d.ts +1 -0
  199. package/scope/proxy.d.ts.map +1 -0
  200. package/scope/proxy.js +1 -0
  201. package/scope/proxy.js.map +1 -1
  202. package/scope/scope.d.ts +1 -0
  203. package/scope/scope.d.ts.map +1 -0
  204. package/scope/scope.js +17 -11
  205. package/scope/scope.js.map +1 -1
  206. package/scope/stack.d.ts +1 -0
  207. package/scope/stack.d.ts.map +1 -0
  208. package/scope/stack.js +21 -13
  209. package/scope/stack.js.map +1 -1
  210. package/v8/enums.d.ts +1 -0
  211. package/v8/enums.d.ts.map +1 -0
  212. package/v8/enums.js +15 -13
  213. package/v8/enums.js.map +1 -1
  214. package/v8/factory.d.ts +1 -0
  215. package/v8/factory.d.ts.map +1 -0
  216. package/v8/factory.js +6 -4
  217. package/v8/factory.js.map +1 -1
  218. package/v8/index.d.ts +1 -0
  219. package/v8/index.d.ts.map +1 -0
  220. package/v8/inline.d.ts +1 -0
  221. package/v8/inline.d.ts.map +1 -0
  222. package/v8/inline.js +10 -6
  223. package/v8/inline.js.map +1 -1
  224. package/v8/language.d.ts +1 -0
  225. package/v8/language.d.ts.map +1 -0
  226. package/v8/node.d.ts +1 -0
  227. package/v8/node.d.ts.map +1 -0
  228. package/v8/parser.d.ts +1 -0
  229. package/v8/parser.d.ts.map +1 -0
  230. package/v8/parser.js +5 -5
  231. package/v8/parser.js.map +1 -1
  232. package/v8/stream.d.ts +1 -0
  233. package/v8/stream.d.ts.map +1 -0
  234. package/v8/stream.js +19 -8
  235. package/v8/stream.js.map +1 -1
  236. package/v8/token.d.ts +1 -0
  237. package/v8/token.d.ts.map +1 -0
  238. package/v8/token.js +365 -359
  239. package/v8/token.js.map +1 -1
  240. package/visit/index.d.ts +1 -0
  241. package/visit/index.d.ts.map +1 -0
  242. package/visit/visitor.d.ts +1 -0
  243. package/visit/visitor.d.ts.map +1 -0
@@ -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,338 @@ 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
+ export let ForNode = (() => {
11
+ let _classDecorators = [Deserializer('ForStatement')];
12
+ let _classDescriptor;
13
+ let _classExtraInitializers = [];
14
+ let _classThis;
15
+ var ForNode = class extends AbstractExpressionNode {
16
+ static {
17
+ __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers);
18
+ ForNode = _classThis = _classDescriptor.value;
19
+ __runInitializers(_classThis, _classExtraInitializers);
20
+ }
21
+ body;
22
+ init;
23
+ test;
24
+ update;
25
+ static fromJSON(node, deserializer) {
26
+ 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);
27
+ }
28
+ static visit(node, visitNode) {
29
+ visitNode(node.body);
30
+ node.init && visitNode(node.init);
31
+ node.test && visitNode(node.test);
32
+ node.update && visitNode(node.update);
33
+ }
34
+ constructor(body, init, test, update, range, loc) {
35
+ super(range, loc);
36
+ this.body = body;
37
+ this.init = init;
38
+ this.test = test;
39
+ this.update = update;
40
+ }
41
+ getBody() {
42
+ return this.body;
43
+ }
44
+ getInit() {
45
+ return this.init;
46
+ }
47
+ getTest() {
48
+ return this.test;
49
+ }
50
+ getUpdate() {
51
+ return this.update;
52
+ }
53
+ set(stack, value) {
54
+ throw new Error(`ForNode#set() has no implementation.`);
55
+ }
56
+ get(stack) {
57
+ const forBlock = stack.pushBlockScope();
58
+ for (this.init?.get(stack); this.test?.get(stack) ?? true; this.update?.get(stack)) {
59
+ const result = this.body.get(stack);
60
+ // useless case, as it at the end of for statement
61
+ // an array/block statement, should return last signal
62
+ if (result instanceof TerminateReturnType) {
63
+ if (result.type === 'continue') {
64
+ continue;
65
+ }
66
+ else {
67
+ break;
68
+ }
52
69
  }
53
- else {
54
- break;
70
+ if (result instanceof ReturnValue) {
71
+ stack.clearTo(forBlock);
72
+ return result;
55
73
  }
56
74
  }
57
- if (result instanceof ReturnValue) {
58
- stack.clearTo(forBlock);
59
- return result;
60
- }
75
+ stack.clearTo(forBlock);
76
+ return void 0;
61
77
  }
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);
95
- 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;
78
+ dependency(computed) {
79
+ let dependency = this.body.dependency(computed);
80
+ this.init && (dependency = dependency.concat(this.init.dependency(computed)));
81
+ this.test && (dependency = dependency.concat(this.test.dependency(computed)));
82
+ this.update && (dependency = dependency.concat(this.update.dependency(computed)));
83
+ return dependency;
84
+ }
85
+ dependencyPath(computed) {
86
+ let dependencyPath = this.body.dependencyPath(computed);
87
+ this.init && (dependencyPath = dependencyPath.concat(this.init.dependencyPath(computed)));
88
+ this.test && (dependencyPath = dependencyPath.concat(this.test.dependencyPath(computed)));
89
+ this.update && (dependencyPath = dependencyPath.concat(this.update.dependencyPath(computed)));
90
+ return dependencyPath;
91
+ }
92
+ toString() {
93
+ return `for (${this.init?.toString()};${this.test?.toString()};${this.init?.toString()}) ${this.body.toString()}`;
94
+ }
95
+ toJson() {
96
+ return {
97
+ body: this.body.toJSON(),
98
+ init: this.init?.toJSON(),
99
+ test: this.test?.toJSON(),
100
+ update: this.update?.toJSON(),
101
+ };
102
+ }
103
+ };
104
+ return ForNode = _classThis;
105
+ })();
106
+ export let ForOfNode = (() => {
107
+ let _classDecorators_1 = [Deserializer('ForOfStatement')];
108
+ let _classDescriptor_1;
109
+ let _classExtraInitializers_1 = [];
110
+ let _classThis_1;
111
+ var ForOfNode = class extends AbstractExpressionNode {
112
+ static {
113
+ __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1);
114
+ ForOfNode = _classThis_1 = _classDescriptor_1.value;
115
+ __runInitializers(_classThis_1, _classExtraInitializers_1);
116
+ }
117
+ left;
118
+ right;
119
+ body;
120
+ static fromJSON(node, deserializer) {
121
+ return new ForOfNode(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
122
+ }
123
+ static visit(node, visitNode) {
124
+ visitNode(node.left);
125
+ visitNode(node.right);
126
+ visitNode(node.body);
127
+ }
128
+ constructor(left, right, body, range, loc) {
129
+ super(range, loc);
130
+ this.left = left;
131
+ this.right = right;
132
+ this.body = body;
133
+ }
134
+ getLeft() {
135
+ return this.left;
136
+ }
137
+ getRight() {
138
+ return this.right;
139
+ }
140
+ getBody() {
141
+ return this.body;
142
+ }
143
+ set(stack, value) {
144
+ throw new Error(`ForOfNode#set() has no implementation.`);
145
+ }
146
+ get(stack) {
147
+ const iterable = this.right.get(stack);
148
+ for (const iterator of iterable) {
149
+ const forBlock = stack.pushBlockScope();
150
+ this.left.declareVariable(stack, iterator);
151
+ const result = this.body.get(stack);
152
+ // useless case, as it at the end of for statement
153
+ // an array/block statement, should return last signal
154
+ if (result instanceof TerminateReturnType) {
155
+ if (result.type === 'continue') {
156
+ continue;
157
+ }
158
+ else {
159
+ break;
160
+ }
134
161
  }
135
- else {
136
- break;
162
+ else if (result instanceof ReturnValue) {
163
+ stack.clearTo(forBlock);
164
+ return result;
137
165
  }
138
- }
139
- else if (result instanceof ReturnValue) {
140
166
  stack.clearTo(forBlock);
141
- return result;
142
167
  }
143
- stack.clearTo(forBlock);
168
+ return void 0;
144
169
  }
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);
168
- 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;
170
+ dependency(computed) {
171
+ return this.right.dependency(computed);
172
+ }
173
+ dependencyPath(computed) {
174
+ return this.right.dependencyPath(computed);
175
+ }
176
+ toString() {
177
+ return `for (${this.left?.toString()} of ${this.right.toString()}) ${this.body.toString()}`;
178
+ }
179
+ toJson() {
180
+ return {
181
+ left: this.left.toJSON(),
182
+ right: this.right.toJSON(),
183
+ body: this.body.toJSON(),
184
+ };
185
+ }
186
+ };
187
+ return ForOfNode = _classThis_1;
188
+ })();
189
+ export let ForInNode = (() => {
190
+ let _classDecorators_2 = [Deserializer('ForInStatement')];
191
+ let _classDescriptor_2;
192
+ let _classExtraInitializers_2 = [];
193
+ let _classThis_2;
194
+ var ForInNode = class extends AbstractExpressionNode {
195
+ static {
196
+ __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2);
197
+ ForInNode = _classThis_2 = _classDescriptor_2.value;
198
+ __runInitializers(_classThis_2, _classExtraInitializers_2);
199
+ }
200
+ left;
201
+ right;
202
+ body;
203
+ static fromJSON(node, deserializer) {
204
+ return new ForInNode(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
205
+ }
206
+ static visit(node, visitNode) {
207
+ visitNode(node.left);
208
+ visitNode(node.right);
209
+ visitNode(node.body);
210
+ }
211
+ // variable of iterable
212
+ constructor(left, right, body, range, loc) {
213
+ super(range, loc);
214
+ this.left = left;
215
+ this.right = right;
216
+ this.body = body;
217
+ }
218
+ getLeft() {
219
+ return this.left;
220
+ }
221
+ getRight() {
222
+ return this.right;
223
+ }
224
+ getBody() {
225
+ return this.body;
226
+ }
227
+ set(stack, value) {
228
+ throw new Error(`ForOfNode#set() has no implementation.`);
229
+ }
230
+ get(stack) {
231
+ const iterable = this.right.get(stack);
232
+ for (const iterator in iterable) {
233
+ const forBlock = stack.pushBlockScope();
234
+ this.left.declareVariable(stack, iterator);
235
+ const result = this.body.get(stack);
236
+ // useless case, as it at the end of for statement
237
+ // an array/block statement, should return last signal
238
+ if (result instanceof TerminateReturnType) {
239
+ if (result.type === 'continue') {
240
+ continue;
241
+ }
242
+ else {
243
+ break;
244
+ }
208
245
  }
209
- else {
210
- break;
246
+ else if (result instanceof ReturnValue) {
247
+ stack.clearTo(forBlock);
248
+ return result;
211
249
  }
250
+ stack.clearTo(forBlock);
212
251
  }
213
- else if (result instanceof ReturnValue) {
252
+ return void 0;
253
+ }
254
+ dependency(computed) {
255
+ return this.right.dependency(computed);
256
+ }
257
+ dependencyPath(computed) {
258
+ return this.right.dependencyPath(computed);
259
+ }
260
+ toString() {
261
+ return `for (${this.left.toString()} in ${this.right.toString()}) ${this.body.toString()}`;
262
+ }
263
+ toJson() {
264
+ return {
265
+ left: this.left.toJSON(),
266
+ right: this.right.toJSON(),
267
+ body: this.body.toJSON(),
268
+ };
269
+ }
270
+ };
271
+ return ForInNode = _classThis_2;
272
+ })();
273
+ export let ForAwaitOfNode = (() => {
274
+ let _classDecorators_3 = [Deserializer('ForAwaitOfStatement')];
275
+ let _classDescriptor_3;
276
+ let _classExtraInitializers_3 = [];
277
+ let _classThis_3;
278
+ var ForAwaitOfNode = class extends AbstractExpressionNode {
279
+ static {
280
+ __esDecorate(null, _classDescriptor_3 = { value: this }, _classDecorators_3, { kind: "class", name: this.name }, null, _classExtraInitializers_3);
281
+ ForAwaitOfNode = _classThis_3 = _classDescriptor_3.value;
282
+ __runInitializers(_classThis_3, _classExtraInitializers_3);
283
+ }
284
+ left;
285
+ right;
286
+ body;
287
+ static fromJSON(node, deserializer) {
288
+ return new ForAwaitOfNode(deserializer(node.left), deserializer(node.right), deserializer(node.body), node.range, node.loc);
289
+ }
290
+ static visit(node, visitNode) {
291
+ visitNode(node.left);
292
+ visitNode(node.right);
293
+ visitNode(node.body);
294
+ }
295
+ // variable of iterable
296
+ constructor(left, right, body, range, loc) {
297
+ super(range, loc);
298
+ this.left = left;
299
+ this.right = right;
300
+ this.body = body;
301
+ }
302
+ getLeft() {
303
+ return this.left;
304
+ }
305
+ getRight() {
306
+ return this.right;
307
+ }
308
+ getBody() {
309
+ return this.body;
310
+ }
311
+ set(stack, value) {
312
+ throw new Error(`ForAwaitOfNode#set() has no implementation.`);
313
+ }
314
+ get(stack) {
315
+ const iterable = this.right.get(stack);
316
+ const forAwaitBody = (iterator) => {
317
+ const forBlock = stack.pushBlockScope();
318
+ this.left.declareVariable(stack, iterator);
319
+ const result = this.body.get(stack);
214
320
  stack.clearTo(forBlock);
215
321
  return result;
216
- }
217
- stack.clearTo(forBlock);
322
+ };
323
+ stack.forAwaitAsyncIterable = { iterable, forAwaitBody };
218
324
  }
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);
242
- 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);
303
- export { ForAwaitOfNode };
325
+ dependency(computed) {
326
+ return this.right.dependency(computed);
327
+ }
328
+ dependencyPath(computed) {
329
+ return this.right.dependencyPath(computed);
330
+ }
331
+ toString() {
332
+ return `for (${this.left?.toString()} of ${this.right.toString()}) ${this.body.toString()}`;
333
+ }
334
+ toJson() {
335
+ return {
336
+ left: this.left.toJSON(),
337
+ right: this.right.toJSON(),
338
+ body: this.body.toJSON(),
339
+ };
340
+ }
341
+ };
342
+ return ForAwaitOfNode = _classThis_3;
343
+ })();
304
344
  //# sourceMappingURL=for.js.map