@ibyar/expressions 0.8.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -1
- package/api/abstract.d.ts +1 -0
- package/api/abstract.d.ts.map +1 -0
- package/api/abstract.js +12 -0
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +1 -0
- package/api/class/class.d.ts.map +1 -0
- package/api/class/class.js +603 -472
- package/api/class/class.js.map +1 -1
- package/api/class/decorator.d.ts +1 -0
- package/api/class/decorator.d.ts.map +1 -0
- package/api/class/decorator.js +53 -41
- package/api/class/decorator.js.map +1 -1
- package/api/computing/call.d.ts +1 -0
- package/api/computing/call.d.ts.map +1 -0
- package/api/computing/call.js +83 -69
- package/api/computing/call.js.map +1 -1
- package/api/computing/debugger.d.ts +1 -0
- package/api/computing/debugger.d.ts.map +1 -0
- package/api/computing/debugger.js +40 -28
- package/api/computing/debugger.js.map +1 -1
- package/api/computing/new.d.ts +1 -0
- package/api/computing/new.d.ts.map +1 -0
- package/api/computing/new.js +81 -68
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +1 -0
- package/api/computing/rest.d.ts.map +1 -0
- package/api/computing/rest.js +54 -42
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +1 -0
- package/api/computing/return.d.ts.map +1 -0
- package/api/computing/return.js +52 -40
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +1 -0
- package/api/computing/spread.d.ts.map +1 -0
- package/api/computing/spread.js +70 -58
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +1 -0
- package/api/computing/throw.d.ts.map +1 -0
- package/api/computing/throw.js +216 -175
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +1 -0
- package/api/computing/yield.d.ts.map +1 -0
- package/api/computing/yield.js +60 -47
- package/api/computing/yield.js.map +1 -1
- package/api/definition/array.d.ts +1 -0
- package/api/definition/array.d.ts.map +1 -0
- package/api/definition/array.js +147 -122
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +1 -0
- package/api/definition/bind.d.ts.map +1 -0
- package/api/definition/bind.js +85 -70
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +1 -0
- package/api/definition/comment.d.ts.map +1 -0
- package/api/definition/comment.js +44 -32
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +1 -0
- package/api/definition/function.d.ts.map +1 -0
- package/api/definition/function.js +500 -443
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +1 -0
- package/api/definition/member.d.ts.map +1 -0
- package/api/definition/member.js +104 -89
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +1 -0
- package/api/definition/object.d.ts.map +1 -0
- package/api/definition/object.js +243 -200
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +1 -0
- package/api/definition/statement.d.ts.map +1 -0
- package/api/definition/statement.js +56 -44
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +1 -0
- package/api/definition/values.d.ts.map +1 -0
- package/api/definition/values.js +228 -160
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +2 -1
- package/api/deserialize/deserialize.d.ts.map +1 -0
- package/api/deserialize/deserialize.js +5 -7
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +1 -0
- package/api/deserialize/type-store.d.ts.map +1 -0
- package/api/expression.d.ts +1 -0
- package/api/expression.d.ts.map +1 -0
- package/api/index.d.ts +1 -0
- package/api/index.d.ts.map +1 -0
- package/api/module/common.d.ts +1 -0
- package/api/module/common.d.ts.map +1 -0
- package/api/module/common.js +63 -50
- package/api/module/common.js.map +1 -1
- package/api/module/export.d.ts +1 -0
- package/api/module/export.d.ts.map +1 -0
- package/api/module/export.js +343 -290
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +1 -0
- package/api/module/import.d.ts.map +1 -0
- package/api/module/import.js +318 -253
- package/api/module/import.js.map +1 -1
- package/api/operators/assignment.d.ts +1 -0
- package/api/operators/assignment.d.ts.map +1 -0
- package/api/operators/assignment.js +88 -75
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +1 -0
- package/api/operators/await.d.ts.map +1 -0
- package/api/operators/await.js +54 -42
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +1 -0
- package/api/operators/binary.d.ts.map +1 -0
- package/api/operators/binary.js +78 -64
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +1 -0
- package/api/operators/chaining.d.ts.map +1 -0
- package/api/operators/chaining.js +56 -44
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +1 -0
- package/api/operators/comma.d.ts.map +1 -0
- package/api/operators/comma.js +53 -41
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +1 -0
- package/api/operators/grouping.d.ts.map +1 -0
- package/api/operators/grouping.js +51 -39
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +1 -0
- package/api/operators/logical.d.ts.map +1 -0
- package/api/operators/logical.js +51 -37
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +1 -0
- package/api/operators/pipeline.d.ts.map +1 -0
- package/api/operators/pipeline.js +95 -81
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +1 -0
- package/api/operators/ternary.d.ts.map +1 -0
- package/api/operators/ternary.js +69 -55
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/types.d.ts +1 -0
- package/api/operators/types.d.ts.map +1 -0
- package/api/operators/unary.d.ts +1 -0
- package/api/operators/unary.d.ts.map +1 -0
- package/api/operators/unary.js +97 -82
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +1 -0
- package/api/operators/update.d.ts.map +1 -0
- package/api/operators/update.js +78 -62
- package/api/operators/update.js.map +1 -1
- package/api/program.d.ts +1 -0
- package/api/program.d.ts.map +1 -0
- package/api/program.js +53 -40
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +1 -0
- package/api/statement/control/block.d.ts.map +1 -0
- package/api/statement/control/block.js +65 -53
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +1 -1
- package/api/statement/control/empty.d.ts.map +1 -0
- package/api/statement/control/empty.js +43 -33
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +1 -0
- package/api/statement/control/if.d.ts.map +1 -0
- package/api/statement/control/if.js +79 -65
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +1 -0
- package/api/statement/control/switch.d.ts.map +1 -0
- package/api/statement/control/switch.js +180 -141
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +1 -2
- package/api/statement/control/terminate.d.ts.map +1 -0
- package/api/statement/control/terminate.js +117 -78
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/control/with.d.ts +1 -0
- package/api/statement/control/with.d.ts.map +1 -0
- package/api/statement/control/with.js +72 -59
- package/api/statement/control/with.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +1 -0
- package/api/statement/declarations/declares.d.ts.map +1 -0
- package/api/statement/declarations/declares.js +148 -121
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +1 -0
- package/api/statement/iterations/for.d.ts.map +1 -0
- package/api/statement/iterations/for.js +337 -277
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +1 -0
- package/api/statement/iterations/while.d.ts.map +1 -0
- package/api/statement/iterations/while.js +152 -125
- package/api/statement/iterations/while.js.map +1 -1
- package/api/utils.d.ts +1 -0
- package/api/utils.d.ts.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/package.json +5 -5
- package/scope/builder.d.ts +27 -0
- package/scope/builder.d.ts.map +1 -0
- package/scope/builder.js +73 -0
- package/scope/builder.js.map +1 -0
- package/scope/event.d.ts +1 -0
- package/scope/event.d.ts.map +1 -0
- package/scope/finalizer.d.ts +1 -0
- package/scope/finalizer.d.ts.map +1 -0
- package/scope/index.d.ts +1 -0
- package/scope/index.d.ts.map +1 -0
- package/scope/pool.d.ts +1 -0
- package/scope/pool.d.ts.map +1 -0
- package/scope/proxy.d.ts +1 -0
- package/scope/proxy.d.ts.map +1 -0
- package/scope/proxy.js +1 -0
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +1 -0
- package/scope/scope.d.ts.map +1 -0
- package/scope/scope.js +17 -11
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +1 -0
- package/scope/stack.d.ts.map +1 -0
- package/scope/stack.js +22 -14
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +1 -0
- package/v8/enums.d.ts.map +1 -0
- package/v8/enums.js +11 -11
- package/v8/enums.js.map +1 -1
- package/v8/factory.d.ts +1 -0
- package/v8/factory.d.ts.map +1 -0
- package/v8/factory.js +3 -1
- package/v8/factory.js.map +1 -1
- package/v8/index.d.ts +1 -0
- package/v8/index.d.ts.map +1 -0
- package/v8/inline.d.ts +1 -0
- package/v8/inline.d.ts.map +1 -0
- package/v8/inline.js +9 -5
- package/v8/inline.js.map +1 -1
- package/v8/language.d.ts +1 -0
- package/v8/language.d.ts.map +1 -0
- package/v8/node.d.ts +1 -0
- package/v8/node.d.ts.map +1 -0
- package/v8/parser.d.ts +1 -0
- package/v8/parser.d.ts.map +1 -0
- package/v8/parser.js +5 -5
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +1 -0
- package/v8/stream.d.ts.map +1 -0
- package/v8/stream.js +17 -7
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +1 -0
- package/v8/token.d.ts.map +1 -0
- package/v8/token.js +363 -358
- package/v8/token.js.map +1 -1
- package/visit/index.d.ts +1 -0
- package/visit/index.d.ts.map +1 -0
- package/visit/visitor.d.ts +1 -0
- package/visit/visitor.d.ts.map +1 -0
- package/v8/nodes.d.ts +0 -0
- package/v8/nodes.js +0 -2
- package/v8/nodes.js.map +0 -1
package/api/class/class.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __metadata } from "tslib";
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
3
2
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
3
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
5
4
|
import { Identifier } from '../definition/values.js';
|
|
6
|
-
import { FunctionExpression } from '../definition/function.js';
|
|
7
5
|
import { BlockStatement } from '../statement/control/block.js';
|
|
8
6
|
import { CallExpression } from '../computing/call.js';
|
|
9
7
|
const TEMP_CLASS_NAME = Symbol('TempClassName');
|
|
10
8
|
const PRIVATE_SYMBOL = Symbol('#');
|
|
11
9
|
;
|
|
12
10
|
class ClassInitializer {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
11
|
+
/**
|
|
12
|
+
* register class public static properties and methods
|
|
13
|
+
*/
|
|
14
|
+
staticInitializer = {};
|
|
15
|
+
/**
|
|
16
|
+
* register class private static properties and methods
|
|
17
|
+
*/
|
|
18
|
+
staticPrivateInitializer = {};
|
|
19
|
+
/**
|
|
20
|
+
* register static initialization block
|
|
21
|
+
*/
|
|
22
|
+
staticInitializerBlock = [];
|
|
23
|
+
/**
|
|
24
|
+
* register class constructor function
|
|
25
|
+
*/
|
|
26
|
+
instanceConstructor;
|
|
27
|
+
/**
|
|
28
|
+
* register super parameter resolver
|
|
29
|
+
*/
|
|
30
|
+
superParameterResolver = (params) => params;
|
|
31
|
+
/**
|
|
32
|
+
* register in class property
|
|
33
|
+
*/
|
|
34
|
+
instanceMethod = {};
|
|
35
|
+
/**
|
|
36
|
+
* register method in instance private space
|
|
37
|
+
*/
|
|
38
|
+
privateInstanceMethod = {};
|
|
39
|
+
/**
|
|
40
|
+
* register property in instance itself
|
|
41
|
+
*/
|
|
42
|
+
instanceInitializer = [];
|
|
43
43
|
addStaticInitializer(key, attributes) {
|
|
44
44
|
Reflect.set(this.staticInitializer, key, attributes);
|
|
45
45
|
}
|
|
@@ -86,36 +86,48 @@ class ClassInitializer {
|
|
|
86
86
|
/**
|
|
87
87
|
* A `super` pseudo-expression.
|
|
88
88
|
*/
|
|
89
|
-
let Super =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
89
|
+
let Super = (() => {
|
|
90
|
+
let _classDecorators = [Deserializer('Super')];
|
|
91
|
+
let _classDescriptor;
|
|
92
|
+
let _classExtraInitializers = [];
|
|
93
|
+
let _classThis;
|
|
94
|
+
let _classSuper = AbstractExpressionNode;
|
|
95
|
+
var Super = class extends _classSuper {
|
|
96
|
+
static { _classThis = this; }
|
|
97
|
+
static {
|
|
98
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
99
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
100
|
+
Super = _classThis = _classDescriptor.value;
|
|
101
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
102
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
103
|
+
}
|
|
104
|
+
static fromJSON(node) {
|
|
105
|
+
return new Super(node.range, node.loc);
|
|
106
|
+
}
|
|
107
|
+
constructor(range, loc) {
|
|
108
|
+
super(range, loc);
|
|
109
|
+
}
|
|
110
|
+
set(stack, value) {
|
|
111
|
+
throw new Error('Super.#set() Method not implemented.');
|
|
112
|
+
}
|
|
113
|
+
get(stack, thisContext) {
|
|
114
|
+
return stack.get('super');
|
|
115
|
+
}
|
|
116
|
+
dependency(computed) {
|
|
117
|
+
throw new Error('Super.#dependency() Method not implemented.');
|
|
118
|
+
}
|
|
119
|
+
dependencyPath(computed) {
|
|
120
|
+
throw new Error('Super.#dependencyPath() Method not implemented.');
|
|
121
|
+
}
|
|
122
|
+
toString() {
|
|
123
|
+
return `super`;
|
|
124
|
+
}
|
|
125
|
+
toJson() {
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
return Super = _classThis;
|
|
130
|
+
})();
|
|
119
131
|
export { Super };
|
|
120
132
|
/**
|
|
121
133
|
* MetaProperty node represents
|
|
@@ -124,102 +136,147 @@ export { Super };
|
|
|
124
136
|
*
|
|
125
137
|
* In the future, it will represent other meta properties as well.
|
|
126
138
|
*/
|
|
127
|
-
let MetaProperty =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return this.meta;
|
|
142
|
-
}
|
|
143
|
-
getProperty() {
|
|
144
|
-
return this.property;
|
|
145
|
-
}
|
|
146
|
-
get(stack) {
|
|
147
|
-
const metaRef = this.meta.get(stack);
|
|
148
|
-
if (metaRef === undefined || metaRef === null) {
|
|
149
|
-
throw new TypeError(`Cannot read meta property '${this.property.toString()}' of ${metaRef}, reading [${this.toString()}]`);
|
|
139
|
+
let MetaProperty = (() => {
|
|
140
|
+
let _classDecorators = [Deserializer('MetaProperty')];
|
|
141
|
+
let _classDescriptor;
|
|
142
|
+
let _classExtraInitializers = [];
|
|
143
|
+
let _classThis;
|
|
144
|
+
let _classSuper = AbstractExpressionNode;
|
|
145
|
+
var MetaProperty = class extends _classSuper {
|
|
146
|
+
static { _classThis = this; }
|
|
147
|
+
static {
|
|
148
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
149
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
150
|
+
MetaProperty = _classThis = _classDescriptor.value;
|
|
151
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
152
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
150
153
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
154
|
+
meta;
|
|
155
|
+
property;
|
|
156
|
+
static fromJSON(node, deserializer) {
|
|
157
|
+
return new MetaProperty(deserializer(node.meta), deserializer(node.property), node.range, node.loc);
|
|
158
|
+
}
|
|
159
|
+
static visit(node, visitNode) {
|
|
160
|
+
visitNode(node.meta);
|
|
161
|
+
visitNode(node.property);
|
|
162
|
+
}
|
|
163
|
+
constructor(meta, property, range, loc) {
|
|
164
|
+
super(range, loc);
|
|
165
|
+
this.meta = meta;
|
|
166
|
+
this.property = property;
|
|
167
|
+
}
|
|
168
|
+
getMeta() {
|
|
169
|
+
return this.meta;
|
|
170
|
+
}
|
|
171
|
+
getProperty() {
|
|
172
|
+
return this.property;
|
|
173
|
+
}
|
|
174
|
+
get(stack) {
|
|
175
|
+
const metaRef = this.meta.get(stack);
|
|
176
|
+
if (metaRef === undefined || metaRef === null) {
|
|
177
|
+
throw new TypeError(`Cannot read meta property '${this.property.toString()}' of ${metaRef}, reading [${this.toString()}]`);
|
|
178
|
+
}
|
|
179
|
+
return this.property.get(stack, metaRef);
|
|
180
|
+
}
|
|
181
|
+
set(stack, value) {
|
|
182
|
+
throw new Error(`MetaProperty#set() has no implementation.`);
|
|
183
|
+
}
|
|
184
|
+
dependency(computed) {
|
|
185
|
+
return [];
|
|
186
|
+
}
|
|
187
|
+
dependencyPath(computed) {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
toString() {
|
|
191
|
+
return `${this.meta.toString()}.${this.property.toString()}`;
|
|
192
|
+
}
|
|
193
|
+
toJson() {
|
|
194
|
+
return {
|
|
195
|
+
meta: this.meta.toJSON(),
|
|
196
|
+
property: this.property.toJSON(),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return MetaProperty = _classThis;
|
|
201
|
+
})();
|
|
176
202
|
export { MetaProperty };
|
|
177
203
|
/**
|
|
178
204
|
* A private identifier refers to private class elements. For a private name `#a`, its name is `a`.
|
|
179
205
|
*/
|
|
180
|
-
let PrivateIdentifier =
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
let PrivateIdentifier = (() => {
|
|
207
|
+
let _classDecorators = [Deserializer('PrivateIdentifier')];
|
|
208
|
+
let _classDescriptor;
|
|
209
|
+
let _classExtraInitializers = [];
|
|
210
|
+
let _classThis;
|
|
211
|
+
let _classSuper = Identifier;
|
|
212
|
+
var PrivateIdentifier = class extends _classSuper {
|
|
213
|
+
static { _classThis = this; }
|
|
214
|
+
static {
|
|
215
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
216
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
217
|
+
PrivateIdentifier = _classThis = _classDescriptor.value;
|
|
218
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
219
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
220
|
+
}
|
|
221
|
+
static fromJSON(node) {
|
|
222
|
+
return new PrivateIdentifier(node.name, node.range, node.loc);
|
|
223
|
+
}
|
|
224
|
+
get(stack, thisContext) {
|
|
225
|
+
return thisContext[PRIVATE_SYMBOL][this.name];
|
|
226
|
+
}
|
|
227
|
+
set(stack, value) {
|
|
228
|
+
const thisContext = stack.lastScope().getContext();
|
|
229
|
+
return thisContext[PRIVATE_SYMBOL][this.name] = value;
|
|
230
|
+
}
|
|
231
|
+
toString() {
|
|
232
|
+
return `#${this.name}`;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return PrivateIdentifier = _classThis;
|
|
236
|
+
})();
|
|
198
237
|
export { PrivateIdentifier };
|
|
199
238
|
/**
|
|
200
239
|
* A static block static { } is a block statement serving as an additional static initializer.
|
|
201
240
|
*/
|
|
202
|
-
let StaticBlock =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
241
|
+
let StaticBlock = (() => {
|
|
242
|
+
let _classDecorators = [Deserializer('StaticBlock')];
|
|
243
|
+
let _classDescriptor;
|
|
244
|
+
let _classExtraInitializers = [];
|
|
245
|
+
let _classThis;
|
|
246
|
+
let _classSuper = BlockStatement;
|
|
247
|
+
var StaticBlock = class extends _classSuper {
|
|
248
|
+
static { _classThis = this; }
|
|
249
|
+
static {
|
|
250
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
251
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
252
|
+
StaticBlock = _classThis = _classDescriptor.value;
|
|
253
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
254
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
255
|
+
}
|
|
256
|
+
static fromJSON(node, deserializer) {
|
|
257
|
+
return new StaticBlock(deserializer(node.body), node.range, node.loc);
|
|
258
|
+
}
|
|
259
|
+
get(stack, classInitializer) {
|
|
260
|
+
classInitializer?.addStaticInitializerBlock(super.get(stack));
|
|
261
|
+
}
|
|
262
|
+
toString() {
|
|
263
|
+
return `static ${super.toString()}`;
|
|
264
|
+
}
|
|
265
|
+
toJson() {
|
|
266
|
+
return {
|
|
267
|
+
body: this.body.map(node => node.toJSON())
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
return StaticBlock = _classThis;
|
|
272
|
+
})();
|
|
221
273
|
export { StaticBlock };
|
|
222
274
|
export class AbstractDefinition extends AbstractExpressionNode {
|
|
275
|
+
key;
|
|
276
|
+
decorators;
|
|
277
|
+
computed;
|
|
278
|
+
value;
|
|
279
|
+
'static';
|
|
223
280
|
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
224
281
|
super(range, loc);
|
|
225
282
|
this.key = key;
|
|
@@ -269,291 +326,346 @@ export class AbstractDefinition extends AbstractExpressionNode {
|
|
|
269
326
|
/**
|
|
270
327
|
* - When key is a PrivateIdentifier, computed must be false and kind can not be "constructor".
|
|
271
328
|
*/
|
|
272
|
-
let MethodDefinition =
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return this.kind;
|
|
287
|
-
}
|
|
288
|
-
getValue() {
|
|
289
|
-
return this.value;
|
|
290
|
-
}
|
|
291
|
-
get(stack, initializer) {
|
|
292
|
-
if (this.kind === 'constructor') {
|
|
293
|
-
this.initConstructor(stack, initializer);
|
|
294
|
-
return;
|
|
329
|
+
let MethodDefinition = (() => {
|
|
330
|
+
let _classDecorators = [Deserializer('MethodDefinition')];
|
|
331
|
+
let _classDescriptor;
|
|
332
|
+
let _classExtraInitializers = [];
|
|
333
|
+
let _classThis;
|
|
334
|
+
let _classSuper = AbstractDefinition;
|
|
335
|
+
var MethodDefinition = class extends _classSuper {
|
|
336
|
+
static { _classThis = this; }
|
|
337
|
+
static {
|
|
338
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
339
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
340
|
+
MethodDefinition = _classThis = _classDescriptor.value;
|
|
341
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
342
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
295
343
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (this.isStatic() && this.isPrivate()) {
|
|
300
|
-
initializer.addStaticPrivateInitializer(name, attributes);
|
|
344
|
+
kind;
|
|
345
|
+
static fromJSON(node, deserializer) {
|
|
346
|
+
return new MethodDefinition(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static, node.range, node.loc);
|
|
301
347
|
}
|
|
302
|
-
|
|
303
|
-
|
|
348
|
+
static visit(node, visitNode) {
|
|
349
|
+
visitNode(node.key);
|
|
350
|
+
visitNode(node.value);
|
|
351
|
+
node.decorators.forEach(visitNode);
|
|
304
352
|
}
|
|
305
|
-
|
|
306
|
-
|
|
353
|
+
afterInstanceConstruct;
|
|
354
|
+
constructor(kind, key, value, decorators, computed, isStatic, range, loc) {
|
|
355
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
356
|
+
this.kind = kind;
|
|
307
357
|
}
|
|
308
|
-
|
|
309
|
-
|
|
358
|
+
getKind() {
|
|
359
|
+
return this.kind;
|
|
310
360
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
switch (this.kind) {
|
|
314
|
-
case 'set': return {
|
|
315
|
-
writable: true,
|
|
316
|
-
configurable: true,
|
|
317
|
-
enumerable: false,
|
|
318
|
-
set: value,
|
|
319
|
-
};
|
|
320
|
-
case 'get': return {
|
|
321
|
-
writable: true,
|
|
322
|
-
configurable: true,
|
|
323
|
-
enumerable: false,
|
|
324
|
-
get: value,
|
|
325
|
-
};
|
|
326
|
-
default:
|
|
327
|
-
case 'method': return {
|
|
328
|
-
writable: true,
|
|
329
|
-
configurable: true,
|
|
330
|
-
enumerable: false,
|
|
331
|
-
value: value
|
|
332
|
-
};
|
|
361
|
+
getValue() {
|
|
362
|
+
return this.value;
|
|
333
363
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
364
|
+
get(stack, initializer) {
|
|
365
|
+
if (this.kind === 'constructor') {
|
|
366
|
+
this.initConstructor(stack, initializer);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const name = this.getKeyName(stack);
|
|
370
|
+
const value = this.value?.get(stack);
|
|
371
|
+
const attributes = this.getPropertyAttributes(value);
|
|
372
|
+
if (this.isStatic() && this.isPrivate()) {
|
|
373
|
+
initializer.addStaticPrivateInitializer(name, attributes);
|
|
374
|
+
}
|
|
375
|
+
else if (this.isStatic()) {
|
|
376
|
+
initializer.addStaticInitializer(name, attributes);
|
|
377
|
+
}
|
|
378
|
+
else if (this.isPrivate()) {
|
|
379
|
+
initializer.addPrivateInstanceMethod(name, attributes);
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
initializer.addInstanceMethod(name, attributes);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
getPropertyAttributes(value) {
|
|
386
|
+
switch (this.kind) {
|
|
387
|
+
case 'set': return {
|
|
388
|
+
writable: true,
|
|
389
|
+
configurable: true,
|
|
390
|
+
enumerable: false,
|
|
391
|
+
set: value,
|
|
392
|
+
};
|
|
393
|
+
case 'get': return {
|
|
394
|
+
writable: true,
|
|
395
|
+
configurable: true,
|
|
396
|
+
enumerable: false,
|
|
397
|
+
get: value,
|
|
398
|
+
};
|
|
399
|
+
default:
|
|
400
|
+
case 'method': return {
|
|
401
|
+
writable: true,
|
|
402
|
+
configurable: true,
|
|
403
|
+
enumerable: false,
|
|
404
|
+
value: value
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
initConstructor(stack, initializer) {
|
|
409
|
+
const body = this.value.getBody().getBody();
|
|
410
|
+
let superIndex = body
|
|
411
|
+
.findIndex(call => call instanceof CallExpression && call.getCallee() instanceof Super);
|
|
412
|
+
const blockAfterSuper = new BlockStatement(body.slice(superIndex + 1));
|
|
413
|
+
initializer.setConstructor(function (params) {
|
|
350
414
|
const scope = stack.pushBlockScope();
|
|
351
|
-
|
|
352
|
-
blockBeforeSuper.get(stack);
|
|
353
|
-
const parameters = superCall.getCallParameters(stack);
|
|
415
|
+
blockAfterSuper.get(stack);
|
|
354
416
|
stack.clearTo(scope);
|
|
355
|
-
return parameters;
|
|
356
417
|
});
|
|
418
|
+
if (superIndex >= 0) {
|
|
419
|
+
const blockBeforeSuper = new BlockStatement(body.slice(0, superIndex));
|
|
420
|
+
const superCall = body[superIndex];
|
|
421
|
+
const cstrExpr = this;
|
|
422
|
+
initializer.setParameterResolver(function (params) {
|
|
423
|
+
const scope = stack.pushBlockScope();
|
|
424
|
+
cstrExpr.value.defineFunctionArguments(stack, params);
|
|
425
|
+
blockBeforeSuper.get(stack);
|
|
426
|
+
const parameters = superCall.getCallParameters(stack);
|
|
427
|
+
stack.clearTo(scope);
|
|
428
|
+
return parameters;
|
|
429
|
+
});
|
|
430
|
+
}
|
|
357
431
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
432
|
+
toString() {
|
|
433
|
+
let str = this.decorators.map(decorator => decorator.toString()).join(' ');
|
|
434
|
+
if (str.length) {
|
|
435
|
+
str += ' ';
|
|
436
|
+
}
|
|
437
|
+
if (this.static) {
|
|
438
|
+
str += 'static ';
|
|
439
|
+
}
|
|
440
|
+
const methodName = this.key.toString();
|
|
441
|
+
switch (this.kind) {
|
|
442
|
+
case 'get':
|
|
443
|
+
str += 'get ' + methodName;
|
|
444
|
+
break;
|
|
445
|
+
case 'set':
|
|
446
|
+
str += 'set ' + methodName;
|
|
447
|
+
break;
|
|
448
|
+
case 'method':
|
|
449
|
+
if (this.value.getAsync() && this.value.getGenerator()) {
|
|
450
|
+
str += 'async *';
|
|
451
|
+
}
|
|
452
|
+
else if (this.value.getAsync()) {
|
|
453
|
+
str += 'async ';
|
|
454
|
+
}
|
|
455
|
+
else if (this.value.getGenerator()) {
|
|
456
|
+
str += '*';
|
|
457
|
+
}
|
|
458
|
+
str += methodName;
|
|
459
|
+
break;
|
|
460
|
+
case 'constructor':
|
|
461
|
+
str += 'constructor';
|
|
462
|
+
break;
|
|
463
|
+
default:
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
str += this.value.paramsAndBodyToString();
|
|
467
|
+
return str;
|
|
392
468
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
};
|
|
407
|
-
MethodDefinition = MethodDefinition_1 = __decorate([
|
|
408
|
-
Deserializer('MethodDefinition'),
|
|
409
|
-
__metadata("design:paramtypes", [String, Object, FunctionExpression, Array, Boolean, Boolean, Array, Object])
|
|
410
|
-
], MethodDefinition);
|
|
469
|
+
toJson() {
|
|
470
|
+
return {
|
|
471
|
+
kind: this.kind,
|
|
472
|
+
key: this.key.toJSON(),
|
|
473
|
+
value: this.value.toJSON(),
|
|
474
|
+
decorators: this.decorators.map(decorator => decorator.toJSON()),
|
|
475
|
+
computed: this.computed,
|
|
476
|
+
static: this.static,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
return MethodDefinition = _classThis;
|
|
481
|
+
})();
|
|
411
482
|
export { MethodDefinition };
|
|
412
483
|
/**
|
|
413
484
|
* - When key is a PrivateIdentifier, computed must be false.
|
|
414
485
|
*/
|
|
415
|
-
let PropertyDefinition =
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
initializer.addInstanceInitializer(() => ({ isPrivate: this.isPrivate(), key: name, value: this.value?.get(stack) }));
|
|
430
|
-
return;
|
|
486
|
+
let PropertyDefinition = (() => {
|
|
487
|
+
let _classDecorators = [Deserializer('PropertyDefinition')];
|
|
488
|
+
let _classDescriptor;
|
|
489
|
+
let _classExtraInitializers = [];
|
|
490
|
+
let _classThis;
|
|
491
|
+
let _classSuper = AbstractDefinition;
|
|
492
|
+
var PropertyDefinition = class extends _classSuper {
|
|
493
|
+
static { _classThis = this; }
|
|
494
|
+
static {
|
|
495
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
496
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
497
|
+
PropertyDefinition = _classThis = _classDescriptor.value;
|
|
498
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
499
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
431
500
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (this.isPrivate()) {
|
|
435
|
-
initializer.addStaticPrivateInitializer(name, attributes);
|
|
501
|
+
static fromJSON(node, deserializer) {
|
|
502
|
+
return new PropertyDefinition(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value), node.range, node.loc);
|
|
436
503
|
}
|
|
437
|
-
|
|
438
|
-
|
|
504
|
+
static visit(node, visitNode) {
|
|
505
|
+
visitNode(node.key);
|
|
506
|
+
node.value && visitNode(node.value);
|
|
439
507
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
value
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
508
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
509
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
510
|
+
}
|
|
511
|
+
get(stack, initializer) {
|
|
512
|
+
const name = this.getKeyName(stack);
|
|
513
|
+
if (!this.isStatic()) {
|
|
514
|
+
initializer.addInstanceInitializer(() => ({ isPrivate: this.isPrivate(), key: name, value: this.value?.get(stack) }));
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const value = this.value?.get(stack);
|
|
518
|
+
const attributes = { writable: true, configurable: true, enumerable: true, value };
|
|
519
|
+
if (this.isPrivate()) {
|
|
520
|
+
initializer.addStaticPrivateInitializer(name, attributes);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
initializer.addStaticInitializer(name, attributes);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
toString() {
|
|
527
|
+
const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
|
|
528
|
+
const name = this.computed ? `[${this.key.toString()}]` : this.key.toString();
|
|
529
|
+
return `${decorators.length ? decorators + ' ' : ''}${this.static ? 'static ' : ''}${name}${this.value ? ` = ${this.value.toString()}` : ''};`;
|
|
530
|
+
}
|
|
531
|
+
toJson() {
|
|
532
|
+
return {
|
|
533
|
+
key: this.key.toJSON(),
|
|
534
|
+
value: this.value?.toJSON(),
|
|
535
|
+
decorators: this.decorators.map(decorator => decorator.toJSON()),
|
|
536
|
+
computed: this.computed,
|
|
537
|
+
static: this.static,
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
return PropertyDefinition = _classThis;
|
|
542
|
+
})();
|
|
460
543
|
export { PropertyDefinition };
|
|
461
|
-
let AccessorProperty =
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const accessorAttributes = {
|
|
476
|
-
writable: false,
|
|
477
|
-
configurable: true,
|
|
478
|
-
enumerable: false,
|
|
479
|
-
set: function (value) {
|
|
480
|
-
this[PRIVATE_SYMBOL][name] = value;
|
|
481
|
-
},
|
|
482
|
-
get: function () {
|
|
483
|
-
return this[PRIVATE_SYMBOL][name];
|
|
484
|
-
},
|
|
485
|
-
};
|
|
486
|
-
if (!this.isStatic()) {
|
|
487
|
-
initializer.addInstanceInitializer(() => ({ isPrivate: true, key: name, value: this.value?.get(stack) }));
|
|
488
|
-
initializer.addInstanceMethod(name, accessorAttributes);
|
|
489
|
-
return;
|
|
544
|
+
let AccessorProperty = (() => {
|
|
545
|
+
let _classDecorators = [Deserializer('AccessorProperty')];
|
|
546
|
+
let _classDescriptor;
|
|
547
|
+
let _classExtraInitializers = [];
|
|
548
|
+
let _classThis;
|
|
549
|
+
let _classSuper = AbstractDefinition;
|
|
550
|
+
var AccessorProperty = class extends _classSuper {
|
|
551
|
+
static { _classThis = this; }
|
|
552
|
+
static {
|
|
553
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
554
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
555
|
+
AccessorProperty = _classThis = _classDescriptor.value;
|
|
556
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
557
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
490
558
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
559
|
+
static fromJSON(node, deserializer) {
|
|
560
|
+
return new AccessorProperty(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0, node.range, node.loc);
|
|
561
|
+
}
|
|
562
|
+
static visit(node, visitNode) {
|
|
563
|
+
visitNode(node.key);
|
|
564
|
+
node.value && visitNode(node.value);
|
|
565
|
+
node.decorators.forEach(visitNode);
|
|
566
|
+
}
|
|
567
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
568
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
569
|
+
}
|
|
570
|
+
get(stack, initializer) {
|
|
571
|
+
const name = this.getKeyName(stack);
|
|
572
|
+
const accessorAttributes = {
|
|
573
|
+
writable: false,
|
|
574
|
+
configurable: true,
|
|
575
|
+
enumerable: false,
|
|
576
|
+
set: function (value) {
|
|
577
|
+
this[PRIVATE_SYMBOL][name] = value;
|
|
578
|
+
},
|
|
579
|
+
get: function () {
|
|
580
|
+
return this[PRIVATE_SYMBOL][name];
|
|
581
|
+
},
|
|
582
|
+
};
|
|
583
|
+
if (!this.isStatic()) {
|
|
584
|
+
initializer.addInstanceInitializer(() => ({ isPrivate: true, key: name, value: this.value?.get(stack) }));
|
|
585
|
+
initializer.addInstanceMethod(name, accessorAttributes);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const value = this.value?.get(stack);
|
|
589
|
+
const valueAttribute = { writable: true, configurable: true, enumerable: true, value };
|
|
590
|
+
initializer.addStaticInitializer(name, accessorAttributes);
|
|
591
|
+
initializer.addStaticPrivateInitializer(name, valueAttribute);
|
|
592
|
+
}
|
|
593
|
+
toString() {
|
|
594
|
+
const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
|
|
595
|
+
const name = this.computed ? `[${this.key.toString()}]` : this.key.toString();
|
|
596
|
+
return `${decorators.length ? decorators.concat(' ') : ''}${this.static ? 'static ' : ''}accessor ${name}${this.value ? ` = ${this.value.toString()}` : ''};`;
|
|
597
|
+
}
|
|
598
|
+
toJson() {
|
|
599
|
+
return {
|
|
600
|
+
key: this.key.toJSON(),
|
|
601
|
+
decorators: this.decorators.map(decorator => decorator.toJSON()),
|
|
602
|
+
computed: this.computed,
|
|
603
|
+
static: this.static,
|
|
604
|
+
value: this.value?.toJSON(),
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
return AccessorProperty = _classThis;
|
|
609
|
+
})();
|
|
515
610
|
export { AccessorProperty };
|
|
516
|
-
let ClassBody =
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
611
|
+
let ClassBody = (() => {
|
|
612
|
+
let _classDecorators = [Deserializer('ClassBody')];
|
|
613
|
+
let _classDescriptor;
|
|
614
|
+
let _classExtraInitializers = [];
|
|
615
|
+
let _classThis;
|
|
616
|
+
let _classSuper = AbstractExpressionNode;
|
|
617
|
+
var ClassBody = class extends _classSuper {
|
|
618
|
+
static { _classThis = this; }
|
|
619
|
+
static {
|
|
620
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
621
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
622
|
+
ClassBody = _classThis = _classDescriptor.value;
|
|
623
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
624
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
625
|
+
}
|
|
626
|
+
body;
|
|
627
|
+
static fromJSON(node, deserializer) {
|
|
628
|
+
return new ClassBody(node.body.map(deserializer), node.range, node.loc);
|
|
629
|
+
}
|
|
630
|
+
static visit(node, visitNode) {
|
|
631
|
+
node.body.forEach(visitNode);
|
|
632
|
+
}
|
|
633
|
+
constructor(body, range, loc) {
|
|
634
|
+
super(range, loc);
|
|
635
|
+
this.body = body;
|
|
636
|
+
}
|
|
637
|
+
getBody() {
|
|
638
|
+
return this.body;
|
|
639
|
+
}
|
|
640
|
+
set(stack, value) {
|
|
641
|
+
throw new Error('Method not implemented.');
|
|
642
|
+
}
|
|
643
|
+
get(stack, initializer) {
|
|
644
|
+
this.body.forEach(definition => definition.get(stack, initializer));
|
|
645
|
+
}
|
|
646
|
+
dependency(computed) {
|
|
647
|
+
throw new Error('Method not implemented.');
|
|
648
|
+
}
|
|
649
|
+
dependencyPath(computed) {
|
|
650
|
+
throw new Error('Method not implemented.');
|
|
651
|
+
}
|
|
652
|
+
toString() {
|
|
653
|
+
return this.body.map(definition => `\t${definition.toString()}`).join('\n');
|
|
654
|
+
}
|
|
655
|
+
toJson() {
|
|
656
|
+
return {
|
|
657
|
+
body: this.body.map(method => method.toJSON())
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
return ClassBody = _classThis;
|
|
662
|
+
})();
|
|
555
663
|
export { ClassBody };
|
|
556
664
|
export class Class extends AbstractExpressionNode {
|
|
665
|
+
body;
|
|
666
|
+
decorators;
|
|
667
|
+
id;
|
|
668
|
+
superClass;
|
|
557
669
|
constructor(body, decorators, id, superClass, range, loc) {
|
|
558
670
|
super(range, loc);
|
|
559
671
|
this.body = body;
|
|
@@ -594,22 +706,17 @@ export class Class extends AbstractExpressionNode {
|
|
|
594
706
|
return ClassConstructor;
|
|
595
707
|
}
|
|
596
708
|
createClass(parentClass, className, initializer) {
|
|
597
|
-
var _a, _b, _c, _d;
|
|
598
709
|
const nameClassDeclaration = {
|
|
599
|
-
[className]:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
_c = PRIVATE_SYMBOL,
|
|
610
|
-
_d[_a] = className,
|
|
611
|
-
_d[_b] = {},
|
|
612
|
-
_d)
|
|
710
|
+
[className]: class extends parentClass {
|
|
711
|
+
static [Symbol.toStringTag] = className;
|
|
712
|
+
static [PRIVATE_SYMBOL] = {};
|
|
713
|
+
[PRIVATE_SYMBOL] = {};
|
|
714
|
+
constructor(...params) {
|
|
715
|
+
const parameters = initializer.getSuperArguments(params);
|
|
716
|
+
super(...parameters);
|
|
717
|
+
initializer.initInstance(this);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
613
720
|
};
|
|
614
721
|
return nameClassDeclaration[className];
|
|
615
722
|
}
|
|
@@ -639,53 +746,77 @@ export class Class extends AbstractExpressionNode {
|
|
|
639
746
|
};
|
|
640
747
|
}
|
|
641
748
|
}
|
|
642
|
-
let ClassDeclaration =
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
749
|
+
let ClassDeclaration = (() => {
|
|
750
|
+
let _classDecorators = [Deserializer('ClassDeclaration')];
|
|
751
|
+
let _classDescriptor;
|
|
752
|
+
let _classExtraInitializers = [];
|
|
753
|
+
let _classThis;
|
|
754
|
+
let _classSuper = Class;
|
|
755
|
+
var ClassDeclaration = class extends _classSuper {
|
|
756
|
+
static { _classThis = this; }
|
|
757
|
+
static {
|
|
758
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
759
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
760
|
+
ClassDeclaration = _classThis = _classDescriptor.value;
|
|
761
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
762
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
763
|
+
}
|
|
764
|
+
static fromJSON(node, deserializer) {
|
|
765
|
+
return new ClassDeclaration(deserializer(node.body), node.decorators.map(deserializer), deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
|
|
766
|
+
}
|
|
767
|
+
static visit(node, visitNode) {
|
|
768
|
+
visitNode(node.body);
|
|
769
|
+
node.decorators.forEach(visitNode);
|
|
770
|
+
visitNode(node.id);
|
|
771
|
+
node.superClass && visitNode(node.superClass);
|
|
772
|
+
}
|
|
773
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
774
|
+
super(body, decorators, id, superClass, range, loc);
|
|
775
|
+
}
|
|
776
|
+
declareVariable(stack, propertyValue) {
|
|
777
|
+
stack.declareVariable(this.id.getName(), propertyValue);
|
|
778
|
+
}
|
|
779
|
+
getDeclarationName() {
|
|
780
|
+
return this.id.getDeclarationName();
|
|
781
|
+
}
|
|
782
|
+
get(stack) {
|
|
783
|
+
const classConstructor = super.get(stack);
|
|
784
|
+
this.id.declareVariable(stack, classConstructor);
|
|
785
|
+
return classConstructor;
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
return ClassDeclaration = _classThis;
|
|
789
|
+
})();
|
|
671
790
|
export { ClassDeclaration };
|
|
672
|
-
let ClassExpression =
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
791
|
+
let ClassExpression = (() => {
|
|
792
|
+
let _classDecorators = [Deserializer('ClassExpression')];
|
|
793
|
+
let _classDescriptor;
|
|
794
|
+
let _classExtraInitializers = [];
|
|
795
|
+
let _classThis;
|
|
796
|
+
let _classSuper = Class;
|
|
797
|
+
var ClassExpression = class extends _classSuper {
|
|
798
|
+
static { _classThis = this; }
|
|
799
|
+
static {
|
|
800
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
801
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
802
|
+
ClassExpression = _classThis = _classDescriptor.value;
|
|
803
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
804
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
805
|
+
}
|
|
806
|
+
static fromJSON(node, deserializer) {
|
|
807
|
+
return new ClassExpression(deserializer(node.body), node.decorators.map(deserializer), node.id && deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
|
|
808
|
+
}
|
|
809
|
+
static visit(node, visitNode) {
|
|
810
|
+
visitNode(node.body);
|
|
811
|
+
node.decorators.forEach(visitNode);
|
|
812
|
+
node.id && visitNode(node.id);
|
|
813
|
+
node.superClass && visitNode(node.superClass);
|
|
814
|
+
}
|
|
815
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
816
|
+
super(body, decorators, id, superClass, range, loc);
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
return ClassExpression = _classThis;
|
|
820
|
+
})();
|
|
690
821
|
export { ClassExpression };
|
|
691
822
|
//# sourceMappingURL=class.js.map
|