@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.
- package/README.md +48 -1
- package/api/abstract.d.ts +1 -0
- package/api/abstract.d.ts.map +1 -0
- package/api/abstract.js +12 -0
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +1 -0
- package/api/class/class.d.ts.map +1 -0
- package/api/class/class.js +603 -472
- package/api/class/class.js.map +1 -1
- package/api/class/decorator.d.ts +1 -0
- package/api/class/decorator.d.ts.map +1 -0
- package/api/class/decorator.js +53 -41
- package/api/class/decorator.js.map +1 -1
- package/api/computing/call.d.ts +1 -0
- package/api/computing/call.d.ts.map +1 -0
- package/api/computing/call.js +83 -69
- package/api/computing/call.js.map +1 -1
- package/api/computing/debugger.d.ts +1 -0
- package/api/computing/debugger.d.ts.map +1 -0
- package/api/computing/debugger.js +40 -28
- package/api/computing/debugger.js.map +1 -1
- package/api/computing/new.d.ts +1 -0
- package/api/computing/new.d.ts.map +1 -0
- package/api/computing/new.js +81 -68
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +1 -0
- package/api/computing/rest.d.ts.map +1 -0
- package/api/computing/rest.js +54 -42
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +1 -0
- package/api/computing/return.d.ts.map +1 -0
- package/api/computing/return.js +52 -40
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +1 -0
- package/api/computing/spread.d.ts.map +1 -0
- package/api/computing/spread.js +70 -58
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +1 -0
- package/api/computing/throw.d.ts.map +1 -0
- package/api/computing/throw.js +216 -175
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +1 -0
- package/api/computing/yield.d.ts.map +1 -0
- package/api/computing/yield.js +60 -47
- package/api/computing/yield.js.map +1 -1
- package/api/definition/array.d.ts +1 -0
- package/api/definition/array.d.ts.map +1 -0
- package/api/definition/array.js +147 -122
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +1 -0
- package/api/definition/bind.d.ts.map +1 -0
- package/api/definition/bind.js +85 -70
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +1 -0
- package/api/definition/comment.d.ts.map +1 -0
- package/api/definition/comment.js +44 -32
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +1 -0
- package/api/definition/function.d.ts.map +1 -0
- package/api/definition/function.js +500 -443
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +1 -0
- package/api/definition/member.d.ts.map +1 -0
- package/api/definition/member.js +104 -89
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +1 -0
- package/api/definition/object.d.ts.map +1 -0
- package/api/definition/object.js +243 -200
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +1 -0
- package/api/definition/statement.d.ts.map +1 -0
- package/api/definition/statement.js +56 -44
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +1 -0
- package/api/definition/values.d.ts.map +1 -0
- package/api/definition/values.js +228 -160
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +2 -1
- package/api/deserialize/deserialize.d.ts.map +1 -0
- package/api/deserialize/deserialize.js +5 -7
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +1 -0
- package/api/deserialize/type-store.d.ts.map +1 -0
- package/api/expression.d.ts +1 -0
- package/api/expression.d.ts.map +1 -0
- package/api/index.d.ts +1 -0
- package/api/index.d.ts.map +1 -0
- package/api/module/common.d.ts +1 -0
- package/api/module/common.d.ts.map +1 -0
- package/api/module/common.js +63 -50
- package/api/module/common.js.map +1 -1
- package/api/module/export.d.ts +1 -0
- package/api/module/export.d.ts.map +1 -0
- package/api/module/export.js +343 -290
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +1 -0
- package/api/module/import.d.ts.map +1 -0
- package/api/module/import.js +318 -253
- package/api/module/import.js.map +1 -1
- package/api/operators/assignment.d.ts +1 -0
- package/api/operators/assignment.d.ts.map +1 -0
- package/api/operators/assignment.js +88 -75
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +1 -0
- package/api/operators/await.d.ts.map +1 -0
- package/api/operators/await.js +54 -42
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +1 -0
- package/api/operators/binary.d.ts.map +1 -0
- package/api/operators/binary.js +78 -64
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +1 -0
- package/api/operators/chaining.d.ts.map +1 -0
- package/api/operators/chaining.js +56 -44
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +1 -0
- package/api/operators/comma.d.ts.map +1 -0
- package/api/operators/comma.js +53 -41
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +1 -0
- package/api/operators/grouping.d.ts.map +1 -0
- package/api/operators/grouping.js +51 -39
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +1 -0
- package/api/operators/logical.d.ts.map +1 -0
- package/api/operators/logical.js +51 -37
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +1 -0
- package/api/operators/pipeline.d.ts.map +1 -0
- package/api/operators/pipeline.js +95 -81
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +1 -0
- package/api/operators/ternary.d.ts.map +1 -0
- package/api/operators/ternary.js +69 -55
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/types.d.ts +1 -0
- package/api/operators/types.d.ts.map +1 -0
- package/api/operators/unary.d.ts +1 -0
- package/api/operators/unary.d.ts.map +1 -0
- package/api/operators/unary.js +97 -82
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +1 -0
- package/api/operators/update.d.ts.map +1 -0
- package/api/operators/update.js +78 -62
- package/api/operators/update.js.map +1 -1
- package/api/program.d.ts +1 -0
- package/api/program.d.ts.map +1 -0
- package/api/program.js +53 -40
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +1 -0
- package/api/statement/control/block.d.ts.map +1 -0
- package/api/statement/control/block.js +65 -53
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +1 -1
- package/api/statement/control/empty.d.ts.map +1 -0
- package/api/statement/control/empty.js +43 -33
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +1 -0
- package/api/statement/control/if.d.ts.map +1 -0
- package/api/statement/control/if.js +79 -65
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +1 -0
- package/api/statement/control/switch.d.ts.map +1 -0
- package/api/statement/control/switch.js +180 -141
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +1 -2
- package/api/statement/control/terminate.d.ts.map +1 -0
- package/api/statement/control/terminate.js +117 -78
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/control/with.d.ts +1 -0
- package/api/statement/control/with.d.ts.map +1 -0
- package/api/statement/control/with.js +72 -59
- package/api/statement/control/with.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +1 -0
- package/api/statement/declarations/declares.d.ts.map +1 -0
- package/api/statement/declarations/declares.js +148 -121
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +1 -0
- package/api/statement/iterations/for.d.ts.map +1 -0
- package/api/statement/iterations/for.js +337 -277
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +1 -0
- package/api/statement/iterations/while.d.ts.map +1 -0
- package/api/statement/iterations/while.js +152 -125
- package/api/statement/iterations/while.js.map +1 -1
- package/api/utils.d.ts +1 -0
- package/api/utils.d.ts.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/package.json +5 -5
- package/scope/builder.d.ts +27 -0
- package/scope/builder.d.ts.map +1 -0
- package/scope/builder.js +73 -0
- package/scope/builder.js.map +1 -0
- package/scope/event.d.ts +1 -0
- package/scope/event.d.ts.map +1 -0
- package/scope/finalizer.d.ts +1 -0
- package/scope/finalizer.d.ts.map +1 -0
- package/scope/index.d.ts +1 -0
- package/scope/index.d.ts.map +1 -0
- package/scope/pool.d.ts +1 -0
- package/scope/pool.d.ts.map +1 -0
- package/scope/proxy.d.ts +1 -0
- package/scope/proxy.d.ts.map +1 -0
- package/scope/proxy.js +1 -0
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +1 -0
- package/scope/scope.d.ts.map +1 -0
- package/scope/scope.js +17 -11
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +1 -0
- package/scope/stack.d.ts.map +1 -0
- package/scope/stack.js +22 -14
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +1 -0
- package/v8/enums.d.ts.map +1 -0
- package/v8/enums.js +11 -11
- package/v8/enums.js.map +1 -1
- package/v8/factory.d.ts +1 -0
- package/v8/factory.d.ts.map +1 -0
- package/v8/factory.js +3 -1
- package/v8/factory.js.map +1 -1
- package/v8/index.d.ts +1 -0
- package/v8/index.d.ts.map +1 -0
- package/v8/inline.d.ts +1 -0
- package/v8/inline.d.ts.map +1 -0
- package/v8/inline.js +9 -5
- package/v8/inline.js.map +1 -1
- package/v8/language.d.ts +1 -0
- package/v8/language.d.ts.map +1 -0
- package/v8/node.d.ts +1 -0
- package/v8/node.d.ts.map +1 -0
- package/v8/parser.d.ts +1 -0
- package/v8/parser.d.ts.map +1 -0
- package/v8/parser.js +5 -5
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +1 -0
- package/v8/stream.d.ts.map +1 -0
- package/v8/stream.js +17 -7
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +1 -0
- package/v8/token.d.ts.map +1 -0
- package/v8/token.js +363 -358
- package/v8/token.js.map +1 -1
- package/visit/index.d.ts +1 -0
- package/visit/index.d.ts.map +1 -0
- package/visit/visitor.d.ts +1 -0
- package/visit/visitor.d.ts.map +1 -0
- package/v8/nodes.d.ts +0 -0
- package/v8/nodes.js +0 -2
- package/v8/nodes.js.map +0 -1
|
@@ -1,491 +1,548 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __metadata } from "tslib";
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
3
2
|
import { AbstractExpressionNode, AwaitPromise, ReturnValue, YieldDelegateValue, YieldValue } from '../abstract.js';
|
|
4
3
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
5
|
-
import { Identifier } from './values.js';
|
|
6
4
|
import { TerminateReturnType } from '../statement/control/terminate.js';
|
|
7
5
|
import { RestElement } from '../computing/rest.js';
|
|
8
|
-
let AssignmentPattern =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
6
|
+
let AssignmentPattern = (() => {
|
|
7
|
+
let _classDecorators = [Deserializer('AssignmentPattern')];
|
|
8
|
+
let _classDescriptor;
|
|
9
|
+
let _classExtraInitializers = [];
|
|
10
|
+
let _classThis;
|
|
11
|
+
let _classSuper = AbstractExpressionNode;
|
|
12
|
+
var AssignmentPattern = class extends _classSuper {
|
|
13
|
+
static { _classThis = this; }
|
|
14
|
+
static {
|
|
15
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
16
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
17
|
+
AssignmentPattern = _classThis = _classDescriptor.value;
|
|
18
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
19
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
20
|
+
}
|
|
21
|
+
left;
|
|
22
|
+
right;
|
|
23
|
+
static fromJSON(node, deserializer) {
|
|
24
|
+
return new AssignmentPattern(deserializer(node.left), deserializer(node.right), node.range, node.loc);
|
|
25
|
+
}
|
|
26
|
+
static visit(node, visitNode) {
|
|
27
|
+
visitNode(node.left);
|
|
28
|
+
visitNode(node.right);
|
|
29
|
+
}
|
|
30
|
+
constructor(left, right, range, loc) {
|
|
31
|
+
super(range, loc);
|
|
32
|
+
this.left = left;
|
|
33
|
+
this.right = right;
|
|
34
|
+
}
|
|
35
|
+
getLeft() {
|
|
36
|
+
return this.left;
|
|
37
|
+
}
|
|
38
|
+
getRight() {
|
|
39
|
+
return this.right;
|
|
40
|
+
}
|
|
41
|
+
set(stack, value) {
|
|
42
|
+
throw new Error('AssignmentPattern#set() has no implementation.');
|
|
43
|
+
}
|
|
44
|
+
get(stack) {
|
|
45
|
+
throw new Error('AssignmentPattern#get() has no implementation.');
|
|
46
|
+
}
|
|
47
|
+
declareVariable(stack, value) {
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
value = this.right.get(stack);
|
|
50
|
+
}
|
|
51
|
+
this.left.declareVariable(stack, value);
|
|
52
|
+
}
|
|
53
|
+
dependency(computed) {
|
|
54
|
+
return [this.right];
|
|
55
|
+
}
|
|
56
|
+
dependencyPath(computed) {
|
|
57
|
+
return this.right.dependencyPath(computed) || [];
|
|
58
|
+
}
|
|
59
|
+
toString() {
|
|
60
|
+
return `${this.left.toString()} = ${this.right.toString()}`;
|
|
61
|
+
}
|
|
62
|
+
toJson() {
|
|
63
|
+
return {
|
|
64
|
+
left: this.left.toJSON(),
|
|
65
|
+
right: this.right.toJSON()
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return AssignmentPattern = _classThis;
|
|
70
|
+
})();
|
|
59
71
|
export { AssignmentPattern };
|
|
60
|
-
let FunctionExpression =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
72
|
+
let FunctionExpression = (() => {
|
|
73
|
+
let _classDecorators = [Deserializer('FunctionExpression')];
|
|
74
|
+
let _classDescriptor;
|
|
75
|
+
let _classExtraInitializers = [];
|
|
76
|
+
let _classThis;
|
|
77
|
+
let _classSuper = AbstractExpressionNode;
|
|
78
|
+
var FunctionExpression = class extends _classSuper {
|
|
79
|
+
static { _classThis = this; }
|
|
80
|
+
static {
|
|
81
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
82
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
83
|
+
FunctionExpression = _classThis = _classDescriptor.value;
|
|
84
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
85
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
86
|
+
}
|
|
87
|
+
params;
|
|
88
|
+
body;
|
|
89
|
+
async;
|
|
90
|
+
generator;
|
|
91
|
+
id;
|
|
92
|
+
static fromJSON(node, deserializer) {
|
|
93
|
+
return new FunctionExpression(node.params.map(deserializer), deserializer(node.body), node.async, node.generator, node.id ? deserializer(node.id) : void 0, node.range, node.loc);
|
|
94
|
+
}
|
|
95
|
+
static visit(node, visitNode) {
|
|
96
|
+
node.id && visitNode(node.id);
|
|
97
|
+
node.params.forEach(visitNode);
|
|
98
|
+
visitNode(node.body);
|
|
99
|
+
}
|
|
100
|
+
constructor(params, body, async, generator, id, range, loc) {
|
|
101
|
+
super(range, loc);
|
|
102
|
+
this.params = params;
|
|
103
|
+
this.body = body;
|
|
104
|
+
this.async = async;
|
|
105
|
+
this.generator = generator;
|
|
106
|
+
this.id = id;
|
|
107
|
+
}
|
|
108
|
+
getParams() {
|
|
109
|
+
return this.params;
|
|
110
|
+
}
|
|
111
|
+
getBody() {
|
|
112
|
+
return this.body;
|
|
113
|
+
}
|
|
114
|
+
getGenerator() {
|
|
115
|
+
return this.generator;
|
|
116
|
+
}
|
|
117
|
+
getId() {
|
|
118
|
+
return this.id;
|
|
119
|
+
}
|
|
120
|
+
getAsync() {
|
|
121
|
+
return this.async;
|
|
122
|
+
}
|
|
123
|
+
set(stack, value) {
|
|
124
|
+
throw new Error(`${this.constructor.name}#set() has no implementation.`);
|
|
125
|
+
}
|
|
126
|
+
defineFunctionArguments(stack, args) {
|
|
127
|
+
const rest = this.params[this.params.length - 1] instanceof RestElement;
|
|
128
|
+
const limit = rest ? this.params.length - 1 : this.params.length;
|
|
129
|
+
for (let i = 0; i < limit; i++) {
|
|
130
|
+
this.params[i].declareVariable(stack, args[i]);
|
|
131
|
+
}
|
|
132
|
+
if (rest) {
|
|
133
|
+
this.params[limit].declareVariable(stack, args.slice(limit));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
get(stack) {
|
|
137
|
+
// freeze scopes
|
|
138
|
+
stack = stack.copyStack();
|
|
139
|
+
let func;
|
|
140
|
+
if (this.async && this.generator) {
|
|
141
|
+
func = this.getAsyncGeneratorFunction(stack);
|
|
142
|
+
}
|
|
143
|
+
else if (this.async) {
|
|
144
|
+
func = this.getAsyncFunction(stack);
|
|
145
|
+
}
|
|
146
|
+
else if (this.generator) {
|
|
147
|
+
func = this.getGeneratorFunction(stack);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
func = this.getFunction(stack);
|
|
151
|
+
}
|
|
152
|
+
// this.id?.declareVariable(stack, func);
|
|
153
|
+
return func;
|
|
154
|
+
}
|
|
155
|
+
getAsyncFunction(gStack) {
|
|
156
|
+
const self = this;
|
|
157
|
+
return async function (...args) {
|
|
158
|
+
const stack = gStack.copyStack();
|
|
159
|
+
stack.pushBlockScope();
|
|
160
|
+
stack.declareVariable('this', this);
|
|
161
|
+
stack.declareVariable('super', this?.constructor?.prototype);
|
|
162
|
+
self.defineFunctionArguments(stack, args);
|
|
163
|
+
let returnValue;
|
|
164
|
+
const statements = self.body.getBody();
|
|
165
|
+
for (const statement of statements) {
|
|
166
|
+
returnValue = statement.get(stack);
|
|
167
|
+
if (stack.awaitPromise?.length > 0) {
|
|
168
|
+
for (const awaitRef of stack.awaitPromise) {
|
|
169
|
+
const awaitValue = await awaitRef.promise;
|
|
170
|
+
if (awaitRef.declareVariable) {
|
|
171
|
+
awaitRef.node.declareVariable(stack, awaitValue);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
awaitRef.node.set(stack, awaitValue);
|
|
175
|
+
}
|
|
144
176
|
}
|
|
177
|
+
stack.awaitPromise.splice(0);
|
|
145
178
|
}
|
|
146
|
-
stack.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
179
|
+
else if (stack.forAwaitAsyncIterable) {
|
|
180
|
+
for await (let iterator of stack.forAwaitAsyncIterable.iterable) {
|
|
181
|
+
const result = stack.forAwaitAsyncIterable.forAwaitBody(iterator);
|
|
182
|
+
if (result instanceof TerminateReturnType) {
|
|
183
|
+
if (result.type === 'continue') {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
154
189
|
}
|
|
155
|
-
else {
|
|
190
|
+
else if (result instanceof ReturnValue) {
|
|
191
|
+
returnValue = result;
|
|
156
192
|
break;
|
|
157
193
|
}
|
|
158
194
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
195
|
+
stack.forAwaitAsyncIterable = undefined;
|
|
196
|
+
}
|
|
197
|
+
if (returnValue instanceof ReturnValue) {
|
|
198
|
+
returnValue = returnValue.value;
|
|
199
|
+
if (returnValue instanceof AwaitPromise) {
|
|
200
|
+
returnValue = await returnValue.promise;
|
|
162
201
|
}
|
|
202
|
+
return returnValue;
|
|
163
203
|
}
|
|
164
|
-
stack.forAwaitAsyncIterable = undefined;
|
|
165
204
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
getGeneratorFunction(gStack) {
|
|
208
|
+
const self = this;
|
|
209
|
+
return function* (...args) {
|
|
210
|
+
const stack = gStack.copyStack();
|
|
211
|
+
stack.pushBlockScope();
|
|
212
|
+
stack.declareVariable('this', this);
|
|
213
|
+
stack.declareVariable('super', this?.constructor?.prototype);
|
|
214
|
+
self.defineFunctionArguments(stack, args);
|
|
215
|
+
let returnValue;
|
|
216
|
+
const statements = self.body.getBody();
|
|
217
|
+
for (const statement of statements) {
|
|
218
|
+
returnValue = statement.get(stack);
|
|
219
|
+
if (returnValue instanceof ReturnValue) {
|
|
220
|
+
return returnValue.value;
|
|
170
221
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
getGeneratorFunction(gStack) {
|
|
177
|
-
const self = this;
|
|
178
|
-
return function* (...args) {
|
|
179
|
-
const stack = gStack.copyStack();
|
|
180
|
-
stack.pushBlockScope();
|
|
181
|
-
stack.declareVariable('this', this);
|
|
182
|
-
stack.declareVariable('super', this?.constructor?.prototype);
|
|
183
|
-
self.defineFunctionArguments(stack, args);
|
|
184
|
-
let returnValue;
|
|
185
|
-
const statements = self.body.getBody();
|
|
186
|
-
for (const statement of statements) {
|
|
187
|
-
returnValue = statement.get(stack);
|
|
188
|
-
if (returnValue instanceof ReturnValue) {
|
|
189
|
-
return returnValue.value;
|
|
190
|
-
}
|
|
191
|
-
else if (returnValue instanceof YieldValue) {
|
|
192
|
-
yield returnValue.value;
|
|
193
|
-
}
|
|
194
|
-
else if (returnValue instanceof YieldDelegateValue) {
|
|
195
|
-
yield* returnValue.value;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
getAsyncGeneratorFunction(gStack) {
|
|
201
|
-
const self = this;
|
|
202
|
-
return async function* (...args) {
|
|
203
|
-
const stack = gStack.copyStack();
|
|
204
|
-
stack.pushBlockScope();
|
|
205
|
-
stack.declareVariable('this', this);
|
|
206
|
-
stack.declareVariable('super', this?.constructor?.prototype);
|
|
207
|
-
self.defineFunctionArguments(stack, args);
|
|
208
|
-
let returnValue;
|
|
209
|
-
const statements = self.body.getBody();
|
|
210
|
-
for (const statement of statements) {
|
|
211
|
-
returnValue = statement.get(stack);
|
|
212
|
-
if (stack.awaitPromise?.length > 0) {
|
|
213
|
-
for (const awaitRef of stack.awaitPromise) {
|
|
214
|
-
const awaitValue = await awaitRef.promise;
|
|
215
|
-
if (awaitRef.declareVariable) {
|
|
216
|
-
awaitRef.node.declareVariable(stack, awaitValue);
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
awaitRef.node.set(stack, awaitValue);
|
|
220
|
-
}
|
|
222
|
+
else if (returnValue instanceof YieldValue) {
|
|
223
|
+
yield returnValue.value;
|
|
224
|
+
}
|
|
225
|
+
else if (returnValue instanceof YieldDelegateValue) {
|
|
226
|
+
yield* returnValue.value;
|
|
221
227
|
}
|
|
222
|
-
stack.awaitPromise.splice(0);
|
|
223
228
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
getAsyncGeneratorFunction(gStack) {
|
|
232
|
+
const self = this;
|
|
233
|
+
return async function* (...args) {
|
|
234
|
+
const stack = gStack.copyStack();
|
|
235
|
+
stack.pushBlockScope();
|
|
236
|
+
stack.declareVariable('this', this);
|
|
237
|
+
stack.declareVariable('super', this?.constructor?.prototype);
|
|
238
|
+
self.defineFunctionArguments(stack, args);
|
|
239
|
+
let returnValue;
|
|
240
|
+
const statements = self.body.getBody();
|
|
241
|
+
for (const statement of statements) {
|
|
242
|
+
returnValue = statement.get(stack);
|
|
243
|
+
if (stack.awaitPromise?.length > 0) {
|
|
244
|
+
for (const awaitRef of stack.awaitPromise) {
|
|
245
|
+
const awaitValue = await awaitRef.promise;
|
|
246
|
+
if (awaitRef.declareVariable) {
|
|
247
|
+
awaitRef.node.declareVariable(stack, awaitValue);
|
|
230
248
|
}
|
|
231
249
|
else {
|
|
232
|
-
|
|
250
|
+
awaitRef.node.set(stack, awaitValue);
|
|
233
251
|
}
|
|
234
252
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
253
|
+
stack.awaitPromise.splice(0);
|
|
254
|
+
}
|
|
255
|
+
else if (stack.forAwaitAsyncIterable) {
|
|
256
|
+
for await (let iterator of stack.forAwaitAsyncIterable.iterable) {
|
|
257
|
+
const result = stack.forAwaitAsyncIterable.forAwaitBody(iterator);
|
|
258
|
+
if (result instanceof TerminateReturnType) {
|
|
259
|
+
if (result.type === 'continue') {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
242
265
|
}
|
|
243
|
-
else if (
|
|
244
|
-
|
|
266
|
+
else if (result instanceof ReturnValue) {
|
|
267
|
+
returnValue = returnValue.value;
|
|
268
|
+
if (returnValue instanceof AwaitPromise) {
|
|
269
|
+
return await returnValue.promise;
|
|
270
|
+
}
|
|
271
|
+
else if (returnValue instanceof YieldValue) {
|
|
272
|
+
yield returnValue.value;
|
|
273
|
+
}
|
|
274
|
+
else if (returnValue instanceof YieldDelegateValue) {
|
|
275
|
+
yield* returnValue.value;
|
|
276
|
+
}
|
|
277
|
+
return returnValue;
|
|
245
278
|
}
|
|
246
|
-
return returnValue;
|
|
247
279
|
}
|
|
280
|
+
stack.forAwaitAsyncIterable = undefined;
|
|
281
|
+
}
|
|
282
|
+
if (returnValue instanceof ReturnValue) {
|
|
283
|
+
returnValue = returnValue.value;
|
|
284
|
+
if (returnValue instanceof AwaitPromise) {
|
|
285
|
+
return await returnValue.promise;
|
|
286
|
+
}
|
|
287
|
+
return returnValue;
|
|
248
288
|
}
|
|
249
|
-
stack.forAwaitAsyncIterable = undefined;
|
|
250
289
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
getFunction(gStack) {
|
|
293
|
+
const self = this;
|
|
294
|
+
return function (...args) {
|
|
295
|
+
const stack = gStack.copyStack();
|
|
296
|
+
stack.pushBlockScope();
|
|
297
|
+
stack.declareVariable('this', this);
|
|
298
|
+
stack.declareVariable('super', this?.constructor?.prototype);
|
|
299
|
+
self.defineFunctionArguments(stack, args);
|
|
300
|
+
let returnValue;
|
|
301
|
+
const statements = self.body.getBody();
|
|
302
|
+
for (const statement of statements) {
|
|
303
|
+
returnValue = statement.get(stack);
|
|
304
|
+
if (returnValue instanceof ReturnValue) {
|
|
305
|
+
return returnValue.value;
|
|
255
306
|
}
|
|
256
|
-
return returnValue;
|
|
257
307
|
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
dependency(computed) {
|
|
311
|
+
return this.params.flatMap(param => param.dependency());
|
|
312
|
+
}
|
|
313
|
+
dependencyPath(computed) {
|
|
314
|
+
return this.params.flatMap(param => param.dependencyPath(computed));
|
|
315
|
+
}
|
|
316
|
+
toString() {
|
|
317
|
+
let declare = 'function ';
|
|
318
|
+
if (this.async && this.generator) {
|
|
319
|
+
declare = 'async function* ';
|
|
258
320
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const stack = gStack.copyStack();
|
|
265
|
-
stack.pushBlockScope();
|
|
266
|
-
stack.declareVariable('this', this);
|
|
267
|
-
stack.declareVariable('super', this?.constructor?.prototype);
|
|
268
|
-
self.defineFunctionArguments(stack, args);
|
|
269
|
-
let returnValue;
|
|
270
|
-
const statements = self.body.getBody();
|
|
271
|
-
for (const statement of statements) {
|
|
272
|
-
returnValue = statement.get(stack);
|
|
273
|
-
if (returnValue instanceof ReturnValue) {
|
|
274
|
-
return returnValue.value;
|
|
275
|
-
}
|
|
321
|
+
else if (this.async) {
|
|
322
|
+
declare = 'async function ';
|
|
323
|
+
}
|
|
324
|
+
else if (this.generator) {
|
|
325
|
+
declare = 'function* ';
|
|
276
326
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
declare = 'function* ';
|
|
295
|
-
}
|
|
296
|
-
return `${declare}${this.id?.toString() || ''}${this.paramsAndBodyToString()}`;
|
|
297
|
-
}
|
|
298
|
-
paramsAndBodyToString() {
|
|
299
|
-
return `(${this.params.map(param => param.toString()).join(', ')}) ${this.body.toString()}`;
|
|
300
|
-
}
|
|
301
|
-
toJson() {
|
|
302
|
-
return {
|
|
303
|
-
params: this.params.map(param => param.toJSON()),
|
|
304
|
-
body: this.body.toJSON(),
|
|
305
|
-
async: this.async,
|
|
306
|
-
id: this.id?.toJSON(),
|
|
307
|
-
generator: this.generator
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
FunctionExpression = FunctionExpression_1 = __decorate([
|
|
312
|
-
Deserializer('FunctionExpression'),
|
|
313
|
-
__metadata("design:paramtypes", [Array, Object, Boolean, Boolean, Identifier, Array, Object])
|
|
314
|
-
], FunctionExpression);
|
|
327
|
+
return `${declare}${this.id?.toString() || ''}${this.paramsAndBodyToString()}`;
|
|
328
|
+
}
|
|
329
|
+
paramsAndBodyToString() {
|
|
330
|
+
return `(${this.params.map(param => param.toString()).join(', ')}) ${this.body.toString()}`;
|
|
331
|
+
}
|
|
332
|
+
toJson() {
|
|
333
|
+
return {
|
|
334
|
+
params: this.params.map(param => param.toJSON()),
|
|
335
|
+
body: this.body.toJSON(),
|
|
336
|
+
async: this.async,
|
|
337
|
+
id: this.id?.toJSON(),
|
|
338
|
+
generator: this.generator
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
return FunctionExpression = _classThis;
|
|
343
|
+
})();
|
|
315
344
|
export { FunctionExpression };
|
|
316
|
-
let FunctionDeclaration =
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
345
|
+
let FunctionDeclaration = (() => {
|
|
346
|
+
let _classDecorators = [Deserializer('FunctionDeclaration')];
|
|
347
|
+
let _classDescriptor;
|
|
348
|
+
let _classExtraInitializers = [];
|
|
349
|
+
let _classThis;
|
|
350
|
+
let _classSuper = FunctionExpression;
|
|
351
|
+
var FunctionDeclaration = class extends _classSuper {
|
|
352
|
+
static { _classThis = this; }
|
|
353
|
+
static {
|
|
354
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
355
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
356
|
+
FunctionDeclaration = _classThis = _classDescriptor.value;
|
|
357
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
358
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
359
|
+
}
|
|
360
|
+
static fromJSON(node, deserializer) {
|
|
361
|
+
return new FunctionDeclaration(node.params.map(deserializer), deserializer(node.body), node.async, node.generator, deserializer(node.id), node.range, node.loc);
|
|
362
|
+
}
|
|
363
|
+
static visit(node, visitNode) {
|
|
364
|
+
visitNode(node.id);
|
|
365
|
+
node.params.forEach(visitNode);
|
|
366
|
+
visitNode(node.body);
|
|
367
|
+
}
|
|
368
|
+
constructor(params, body, async, generator, id, range, loc) {
|
|
369
|
+
super(params, body, async, generator, id, range, loc);
|
|
370
|
+
}
|
|
371
|
+
get(stack) {
|
|
372
|
+
const func = super.get(stack);
|
|
373
|
+
this.declareVariable(stack, func);
|
|
374
|
+
return func;
|
|
375
|
+
}
|
|
376
|
+
declareVariable(stack, value) {
|
|
377
|
+
this.id.declareVariable(stack, value);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
return FunctionDeclaration = _classThis;
|
|
381
|
+
})();
|
|
341
382
|
export { FunctionDeclaration };
|
|
342
|
-
let ArrowFunctionExpression =
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
?
|
|
352
|
-
:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
this.
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
this.params
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
this.
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
383
|
+
let ArrowFunctionExpression = (() => {
|
|
384
|
+
let _classDecorators = [Deserializer('ArrowFunctionExpression')];
|
|
385
|
+
let _classDescriptor;
|
|
386
|
+
let _classExtraInitializers = [];
|
|
387
|
+
let _classThis;
|
|
388
|
+
let _classSuper = AbstractExpressionNode;
|
|
389
|
+
var ArrowFunctionExpression = class extends _classSuper {
|
|
390
|
+
static { _classThis = this; }
|
|
391
|
+
static {
|
|
392
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
393
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
394
|
+
ArrowFunctionExpression = _classThis = _classDescriptor.value;
|
|
395
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
396
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
397
|
+
}
|
|
398
|
+
params;
|
|
399
|
+
body;
|
|
400
|
+
expression;
|
|
401
|
+
async;
|
|
402
|
+
static fromJSON(node, deserializer) {
|
|
403
|
+
return new ArrowFunctionExpression(node.params.map(deserializer), Array.isArray(node.body)
|
|
404
|
+
? node.body.map(deserializer)
|
|
405
|
+
: deserializer(node.body), node.expression, node.async, node.range, node.loc);
|
|
406
|
+
}
|
|
407
|
+
static visit(node, visitNode) {
|
|
408
|
+
node.params.forEach(visitNode);
|
|
409
|
+
Array.isArray(node.body)
|
|
410
|
+
? node.body.forEach(visitNode)
|
|
411
|
+
: visitNode(node.body);
|
|
412
|
+
}
|
|
413
|
+
generator = false;
|
|
414
|
+
constructor(params, body, expression, async, range, loc) {
|
|
415
|
+
super(range, loc);
|
|
416
|
+
this.params = params;
|
|
417
|
+
this.body = body;
|
|
418
|
+
this.expression = expression;
|
|
419
|
+
this.async = async;
|
|
420
|
+
}
|
|
421
|
+
getParams() {
|
|
422
|
+
return this.params;
|
|
423
|
+
}
|
|
424
|
+
getBody() {
|
|
425
|
+
return this.body;
|
|
426
|
+
}
|
|
427
|
+
getExpression() {
|
|
428
|
+
return this.expression;
|
|
429
|
+
}
|
|
430
|
+
set(stack, value) {
|
|
431
|
+
throw new Error('ArrowFunctionExpression#set() has no implementation.');
|
|
432
|
+
}
|
|
433
|
+
setParameter(stack, args) {
|
|
434
|
+
const rest = this.params[this.params.length - 1] instanceof RestElement;
|
|
435
|
+
const limit = rest ? this.params.length - 1 : this.params.length;
|
|
436
|
+
for (let i = 0; i < limit; i++) {
|
|
437
|
+
this.params[i].declareVariable(stack, args[i]);
|
|
438
|
+
}
|
|
439
|
+
if (rest) {
|
|
440
|
+
this.params[limit].declareVariable(stack, args.slice(limit));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
get(stack) {
|
|
444
|
+
// freeze stack
|
|
445
|
+
stack = stack.copyStack();
|
|
446
|
+
return this.async ? this.getAsyncArrowFunction(stack) : this.getArrowFunction(stack);
|
|
447
|
+
}
|
|
448
|
+
getAsyncArrowFunction(gStack) {
|
|
449
|
+
async (...args) => {
|
|
450
|
+
const stack = gStack.copyStack();
|
|
451
|
+
stack.pushBlockScope();
|
|
452
|
+
this.setParameter(stack, args);
|
|
453
|
+
let returnValue;
|
|
454
|
+
const statements = Array.isArray(this.body) ? this.body : [this.body];
|
|
455
|
+
for (const state of statements) {
|
|
456
|
+
returnValue = state.get(stack);
|
|
457
|
+
if (stack.awaitPromise?.length > 0) {
|
|
458
|
+
for (const awaitRef of stack.awaitPromise) {
|
|
459
|
+
const awaitValue = await awaitRef.promise;
|
|
460
|
+
if (awaitRef.declareVariable) {
|
|
461
|
+
awaitRef.node.declareVariable(stack, awaitValue);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
awaitRef.node.set(stack, awaitValue);
|
|
465
|
+
}
|
|
406
466
|
}
|
|
467
|
+
stack.awaitPromise.splice(0);
|
|
407
468
|
}
|
|
408
|
-
stack.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
469
|
+
else if (stack.forAwaitAsyncIterable) {
|
|
470
|
+
for await (let iterator of stack.forAwaitAsyncIterable.iterable) {
|
|
471
|
+
const result = stack.forAwaitAsyncIterable.forAwaitBody(iterator);
|
|
472
|
+
if (result instanceof TerminateReturnType) {
|
|
473
|
+
if (result.type === 'continue') {
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
416
479
|
}
|
|
417
|
-
else {
|
|
480
|
+
else if (result instanceof ReturnValue) {
|
|
481
|
+
returnValue = result;
|
|
418
482
|
break;
|
|
419
483
|
}
|
|
420
484
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
485
|
+
stack.forAwaitAsyncIterable = undefined;
|
|
486
|
+
}
|
|
487
|
+
if (returnValue instanceof ReturnValue) {
|
|
488
|
+
returnValue = returnValue.value;
|
|
489
|
+
if (returnValue instanceof AwaitPromise) {
|
|
490
|
+
return await returnValue.promise;
|
|
424
491
|
}
|
|
425
492
|
}
|
|
426
|
-
stack.forAwaitAsyncIterable = undefined;
|
|
427
493
|
}
|
|
428
|
-
if (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
494
|
+
if (this.expression) {
|
|
495
|
+
return returnValue;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
getArrowFunction(gStack) {
|
|
500
|
+
return (...args) => {
|
|
501
|
+
const stack = gStack.copyStack();
|
|
502
|
+
stack.pushBlockScope();
|
|
503
|
+
this.setParameter(stack, args);
|
|
504
|
+
let returnValue;
|
|
505
|
+
const statements = Array.isArray(this.body) ? this.body : [this.body];
|
|
506
|
+
for (const statement of statements) {
|
|
507
|
+
returnValue = statement.get(stack);
|
|
508
|
+
if (returnValue instanceof ReturnValue) {
|
|
509
|
+
return returnValue.value;
|
|
432
510
|
}
|
|
433
511
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
return returnValue;
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
getArrowFunction(gStack) {
|
|
441
|
-
return (...args) => {
|
|
442
|
-
const stack = gStack.copyStack();
|
|
443
|
-
stack.pushBlockScope();
|
|
444
|
-
this.setParameter(stack, args);
|
|
445
|
-
let returnValue;
|
|
446
|
-
const statements = Array.isArray(this.body) ? this.body : [this.body];
|
|
447
|
-
for (const statement of statements) {
|
|
448
|
-
returnValue = statement.get(stack);
|
|
449
|
-
if (returnValue instanceof ReturnValue) {
|
|
450
|
-
return returnValue.value;
|
|
512
|
+
if (this.expression) {
|
|
513
|
+
return returnValue;
|
|
451
514
|
}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
dependency(computed) {
|
|
518
|
+
return this.params.flatMap(param => param.dependency());
|
|
519
|
+
}
|
|
520
|
+
dependencyPath(computed) {
|
|
521
|
+
return this.params.flatMap(param => param.dependencyPath(computed));
|
|
522
|
+
}
|
|
523
|
+
toString() {
|
|
524
|
+
let str = this.async ? 'async ' : '';
|
|
525
|
+
if (this.params.length === 1) {
|
|
526
|
+
str += this.params[0].toString();
|
|
452
527
|
}
|
|
453
|
-
|
|
454
|
-
|
|
528
|
+
else {
|
|
529
|
+
str += `(${this.params.map(param => param.toString()).join(', ')})`;
|
|
455
530
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
str += ' => ';
|
|
473
|
-
str += this.body.toString();
|
|
474
|
-
return str;
|
|
475
|
-
}
|
|
476
|
-
toJson() {
|
|
477
|
-
return {
|
|
478
|
-
params: this.params.map(param => param.toJSON()),
|
|
479
|
-
body: Array.isArray(this.body) ? this.body.map(item => item.toJSON()) : this.body.toJSON(),
|
|
480
|
-
expression: true,
|
|
481
|
-
async: this.async,
|
|
482
|
-
generator: this.generator
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
ArrowFunctionExpression = ArrowFunctionExpression_1 = __decorate([
|
|
487
|
-
Deserializer('ArrowFunctionExpression'),
|
|
488
|
-
__metadata("design:paramtypes", [Array, Object, Boolean, Boolean, Array, Object])
|
|
489
|
-
], ArrowFunctionExpression);
|
|
531
|
+
str += ' => ';
|
|
532
|
+
str += this.body.toString();
|
|
533
|
+
return str;
|
|
534
|
+
}
|
|
535
|
+
toJson() {
|
|
536
|
+
return {
|
|
537
|
+
params: this.params.map(param => param.toJSON()),
|
|
538
|
+
body: Array.isArray(this.body) ? this.body.map(item => item.toJSON()) : this.body.toJSON(),
|
|
539
|
+
expression: true,
|
|
540
|
+
async: this.async,
|
|
541
|
+
generator: this.generator
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
return ArrowFunctionExpression = _classThis;
|
|
546
|
+
})();
|
|
490
547
|
export { ArrowFunctionExpression };
|
|
491
548
|
//# sourceMappingURL=function.js.map
|