@ibyar/expressions 0.3.8 → 0.5.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 +22 -12
- package/api/abstract.d.ts +20 -4
- package/api/abstract.js +54 -3
- package/api/abstract.js.map +1 -1
- package/api/app/class.d.ts +21 -11
- package/api/app/class.js +28 -10
- package/api/app/class.js.map +1 -1
- package/api/app/program.d.ts +6 -3
- package/api/app/program.js +7 -3
- package/api/app/program.js.map +1 -1
- package/api/computing/call.d.ts +5 -2
- package/api/computing/call.js +8 -2
- package/api/computing/call.js.map +1 -1
- package/api/computing/new.d.ts +5 -2
- package/api/computing/new.js +10 -2
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +5 -2
- package/api/computing/rest.js +8 -2
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +5 -2
- package/api/computing/return.js +8 -2
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +5 -2
- package/api/computing/spread.js +8 -2
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +11 -4
- package/api/computing/throw.js +23 -6
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +18 -0
- package/api/computing/yield.js +51 -0
- package/api/computing/yield.js.map +1 -0
- package/api/definition/array.d.ts +10 -3
- package/api/definition/array.js +20 -4
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +5 -2
- package/api/definition/bind.js +10 -9
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +5 -1
- package/api/definition/comment.js +6 -4
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +26 -10
- package/api/definition/function.js +123 -54
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +5 -2
- package/api/definition/member.js +19 -7
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +14 -5
- package/api/definition/object.js +32 -6
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +6 -2
- package/api/definition/statement.js +11 -2
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +20 -7
- package/api/definition/values.js +37 -9
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.js +3 -3
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +2 -0
- package/api/deserialize/type-store.js +2 -0
- package/api/deserialize/type-store.js.map +1 -0
- package/api/expression.d.ts +27 -5
- package/api/expression.js.map +1 -1
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/api/index.js.map +1 -1
- package/api/module/export.d.ts +7 -2
- package/api/module/export.js +15 -1
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +7 -2
- package/api/module/import.js +15 -1
- package/api/module/import.js.map +1 -1
- package/api/module/module.d.ts +6 -2
- package/api/module/module.js +11 -2
- package/api/module/module.js.map +1 -1
- package/api/operators/assignment.d.ts +2 -1
- package/api/operators/assignment.js +4 -0
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +6 -2
- package/api/operators/await.js +12 -3
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +2 -1
- package/api/operators/binary.js +4 -0
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +5 -2
- package/api/operators/chaining.js +9 -2
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +6 -2
- package/api/operators/comma.js +11 -2
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +6 -2
- package/api/operators/grouping.js +11 -2
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +2 -1
- package/api/operators/logical.js +4 -0
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +6 -2
- package/api/operators/pipeline.js +21 -6
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +6 -2
- package/api/operators/ternary.js +17 -2
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/unary.d.ts +6 -2
- package/api/operators/unary.js +20 -5
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +6 -2
- package/api/operators/update.js +11 -2
- package/api/operators/update.js.map +1 -1
- package/api/statement/control/block.d.ts +6 -2
- package/api/statement/control/block.js +11 -2
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +5 -1
- package/api/statement/control/empty.js +5 -1
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +6 -2
- package/api/statement/control/if.js +16 -2
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +13 -3
- package/api/statement/control/switch.js +35 -9
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +9 -4
- package/api/statement/control/terminate.js +11 -1
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +10 -3
- package/api/statement/declarations/declares.js +25 -6
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +18 -5
- package/api/statement/iterations/for.js +67 -8
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +10 -3
- package/api/statement/iterations/while.js +26 -4
- package/api/statement/iterations/while.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +12 -4
- package/scope/event.d.ts +5 -0
- package/scope/event.js +41 -0
- package/scope/event.js.map +1 -0
- package/scope/index.d.ts +1 -0
- package/scope/index.js +1 -0
- package/scope/index.js.map +1 -1
- package/scope/proxy.d.ts +18 -6
- package/scope/proxy.js +57 -9
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +71 -61
- package/scope/scope.js +104 -52
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +28 -28
- package/scope/stack.js.map +1 -1
- package/v8/nodes.d.ts +1 -1
- package/v8/parser.d.ts +2 -1
- package/v8/parser.js +16 -10
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +4 -2
- package/v8/stream.js +39 -17
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +1 -1
- package/v8/token.js.map +1 -1
- package/visit/index.d.ts +1 -0
- package/visit/index.js +2 -0
- package/visit/index.js.map +1 -0
- package/visit/visitor.d.ts +11 -0
- package/visit/visitor.js +42 -0
- package/visit/visitor.js.map +1 -0
package/README.md
CHANGED
|
@@ -3,22 +3,20 @@
|
|
|
3
3
|
[![NPM Version][npm-image]][npm-url]
|
|
4
4
|
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
5
|
[![LICENSE][license-img]][license-url]
|
|
6
|
-
![npm-dependencies][npm-dep-url]
|
|
7
6
|
[![lerna][lerna-img]][lerna-url]
|
|
8
7
|
![GitHub contributors][contributors]
|
|
9
8
|
|
|
10
|
-
[npm-image]: https://img.shields.io/npm/v/@ibyar/expressions.svg
|
|
9
|
+
[npm-image]: https://img.shields.io/npm/v/@ibyar/expressions.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen
|
|
11
10
|
[npm-url]: https://npmjs.org/package/@ibyar/expressions
|
|
12
11
|
[downloads-image]: https://img.shields.io/npm/dt/@ibyar/expressions
|
|
13
12
|
[downloads-url]: https://npmjs.org/package/@ibyar/expressions
|
|
14
13
|
[license-img]: https://img.shields.io/github/license/ibyar/aurora
|
|
15
14
|
[license-url]: https://github.com/ibyar/aurora/blob/master/LICENSE
|
|
16
|
-
[npm-dep-url]: https://img.shields.io/david/ibyar/aurora?path=packages%2Fexpressions
|
|
17
15
|
[lerna-img]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
|
|
18
16
|
[lerna-url]: https://lerna.js.org/
|
|
19
17
|
[contributors]: https://img.shields.io/github/contributors/ibyar/aurora
|
|
20
18
|
|
|
21
|
-
Aurora expression,
|
|
19
|
+
Aurora expression, is a JavaScript expression parsing and evaluation. and template expression evaluation, with stack and scope.
|
|
22
20
|
|
|
23
21
|
- this package has no dependance, can work on both (Node.js) and any Web Browsers, that support modules and class syntax
|
|
24
22
|
|
|
@@ -118,7 +116,7 @@ console.log(
|
|
|
118
116
|
|
|
119
117
|
- class expression
|
|
120
118
|
- Import/Export module
|
|
121
|
-
- Custom Factory Builder to convert the code to ESTree directly or to
|
|
119
|
+
- Custom Factory Builder to convert the code to ESTree directly or to executable expression node
|
|
122
120
|
|
|
123
121
|
## Operators
|
|
124
122
|
|
|
@@ -130,7 +128,7 @@ console.log(
|
|
|
130
128
|
| multiply/divide | `* / % ** %%` |
|
|
131
129
|
| addition/subtraction | `+ -` |
|
|
132
130
|
| bitwise shift | `<< >> >>>` |
|
|
133
|
-
| relational | `< <= > >= >? <? <=> in instanceof`
|
|
131
|
+
| relational | `< <= > >= >? <? <=> in instanceof` |
|
|
134
132
|
| equality | `== != === !==` |
|
|
135
133
|
| bitwise-and | `&` |
|
|
136
134
|
| bitwise-xor | `^` |
|
|
@@ -138,6 +136,7 @@ console.log(
|
|
|
138
136
|
| logical-and | `&&` |
|
|
139
137
|
| logical-or | `\|\|` |
|
|
140
138
|
| conditional | `?:` |
|
|
139
|
+
| pipeline | `|>` |
|
|
141
140
|
| assignment | `= += -= *= **= /= %= <<= >>= >>>= &= ^= \|= &&= \|\|= ??= >?= <?= %%=` |
|
|
142
141
|
| comma | `,` |
|
|
143
142
|
|
|
@@ -161,11 +160,22 @@ const z = a |> add:b:c; // === add(a, b, c)
|
|
|
161
160
|
```
|
|
162
161
|
|
|
163
162
|
```js
|
|
163
|
+
function map(num){
|
|
164
|
+
return { number: num };
|
|
165
|
+
}
|
|
166
|
+
function plus(num1){
|
|
167
|
+
return function(num2){
|
|
168
|
+
return num1 + num2;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
164
171
|
function add(x, y) { return x + y };
|
|
165
|
-
const a = 88;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
const a = 88, b = 11;
|
|
173
|
+
b |> function(x) { console.log(x); return x; }
|
|
174
|
+
|> x => { console.log(x); return x; }
|
|
175
|
+
|> (x => x + 10)
|
|
176
|
+
|> plus(a)
|
|
177
|
+
|> add(99, ?)
|
|
178
|
+
|> add : 88 : ?
|
|
179
|
+
|> add : ? : 77
|
|
180
|
+
|> map
|
|
171
181
|
```
|
package/api/abstract.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type { ScopeType } from '../scope/scope.js';
|
|
1
|
+
import type { Scope, ScopeType } from '../scope/scope.js';
|
|
2
2
|
import type { AwaitPromiseInfo, Stack } from '../scope/stack.js';
|
|
3
|
-
import type { NodeDeserializer, ExpressionNode, NodeExpressionClass, NodeJsonType, CanDeclareExpression } from './expression.js';
|
|
3
|
+
import type { NodeDeserializer, ExpressionNode, NodeExpressionClass, NodeJsonType, CanDeclareExpression, ExpressionEventMap, ExpressionEventPath, VisitNodeType, VisitNodeListType } from './expression.js';
|
|
4
4
|
export declare abstract class AbstractExpressionNode implements ExpressionNode {
|
|
5
5
|
static fromJSON(node: ExpressionNode, deserializer: NodeDeserializer): ExpressionNode;
|
|
6
6
|
getClass(): NodeExpressionClass<ExpressionNode>;
|
|
7
7
|
toJSON(key?: string): NodeJsonType;
|
|
8
|
+
events(): ExpressionEventMap;
|
|
9
|
+
abstract shareVariables(scopeList: Scope<any>[]): void;
|
|
8
10
|
abstract set(stack: Stack, value: any): any;
|
|
9
11
|
abstract get(stack: Stack, thisContext?: any): any;
|
|
10
|
-
abstract
|
|
12
|
+
abstract dependency(computed?: true): ExpressionNode[];
|
|
13
|
+
abstract dependencyPath(computed?: true): ExpressionEventPath[];
|
|
11
14
|
abstract toString(): string;
|
|
12
15
|
abstract toJson(key?: string): {
|
|
13
16
|
[key: string]: any;
|
|
@@ -17,13 +20,16 @@ export declare abstract class InfixExpressionNode<T> extends AbstractExpressionN
|
|
|
17
20
|
protected operator: T;
|
|
18
21
|
protected left: ExpressionNode;
|
|
19
22
|
protected right: ExpressionNode;
|
|
23
|
+
static visit(node: InfixExpressionNode<any>, visitNode: VisitNodeType, visitNodeList: VisitNodeListType): void;
|
|
20
24
|
constructor(operator: T, left: ExpressionNode, right: ExpressionNode);
|
|
21
25
|
getOperator(): T;
|
|
22
26
|
getLeft(): ExpressionNode;
|
|
23
27
|
getRight(): ExpressionNode;
|
|
28
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
24
29
|
set(context: object, value: any): void;
|
|
25
30
|
abstract get(stack: Stack): any;
|
|
26
|
-
|
|
31
|
+
dependency(computed?: true): ExpressionNode[];
|
|
32
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
27
33
|
toString(): string;
|
|
28
34
|
toJson(key: string): object;
|
|
29
35
|
}
|
|
@@ -32,6 +38,16 @@ export declare class ReturnValue {
|
|
|
32
38
|
constructor(value: any);
|
|
33
39
|
getValue(): any;
|
|
34
40
|
}
|
|
41
|
+
export declare class YieldValue {
|
|
42
|
+
value: any;
|
|
43
|
+
constructor(value: any);
|
|
44
|
+
getValue(): any;
|
|
45
|
+
}
|
|
46
|
+
export declare class YieldDelegateValue {
|
|
47
|
+
value: any;
|
|
48
|
+
constructor(value: any);
|
|
49
|
+
getValue(): any;
|
|
50
|
+
}
|
|
35
51
|
export declare class AwaitPromise implements AwaitPromiseInfo {
|
|
36
52
|
promise: Promise<any>;
|
|
37
53
|
node: CanDeclareExpression;
|
package/api/abstract.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
function initPathExpressionEventMap(rootEventMap, path) {
|
|
2
|
+
let lastMap = rootEventMap;
|
|
3
|
+
for (const node of path) {
|
|
4
|
+
const scopeName = node.path;
|
|
5
|
+
let eventMap = lastMap[scopeName];
|
|
6
|
+
if (eventMap) {
|
|
7
|
+
lastMap = eventMap;
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
lastMap = lastMap[scopeName] = {};
|
|
11
|
+
if (node.computed) {
|
|
12
|
+
node.computedPath.forEach(path => initPathExpressionEventMap(rootEventMap, path));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
1
16
|
export class AbstractExpressionNode {
|
|
2
17
|
static fromJSON(node, deserializer) {
|
|
3
18
|
return deserializer(node);
|
|
@@ -10,6 +25,15 @@ export class AbstractExpressionNode {
|
|
|
10
25
|
json.type = Reflect.get(this.constructor, 'type');
|
|
11
26
|
return json;
|
|
12
27
|
}
|
|
28
|
+
events() {
|
|
29
|
+
const dependencyNodes = this.dependency();
|
|
30
|
+
const eventMap = {};
|
|
31
|
+
for (const node of dependencyNodes) {
|
|
32
|
+
const dependencyPath = node.dependencyPath();
|
|
33
|
+
initPathExpressionEventMap(eventMap, dependencyPath);
|
|
34
|
+
}
|
|
35
|
+
return eventMap;
|
|
36
|
+
}
|
|
13
37
|
}
|
|
14
38
|
export class InfixExpressionNode extends AbstractExpressionNode {
|
|
15
39
|
constructor(operator, left, right) {
|
|
@@ -18,6 +42,10 @@ export class InfixExpressionNode extends AbstractExpressionNode {
|
|
|
18
42
|
this.left = left;
|
|
19
43
|
this.right = right;
|
|
20
44
|
}
|
|
45
|
+
static visit(node, visitNode, visitNodeList) {
|
|
46
|
+
visitNode(node.getLeft());
|
|
47
|
+
visitNode(node.getRight());
|
|
48
|
+
}
|
|
21
49
|
getOperator() {
|
|
22
50
|
return this.operator;
|
|
23
51
|
}
|
|
@@ -27,18 +55,25 @@ export class InfixExpressionNode extends AbstractExpressionNode {
|
|
|
27
55
|
getRight() {
|
|
28
56
|
return this.right;
|
|
29
57
|
}
|
|
58
|
+
shareVariables(scopeList) {
|
|
59
|
+
this.left.shareVariables(scopeList);
|
|
60
|
+
this.right.shareVariables(scopeList);
|
|
61
|
+
}
|
|
30
62
|
set(context, value) {
|
|
31
63
|
throw new Error(`${this.constructor.name}#set() of operator: '${this.operator}' has no implementation.`);
|
|
32
64
|
}
|
|
33
|
-
|
|
34
|
-
return
|
|
65
|
+
dependency(computed) {
|
|
66
|
+
return this.left.dependency(computed).concat(this.right.dependency(computed));
|
|
67
|
+
}
|
|
68
|
+
dependencyPath(computed) {
|
|
69
|
+
return this.left.dependencyPath(computed).concat(this.right.dependencyPath(computed));
|
|
35
70
|
}
|
|
36
71
|
toString() {
|
|
37
72
|
return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
|
|
38
73
|
}
|
|
39
74
|
toJson(key) {
|
|
40
75
|
return {
|
|
41
|
-
|
|
76
|
+
operator: this.operator,
|
|
42
77
|
left: this.left.toJSON(),
|
|
43
78
|
right: this.right.toJSON()
|
|
44
79
|
};
|
|
@@ -52,6 +87,22 @@ export class ReturnValue {
|
|
|
52
87
|
return this.value;
|
|
53
88
|
}
|
|
54
89
|
}
|
|
90
|
+
export class YieldValue {
|
|
91
|
+
constructor(value) {
|
|
92
|
+
this.value = value;
|
|
93
|
+
}
|
|
94
|
+
getValue() {
|
|
95
|
+
return this.value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export class YieldDelegateValue {
|
|
99
|
+
constructor(value) {
|
|
100
|
+
this.value = value;
|
|
101
|
+
}
|
|
102
|
+
getValue() {
|
|
103
|
+
return this.value;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
55
106
|
export class AwaitPromise {
|
|
56
107
|
constructor(promise) {
|
|
57
108
|
this.promise = promise;
|
package/api/abstract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/expressions/api/abstract.ts"],"names":[],"mappings":"AAQA,MAAM,OAAgB,sBAAsB;IAC3C,MAAM,CAAC,QAAQ,CAAC,IAAoB,EAAE,YAA8B;QACnE,OAAO,YAAY,CAAC,IAAW,CAAC,CAAC;IAClC,CAAC;IACD,QAAQ;QACP,OAAO,IAAI,CAAC,WAAkD,CAAC;IAChE,CAAC;IACD,MAAM,CAAC,GAAY;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC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c,CAAC,QAAe;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvF,CAAC;IACD,QAAQ;QACP,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC5E,CAAC;IACD,MAAM,CAAC,GAAW;QACjB,OAAO;YACN,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;SAC1B,CAAC;IACH,CAAC;CACD;AAED,MAAM,OAAO,WAAW;IACvB,YAAmB,KAAU;QAAV,UAAK,GAAL,KAAK,CAAK;IAAI,CAAC;IAClC,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AAED,MAAM,OAAO,UAAU;IACtB,YAAmB,KAAU;QAAV,UAAK,GAAL,KAAK,CAAK;IAAI,CAAC;IAClC,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AAED,MAAM,OAAO,kBAAkB;IAC9B,YAAmB,KAAU;QAAV,UAAK,GAAL,KAAK,CAAK;IAAI,CAAC;IAClC,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AAED,MAAM,OAAO,YAAY;IAIxB,YAAmB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;IAAI,CAAC;CAC7C","sourcesContent":["import type { Scope, ScopeType } from '../scope/scope.js';\nimport type { AwaitPromiseInfo, Stack } from '../scope/stack.js';\nimport type {\n\tNodeDeserializer, ExpressionNode, NodeExpressionClass,\n\tNodeJsonType, CanDeclareExpression, ExpressionEventMap,\n\tExpressionEventPath, VisitNodeType, VisitNodeListType\n} from './expression.js';\n\nfunction initPathExpressionEventMap(rootEventMap: ExpressionEventMap, path: ExpressionEventPath[]): void {\n\tlet lastMap = rootEventMap;\n\t// let index = 0;\n\tfor (const node of path) {\n\t\tconst scopeName = node.path;\n\t\tlet eventMap = lastMap[scopeName];\n\t\tif (eventMap) {\n\t\t\tlastMap = eventMap;\n\t\t\tcontinue;\n\t\t}\n\t\t// if ((index++) === path.length - 1) {\n\t\t// \tlastMap[scopeName] = undefined;\n\t\t// \tcontinue;\n\t\t// }\n\t\tlastMap = lastMap[scopeName] = {};\n\t\tif (node.computed) {\n\t\t\tnode.computedPath.forEach(path => initPathExpressionEventMap(rootEventMap, path));\n\t\t}\n\t}\n}\nexport abstract class AbstractExpressionNode implements ExpressionNode {\n\tstatic fromJSON(node: ExpressionNode, deserializer: NodeDeserializer): ExpressionNode {\n\t\treturn deserializer(node as any);\n\t}\n\tgetClass(): NodeExpressionClass<ExpressionNode> {\n\t\treturn this.constructor as NodeExpressionClass<ExpressionNode>;\n\t}\n\ttoJSON(key?: string): NodeJsonType {\n\t\tconst json = this.toJson(key) as NodeJsonType;\n\t\tjson.type = Reflect.get(this.constructor, 'type');\n\t\treturn json;\n\t}\n\tevents(): ExpressionEventMap {\n\t\tconst dependencyNodes = this.dependency();\n\t\tconst eventMap: ExpressionEventMap = {};\n\t\tfor (const node of dependencyNodes) {\n\t\t\tconst dependencyPath = node.dependencyPath();\n\t\t\tinitPathExpressionEventMap(eventMap, dependencyPath);\n\t\t}\n\t\treturn eventMap;\n\t}\n\tabstract shareVariables(scopeList: Scope<any>[]): void;\n\tabstract set(stack: Stack, value: any): any;\n\tabstract get(stack: Stack, thisContext?: any): any;\n\tabstract dependency(computed?: true): ExpressionNode[];\n\tabstract dependencyPath(computed?: true): ExpressionEventPath[];\n\tabstract toString(): string;\n\tabstract toJson(key?: string): { [key: string]: any };\n}\nexport abstract class InfixExpressionNode<T> extends AbstractExpressionNode {\n\tstatic visit(node: InfixExpressionNode<any>, visitNode: VisitNodeType, visitNodeList: VisitNodeListType): void {\n\t\tvisitNode(node.getLeft());\n\t\tvisitNode(node.getRight())\n\t}\n\tconstructor(protected operator: T, protected left: ExpressionNode, protected right: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetOperator() {\n\t\treturn this.operator;\n\t}\n\tgetLeft() {\n\t\treturn this.left;\n\t}\n\tgetRight() {\n\t\treturn this.right;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.left.shareVariables(scopeList);\n\t\tthis.right.shareVariables(scopeList);\n\t}\n\tset(context: object, value: any) {\n\t\tthrow new Error(`${this.constructor.name}#set() of operator: '${this.operator}' has no implementation.`);\n\t}\n\tabstract get(stack: Stack): any;\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.left.dependency(computed).concat(this.right.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.left.dependencyPath(computed).concat(this.right.dependencyPath(computed));\n\t}\n\ttoString() {\n\t\treturn `${this.left.toString()} ${this.operator} ${this.right.toString()}`;\n\t}\n\ttoJson(key: string): object {\n\t\treturn {\n\t\t\toperator: this.operator,\n\t\t\tleft: this.left.toJSON(),\n\t\t\tright: this.right.toJSON()\n\t\t};\n\t}\n}\n\nexport class ReturnValue {\n\tconstructor(public value: any) { }\n\tgetValue() {\n\t\treturn this.value;\n\t}\n}\n\nexport class YieldValue {\n\tconstructor(public value: any) { }\n\tgetValue() {\n\t\treturn this.value;\n\t}\n}\n\nexport class YieldDelegateValue {\n\tconstructor(public value: any) { }\n\tgetValue() {\n\t\treturn this.value;\n\t}\n}\n\nexport class AwaitPromise implements AwaitPromiseInfo {\n\tnode: CanDeclareExpression;\n\tdeclareVariable: boolean;\n\tscopeType: ScopeType;\n\tconstructor(public promise: Promise<any>) { }\n}\n"]}
|
package/api/app/class.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { CanDeclareExpression, ExpressionEventPath, ExpressionNode, NodeDeserializer } from '../expression.js';
|
|
1
2
|
import type { Stack } from '../../scope/stack.js';
|
|
2
|
-
import type { ScopeType } from '../../scope/scope.js';
|
|
3
|
-
import type { CanDeclareExpression, ExpressionNode, NodeDeserializer } from '../expression.js';
|
|
3
|
+
import type { Scope, ScopeType } from '../../scope/scope.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
5
|
import { Identifier } from '../definition/values.js';
|
|
6
6
|
import { MemberExpression } from '../definition/member.js';
|
|
@@ -13,8 +13,9 @@ export declare class MetaProperty extends MemberExpression {
|
|
|
13
13
|
static fromJSON(node: MetaProperty, deserializer: NodeDeserializer<any>): MetaProperty;
|
|
14
14
|
constructor(meta: Identifier, property: Identifier);
|
|
15
15
|
getMeta(): Identifier;
|
|
16
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
16
17
|
toString(): string;
|
|
17
|
-
toJson(
|
|
18
|
+
toJson(): {
|
|
18
19
|
[key: string]: any;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
@@ -22,8 +23,9 @@ export declare class PrivateIdentifier extends Identifier {
|
|
|
22
23
|
private privateName;
|
|
23
24
|
static fromJSON(node: PrivateIdentifier): PrivateIdentifier;
|
|
24
25
|
constructor(privateName: string);
|
|
26
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
25
27
|
toString(): string;
|
|
26
|
-
toJson(
|
|
28
|
+
toJson(): {
|
|
27
29
|
[key: string]: any;
|
|
28
30
|
};
|
|
29
31
|
}
|
|
@@ -41,12 +43,14 @@ export declare class MethodDefinition extends AbstractExpressionNode implements
|
|
|
41
43
|
getValue(): FunctionExpression;
|
|
42
44
|
isComputed(): boolean;
|
|
43
45
|
isStatic(): boolean;
|
|
46
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
44
47
|
set(stack: Stack, value: any): void;
|
|
45
48
|
get(stack: Stack, thisContext?: any): void;
|
|
46
49
|
declareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any): void;
|
|
47
|
-
|
|
50
|
+
dependency(computed?: true): ExpressionNode[];
|
|
51
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
48
52
|
toString(): string;
|
|
49
|
-
toJson(
|
|
53
|
+
toJson(): {
|
|
50
54
|
[key: string]: any;
|
|
51
55
|
};
|
|
52
56
|
}
|
|
@@ -61,12 +65,14 @@ export declare class PropertyDefinition extends AbstractExpressionNode implement
|
|
|
61
65
|
getValue(): ExpressionNode | undefined;
|
|
62
66
|
isComputed(): boolean;
|
|
63
67
|
isStatic(): boolean;
|
|
68
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
64
69
|
set(stack: Stack, value: any): void;
|
|
65
70
|
get(stack: Stack, thisContext?: any): void;
|
|
66
71
|
declareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any): void;
|
|
67
|
-
|
|
72
|
+
dependency(computed?: true): ExpressionNode[];
|
|
73
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
68
74
|
toString(): string;
|
|
69
|
-
toJson(
|
|
75
|
+
toJson(): {
|
|
70
76
|
[key: string]: any;
|
|
71
77
|
};
|
|
72
78
|
}
|
|
@@ -75,11 +81,13 @@ export declare class ClassBody extends AbstractExpressionNode {
|
|
|
75
81
|
static fromJSON(node: ClassBody, deserializer: NodeDeserializer<any>): ClassBody;
|
|
76
82
|
constructor(body: (MethodDefinition | PropertyDefinition)[]);
|
|
77
83
|
getBody(): (MethodDefinition | PropertyDefinition)[];
|
|
84
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
78
85
|
set(stack: Stack, value: any): void;
|
|
79
86
|
get(stack: Stack, thisContext?: any): void;
|
|
80
|
-
|
|
87
|
+
dependency(computed?: true): ExpressionNode[];
|
|
88
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
81
89
|
toString(): string;
|
|
82
|
-
toJson(
|
|
90
|
+
toJson(): {
|
|
83
91
|
[key: string]: any;
|
|
84
92
|
};
|
|
85
93
|
}
|
|
@@ -91,9 +99,11 @@ export declare class Class extends AbstractExpressionNode {
|
|
|
91
99
|
getBody(): ClassBody;
|
|
92
100
|
getId(): Identifier | undefined;
|
|
93
101
|
getSuperClass(): ExpressionNode | undefined;
|
|
102
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
94
103
|
set(stack: Stack): void;
|
|
95
104
|
get(stack: Stack): void;
|
|
96
|
-
|
|
105
|
+
dependency(computed?: true): ExpressionNode[];
|
|
106
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
97
107
|
toString(): string;
|
|
98
108
|
toJson(): object;
|
|
99
109
|
}
|
package/api/app/class.js
CHANGED
|
@@ -25,10 +25,11 @@ let MetaProperty = MetaProperty_1 = class MetaProperty extends MemberExpression
|
|
|
25
25
|
getMeta() {
|
|
26
26
|
return this.meta;
|
|
27
27
|
}
|
|
28
|
+
shareVariables(scopeList) { }
|
|
28
29
|
toString() {
|
|
29
30
|
return `${this.meta.toString()}.${this.property.toString()}`;
|
|
30
31
|
}
|
|
31
|
-
toJson(
|
|
32
|
+
toJson() {
|
|
32
33
|
return {
|
|
33
34
|
meta: this.meta.toJSON(),
|
|
34
35
|
property: this.property.toJSON(),
|
|
@@ -50,10 +51,11 @@ let PrivateIdentifier = PrivateIdentifier_1 = class PrivateIdentifier extends Id
|
|
|
50
51
|
static fromJSON(node) {
|
|
51
52
|
return new PrivateIdentifier_1(node.name);
|
|
52
53
|
}
|
|
54
|
+
shareVariables(scopeList) { }
|
|
53
55
|
toString() {
|
|
54
56
|
return `#${this.privateName}`;
|
|
55
57
|
}
|
|
56
|
-
toJson(
|
|
58
|
+
toJson() {
|
|
57
59
|
return {
|
|
58
60
|
name: this.privateName
|
|
59
61
|
};
|
|
@@ -91,6 +93,7 @@ let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends Abstr
|
|
|
91
93
|
isStatic() {
|
|
92
94
|
return this.static;
|
|
93
95
|
}
|
|
96
|
+
shareVariables(scopeList) { }
|
|
94
97
|
set(stack, value) {
|
|
95
98
|
throw new Error('Method not implemented.');
|
|
96
99
|
}
|
|
@@ -100,13 +103,16 @@ let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends Abstr
|
|
|
100
103
|
declareVariable(stack, scopeType, propertyValue) {
|
|
101
104
|
throw new Error('Method not implemented.');
|
|
102
105
|
}
|
|
103
|
-
|
|
106
|
+
dependency(computed) {
|
|
107
|
+
throw new Error('Method not implemented.');
|
|
108
|
+
}
|
|
109
|
+
dependencyPath(computed) {
|
|
104
110
|
throw new Error('Method not implemented.');
|
|
105
111
|
}
|
|
106
112
|
toString() {
|
|
107
113
|
throw new Error('Method not implemented.');
|
|
108
114
|
}
|
|
109
|
-
toJson(
|
|
115
|
+
toJson() {
|
|
110
116
|
return {
|
|
111
117
|
kind: this.kind,
|
|
112
118
|
key: this.key,
|
|
@@ -144,6 +150,7 @@ let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends
|
|
|
144
150
|
isStatic() {
|
|
145
151
|
return this.static;
|
|
146
152
|
}
|
|
153
|
+
shareVariables(scopeList) { }
|
|
147
154
|
set(stack, value) {
|
|
148
155
|
throw new Error('Method not implemented.');
|
|
149
156
|
}
|
|
@@ -153,13 +160,16 @@ let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends
|
|
|
153
160
|
declareVariable(stack, scopeType, propertyValue) {
|
|
154
161
|
throw new Error('Method not implemented.');
|
|
155
162
|
}
|
|
156
|
-
|
|
163
|
+
dependency(computed) {
|
|
164
|
+
throw new Error('Method not implemented.');
|
|
165
|
+
}
|
|
166
|
+
dependencyPath(computed) {
|
|
157
167
|
throw new Error('Method not implemented.');
|
|
158
168
|
}
|
|
159
169
|
toString() {
|
|
160
170
|
throw new Error('Method not implemented.');
|
|
161
171
|
}
|
|
162
|
-
toJson(
|
|
172
|
+
toJson() {
|
|
163
173
|
return {
|
|
164
174
|
key: this.key.toJSON(),
|
|
165
175
|
computed: this.computed,
|
|
@@ -184,19 +194,23 @@ let ClassBody = ClassBody_1 = class ClassBody extends AbstractExpressionNode {
|
|
|
184
194
|
getBody() {
|
|
185
195
|
return this.body;
|
|
186
196
|
}
|
|
197
|
+
shareVariables(scopeList) { }
|
|
187
198
|
set(stack, value) {
|
|
188
199
|
throw new Error('Method not implemented.');
|
|
189
200
|
}
|
|
190
201
|
get(stack, thisContext) {
|
|
191
202
|
throw new Error('Method not implemented.');
|
|
192
203
|
}
|
|
193
|
-
|
|
204
|
+
dependency(computed) {
|
|
205
|
+
throw new Error('Method not implemented.');
|
|
206
|
+
}
|
|
207
|
+
dependencyPath(computed) {
|
|
194
208
|
throw new Error('Method not implemented.');
|
|
195
209
|
}
|
|
196
210
|
toString() {
|
|
197
211
|
throw new Error('Method not implemented.');
|
|
198
212
|
}
|
|
199
|
-
toJson(
|
|
213
|
+
toJson() {
|
|
200
214
|
return {
|
|
201
215
|
body: this.body.map(method => method.toJSON())
|
|
202
216
|
};
|
|
@@ -223,14 +237,18 @@ export class Class extends AbstractExpressionNode {
|
|
|
223
237
|
getSuperClass() {
|
|
224
238
|
return this.superClass;
|
|
225
239
|
}
|
|
240
|
+
shareVariables(scopeList) { }
|
|
226
241
|
set(stack) {
|
|
227
242
|
throw new Error(`Class.#set() has no implementation.`);
|
|
228
243
|
}
|
|
229
244
|
get(stack) {
|
|
230
245
|
throw new Error(`Class.#get() has no implementation.`);
|
|
231
246
|
}
|
|
232
|
-
|
|
233
|
-
|
|
247
|
+
dependency(computed) {
|
|
248
|
+
throw new Error('Method not implemented.');
|
|
249
|
+
}
|
|
250
|
+
dependencyPath(computed) {
|
|
251
|
+
throw new Error('Method not implemented.');
|
|
234
252
|
}
|
|
235
253
|
toString() {
|
|
236
254
|
let classDeclaration = 'class ';
|
package/api/app/class.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../../../src/expressions/api/app/class.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,sBAAs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AAC,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAChC,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAChD,CAAC;IACH,CAAC;CACD,CAAA;AARY,eAAe;IAD3B,YAAY,CAAC,iBAAiB,CAAC;GACnB,eAAe,CAQ3B;SARY,eAAe","sourcesContent":["import type { Stack } from '../../scope/stack.js';\nimport type { ScopeType } from '../../scope/scope.js';\nimport type { CanDeclareExpression, ExpressionNode, NodeDeserializer } from '../expression.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier } from '../definition/values.js';\nimport { MemberExpression } from '../definition/member.js';\nimport { FunctionExpression } from '../definition/function.js';\n\n\n/**\n * MetaProperty node represents\n * - `new.target` meta property in ES2015.\n * - `import.meta` meta property in ES2030.\n * \n * In the future, it will represent other meta properties as well.\n */\n@Deserializer('MetaProperty')\nexport class MetaProperty extends MemberExpression {\n\n\tpublic static NewTarget = new MetaProperty(new Identifier('new'), new Identifier('target'));\n\n\tpublic static ImportMeta = new MetaProperty(new Identifier('import'), new Identifier('meta'));\n\n\tprivate static getJsonName(identifier: ExpressionNode): string {\n\t\treturn Reflect.get(identifier, 'name');\n\t}\n\n\tstatic fromJSON(node: MetaProperty, deserializer: NodeDeserializer<any>): MetaProperty {\n\t\tif (MetaProperty.getJsonName(node.meta) === 'new' && MetaProperty.getJsonName(node.property) === 'target') {\n\t\t\treturn MetaProperty.NewTarget;\n\t\t}\n\t\telse if (MetaProperty.getJsonName(node.meta) === 'new' && MetaProperty.getJsonName(node.property) === 'meta') {\n\t\t\treturn MetaProperty.ImportMeta;\n\t\t}\n\t\treturn new MetaProperty(\n\t\t\tdeserializer(node.meta),\n\t\t\tdeserializer(node.property)\n\t\t);\n\t}\n\tconstructor(private meta: Identifier, property: Identifier) {\n\t\tsuper(meta, property, false);\n\t}\n\tgetMeta() {\n\t\treturn this.meta;\n\t}\n\ttoString(): string {\n\t\treturn `${this.meta.toString()}.${this.property.toString()}`;\n\t}\n\ttoJson(key?: string): { [key: string]: any; } {\n\t\treturn {\n\t\t\tmeta: this.meta.toJSON(),\n\t\t\tproperty: this.property.toJSON(),\n\t\t};\n\t}\n}\n\n/**\n * A private identifier refers to private class elements. For a private name #a, its name is a.\n */\n@Deserializer('PrivateIdentifier')\nexport class PrivateIdentifier extends Identifier {\n\tstatic fromJSON(node: PrivateIdentifier): PrivateIdentifier {\n\t\treturn new PrivateIdentifier(\n\t\t\tnode.name as string\n\t\t);\n\t}\n\tconstructor(private privateName: string) {\n\t\tsuper('ɵ_' + privateName);\n\t}\n\ttoString(): string {\n\t\treturn `#${this.privateName}`;\n\t}\n\ttoJson(key?: string): { [key: string]: any; } {\n\t\treturn {\n\t\t\tname: this.privateName\n\t\t};\n\t}\n}\n\nexport type MethodDefinitionKind = 'constructor' | 'method' | 'set' | 'get';\n\n/**\n * - When key is a PrivateIdentifier, computed must be false and kind can not be \"constructor\".\n */\n@Deserializer('MethodDefinition')\nexport class MethodDefinition extends AbstractExpressionNode implements CanDeclareExpression {\n\tstatic fromJSON(node: MethodDefinition, deserializer: NodeDeserializer<any>): MethodDefinition {\n\t\treturn new MethodDefinition(\n\t\t\tnode.kind,\n\t\t\tdeserializer(node.key),\n\t\t\tdeserializer(node.value),\n\t\t\tnode.computed,\n\t\t\tnode.static\n\t\t);\n\t}\n\tprivate 'static': boolean;\n\tconstructor(\n\t\tprivate kind: MethodDefinitionKind,\n\t\tprivate key: ExpressionNode | PrivateIdentifier,\n\t\tprivate value: FunctionExpression,\n\n\t\tprivate computed: boolean,\n\t\tisStatic: boolean) {\n\t\tsuper();\n\t\tthis.static = isStatic;\n\t}\n\tgetKind() {\n\t\treturn this.kind;\n\t}\n\tgetKey() {\n\t\treturn this.key;\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tisComputed() {\n\t\treturn this.computed;\n\t}\n\tisStatic() {\n\t\treturn this.static;\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdeclareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tevents(parent?: string): string[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoJson(key?: string): { [key: string]: any; } {\n\t\treturn {\n\t\t\tkind: this.kind,\n\t\t\tkey: this.key,\n\t\t\tvalue: this.value,\n\t\t\tcomputed: this.computed,\n\t\t\tstatic: this.static,\n\t\t};\n\t}\n}\n\n\n\n/**\n * - When key is a PrivateIdentifier, computed must be false.\n */\n@Deserializer('PropertyDefinition')\nexport class PropertyDefinition extends AbstractExpressionNode implements CanDeclareExpression {\n\tstatic fromJSON(node: PropertyDefinition, deserializer: NodeDeserializer<any>): PropertyDefinition {\n\t\treturn new PropertyDefinition(\n\t\t\tdeserializer(node.key),\n\t\t\tnode.computed,\n\t\t\tnode.static,\n\t\t\tnode.value && deserializer(node.value)\n\t\t);\n\t}\n\tprivate 'static': boolean;\n\tconstructor(\n\t\tprivate key: ExpressionNode | PrivateIdentifier,\n\t\tprivate computed: boolean,\n\t\tisStatic: boolean,\n\t\tprivate value?: ExpressionNode) {\n\t\tsuper();\n\t\tthis.static = isStatic;\n\t}\n\tgetKey() {\n\t\treturn this.key;\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tisComputed() {\n\t\treturn this.computed;\n\t}\n\tisStatic() {\n\t\treturn this.static;\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdeclareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tevents(parent?: string): string[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoJson(key?: string): { [key: string]: any; } {\n\t\treturn {\n\t\t\tkey: this.key.toJSON(),\n\t\t\tcomputed: this.computed,\n\t\t\tstatic: this.static,\n\t\t\tvalue: this.value?.toJSON()\n\t\t};\n\t}\n}\n\n@Deserializer('ClassBody')\nexport class ClassBody extends AbstractExpressionNode {\n\tstatic fromJSON(node: ClassBody, deserializer: NodeDeserializer<any>): ClassBody {\n\t\treturn new ClassBody(\n\t\t\tnode.body.map(deserializer)\n\t\t);\n\t}\n\tconstructor(private body: (MethodDefinition | PropertyDefinition)[]) {\n\t\tsuper();\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tevents(parent?: string): string[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoJson(key?: string): { [key: string]: any; } {\n\t\treturn {\n\t\t\tbody: this.body.map(method => method.toJSON())\n\t\t};\n\t}\n}\n\nexport class Class extends AbstractExpressionNode {\n\tconstructor(\n\t\tprotected body: ClassBody,\n\t\tprotected id?: Identifier,\n\t\tprotected superClass?: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tgetId() {\n\t\treturn this.id;\n\t}\n\tgetSuperClass() {\n\t\treturn this.superClass;\n\t}\n\n\tset(stack: Stack) {\n\t\tthrow new Error(`Class.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tthrow new Error(`Class.#get() has no implementation.`);\n\t}\n\tevents(parent?: string): string[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tlet classDeclaration = 'class ';\n\t\tif (this.id) {\n\t\t\tclassDeclaration += this.id.toString();\n\t\t}\n\t\tif (this.superClass) {\n\t\t\tclassDeclaration += ' extends ' + this.superClass.toString();\n\t\t}\n\t\treturn `${classDeclaration} {${this.body.toString()}\\n`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tbody: this.body.toJSON(),\n\t\t\tid: this.id?.toJSON(),\n\t\t\tsuperClass: this.superClass?.toJSON(),\n\t\t};\n\t}\n}\n\n@Deserializer('ClassDeclaration')\nexport class ClassDeclaration extends Class implements CanDeclareExpression {\n\tstatic fromJSON(node: ClassDeclaration, deserializer: NodeDeserializer<any>): ClassDeclaration {\n\t\treturn new ClassDeclaration(\n\t\t\tdeserializer(node.body),\n\t\t\tdeserializer(node.id),\n\t\t\tnode.superClass && deserializer(node.superClass)\n\t\t);\n\t}\n\tprotected id: Identifier;\n\tdeclareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any) {\n\t\tstack.declareVariable(scopeType, this.id.getName(), propertyValue);\n\t}\n}\n\n@Deserializer('ClassExpression')\nexport class ClassExpression extends Class {\n\tstatic fromJSON(node: ClassExpression, deserializer: NodeDeserializer<any>): ClassExpression {\n\t\treturn new ClassExpression(\n\t\t\tdeserializer(node.body),\n\t\t\tnode.id && deserializer(node.id),\n\t\t\tnode.superClass && deserializer(node.superClass)\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../../../src/expressions/api/app/class.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAW/D,IAAa,YAAY,oBAAzB,MAAa,YAAa,SAAQ,gBAAgB;IAsBjD,YAAoB,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B,CAAC;GACpB,gBAAgB,CAY5B;SAZY,gBAAgB;AAe7B,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,KAAK;IACzC,MAAM,CAAC,QAAQ,CAAC,IAAqB,EAAE,YAAmC;QACzE,OAAO,IAAI,iBAAe,CACzB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EACvB,IAAI,CAAC,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAChC,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAChD,CAAC;IACH,CAAC;CACD,CAAA;AARY,eAAe;IAD3B,YAAY,CAAC,iBAAiB,CAAC;GACnB,eAAe,CAQ3B;SARY,eAAe","sourcesContent":["import type {\n\tCanDeclareExpression, ExpressionEventPath,\n\tExpressionNode, NodeDeserializer\n} from '../expression.js';\nimport type { Stack } from '../../scope/stack.js';\nimport type { Scope, ScopeType } from '../../scope/scope.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier } from '../definition/values.js';\nimport { MemberExpression } from '../definition/member.js';\nimport { FunctionExpression } from '../definition/function.js';\n\n\n/**\n * MetaProperty node represents\n * - `new.target` meta property in ES2015.\n * - `import.meta` meta property in ES2030.\n * \n * In the future, it will represent other meta properties as well.\n */\n@Deserializer('MetaProperty')\nexport class MetaProperty extends MemberExpression {\n\n\tpublic static NewTarget = new MetaProperty(new Identifier('new'), new Identifier('target'));\n\n\tpublic static ImportMeta = new MetaProperty(new Identifier('import'), new Identifier('meta'));\n\n\tprivate static getJsonName(identifier: ExpressionNode): string {\n\t\treturn Reflect.get(identifier, 'name');\n\t}\n\n\tstatic fromJSON(node: MetaProperty, deserializer: NodeDeserializer<any>): MetaProperty {\n\t\tif (MetaProperty.getJsonName(node.meta) === 'new' && MetaProperty.getJsonName(node.property) === 'target') {\n\t\t\treturn MetaProperty.NewTarget;\n\t\t}\n\t\telse if (MetaProperty.getJsonName(node.meta) === 'new' && MetaProperty.getJsonName(node.property) === 'meta') {\n\t\t\treturn MetaProperty.ImportMeta;\n\t\t}\n\t\treturn new MetaProperty(\n\t\t\tdeserializer(node.meta),\n\t\t\tdeserializer(node.property)\n\t\t);\n\t}\n\tconstructor(private meta: Identifier, property: Identifier) {\n\t\tsuper(meta, property, false);\n\t}\n\tgetMeta() {\n\t\treturn this.meta;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\ttoString(): string {\n\t\treturn `${this.meta.toString()}.${this.property.toString()}`;\n\t}\n\ttoJson(): { [key: string]: any; } {\n\t\treturn {\n\t\t\tmeta: this.meta.toJSON(),\n\t\t\tproperty: this.property.toJSON(),\n\t\t};\n\t}\n}\n\n/**\n * A private identifier refers to private class elements. For a private name #a, its name is a.\n */\n@Deserializer('PrivateIdentifier')\nexport class PrivateIdentifier extends Identifier {\n\tstatic fromJSON(node: PrivateIdentifier): PrivateIdentifier {\n\t\treturn new PrivateIdentifier(\n\t\t\tnode.name as string\n\t\t);\n\t}\n\tconstructor(private privateName: string) {\n\t\tsuper('ɵ_' + privateName);\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\ttoString(): string {\n\t\treturn `#${this.privateName}`;\n\t}\n\ttoJson(): { [key: string]: any; } {\n\t\treturn {\n\t\t\tname: this.privateName\n\t\t};\n\t}\n}\n\nexport type MethodDefinitionKind = 'constructor' | 'method' | 'set' | 'get';\n\n/**\n * - When key is a PrivateIdentifier, computed must be false and kind can not be \"constructor\".\n */\n@Deserializer('MethodDefinition')\nexport class MethodDefinition extends AbstractExpressionNode implements CanDeclareExpression {\n\tstatic fromJSON(node: MethodDefinition, deserializer: NodeDeserializer<any>): MethodDefinition {\n\t\treturn new MethodDefinition(\n\t\t\tnode.kind,\n\t\t\tdeserializer(node.key),\n\t\t\tdeserializer(node.value),\n\t\t\tnode.computed,\n\t\t\tnode.static\n\t\t);\n\t}\n\tprivate 'static': boolean;\n\tconstructor(\n\t\tprivate kind: MethodDefinitionKind,\n\t\tprivate key: ExpressionNode | PrivateIdentifier,\n\t\tprivate value: FunctionExpression,\n\n\t\tprivate computed: boolean,\n\t\tisStatic: boolean) {\n\t\tsuper();\n\t\tthis.static = isStatic;\n\t}\n\tgetKind() {\n\t\treturn this.kind;\n\t}\n\tgetKey() {\n\t\treturn this.key;\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tisComputed() {\n\t\treturn this.computed;\n\t}\n\tisStatic() {\n\t\treturn this.static;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdeclareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoJson(): { [key: string]: any; } {\n\t\treturn {\n\t\t\tkind: this.kind,\n\t\t\tkey: this.key,\n\t\t\tvalue: this.value,\n\t\t\tcomputed: this.computed,\n\t\t\tstatic: this.static,\n\t\t};\n\t}\n}\n\n\n\n/**\n * - When key is a PrivateIdentifier, computed must be false.\n */\n@Deserializer('PropertyDefinition')\nexport class PropertyDefinition extends AbstractExpressionNode implements CanDeclareExpression {\n\tstatic fromJSON(node: PropertyDefinition, deserializer: NodeDeserializer<any>): PropertyDefinition {\n\t\treturn new PropertyDefinition(\n\t\t\tdeserializer(node.key),\n\t\t\tnode.computed,\n\t\t\tnode.static,\n\t\t\tnode.value && deserializer(node.value)\n\t\t);\n\t}\n\tprivate 'static': boolean;\n\tconstructor(\n\t\tprivate key: ExpressionNode | PrivateIdentifier,\n\t\tprivate computed: boolean,\n\t\tisStatic: boolean,\n\t\tprivate value?: ExpressionNode) {\n\t\tsuper();\n\t\tthis.static = isStatic;\n\t}\n\tgetKey() {\n\t\treturn this.key;\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tisComputed() {\n\t\treturn this.computed;\n\t}\n\tisStatic() {\n\t\treturn this.static;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdeclareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoJson(): { [key: string]: any; } {\n\t\treturn {\n\t\t\tkey: this.key.toJSON(),\n\t\t\tcomputed: this.computed,\n\t\t\tstatic: this.static,\n\t\t\tvalue: this.value?.toJSON()\n\t\t};\n\t}\n}\n\n@Deserializer('ClassBody')\nexport class ClassBody extends AbstractExpressionNode {\n\tstatic fromJSON(node: ClassBody, deserializer: NodeDeserializer<any>): ClassBody {\n\t\treturn new ClassBody(\n\t\t\tnode.body.map(deserializer)\n\t\t);\n\t}\n\tconstructor(private body: (MethodDefinition | PropertyDefinition)[]) {\n\t\tsuper();\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoJson(): { [key: string]: any; } {\n\t\treturn {\n\t\t\tbody: this.body.map(method => method.toJSON())\n\t\t};\n\t}\n}\n\nexport class Class extends AbstractExpressionNode {\n\tconstructor(\n\t\tprotected body: ClassBody,\n\t\tprotected id?: Identifier,\n\t\tprotected superClass?: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tgetId() {\n\t\treturn this.id;\n\t}\n\tgetSuperClass() {\n\t\treturn this.superClass;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`Class.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tthrow new Error(`Class.#get() has no implementation.`);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString() {\n\t\tlet classDeclaration = 'class ';\n\t\tif (this.id) {\n\t\t\tclassDeclaration += this.id.toString();\n\t\t}\n\t\tif (this.superClass) {\n\t\t\tclassDeclaration += ' extends ' + this.superClass.toString();\n\t\t}\n\t\treturn `${classDeclaration} {${this.body.toString()}\\n`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tbody: this.body.toJSON(),\n\t\t\tid: this.id?.toJSON(),\n\t\t\tsuperClass: this.superClass?.toJSON(),\n\t\t};\n\t}\n}\n\n@Deserializer('ClassDeclaration')\nexport class ClassDeclaration extends Class implements CanDeclareExpression {\n\tstatic fromJSON(node: ClassDeclaration, deserializer: NodeDeserializer<any>): ClassDeclaration {\n\t\treturn new ClassDeclaration(\n\t\t\tdeserializer(node.body),\n\t\t\tdeserializer(node.id),\n\t\t\tnode.superClass && deserializer(node.superClass)\n\t\t);\n\t}\n\tprotected id: Identifier;\n\tdeclareVariable(stack: Stack, scopeType: ScopeType, propertyValue?: any) {\n\t\tstack.declareVariable(scopeType, this.id.getName(), propertyValue);\n\t}\n}\n\n@Deserializer('ClassExpression')\nexport class ClassExpression extends Class {\n\tstatic fromJSON(node: ClassExpression, deserializer: NodeDeserializer<any>): ClassExpression {\n\t\treturn new ClassExpression(\n\t\t\tdeserializer(node.body),\n\t\t\tnode.id && deserializer(node.id),\n\t\t\tnode.superClass && deserializer(node.superClass)\n\t\t);\n\t}\n}\n"]}
|
package/api/app/program.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import type { ExpressionEventPath, ExpressionNode, NodeDeserializer } from '../expression.js';
|
|
2
|
+
import type { Scope } from '../../scope/scope.js';
|
|
1
3
|
import type { Stack } from '../../scope/stack.js';
|
|
2
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
3
|
-
import type { ExpressionNode, NodeDeserializer } from '../expression.js';
|
|
4
5
|
export declare type ProgramSourceType = 'script' | 'module';
|
|
5
6
|
export declare class Program extends AbstractExpressionNode {
|
|
6
7
|
private sourceType;
|
|
7
8
|
private body;
|
|
8
9
|
static fromJSON(node: Program, deserializer: NodeDeserializer): Program;
|
|
9
10
|
constructor(sourceType: ProgramSourceType, body: ExpressionNode[]);
|
|
11
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
10
12
|
set(stack: Stack, value: any): any;
|
|
11
13
|
get(stack: Stack, thisContext?: any): any;
|
|
12
|
-
|
|
14
|
+
dependency(computed?: true): ExpressionNode[];
|
|
15
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
13
16
|
toString(): string;
|
|
14
|
-
toJson(
|
|
17
|
+
toJson(): {
|
|
15
18
|
[key: string]: any;
|
|
16
19
|
};
|
|
17
20
|
}
|
package/api/app/program.js
CHANGED
|
@@ -11,19 +11,23 @@ let Program = Program_1 = class Program extends AbstractExpressionNode {
|
|
|
11
11
|
static fromJSON(node, deserializer) {
|
|
12
12
|
return new Program_1(node.sourceType, node.body.map(deserializer));
|
|
13
13
|
}
|
|
14
|
+
shareVariables(scopeList) { }
|
|
14
15
|
set(stack, value) {
|
|
15
16
|
throw new Error(`${this.constructor.name}#set() has no implementation.`);
|
|
16
17
|
}
|
|
17
18
|
get(stack, thisContext) {
|
|
18
19
|
throw new Error(`${this.constructor.name}#set() has no implementation.`);
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
throw new Error(
|
|
21
|
+
dependency(computed) {
|
|
22
|
+
throw new Error('Method not implemented.');
|
|
23
|
+
}
|
|
24
|
+
dependencyPath(computed) {
|
|
25
|
+
throw new Error('Method not implemented.');
|
|
22
26
|
}
|
|
23
27
|
toString() {
|
|
24
28
|
throw new Error(`${this.constructor.name}#set() has no implementation.`);
|
|
25
29
|
}
|
|
26
|
-
toJson(
|
|
30
|
+
toJson() {
|
|
27
31
|
throw new Error(`${this.constructor.name}#set() has no implementation.`);
|
|
28
32
|
}
|
|
29
33
|
};
|
package/api/app/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../../../src/expressions/api/app/program.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../../../src/expressions/api/app/program.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D,IAAa,OAAO,eAApB,MAAa,OAAQ,SAAQ,sBAAsB;IAKlD,YAAoB,UAA6B,EAAU,IAAsB;QAChF,KAAK,EAAE,CAAC;QADW,eAAU,GAAV,UAAU,CAAmB;QAAU,SAAI,GAAJ,IAAI,CAAkB;IAEjF,CAAC;IALD,MAAM,CAAC,QAAQ,CAAC,IAAa,EAAE,YAA8B;QAC5D,OAAO,IAAI,SAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAClE,CAAC;IAID,cAAc,CAAC,SAAuB,IAAU,CAAC;IACjD,GAAG,CAAC,KAAY,EAAE,KAAU;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,+BAA+B,CAAC,CAAC;IAC1E,CAAC;IACD,GAAG,CAAC,KAAY,EAAE,WAAiB;QAClC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,+BAA+B,CAAC,CAAC;IAC1E,CAAC;IAED,UAAU,CAAC,QAAe;QACzB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,QAAQ;QACP,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,+BAA+B,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM;QACL,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,+BAA+B,CAAC,CAAC;IAC1E,CAAC;CAED,CAAA;AA7BY,OAAO;IADnB,YAAY,CAAC,SAAS,CAAC;;GACX,OAAO,CA6BnB;SA7BY,OAAO","sourcesContent":["import type { ExpressionEventPath, ExpressionNode, NodeDeserializer } from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\n\nexport type ProgramSourceType = 'script' | 'module';\n\n@Deserializer('Program')\nexport class Program extends AbstractExpressionNode {\n\n\tstatic fromJSON(node: Program, deserializer: NodeDeserializer): Program {\n\t\treturn new Program(node.sourceType, node.body.map(deserializer));\n\t}\n\tconstructor(private sourceType: ProgramSourceType, private body: ExpressionNode[]) {\n\t\tsuper();\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any): any {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\tget(stack: Stack, thisContext?: any): any {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\n\tdependency(computed?: true): ExpressionNode[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\ttoString(): string {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\ttoJson(): { [key: string]: any } {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\n}"]}
|
package/api/computing/call.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { NodeDeserializer, ExpressionNode } from '../expression.js';
|
|
1
|
+
import type { NodeDeserializer, ExpressionNode, ExpressionEventPath } from '../expression.js';
|
|
2
|
+
import type { Scope } from '../../scope/scope.js';
|
|
2
3
|
import type { Stack } from '../../scope/stack.js';
|
|
3
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
5
|
export declare class CallExpression extends AbstractExpressionNode {
|
|
@@ -9,9 +10,11 @@ export declare class CallExpression extends AbstractExpressionNode {
|
|
|
9
10
|
constructor(callee: ExpressionNode, params: ExpressionNode[], optional?: boolean);
|
|
10
11
|
getCallee(): ExpressionNode;
|
|
11
12
|
getArguments(): ExpressionNode[];
|
|
13
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
12
14
|
set(stack: Stack, value: any): void;
|
|
13
15
|
get(stack: Stack, thisContext?: any): any;
|
|
14
|
-
|
|
16
|
+
dependency(computed?: true): ExpressionNode[];
|
|
17
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
15
18
|
toString(): string;
|
|
16
19
|
toJson(): object;
|
|
17
20
|
}
|