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