@ibyar/expressions 0.5.4 → 0.6.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/LICENSE +1 -1
- package/README.md +1 -0
- package/api/abstract.d.ts +3 -3
- package/api/abstract.js +7 -2
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +45 -24
- package/api/class/class.js +158 -112
- package/api/class/class.js.map +1 -1
- package/api/computing/debugger.d.ts +15 -0
- package/api/computing/debugger.js +35 -0
- package/api/computing/debugger.js.map +1 -0
- package/api/computing/rest.d.ts +4 -4
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +4 -0
- package/api/computing/return.js +5 -0
- package/api/computing/return.js.map +1 -1
- package/api/computing/throw.d.ts +4 -0
- package/api/computing/throw.js +4 -0
- package/api/computing/throw.js.map +1 -1
- package/api/definition/array.d.ts +7 -6
- package/api/definition/array.js +20 -14
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +6 -0
- package/api/definition/bind.js +6 -0
- package/api/definition/bind.js.map +1 -1
- package/api/definition/function.d.ts +35 -46
- package/api/definition/function.js +282 -299
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +9 -6
- package/api/definition/object.js +35 -5
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.js +5 -1
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +43 -50
- package/api/definition/values.js +84 -149
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +7 -1
- package/api/deserialize/deserialize.js +9 -1
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +2 -2
- package/api/deserialize/type-store.js.map +1 -1
- package/api/expression.d.ts +156 -12
- package/api/expression.js.map +1 -1
- package/api/index.d.ts +2 -0
- package/api/index.js +2 -0
- package/api/index.js.map +1 -1
- package/api/module/common.d.ts +29 -0
- package/api/module/common.js +71 -0
- package/api/module/common.js.map +1 -0
- package/api/module/export.d.ts +78 -9
- package/api/module/export.js +120 -15
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +56 -8
- package/api/module/import.js +62 -19
- package/api/module/import.js.map +1 -1
- package/api/operators/grouping.d.ts +7 -0
- package/api/operators/grouping.js +7 -0
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/pipeline.d.ts +12 -0
- package/api/operators/pipeline.js +12 -0
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/unary.js +3 -0
- package/api/operators/unary.js.map +1 -1
- package/api/{module/app/program.d.ts → program.d.ts} +5 -5
- package/api/{module/app/program.js → program.js} +3 -3
- package/api/program.js.map +1 -0
- package/api/statement/control/block.d.ts +5 -2
- package/api/statement/control/block.js +24 -21
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +7 -0
- package/api/statement/control/empty.js +7 -0
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +5 -0
- package/api/statement/control/if.js +5 -0
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +6 -0
- package/api/statement/control/switch.js +17 -3
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +44 -11
- package/api/statement/control/terminate.js +87 -18
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +7 -7
- package/api/statement/declarations/declares.js +1 -1
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +5 -0
- package/api/statement/iterations/for.js +35 -16
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +6 -0
- package/api/statement/iterations/while.js +25 -11
- package/api/statement/iterations/while.js.map +1 -1
- package/api/utils.d.ts +2 -0
- package/api/utils.js +3 -1
- package/api/utils.js.map +1 -1
- package/package.json +7 -5
- package/scope/event.d.ts +3 -3
- package/scope/event.js +2 -2
- package/scope/event.js.map +1 -1
- package/scope/pool.d.ts +7 -0
- package/scope/pool.js +29 -0
- package/scope/pool.js.map +1 -0
- package/scope/proxy.d.ts +6 -11
- package/scope/proxy.js +23 -52
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +161 -38
- package/scope/scope.js +260 -106
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +97 -21
- package/scope/stack.js +13 -0
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +204 -0
- package/v8/enums.js +406 -0
- package/v8/enums.js.map +1 -0
- package/v8/index.d.ts +2 -1
- package/v8/index.js +2 -1
- package/v8/index.js.map +1 -1
- package/v8/inline.d.ts +213 -0
- package/v8/inline.js +2375 -0
- package/v8/inline.js.map +1 -0
- package/v8/nodes.d.ts +8 -7
- package/v8/nodes.js +39 -64
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +49 -151
- package/v8/parser.js +839 -1608
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +39 -3
- package/v8/stream.js +685 -171
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +244 -9
- package/v8/token.js +315 -47
- package/v8/token.js.map +1 -1
- package/visit/visitor.d.ts +3 -0
- package/visit/visitor.js.map +1 -1
- package/api/module/app/program.js.map +0 -1
- package/v8/app.d.ts +0 -0
- package/v8/app.js +0 -2
- package/v8/app.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
Aurora expression, is a JavaScript expression parsing and evaluation. and template expression evaluation, with stack and scope.
|
|
20
20
|
|
|
21
21
|
- this package has no dependance, can work on both (Node.js) and any Web Browsers, that support modules and class syntax
|
|
22
|
+
- An 100% spec compliant ES2022 JavaScript toolchain
|
|
22
23
|
|
|
23
24
|
## `Install`
|
|
24
25
|
|
package/api/abstract.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Scope } from '../scope/scope.js';
|
|
2
2
|
import type { AwaitPromiseInfo, Stack } from '../scope/stack.js';
|
|
3
|
-
import type { NodeDeserializer, ExpressionNode,
|
|
3
|
+
import type { NodeDeserializer, ExpressionNode, ExpressionNodConstructor, NodeJsonType, DeclarationExpression, ExpressionEventMap, ExpressionEventPath, VisitNodeType } from './expression.js';
|
|
4
4
|
export declare abstract class AbstractExpressionNode implements ExpressionNode {
|
|
5
5
|
static fromJSON(node: ExpressionNode, deserializer: NodeDeserializer): ExpressionNode;
|
|
6
|
-
getClass():
|
|
6
|
+
getClass(): ExpressionNodConstructor<ExpressionNode>;
|
|
7
7
|
toJSON(key?: string): NodeJsonType;
|
|
8
8
|
events(): ExpressionEventMap;
|
|
9
9
|
abstract shareVariables(scopeList: Scope<any>[]): void;
|
|
@@ -50,7 +50,7 @@ export declare class YieldDelegateValue {
|
|
|
50
50
|
}
|
|
51
51
|
export declare class AwaitPromise implements AwaitPromiseInfo {
|
|
52
52
|
promise: Promise<any>;
|
|
53
|
-
node:
|
|
53
|
+
node: DeclarationExpression;
|
|
54
54
|
declareVariable: boolean;
|
|
55
55
|
constructor(promise: Promise<any>);
|
|
56
56
|
}
|
package/api/abstract.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function initPathExpressionEventMap(rootEventMap, path) {
|
|
2
2
|
let lastMap = rootEventMap;
|
|
3
|
+
// let index = 0;
|
|
3
4
|
for (const node of path) {
|
|
4
5
|
const scopeName = node.path;
|
|
5
6
|
let eventMap = lastMap[scopeName];
|
|
@@ -7,6 +8,10 @@ function initPathExpressionEventMap(rootEventMap, path) {
|
|
|
7
8
|
lastMap = eventMap;
|
|
8
9
|
continue;
|
|
9
10
|
}
|
|
11
|
+
// if ((index++) === path.length - 1) {
|
|
12
|
+
// lastMap[scopeName] = undefined;
|
|
13
|
+
// continue;
|
|
14
|
+
// }
|
|
10
15
|
lastMap = lastMap[scopeName] = {};
|
|
11
16
|
if (node.computed) {
|
|
12
17
|
node.computedPath.forEach(path => initPathExpressionEventMap(rootEventMap, path));
|
|
@@ -21,9 +26,9 @@ export class AbstractExpressionNode {
|
|
|
21
26
|
return this.constructor;
|
|
22
27
|
}
|
|
23
28
|
toJSON(key) {
|
|
29
|
+
const type = this.getClass().type;
|
|
24
30
|
const json = this.toJson(key);
|
|
25
|
-
|
|
26
|
-
return json;
|
|
31
|
+
return { type, ...json };
|
|
27
32
|
}
|
|
28
33
|
events() {
|
|
29
34
|
const dependencyNodes = this.dependency();
|
package/api/abstract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/expressions/api/abstract.ts"],"names":[],"mappings":"AAQA,SAAS,0BAA0B,CAAC,YAAgC,EAAE,IAA2B;IAChG,IAAI,OAAO,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/expressions/api/abstract.ts"],"names":[],"mappings":"AAQA,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;AACD,MAAM,OAAgB,sBAAsB;IAC3C,MAAM,CAAC,QAAQ,CAAC,IAAoB,EAAE,YAA8B;QACnE,OAAO,YAAY,CAAC,IAAW,CAAC,C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P,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;IAGxB,YAAmB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;IAAI,CAAC;CAC7C","sourcesContent":["import type { Scope } from '../scope/scope.js';\nimport type { AwaitPromiseInfo, Stack } from '../scope/stack.js';\nimport type {\n\tNodeDeserializer, ExpressionNode, ExpressionNodConstructor,\n\tNodeJsonType, DeclarationExpression, ExpressionEventMap,\n\tExpressionEventPath, VisitNodeType\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(): ExpressionNodConstructor<ExpressionNode> {\n\t\treturn this.constructor as ExpressionNodConstructor<ExpressionNode>;\n\t}\n\ttoJSON(key?: string): NodeJsonType {\n\t\tconst type = this.getClass().type;\n\t\tconst json = this.toJson(key);\n\t\treturn { type, ...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): 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: DeclarationExpression;\n\tdeclareVariable: boolean;\n\tconstructor(public promise: Promise<any>) { }\n}\n"]}
|
package/api/class/class.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { DeclarationExpression, ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from '../expression.js';
|
|
2
|
+
import { Scope } from '../../scope/scope.js';
|
|
3
3
|
import { Stack } from '../../scope/stack.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
5
|
import { Identifier } from '../definition/values.js';
|
|
@@ -11,32 +11,35 @@ declare const STACK: unique symbol;
|
|
|
11
11
|
declare const GET_PARAMETERS: unique symbol;
|
|
12
12
|
declare const CONSTRUCTOR: unique symbol;
|
|
13
13
|
declare const PRIVATE_SYMBOL: unique symbol;
|
|
14
|
-
declare const
|
|
14
|
+
declare const INSTANCE_PRIVATE_SYMBOL: unique symbol;
|
|
15
15
|
declare const STATIC_INITIALIZATION_BLOCK: unique symbol;
|
|
16
16
|
interface ClassConstructor {
|
|
17
|
+
/**
|
|
18
|
+
* A reference to the prototype.
|
|
19
|
+
*/
|
|
17
20
|
readonly prototype: ClassInstance;
|
|
18
21
|
[GET_PARAMETERS](args: any[]): any[];
|
|
19
22
|
[STATIC_INITIALIZATION_BLOCK]: Function[];
|
|
20
|
-
[
|
|
23
|
+
[PRIVATE_SYMBOL]: {
|
|
21
24
|
[key: PropertyKey]: any;
|
|
22
25
|
};
|
|
23
|
-
[
|
|
26
|
+
[INSTANCE_PRIVATE_SYMBOL]: {
|
|
24
27
|
[key: PropertyKey]: any;
|
|
25
28
|
};
|
|
29
|
+
[CONSTRUCTOR]: Function;
|
|
26
30
|
[key: string]: any;
|
|
27
31
|
}
|
|
28
32
|
declare var ClassInstance: ClassConstructor;
|
|
29
33
|
interface ClassInstance {
|
|
30
|
-
[CONSTRUCTOR]: Function;
|
|
31
|
-
[INIT_PRIVATE_SYMBOL]: {
|
|
32
|
-
[key: PropertyKey]: any;
|
|
33
|
-
};
|
|
34
34
|
[PRIVATE_SYMBOL]: {
|
|
35
35
|
[key: PropertyKey]: any;
|
|
36
36
|
};
|
|
37
37
|
[STACK]: Stack;
|
|
38
38
|
[key: string]: any;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* A `super` pseudo-expression.
|
|
42
|
+
*/
|
|
40
43
|
export declare class Super extends AbstractExpressionNode {
|
|
41
44
|
static INSTANCE: Super;
|
|
42
45
|
static fromJSON(node: Super): Super;
|
|
@@ -51,6 +54,13 @@ export declare class Super extends AbstractExpressionNode {
|
|
|
51
54
|
[key: string]: any;
|
|
52
55
|
};
|
|
53
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* MetaProperty node represents
|
|
59
|
+
* - `new.target` meta property in ES2015.
|
|
60
|
+
* - `import.meta` meta property in ES2030.
|
|
61
|
+
*
|
|
62
|
+
* In the future, it will represent other meta properties as well.
|
|
63
|
+
*/
|
|
54
64
|
export declare class MetaProperty extends MemberExpression {
|
|
55
65
|
private meta;
|
|
56
66
|
static NewTarget: MetaProperty;
|
|
@@ -67,26 +77,23 @@ export declare class MetaProperty extends MemberExpression {
|
|
|
67
77
|
[key: string]: any;
|
|
68
78
|
};
|
|
69
79
|
}
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
/**
|
|
81
|
+
* A private identifier refers to private class elements. For a private name `#a`, its name is `a`.
|
|
82
|
+
*/
|
|
83
|
+
export declare class PrivateIdentifier extends Identifier {
|
|
72
84
|
static fromJSON(node: PrivateIdentifier): PrivateIdentifier;
|
|
73
|
-
|
|
74
|
-
getName(): string;
|
|
75
|
-
set(stack: Stack, value: any): void;
|
|
76
|
-
get(stack: Stack, thisContext?: any): any;
|
|
77
|
-
dependency(computed?: true): ExpressionNode[];
|
|
78
|
-
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
79
|
-
shareVariables(scopeList: Scope<any>[]): void;
|
|
85
|
+
get(stack: Stack): any;
|
|
80
86
|
toString(): string;
|
|
81
|
-
toJson(): {
|
|
82
|
-
[key: string]: any;
|
|
83
|
-
};
|
|
84
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* A static block static { } is a block statement serving as an additional static initializer.
|
|
90
|
+
*/
|
|
85
91
|
export declare class StaticBlock extends BlockStatement {
|
|
86
92
|
static fromJSON(node: StaticBlock, deserializer: NodeDeserializer<any>): StaticBlock;
|
|
87
|
-
constructor(body: ExpressionNode[]
|
|
93
|
+
constructor(body: ExpressionNode[]);
|
|
88
94
|
get(stack: Stack, classConstructor?: ClassConstructor): void;
|
|
89
95
|
toString(): string;
|
|
96
|
+
toJson(): object;
|
|
90
97
|
}
|
|
91
98
|
export declare abstract class AbstractDefinition extends AbstractExpressionNode {
|
|
92
99
|
protected key: ExpressionNode | PrivateIdentifier;
|
|
@@ -104,6 +111,12 @@ export declare abstract class AbstractDefinition extends AbstractExpressionNode
|
|
|
104
111
|
set(stack: Stack, value: any): void;
|
|
105
112
|
dependency(computed?: true): ExpressionNode[];
|
|
106
113
|
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
114
|
+
getTarget(classConstructor: ClassConstructor): {
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
[key: number]: any;
|
|
117
|
+
[key: symbol]: any;
|
|
118
|
+
};
|
|
119
|
+
getKeyName(stack: Stack): any;
|
|
107
120
|
abstract get(stack: Stack, classConstructor: ClassConstructor): void;
|
|
108
121
|
abstract toString(): string;
|
|
109
122
|
abstract toJson(): {
|
|
@@ -111,6 +124,9 @@ export declare abstract class AbstractDefinition extends AbstractExpressionNode
|
|
|
111
124
|
};
|
|
112
125
|
}
|
|
113
126
|
export declare type MethodDefinitionKind = 'constructor' | 'method' | 'set' | 'get';
|
|
127
|
+
/**
|
|
128
|
+
* - When key is a PrivateIdentifier, computed must be false and kind can not be "constructor".
|
|
129
|
+
*/
|
|
114
130
|
export declare class MethodDefinition extends AbstractDefinition {
|
|
115
131
|
private kind;
|
|
116
132
|
static fromJSON(node: MethodDefinition, deserializer: NodeDeserializer<any>): MethodDefinition;
|
|
@@ -126,6 +142,9 @@ export declare class MethodDefinition extends AbstractDefinition {
|
|
|
126
142
|
[key: string]: any;
|
|
127
143
|
};
|
|
128
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* - When key is a PrivateIdentifier, computed must be false.
|
|
147
|
+
*/
|
|
129
148
|
export declare class PropertyDefinition extends AbstractDefinition {
|
|
130
149
|
static fromJSON(node: PropertyDefinition, deserializer: NodeDeserializer<any>): PropertyDefinition;
|
|
131
150
|
static visit(node: PropertyDefinition, visitNode: VisitNodeType): void;
|
|
@@ -182,12 +201,14 @@ export declare class Class extends AbstractExpressionNode {
|
|
|
182
201
|
toString(): string;
|
|
183
202
|
toJson(): object;
|
|
184
203
|
}
|
|
185
|
-
export declare class ClassDeclaration extends Class implements
|
|
204
|
+
export declare class ClassDeclaration extends Class implements DeclarationExpression {
|
|
186
205
|
static fromJSON(node: ClassDeclaration, deserializer: NodeDeserializer<any>): ClassDeclaration;
|
|
187
206
|
static visit(node: ClassDeclaration, visitNode: VisitNodeType): void;
|
|
188
|
-
protected id
|
|
207
|
+
protected id: Identifier;
|
|
208
|
+
constructor(body: ClassBody, decorators: Decorator[], id: Identifier, superClass?: ExpressionNode);
|
|
189
209
|
declareVariable(stack: Stack, propertyValue?: any): void;
|
|
190
210
|
getDeclarationName(): string;
|
|
211
|
+
get(stack: Stack): ClassConstructor;
|
|
191
212
|
}
|
|
192
213
|
export declare class ClassExpression extends Class {
|
|
193
214
|
static fromJSON(node: ClassExpression, deserializer: NodeDeserializer<any>): ClassExpression;
|