@ibyar/expressions 0.8.3 → 0.8.4
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 +0 -3
- package/api/abstract.d.ts +6 -2
- package/api/abstract.js +15 -8
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +15 -18
- package/api/class/class.js +49 -61
- package/api/class/class.js.map +1 -1
- package/api/class/decorator.d.ts +2 -2
- package/api/class/decorator.js +6 -6
- package/api/class/decorator.js.map +1 -1
- package/api/computing/call.d.ts +2 -2
- package/api/computing/call.js +8 -8
- package/api/computing/call.js.map +1 -1
- package/api/computing/debugger.d.ts +1 -2
- package/api/computing/debugger.js +2 -3
- package/api/computing/debugger.js.map +1 -1
- package/api/computing/new.d.ts +2 -2
- package/api/computing/new.js +7 -7
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +2 -2
- package/api/computing/rest.js +6 -6
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +2 -2
- package/api/computing/return.js +6 -6
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +2 -2
- package/api/computing/spread.js +6 -6
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +4 -4
- package/api/computing/throw.js +18 -18
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +2 -2
- package/api/computing/yield.js +7 -7
- package/api/computing/yield.js.map +1 -1
- package/api/definition/array.d.ts +3 -3
- package/api/definition/array.js +14 -14
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +2 -2
- package/api/definition/bind.js +9 -9
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +3 -3
- package/api/definition/comment.js +6 -6
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +17 -16
- package/api/definition/function.js +60 -55
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +2 -2
- package/api/definition/member.js +13 -9
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +4 -4
- package/api/definition/object.js +22 -22
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +2 -2
- package/api/definition/statement.js +6 -6
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +15 -37
- package/api/definition/values.js +49 -74
- package/api/definition/values.js.map +1 -1
- package/api/expression.d.ts +42 -8
- 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/common.d.ts +3 -3
- package/api/module/common.js +9 -9
- package/api/module/common.js.map +1 -1
- package/api/module/export.d.ts +5 -5
- package/api/module/export.js +30 -29
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +4 -4
- package/api/module/import.js +24 -23
- package/api/module/import.js.map +1 -1
- package/api/operators/assignment.d.ts +3 -3
- package/api/operators/assignment.js +5 -5
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +3 -3
- package/api/operators/await.js +7 -7
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +1 -1
- package/api/operators/binary.js +1 -1
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +2 -2
- package/api/operators/chaining.js +6 -6
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +2 -2
- package/api/operators/comma.js +6 -6
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +2 -2
- package/api/operators/grouping.js +6 -6
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +1 -1
- package/api/operators/logical.js +1 -1
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +3 -3
- package/api/operators/pipeline.js +8 -8
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +2 -2
- package/api/operators/ternary.js +8 -8
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/types.d.ts +1 -1
- package/api/operators/unary.d.ts +3 -3
- package/api/operators/unary.js +7 -7
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +3 -3
- package/api/operators/update.js +8 -8
- package/api/operators/update.js.map +1 -1
- package/api/program.d.ts +3 -3
- package/api/program.js +7 -7
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +2 -2
- package/api/statement/control/block.js +6 -6
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +2 -3
- package/api/statement/control/empty.js +6 -7
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +2 -2
- package/api/statement/control/if.js +8 -8
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +4 -6
- package/api/statement/control/switch.js +19 -20
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +4 -4
- package/api/statement/control/terminate.js +11 -15
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/control/with.d.ts +21 -0
- package/api/statement/control/with.js +67 -0
- package/api/statement/control/with.js.map +1 -0
- package/api/statement/declarations/declares.d.ts +4 -4
- package/api/statement/declarations/declares.js +14 -14
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +7 -7
- package/api/statement/iterations/for.js +35 -35
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +3 -3
- package/api/statement/iterations/while.js +14 -14
- package/api/statement/iterations/while.js.map +1 -1
- package/package.json +14 -4
- package/scope/finalizer.d.ts +1 -1
- package/scope/pool.d.ts +1 -1
- package/scope/proxy.d.ts +1 -1
- package/scope/proxy.js +1 -0
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +2 -2
- package/scope/scope.js +13 -16
- package/scope/scope.js.map +1 -1
- package/scope/stack.js +23 -23
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +4 -2
- package/v8/enums.js.map +1 -1
- package/v8/factory.d.ts +148 -0
- package/v8/factory.js +499 -0
- package/v8/factory.js.map +1 -0
- package/v8/inline.d.ts +49 -49
- package/v8/inline.js +314 -305
- package/v8/inline.js.map +1 -1
- package/v8/node.d.ts +141 -0
- package/v8/node.js +2 -0
- package/v8/node.js.map +1 -0
- package/v8/nodes.d.ts +0 -14
- package/v8/nodes.js +1 -152
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +21 -18
- package/v8/parser.js +97 -84
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +2 -1
- package/v8/stream.js +221 -311
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +3 -1
- package/v8/token.js +7 -5
- package/v8/token.js.map +1 -1
- package/visit/visitor.d.ts +1 -1
package/README.md
CHANGED
|
@@ -117,9 +117,6 @@ console.log(
|
|
|
117
117
|
|
|
118
118
|
- [V8 JavaScript engine](https://github.com/v8/v8) to parse js source code.
|
|
119
119
|
- for now this parser does not provide any info about `SourceLocation`
|
|
120
|
-
|
|
121
|
-
## Future Feature
|
|
122
|
-
|
|
123
120
|
- class expression
|
|
124
121
|
- Import/Export module
|
|
125
122
|
- Custom Factory Builder to convert the code to ESTree directly or to executable expression node
|
package/api/abstract.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { AwaitPromiseInfo, Stack } from '../scope/stack.js';
|
|
2
|
-
import type { NodeDeserializer, ExpressionNode, ExpressionNodConstructor, NodeJsonType, DeclarationExpression, ExpressionEventMap, ExpressionEventPath, VisitNodeType } from './expression.js';
|
|
2
|
+
import type { NodeDeserializer, ExpressionNode, ExpressionNodConstructor, NodeJsonType, DeclarationExpression, ExpressionEventMap, ExpressionEventPath, VisitNodeType, SourceLocation } from './expression.js';
|
|
3
3
|
export declare abstract class AbstractExpressionNode implements ExpressionNode {
|
|
4
4
|
static fromJSON(node: ExpressionNode, deserializer: NodeDeserializer): ExpressionNode;
|
|
5
|
+
type: string;
|
|
6
|
+
loc?: SourceLocation;
|
|
7
|
+
range?: [number, number];
|
|
8
|
+
constructor(range?: [number, number], loc?: SourceLocation);
|
|
5
9
|
getClass(): ExpressionNodConstructor<ExpressionNode>;
|
|
6
10
|
toJSON(key?: string): NodeJsonType;
|
|
7
11
|
events(): ExpressionEventMap;
|
|
@@ -19,7 +23,7 @@ export declare abstract class InfixExpressionNode<T> extends AbstractExpressionN
|
|
|
19
23
|
protected left: ExpressionNode;
|
|
20
24
|
protected right: ExpressionNode;
|
|
21
25
|
static visit(node: InfixExpressionNode<any>, visitNode: VisitNodeType): void;
|
|
22
|
-
constructor(operator: T, left: ExpressionNode, right: ExpressionNode);
|
|
26
|
+
constructor(operator: T, left: ExpressionNode, right: ExpressionNode, range?: [number, number], loc?: SourceLocation);
|
|
23
27
|
getOperator(): T;
|
|
24
28
|
getLeft(): ExpressionNode;
|
|
25
29
|
getRight(): ExpressionNode;
|
package/api/abstract.js
CHANGED
|
@@ -22,13 +22,20 @@ export class AbstractExpressionNode {
|
|
|
22
22
|
static fromJSON(node, deserializer) {
|
|
23
23
|
return deserializer(node);
|
|
24
24
|
}
|
|
25
|
+
constructor(range, loc) {
|
|
26
|
+
this.type = this.getClass().type;
|
|
27
|
+
range && (this.range = range);
|
|
28
|
+
loc && (this.loc = loc);
|
|
29
|
+
}
|
|
25
30
|
getClass() {
|
|
26
31
|
return this.constructor;
|
|
27
32
|
}
|
|
28
33
|
toJSON(key) {
|
|
29
|
-
const type = this.getClass().type;
|
|
30
34
|
const json = this.toJson(key);
|
|
31
|
-
|
|
35
|
+
const index = {};
|
|
36
|
+
this.range && (index.range = this.range);
|
|
37
|
+
this.loc && (index.loc = this.loc);
|
|
38
|
+
return Object.assign({ type: this.type }, json, index);
|
|
32
39
|
}
|
|
33
40
|
events() {
|
|
34
41
|
const dependencyNodes = this.dependency();
|
|
@@ -41,16 +48,16 @@ export class AbstractExpressionNode {
|
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
export class InfixExpressionNode extends AbstractExpressionNode {
|
|
44
|
-
constructor(operator, left, right) {
|
|
45
|
-
super();
|
|
46
|
-
this.operator = operator;
|
|
47
|
-
this.left = left;
|
|
48
|
-
this.right = right;
|
|
49
|
-
}
|
|
50
51
|
static visit(node, visitNode) {
|
|
51
52
|
visitNode(node.getLeft());
|
|
52
53
|
visitNode(node.getRight());
|
|
53
54
|
}
|
|
55
|
+
constructor(operator, left, right, range, loc) {
|
|
56
|
+
super(range, loc);
|
|
57
|
+
this.operator = operator;
|
|
58
|
+
this.left = left;
|
|
59
|
+
this.right = right;
|
|
60
|
+
}
|
|
54
61
|
getOperator() {
|
|
55
62
|
return this.operator;
|
|
56
63
|
}
|
package/api/abstract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/expressions/api/abstract.ts"],"names":[],"mappings":"AAOA,SAAS,0BAA0B,CAAC,YAAgC,EAAE,IAA2B;IAChG,IAAI,OAAO,GAAG,YAAY,CAAC;IAC3B,iBAAiB;IACjB,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;QACxB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,QAAQ,EAAE;YACb,OAAO,GAAG,QAAQ,CAAC;YACnB,SAAS;SACT;QACD,uCAAuC;QACvC,mCAAmC;QACnC,aAAa;QACb,IAAI;QACJ,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,0BAA0B,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;SAClF;KACD;AACF,CAAC;
|
|
1
|
+
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/expressions/api/abstract.ts"],"names":[],"mappings":"AAOA,SAAS,0BAA0B,CAAC,YAAgC,EAAE,IAA2B;IAChG,IAAI,OAAO,GAAG,YAAY,CAAC;IAC3B,iBAAiB;IACjB,KAAK,MAA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CAAc;IAAI,CAAC;CAC7C","sourcesContent":["import type { AwaitPromiseInfo, Stack } from '../scope/stack.js';\nimport type {\n\tNodeDeserializer, ExpressionNode, ExpressionNodConstructor,\n\tNodeJsonType, DeclarationExpression, ExpressionEventMap,\n\tExpressionEventPath, VisitNodeType, SourceLocation\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}\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\ttype: string;\n\tloc?: SourceLocation;\n\trange?: [number, number];\n\tconstructor(range?: [number, number], loc?: SourceLocation) {\n\t\tthis.type = this.getClass().type;\n\t\trange && (this.range = range);\n\t\tloc && (this.loc = loc);\n\t}\n\tgetClass(): ExpressionNodConstructor<ExpressionNode> {\n\t\treturn this.constructor as ExpressionNodConstructor<ExpressionNode>;\n\t}\n\ttoJSON(key?: string): NodeJsonType {\n\t\tconst json = this.toJson(key);\n\t\tconst index: { range?: [number, number], loc?: SourceLocation } = {};\n\t\tthis.range && (index.range = this.range);\n\t\tthis.loc && (index.loc = this.loc);\n\t\treturn Object.assign({ type: this.type }, json, index);\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 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}\n\nexport abstract class InfixExpressionNode<T> extends AbstractExpressionNode {\n\tstatic visit(node: InfixExpressionNode<any>, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.getLeft());\n\t\tvisitNode(node.getRight())\n\t}\n\tconstructor(protected operator: T, protected left: ExpressionNode, protected right: ExpressionNode, range?: [number, number], loc?: SourceLocation) {\n\t\tsuper(range, loc);\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\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: DeclarationExpression;\n\tdeclareVariable: boolean;\n\tconstructor(public promise: Promise<any>) { }\n}\n"]}
|
package/api/class/class.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeclarationExpression, ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from '../expression.js';
|
|
1
|
+
import type { DeclarationExpression, ExpressionEventPath, ExpressionNode, NodeDeserializer, SourceLocation, VisitNodeType } from '../expression.js';
|
|
2
2
|
import { Stack } from '../../scope/stack.js';
|
|
3
3
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
4
|
import { Identifier } from '../definition/values.js';
|
|
@@ -31,7 +31,7 @@ interface ClassInstance {
|
|
|
31
31
|
*/
|
|
32
32
|
[key: PropertyKey]: any;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
type PropertyInitializer = () => {
|
|
35
35
|
key: PropertyKey;
|
|
36
36
|
value: any;
|
|
37
37
|
isPrivate: boolean;
|
|
@@ -85,9 +85,8 @@ declare class ClassInitializer {
|
|
|
85
85
|
* A `super` pseudo-expression.
|
|
86
86
|
*/
|
|
87
87
|
export declare class Super extends AbstractExpressionNode {
|
|
88
|
-
static INSTANCE: Super;
|
|
89
88
|
static fromJSON(node: Super): Super;
|
|
90
|
-
constructor();
|
|
89
|
+
constructor(range?: [number, number], loc?: SourceLocation);
|
|
91
90
|
set(stack: Stack, value: any): void;
|
|
92
91
|
get(stack: Stack, thisContext?: any): any;
|
|
93
92
|
dependency(computed?: true): ExpressionNode[];
|
|
@@ -107,12 +106,9 @@ export declare class Super extends AbstractExpressionNode {
|
|
|
107
106
|
export declare class MetaProperty extends AbstractExpressionNode {
|
|
108
107
|
private meta;
|
|
109
108
|
private property;
|
|
110
|
-
static NewTarget: MetaProperty;
|
|
111
|
-
static ImportMeta: MetaProperty;
|
|
112
|
-
private static getJsonName;
|
|
113
109
|
static fromJSON(node: MetaProperty, deserializer: NodeDeserializer<any>): MetaProperty;
|
|
114
110
|
static visit(node: MetaProperty, visitNode: VisitNodeType): void;
|
|
115
|
-
constructor(meta: Identifier, property: Identifier);
|
|
111
|
+
constructor(meta: Identifier, property: Identifier, range?: [number, number], loc?: SourceLocation);
|
|
116
112
|
getMeta(): Identifier;
|
|
117
113
|
getProperty(): Identifier;
|
|
118
114
|
get(stack: Stack): any;
|
|
@@ -138,7 +134,6 @@ export declare class PrivateIdentifier extends Identifier {
|
|
|
138
134
|
*/
|
|
139
135
|
export declare class StaticBlock extends BlockStatement {
|
|
140
136
|
static fromJSON(node: StaticBlock, deserializer: NodeDeserializer<any>): StaticBlock;
|
|
141
|
-
constructor(body: ExpressionNode[]);
|
|
142
137
|
get(stack: Stack, classInitializer?: ClassInitializer): void;
|
|
143
138
|
toString(): string;
|
|
144
139
|
toJson(): object;
|
|
@@ -149,7 +144,7 @@ export declare abstract class AbstractDefinition extends AbstractExpressionNode
|
|
|
149
144
|
protected computed: boolean;
|
|
150
145
|
protected value?: ExpressionNode | undefined;
|
|
151
146
|
protected 'static': boolean;
|
|
152
|
-
constructor(key: ExpressionNode | PrivateIdentifier, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode | undefined);
|
|
147
|
+
constructor(key: ExpressionNode | PrivateIdentifier, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode | undefined, range?: [number, number], loc?: SourceLocation);
|
|
153
148
|
getKey(): ExpressionNode | PrivateIdentifier;
|
|
154
149
|
getValue(): ExpressionNode | undefined;
|
|
155
150
|
isComputed(): boolean;
|
|
@@ -166,7 +161,7 @@ export declare abstract class AbstractDefinition extends AbstractExpressionNode
|
|
|
166
161
|
[key: string]: any;
|
|
167
162
|
};
|
|
168
163
|
}
|
|
169
|
-
export
|
|
164
|
+
export type MethodDefinitionKind = 'constructor' | 'method' | 'set' | 'get';
|
|
170
165
|
/**
|
|
171
166
|
* - When key is a PrivateIdentifier, computed must be false and kind can not be "constructor".
|
|
172
167
|
*/
|
|
@@ -174,9 +169,10 @@ export declare class MethodDefinition extends AbstractDefinition {
|
|
|
174
169
|
private kind;
|
|
175
170
|
static fromJSON(node: MethodDefinition, deserializer: NodeDeserializer<any>): MethodDefinition;
|
|
176
171
|
static visit(node: MethodDefinition, visitNode: VisitNodeType): void;
|
|
177
|
-
protected
|
|
172
|
+
protected 'static': boolean;
|
|
173
|
+
value: FunctionExpression;
|
|
178
174
|
afterInstanceConstruct: any;
|
|
179
|
-
constructor(kind: MethodDefinitionKind, key: ExpressionNode | PrivateIdentifier, value: FunctionExpression, decorators: Decorator[], computed: boolean, isStatic: boolean);
|
|
175
|
+
constructor(kind: MethodDefinitionKind, key: ExpressionNode | PrivateIdentifier, value: FunctionExpression, decorators: Decorator[], computed: boolean, isStatic: boolean, range?: [number, number], loc?: SourceLocation);
|
|
180
176
|
getKind(): MethodDefinitionKind;
|
|
181
177
|
getValue(): FunctionExpression;
|
|
182
178
|
get(stack: Stack, initializer: ClassInitializer): void;
|
|
@@ -193,7 +189,7 @@ export declare class MethodDefinition extends AbstractDefinition {
|
|
|
193
189
|
export declare class PropertyDefinition extends AbstractDefinition {
|
|
194
190
|
static fromJSON(node: PropertyDefinition, deserializer: NodeDeserializer<any>): PropertyDefinition;
|
|
195
191
|
static visit(node: PropertyDefinition, visitNode: VisitNodeType): void;
|
|
196
|
-
constructor(key: ExpressionNode | PrivateIdentifier, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode);
|
|
192
|
+
constructor(key: ExpressionNode | PrivateIdentifier, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode, range?: [number, number], loc?: SourceLocation);
|
|
197
193
|
get(stack: Stack, initializer: ClassInitializer): void;
|
|
198
194
|
toString(): string;
|
|
199
195
|
toJson(): {
|
|
@@ -203,7 +199,7 @@ export declare class PropertyDefinition extends AbstractDefinition {
|
|
|
203
199
|
export declare class AccessorProperty extends AbstractDefinition {
|
|
204
200
|
static fromJSON(node: AccessorProperty, deserializer: NodeDeserializer): AccessorProperty;
|
|
205
201
|
static visit(node: AccessorProperty, visitNode: VisitNodeType): void;
|
|
206
|
-
constructor(key: ExpressionNode, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode);
|
|
202
|
+
constructor(key: ExpressionNode, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode, range?: [number, number], loc?: SourceLocation);
|
|
207
203
|
get(stack: Stack, initializer: ClassInitializer): void;
|
|
208
204
|
toString(): string;
|
|
209
205
|
toJson(): {
|
|
@@ -214,7 +210,7 @@ export declare class ClassBody extends AbstractExpressionNode {
|
|
|
214
210
|
private body;
|
|
215
211
|
static fromJSON(node: ClassBody, deserializer: NodeDeserializer<any>): ClassBody;
|
|
216
212
|
static visit(node: ClassBody, visitNode: VisitNodeType): void;
|
|
217
|
-
constructor(body: (MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock)[]);
|
|
213
|
+
constructor(body: (MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock)[], range?: [number, number], loc?: SourceLocation);
|
|
218
214
|
getBody(): (StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty)[];
|
|
219
215
|
set(stack: Stack, value: any): void;
|
|
220
216
|
get(stack: Stack, initializer: ClassInitializer): void;
|
|
@@ -230,7 +226,7 @@ export declare class Class extends AbstractExpressionNode {
|
|
|
230
226
|
protected decorators: Decorator[];
|
|
231
227
|
protected id?: Identifier | undefined;
|
|
232
228
|
protected superClass?: ExpressionNode | undefined;
|
|
233
|
-
constructor(body: ClassBody, decorators: Decorator[], id?: Identifier | undefined, superClass?: ExpressionNode | undefined);
|
|
229
|
+
constructor(body: ClassBody, decorators: Decorator[], id?: Identifier | undefined, superClass?: ExpressionNode | undefined, range?: [number, number], loc?: SourceLocation);
|
|
234
230
|
getBody(): ClassBody;
|
|
235
231
|
getDecorators(): Decorator[];
|
|
236
232
|
getId(): Identifier | undefined;
|
|
@@ -247,7 +243,7 @@ export declare class ClassDeclaration extends Class implements DeclarationExpres
|
|
|
247
243
|
static fromJSON(node: ClassDeclaration, deserializer: NodeDeserializer<any>): ClassDeclaration;
|
|
248
244
|
static visit(node: ClassDeclaration, visitNode: VisitNodeType): void;
|
|
249
245
|
protected id: Identifier;
|
|
250
|
-
constructor(body: ClassBody, decorators: Decorator[], id: Identifier, superClass?: ExpressionNode);
|
|
246
|
+
constructor(body: ClassBody, decorators: Decorator[], id: Identifier, superClass?: ExpressionNode, range?: [number, number], loc?: SourceLocation);
|
|
251
247
|
declareVariable(stack: Stack, propertyValue?: any): void;
|
|
252
248
|
getDeclarationName(): string;
|
|
253
249
|
get(stack: Stack): ClassConstructor;
|
|
@@ -255,5 +251,6 @@ export declare class ClassDeclaration extends Class implements DeclarationExpres
|
|
|
255
251
|
export declare class ClassExpression extends Class {
|
|
256
252
|
static fromJSON(node: ClassExpression, deserializer: NodeDeserializer<any>): ClassExpression;
|
|
257
253
|
static visit(node: ClassExpression, visitNode: VisitNodeType): void;
|
|
254
|
+
constructor(body: ClassBody, decorators: Decorator[], id?: Identifier, superClass?: ExpressionNode, range?: [number, number], loc?: SourceLocation);
|
|
258
255
|
}
|
|
259
256
|
export {};
|
package/api/class/class.js
CHANGED
|
@@ -87,11 +87,11 @@ class ClassInitializer {
|
|
|
87
87
|
* A `super` pseudo-expression.
|
|
88
88
|
*/
|
|
89
89
|
let Super = Super_1 = class Super extends AbstractExpressionNode {
|
|
90
|
-
constructor() {
|
|
91
|
-
super();
|
|
92
|
-
}
|
|
93
90
|
static fromJSON(node) {
|
|
94
|
-
return Super_1.
|
|
91
|
+
return new Super_1(node.range, node.loc);
|
|
92
|
+
}
|
|
93
|
+
constructor(range, loc) {
|
|
94
|
+
super(range, loc);
|
|
95
95
|
}
|
|
96
96
|
set(stack, value) {
|
|
97
97
|
throw new Error('Super.#set() Method not implemented.');
|
|
@@ -112,10 +112,9 @@ let Super = Super_1 = class Super extends AbstractExpressionNode {
|
|
|
112
112
|
return {};
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
Super.INSTANCE = new Super_1();
|
|
116
115
|
Super = Super_1 = __decorate([
|
|
117
116
|
Deserializer('Super'),
|
|
118
|
-
__metadata("design:paramtypes", [])
|
|
117
|
+
__metadata("design:paramtypes", [Array, Object])
|
|
119
118
|
], Super);
|
|
120
119
|
export { Super };
|
|
121
120
|
/**
|
|
@@ -126,27 +125,18 @@ export { Super };
|
|
|
126
125
|
* In the future, it will represent other meta properties as well.
|
|
127
126
|
*/
|
|
128
127
|
let MetaProperty = MetaProperty_1 = class MetaProperty extends AbstractExpressionNode {
|
|
129
|
-
constructor(meta, property) {
|
|
130
|
-
super();
|
|
131
|
-
this.meta = meta;
|
|
132
|
-
this.property = property;
|
|
133
|
-
}
|
|
134
|
-
static getJsonName(identifier) {
|
|
135
|
-
return Reflect.get(identifier, 'name');
|
|
136
|
-
}
|
|
137
128
|
static fromJSON(node, deserializer) {
|
|
138
|
-
|
|
139
|
-
return MetaProperty_1.NewTarget;
|
|
140
|
-
}
|
|
141
|
-
else if (MetaProperty_1.getJsonName(node.meta) === 'import' && MetaProperty_1.getJsonName(node.property) === 'meta') {
|
|
142
|
-
return MetaProperty_1.ImportMeta;
|
|
143
|
-
}
|
|
144
|
-
return new MetaProperty_1(deserializer(node.meta), deserializer(node.property));
|
|
129
|
+
return new MetaProperty_1(deserializer(node.meta), deserializer(node.property), node.range, node.loc);
|
|
145
130
|
}
|
|
146
131
|
static visit(node, visitNode) {
|
|
147
132
|
visitNode(node.meta);
|
|
148
133
|
visitNode(node.property);
|
|
149
134
|
}
|
|
135
|
+
constructor(meta, property, range, loc) {
|
|
136
|
+
super(range, loc);
|
|
137
|
+
this.meta = meta;
|
|
138
|
+
this.property = property;
|
|
139
|
+
}
|
|
150
140
|
getMeta() {
|
|
151
141
|
return this.meta;
|
|
152
142
|
}
|
|
@@ -179,11 +169,9 @@ let MetaProperty = MetaProperty_1 = class MetaProperty extends AbstractExpressio
|
|
|
179
169
|
};
|
|
180
170
|
}
|
|
181
171
|
};
|
|
182
|
-
MetaProperty.NewTarget = new MetaProperty_1(new Identifier('new'), new Identifier('target'));
|
|
183
|
-
MetaProperty.ImportMeta = new MetaProperty_1(new Identifier('import'), new Identifier('meta'));
|
|
184
172
|
MetaProperty = MetaProperty_1 = __decorate([
|
|
185
173
|
Deserializer('MetaProperty'),
|
|
186
|
-
__metadata("design:paramtypes", [Identifier, Identifier])
|
|
174
|
+
__metadata("design:paramtypes", [Identifier, Identifier, Array, Object])
|
|
187
175
|
], MetaProperty);
|
|
188
176
|
export { MetaProperty };
|
|
189
177
|
/**
|
|
@@ -191,7 +179,7 @@ export { MetaProperty };
|
|
|
191
179
|
*/
|
|
192
180
|
let PrivateIdentifier = PrivateIdentifier_1 = class PrivateIdentifier extends Identifier {
|
|
193
181
|
static fromJSON(node) {
|
|
194
|
-
return new PrivateIdentifier_1(node.name);
|
|
182
|
+
return new PrivateIdentifier_1(node.name, node.range, node.loc);
|
|
195
183
|
}
|
|
196
184
|
get(stack, thisContext) {
|
|
197
185
|
return thisContext[PRIVATE_SYMBOL][this.name];
|
|
@@ -213,10 +201,7 @@ export { PrivateIdentifier };
|
|
|
213
201
|
*/
|
|
214
202
|
let StaticBlock = StaticBlock_1 = class StaticBlock extends BlockStatement {
|
|
215
203
|
static fromJSON(node, deserializer) {
|
|
216
|
-
return new StaticBlock_1(deserializer(node.body));
|
|
217
|
-
}
|
|
218
|
-
constructor(body) {
|
|
219
|
-
super(body);
|
|
204
|
+
return new StaticBlock_1(deserializer(node.body), node.range, node.loc);
|
|
220
205
|
}
|
|
221
206
|
get(stack, classInitializer) {
|
|
222
207
|
classInitializer?.addStaticInitializerBlock(super.get(stack));
|
|
@@ -231,13 +216,12 @@ let StaticBlock = StaticBlock_1 = class StaticBlock extends BlockStatement {
|
|
|
231
216
|
}
|
|
232
217
|
};
|
|
233
218
|
StaticBlock = StaticBlock_1 = __decorate([
|
|
234
|
-
Deserializer('StaticBlock')
|
|
235
|
-
__metadata("design:paramtypes", [Array])
|
|
219
|
+
Deserializer('StaticBlock')
|
|
236
220
|
], StaticBlock);
|
|
237
221
|
export { StaticBlock };
|
|
238
222
|
export class AbstractDefinition extends AbstractExpressionNode {
|
|
239
|
-
constructor(key, decorators, computed, isStatic, value) {
|
|
240
|
-
super();
|
|
223
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
224
|
+
super(range, loc);
|
|
241
225
|
this.key = key;
|
|
242
226
|
this.decorators = decorators;
|
|
243
227
|
this.computed = computed;
|
|
@@ -286,18 +270,18 @@ export class AbstractDefinition extends AbstractExpressionNode {
|
|
|
286
270
|
* - When key is a PrivateIdentifier, computed must be false and kind can not be "constructor".
|
|
287
271
|
*/
|
|
288
272
|
let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends AbstractDefinition {
|
|
289
|
-
constructor(kind, key, value, decorators, computed, isStatic) {
|
|
290
|
-
super(key, decorators, computed, isStatic, value);
|
|
291
|
-
this.kind = kind;
|
|
292
|
-
}
|
|
293
273
|
static fromJSON(node, deserializer) {
|
|
294
|
-
return new MethodDefinition_1(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static);
|
|
274
|
+
return new MethodDefinition_1(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static, node.range, node.loc);
|
|
295
275
|
}
|
|
296
276
|
static visit(node, visitNode) {
|
|
297
277
|
visitNode(node.key);
|
|
298
278
|
visitNode(node.value);
|
|
299
279
|
node.decorators.forEach(visitNode);
|
|
300
280
|
}
|
|
281
|
+
constructor(kind, key, value, decorators, computed, isStatic, range, loc) {
|
|
282
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
283
|
+
this.kind = kind;
|
|
284
|
+
}
|
|
301
285
|
getKind() {
|
|
302
286
|
return this.kind;
|
|
303
287
|
}
|
|
@@ -422,7 +406,7 @@ let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends Abstr
|
|
|
422
406
|
};
|
|
423
407
|
MethodDefinition = MethodDefinition_1 = __decorate([
|
|
424
408
|
Deserializer('MethodDefinition'),
|
|
425
|
-
__metadata("design:paramtypes", [String, Object, FunctionExpression, Array, Boolean, Boolean])
|
|
409
|
+
__metadata("design:paramtypes", [String, Object, FunctionExpression, Array, Boolean, Boolean, Array, Object])
|
|
426
410
|
], MethodDefinition);
|
|
427
411
|
export { MethodDefinition };
|
|
428
412
|
/**
|
|
@@ -430,14 +414,14 @@ export { MethodDefinition };
|
|
|
430
414
|
*/
|
|
431
415
|
let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends AbstractDefinition {
|
|
432
416
|
static fromJSON(node, deserializer) {
|
|
433
|
-
return new PropertyDefinition_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value));
|
|
417
|
+
return new PropertyDefinition_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value), node.range, node.loc);
|
|
434
418
|
}
|
|
435
419
|
static visit(node, visitNode) {
|
|
436
420
|
visitNode(node.key);
|
|
437
421
|
node.value && visitNode(node.value);
|
|
438
422
|
}
|
|
439
|
-
constructor(key, decorators, computed, isStatic, value) {
|
|
440
|
-
super(key, decorators, computed, isStatic, value);
|
|
423
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
424
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
441
425
|
}
|
|
442
426
|
get(stack, initializer) {
|
|
443
427
|
const name = this.getKeyName(stack);
|
|
@@ -471,20 +455,20 @@ let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends
|
|
|
471
455
|
};
|
|
472
456
|
PropertyDefinition = PropertyDefinition_1 = __decorate([
|
|
473
457
|
Deserializer('PropertyDefinition'),
|
|
474
|
-
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object])
|
|
458
|
+
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object, Array, Object])
|
|
475
459
|
], PropertyDefinition);
|
|
476
460
|
export { PropertyDefinition };
|
|
477
461
|
let AccessorProperty = AccessorProperty_1 = class AccessorProperty extends AbstractDefinition {
|
|
478
462
|
static fromJSON(node, deserializer) {
|
|
479
|
-
return new AccessorProperty_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0);
|
|
463
|
+
return new AccessorProperty_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0, node.range, node.loc);
|
|
480
464
|
}
|
|
481
465
|
static visit(node, visitNode) {
|
|
482
466
|
visitNode(node.key);
|
|
483
467
|
node.value && visitNode(node.value);
|
|
484
468
|
node.decorators.forEach(visitNode);
|
|
485
469
|
}
|
|
486
|
-
constructor(key, decorators, computed, isStatic, value) {
|
|
487
|
-
super(key, decorators, computed, isStatic, value);
|
|
470
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
471
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
488
472
|
}
|
|
489
473
|
get(stack, initializer) {
|
|
490
474
|
const name = this.getKeyName(stack);
|
|
@@ -526,20 +510,20 @@ let AccessorProperty = AccessorProperty_1 = class AccessorProperty extends Abstr
|
|
|
526
510
|
};
|
|
527
511
|
AccessorProperty = AccessorProperty_1 = __decorate([
|
|
528
512
|
Deserializer('AccessorProperty'),
|
|
529
|
-
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object])
|
|
513
|
+
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object, Array, Object])
|
|
530
514
|
], AccessorProperty);
|
|
531
515
|
export { AccessorProperty };
|
|
532
516
|
let ClassBody = ClassBody_1 = class ClassBody extends AbstractExpressionNode {
|
|
533
|
-
constructor(body) {
|
|
534
|
-
super();
|
|
535
|
-
this.body = body;
|
|
536
|
-
}
|
|
537
517
|
static fromJSON(node, deserializer) {
|
|
538
|
-
return new ClassBody_1(node.body.map(deserializer));
|
|
518
|
+
return new ClassBody_1(node.body.map(deserializer), node.range, node.loc);
|
|
539
519
|
}
|
|
540
520
|
static visit(node, visitNode) {
|
|
541
521
|
node.body.forEach(visitNode);
|
|
542
522
|
}
|
|
523
|
+
constructor(body, range, loc) {
|
|
524
|
+
super(range, loc);
|
|
525
|
+
this.body = body;
|
|
526
|
+
}
|
|
543
527
|
getBody() {
|
|
544
528
|
return this.body;
|
|
545
529
|
}
|
|
@@ -566,12 +550,12 @@ let ClassBody = ClassBody_1 = class ClassBody extends AbstractExpressionNode {
|
|
|
566
550
|
};
|
|
567
551
|
ClassBody = ClassBody_1 = __decorate([
|
|
568
552
|
Deserializer('ClassBody'),
|
|
569
|
-
__metadata("design:paramtypes", [Array])
|
|
553
|
+
__metadata("design:paramtypes", [Array, Array, Object])
|
|
570
554
|
], ClassBody);
|
|
571
555
|
export { ClassBody };
|
|
572
556
|
export class Class extends AbstractExpressionNode {
|
|
573
|
-
constructor(body, decorators, id, superClass) {
|
|
574
|
-
super();
|
|
557
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
558
|
+
super(range, loc);
|
|
575
559
|
this.body = body;
|
|
576
560
|
this.decorators = decorators;
|
|
577
561
|
this.id = id;
|
|
@@ -657,7 +641,7 @@ export class Class extends AbstractExpressionNode {
|
|
|
657
641
|
}
|
|
658
642
|
let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class {
|
|
659
643
|
static fromJSON(node, deserializer) {
|
|
660
|
-
return new ClassDeclaration_1(deserializer(node.body), deserializer(node.id), node.superClass && deserializer(node.superClass));
|
|
644
|
+
return new ClassDeclaration_1(deserializer(node.body), node.decorators.map(deserializer), deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
|
|
661
645
|
}
|
|
662
646
|
static visit(node, visitNode) {
|
|
663
647
|
visitNode(node.body);
|
|
@@ -665,8 +649,8 @@ let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class
|
|
|
665
649
|
visitNode(node.id);
|
|
666
650
|
node.superClass && visitNode(node.superClass);
|
|
667
651
|
}
|
|
668
|
-
constructor(body, decorators, id, superClass) {
|
|
669
|
-
super(body, decorators, id, superClass);
|
|
652
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
653
|
+
super(body, decorators, id, superClass, range, loc);
|
|
670
654
|
}
|
|
671
655
|
declareVariable(stack, propertyValue) {
|
|
672
656
|
stack.declareVariable(this.id.getName(), propertyValue);
|
|
@@ -682,12 +666,12 @@ let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class
|
|
|
682
666
|
};
|
|
683
667
|
ClassDeclaration = ClassDeclaration_1 = __decorate([
|
|
684
668
|
Deserializer('ClassDeclaration'),
|
|
685
|
-
__metadata("design:paramtypes", [ClassBody, Array, Identifier, Object])
|
|
669
|
+
__metadata("design:paramtypes", [ClassBody, Array, Identifier, Object, Array, Object])
|
|
686
670
|
], ClassDeclaration);
|
|
687
671
|
export { ClassDeclaration };
|
|
688
672
|
let ClassExpression = ClassExpression_1 = class ClassExpression extends Class {
|
|
689
673
|
static fromJSON(node, deserializer) {
|
|
690
|
-
return new ClassExpression_1(deserializer(node.body), node.superClass && deserializer(node.superClass));
|
|
674
|
+
return new ClassExpression_1(deserializer(node.body), node.decorators.map(deserializer), node.id && deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
|
|
691
675
|
}
|
|
692
676
|
static visit(node, visitNode) {
|
|
693
677
|
visitNode(node.body);
|
|
@@ -695,9 +679,13 @@ let ClassExpression = ClassExpression_1 = class ClassExpression extends Class {
|
|
|
695
679
|
node.id && visitNode(node.id);
|
|
696
680
|
node.superClass && visitNode(node.superClass);
|
|
697
681
|
}
|
|
682
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
683
|
+
super(body, decorators, id, superClass, range, loc);
|
|
684
|
+
}
|
|
698
685
|
};
|
|
699
686
|
ClassExpression = ClassExpression_1 = __decorate([
|
|
700
|
-
Deserializer('ClassExpression')
|
|
687
|
+
Deserializer('ClassExpression'),
|
|
688
|
+
__metadata("design:paramtypes", [ClassBody, Array, Identifier, Object, Array, Object])
|
|
701
689
|
], ClassExpression);
|
|
702
690
|
export { ClassExpression };
|
|
703
691
|
//# sourceMappingURL=class.js.map
|