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