@ibyar/expressions 0.8.2-dev.20221008 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/api/abstract.d.ts +6 -5
- package/api/abstract.js +15 -12
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +99 -60
- package/api/class/class.js +285 -233
- package/api/class/class.js.map +1 -1
- package/api/class/decorator.d.ts +2 -4
- package/api/class/decorator.js +6 -9
- package/api/class/decorator.js.map +1 -1
- package/api/computing/call.d.ts +2 -4
- package/api/computing/call.js +8 -11
- package/api/computing/call.js.map +1 -1
- package/api/computing/debugger.d.ts +1 -4
- package/api/computing/debugger.js +2 -5
- package/api/computing/debugger.js.map +1 -1
- package/api/computing/new.d.ts +2 -4
- package/api/computing/new.js +7 -10
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +2 -4
- package/api/computing/rest.js +6 -9
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +2 -4
- package/api/computing/return.js +6 -9
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +2 -4
- package/api/computing/spread.js +6 -9
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +4 -8
- package/api/computing/throw.js +18 -23
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +2 -4
- package/api/computing/yield.js +7 -10
- package/api/computing/yield.js.map +1 -1
- package/api/definition/array.d.ts +3 -6
- package/api/definition/array.js +14 -18
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +2 -3
- package/api/definition/bind.js +9 -10
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +3 -5
- package/api/definition/comment.js +6 -7
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +20 -27
- package/api/definition/function.js +92 -110
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +2 -3
- package/api/definition/member.js +14 -11
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +5 -9
- package/api/definition/object.js +24 -30
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +2 -4
- package/api/definition/statement.js +6 -9
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +15 -40
- package/api/definition/values.js +49 -79
- package/api/definition/values.js.map +1 -1
- package/api/expression.d.ts +40 -26
- package/api/expression.js.map +1 -1
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/api/index.js.map +1 -1
- package/api/module/common.d.ts +4 -5
- package/api/module/common.js +12 -12
- package/api/module/common.js.map +1 -1
- package/api/module/export.d.ts +5 -10
- package/api/module/export.js +35 -38
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +6 -10
- package/api/module/import.js +28 -32
- package/api/module/import.js.map +1 -1
- package/api/operators/assignment.d.ts +3 -3
- package/api/operators/assignment.js +5 -5
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +3 -5
- package/api/operators/await.js +7 -10
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +1 -1
- package/api/operators/binary.js +1 -1
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +2 -3
- package/api/operators/chaining.js +6 -7
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +2 -4
- package/api/operators/comma.js +6 -9
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +2 -4
- package/api/operators/grouping.js +6 -9
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +1 -1
- package/api/operators/logical.js +1 -1
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +2 -4
- package/api/operators/pipeline.js +8 -15
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +2 -4
- package/api/operators/ternary.js +8 -13
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/types.d.ts +1 -1
- package/api/operators/unary.d.ts +3 -5
- package/api/operators/unary.js +7 -10
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +3 -5
- package/api/operators/update.js +8 -11
- package/api/operators/update.js.map +1 -1
- package/api/program.d.ts +3 -5
- package/api/program.js +7 -8
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +2 -4
- package/api/statement/control/block.js +9 -14
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +2 -5
- package/api/statement/control/empty.js +6 -8
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +2 -4
- package/api/statement/control/if.js +8 -13
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +4 -9
- package/api/statement/control/switch.js +19 -28
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +4 -7
- package/api/statement/control/terminate.js +11 -19
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/control/with.d.ts +21 -0
- package/api/statement/control/with.js +67 -0
- package/api/statement/control/with.js.map +1 -0
- package/api/statement/declarations/declares.d.ts +4 -7
- package/api/statement/declarations/declares.js +14 -20
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +6 -11
- package/api/statement/iterations/for.js +35 -53
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +3 -6
- package/api/statement/iterations/while.js +14 -22
- package/api/statement/iterations/while.js.map +1 -1
- package/package.json +14 -4
- package/scope/finalizer.d.ts +1 -1
- package/scope/pool.d.ts +1 -1
- package/scope/proxy.d.ts +1 -1
- package/scope/proxy.js +1 -0
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +8 -24
- package/scope/scope.js +25 -75
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +15 -3
- package/scope/stack.js +49 -32
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +4 -2
- package/v8/enums.js.map +1 -1
- package/v8/factory.d.ts +148 -0
- package/v8/factory.js +499 -0
- package/v8/factory.js.map +1 -0
- package/v8/inline.d.ts +50 -48
- package/v8/inline.js +322 -300
- package/v8/inline.js.map +1 -1
- package/v8/node.d.ts +141 -0
- package/v8/node.js +2 -0
- package/v8/node.js.map +1 -0
- package/v8/nodes.d.ts +0 -14
- package/v8/nodes.js +1 -152
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +21 -18
- package/v8/parser.js +97 -84
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +2 -1
- package/v8/stream.js +221 -311
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +3 -1
- package/v8/token.js +7 -5
- package/v8/token.js.map +1 -1
- package/visit/visitor.d.ts +1 -1
package/api/class/class.js
CHANGED
|
@@ -1,42 +1,103 @@
|
|
|
1
1
|
var Super_1, MetaProperty_1, PrivateIdentifier_1, StaticBlock_1, MethodDefinition_1, PropertyDefinition_1, AccessorProperty_1, ClassBody_1, ClassDeclaration_1, ClassExpression_1;
|
|
2
|
-
import { __decorate
|
|
3
|
-
import { ClassScope } from '../../scope/scope.js';
|
|
4
|
-
import { __decorate } from 'tslib';
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
5
3
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
6
4
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
7
5
|
import { Identifier } from '../definition/values.js';
|
|
8
|
-
import { MemberExpression } from '../definition/member.js';
|
|
9
6
|
import { FunctionExpression } from '../definition/function.js';
|
|
10
7
|
import { BlockStatement } from '../statement/control/block.js';
|
|
11
8
|
import { CallExpression } from '../computing/call.js';
|
|
12
9
|
const TEMP_CLASS_NAME = Symbol('TempClassName');
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const PRIVATE_SYMBOL = Symbol('#');
|
|
11
|
+
;
|
|
12
|
+
class ClassInitializer {
|
|
13
|
+
constructor() {
|
|
14
|
+
/**
|
|
15
|
+
* register class public static properties and methods
|
|
16
|
+
*/
|
|
17
|
+
this.staticInitializer = {};
|
|
18
|
+
/**
|
|
19
|
+
* register class private static properties and methods
|
|
20
|
+
*/
|
|
21
|
+
this.staticPrivateInitializer = {};
|
|
22
|
+
/**
|
|
23
|
+
* register static initialization block
|
|
24
|
+
*/
|
|
25
|
+
this.staticInitializerBlock = [];
|
|
26
|
+
/**
|
|
27
|
+
* register super parameter resolver
|
|
28
|
+
*/
|
|
29
|
+
this.superParameterResolver = (params) => params;
|
|
30
|
+
/**
|
|
31
|
+
* register in class property
|
|
32
|
+
*/
|
|
33
|
+
this.instanceMethod = {};
|
|
34
|
+
/**
|
|
35
|
+
* register method in instance private space
|
|
36
|
+
*/
|
|
37
|
+
this.privateInstanceMethod = {};
|
|
38
|
+
/**
|
|
39
|
+
* register property in instance itself
|
|
40
|
+
*/
|
|
41
|
+
this.instanceInitializer = [];
|
|
42
|
+
}
|
|
43
|
+
addStaticInitializer(key, attributes) {
|
|
44
|
+
Reflect.set(this.staticInitializer, key, attributes);
|
|
45
|
+
}
|
|
46
|
+
addStaticPrivateInitializer(key, attributes) {
|
|
47
|
+
Reflect.set(this.staticPrivateInitializer, key, attributes);
|
|
48
|
+
}
|
|
49
|
+
addStaticInitializerBlock(block) {
|
|
50
|
+
this.staticInitializerBlock.push(block);
|
|
51
|
+
}
|
|
52
|
+
setConstructor(cstr) {
|
|
53
|
+
this.instanceConstructor = cstr;
|
|
54
|
+
}
|
|
55
|
+
setParameterResolver(resolver) {
|
|
56
|
+
this.superParameterResolver = resolver;
|
|
57
|
+
}
|
|
58
|
+
addInstanceMethod(key, attributes) {
|
|
59
|
+
Reflect.set(this.instanceMethod, key, attributes);
|
|
60
|
+
}
|
|
61
|
+
addPrivateInstanceMethod(key, attributes) {
|
|
62
|
+
Reflect.set(this.privateInstanceMethod, key, attributes);
|
|
63
|
+
}
|
|
64
|
+
addInstanceInitializer(initializer) {
|
|
65
|
+
this.instanceInitializer.push(initializer);
|
|
66
|
+
}
|
|
67
|
+
initClass(classConstructor) {
|
|
68
|
+
Object.defineProperties(classConstructor, this.staticInitializer);
|
|
69
|
+
Object.defineProperties(classConstructor[PRIVATE_SYMBOL], this.staticPrivateInitializer);
|
|
70
|
+
Object.defineProperties(classConstructor.prototype, this.instanceMethod);
|
|
71
|
+
this.staticInitializerBlock.forEach(block => block());
|
|
72
|
+
}
|
|
73
|
+
getSuperArguments(args) {
|
|
74
|
+
return this.superParameterResolver(args);
|
|
75
|
+
}
|
|
76
|
+
initInstance(instance) {
|
|
77
|
+
Object.defineProperties(instance[PRIVATE_SYMBOL], this.privateInstanceMethod);
|
|
78
|
+
this.instanceInitializer.forEach(initializer => {
|
|
79
|
+
const definition = initializer();
|
|
80
|
+
const target = definition.isPrivate ? instance[PRIVATE_SYMBOL] : instance;
|
|
81
|
+
target[definition.key] = definition.value;
|
|
82
|
+
});
|
|
83
|
+
this.instanceConstructor?.apply(instance);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
24
86
|
/**
|
|
25
87
|
* A `super` pseudo-expression.
|
|
26
88
|
*/
|
|
27
89
|
let Super = Super_1 = class Super extends AbstractExpressionNode {
|
|
28
|
-
constructor() {
|
|
29
|
-
super();
|
|
30
|
-
}
|
|
31
90
|
static fromJSON(node) {
|
|
32
|
-
return Super_1.
|
|
91
|
+
return new Super_1(node.range, node.loc);
|
|
92
|
+
}
|
|
93
|
+
constructor(range, loc) {
|
|
94
|
+
super(range, loc);
|
|
33
95
|
}
|
|
34
|
-
shareVariables(scopeList) { }
|
|
35
96
|
set(stack, value) {
|
|
36
97
|
throw new Error('Super.#set() Method not implemented.');
|
|
37
98
|
}
|
|
38
99
|
get(stack, thisContext) {
|
|
39
|
-
|
|
100
|
+
return stack.get('super');
|
|
40
101
|
}
|
|
41
102
|
dependency(computed) {
|
|
42
103
|
throw new Error('Super.#dependency() Method not implemented.');
|
|
@@ -51,10 +112,9 @@ let Super = Super_1 = class Super extends AbstractExpressionNode {
|
|
|
51
112
|
return {};
|
|
52
113
|
}
|
|
53
114
|
};
|
|
54
|
-
Super
|
|
55
|
-
Super = Super_1 = __decorate_1([
|
|
115
|
+
Super = Super_1 = __decorate([
|
|
56
116
|
Deserializer('Super'),
|
|
57
|
-
__metadata("design:paramtypes", [])
|
|
117
|
+
__metadata("design:paramtypes", [Array, Object])
|
|
58
118
|
], Super);
|
|
59
119
|
export { Super };
|
|
60
120
|
/**
|
|
@@ -64,40 +124,40 @@ export { Super };
|
|
|
64
124
|
*
|
|
65
125
|
* In the future, it will represent other meta properties as well.
|
|
66
126
|
*/
|
|
67
|
-
let MetaProperty = MetaProperty_1 = class MetaProperty extends
|
|
68
|
-
constructor(meta, property) {
|
|
69
|
-
super(meta, property, false);
|
|
70
|
-
this.meta = meta;
|
|
71
|
-
}
|
|
72
|
-
static getJsonName(identifier) {
|
|
73
|
-
return Reflect.get(identifier, 'name');
|
|
74
|
-
}
|
|
127
|
+
let MetaProperty = MetaProperty_1 = class MetaProperty extends AbstractExpressionNode {
|
|
75
128
|
static fromJSON(node, deserializer) {
|
|
76
|
-
|
|
77
|
-
return MetaProperty_1.NewTarget;
|
|
78
|
-
}
|
|
79
|
-
else if (MetaProperty_1.getJsonName(node.meta) === 'import' && MetaProperty_1.getJsonName(node.property) === 'meta') {
|
|
80
|
-
return MetaProperty_1.ImportMeta;
|
|
81
|
-
}
|
|
82
|
-
return new MetaProperty_1(deserializer(node.meta), deserializer(node.property));
|
|
129
|
+
return new MetaProperty_1(deserializer(node.meta), deserializer(node.property), node.range, node.loc);
|
|
83
130
|
}
|
|
84
131
|
static visit(node, visitNode) {
|
|
85
132
|
visitNode(node.meta);
|
|
86
133
|
visitNode(node.property);
|
|
87
134
|
}
|
|
135
|
+
constructor(meta, property, range, loc) {
|
|
136
|
+
super(range, loc);
|
|
137
|
+
this.meta = meta;
|
|
138
|
+
this.property = property;
|
|
139
|
+
}
|
|
88
140
|
getMeta() {
|
|
89
141
|
return this.meta;
|
|
90
142
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return importObject['meta'];
|
|
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()}]`);
|
|
99
150
|
}
|
|
100
|
-
return
|
|
151
|
+
return this.property.get(stack, metaRef);
|
|
152
|
+
}
|
|
153
|
+
set(stack, value) {
|
|
154
|
+
throw new Error(`MetaProperty#set() has no implementation.`);
|
|
155
|
+
}
|
|
156
|
+
dependency(computed) {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
dependencyPath(computed) {
|
|
160
|
+
return [];
|
|
101
161
|
}
|
|
102
162
|
toString() {
|
|
103
163
|
return `${this.meta.toString()}.${this.property.toString()}`;
|
|
@@ -109,11 +169,9 @@ let MetaProperty = MetaProperty_1 = class MetaProperty extends MemberExpression
|
|
|
109
169
|
};
|
|
110
170
|
}
|
|
111
171
|
};
|
|
112
|
-
MetaProperty
|
|
113
|
-
MetaProperty.ImportMeta = new MetaProperty_1(new Identifier('import'), new Identifier('meta'));
|
|
114
|
-
MetaProperty = MetaProperty_1 = __decorate_1([
|
|
172
|
+
MetaProperty = MetaProperty_1 = __decorate([
|
|
115
173
|
Deserializer('MetaProperty'),
|
|
116
|
-
__metadata("design:paramtypes", [Identifier, Identifier])
|
|
174
|
+
__metadata("design:paramtypes", [Identifier, Identifier, Array, Object])
|
|
117
175
|
], MetaProperty);
|
|
118
176
|
export { MetaProperty };
|
|
119
177
|
/**
|
|
@@ -121,16 +179,20 @@ export { MetaProperty };
|
|
|
121
179
|
*/
|
|
122
180
|
let PrivateIdentifier = PrivateIdentifier_1 = class PrivateIdentifier extends Identifier {
|
|
123
181
|
static fromJSON(node) {
|
|
124
|
-
return new PrivateIdentifier_1(node.name);
|
|
182
|
+
return new PrivateIdentifier_1(node.name, node.range, node.loc);
|
|
125
183
|
}
|
|
126
|
-
get(stack) {
|
|
127
|
-
return
|
|
184
|
+
get(stack, thisContext) {
|
|
185
|
+
return thisContext[PRIVATE_SYMBOL][this.name];
|
|
186
|
+
}
|
|
187
|
+
set(stack, value) {
|
|
188
|
+
const thisContext = stack.lastScope().getContext();
|
|
189
|
+
return thisContext[PRIVATE_SYMBOL][this.name] = value;
|
|
128
190
|
}
|
|
129
191
|
toString() {
|
|
130
192
|
return `#${this.name}`;
|
|
131
193
|
}
|
|
132
194
|
};
|
|
133
|
-
PrivateIdentifier = PrivateIdentifier_1 =
|
|
195
|
+
PrivateIdentifier = PrivateIdentifier_1 = __decorate([
|
|
134
196
|
Deserializer('PrivateIdentifier')
|
|
135
197
|
], PrivateIdentifier);
|
|
136
198
|
export { PrivateIdentifier };
|
|
@@ -139,23 +201,10 @@ export { PrivateIdentifier };
|
|
|
139
201
|
*/
|
|
140
202
|
let StaticBlock = StaticBlock_1 = class StaticBlock extends BlockStatement {
|
|
141
203
|
static fromJSON(node, deserializer) {
|
|
142
|
-
return new StaticBlock_1(deserializer(node.body));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
super(
|
|
146
|
-
}
|
|
147
|
-
get(stack, classConstructor) {
|
|
148
|
-
const constructor = classConstructor;
|
|
149
|
-
constructor[STATIC_INITIALIZATION_BLOCK].push(() => {
|
|
150
|
-
const scope = new ClassScope(constructor);
|
|
151
|
-
stack.pushScope(scope);
|
|
152
|
-
try {
|
|
153
|
-
super.get(stack);
|
|
154
|
-
}
|
|
155
|
-
finally {
|
|
156
|
-
stack.clearTo(scope);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
204
|
+
return new StaticBlock_1(deserializer(node.body), node.range, node.loc);
|
|
205
|
+
}
|
|
206
|
+
get(stack, classInitializer) {
|
|
207
|
+
classInitializer?.addStaticInitializerBlock(super.get(stack));
|
|
159
208
|
}
|
|
160
209
|
toString() {
|
|
161
210
|
return `static ${super.toString()}`;
|
|
@@ -166,14 +215,13 @@ let StaticBlock = StaticBlock_1 = class StaticBlock extends BlockStatement {
|
|
|
166
215
|
};
|
|
167
216
|
}
|
|
168
217
|
};
|
|
169
|
-
StaticBlock = StaticBlock_1 =
|
|
170
|
-
Deserializer('StaticBlock')
|
|
171
|
-
__metadata("design:paramtypes", [Array])
|
|
218
|
+
StaticBlock = StaticBlock_1 = __decorate([
|
|
219
|
+
Deserializer('StaticBlock')
|
|
172
220
|
], StaticBlock);
|
|
173
221
|
export { StaticBlock };
|
|
174
222
|
export class AbstractDefinition extends AbstractExpressionNode {
|
|
175
|
-
constructor(key, decorators, computed, isStatic, value) {
|
|
176
|
-
super();
|
|
223
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
224
|
+
super(range, loc);
|
|
177
225
|
this.key = key;
|
|
178
226
|
this.decorators = decorators;
|
|
179
227
|
this.computed = computed;
|
|
@@ -192,10 +240,12 @@ export class AbstractDefinition extends AbstractExpressionNode {
|
|
|
192
240
|
isStatic() {
|
|
193
241
|
return this.static;
|
|
194
242
|
}
|
|
243
|
+
isPrivate() {
|
|
244
|
+
return this.key instanceof PrivateIdentifier;
|
|
245
|
+
}
|
|
195
246
|
getDecorators() {
|
|
196
247
|
return this.decorators;
|
|
197
248
|
}
|
|
198
|
-
shareVariables(scopeList) { }
|
|
199
249
|
set(stack, value) {
|
|
200
250
|
throw new Error('AbstractDefinition.#set() Method not implemented.');
|
|
201
251
|
}
|
|
@@ -205,101 +255,106 @@ export class AbstractDefinition extends AbstractExpressionNode {
|
|
|
205
255
|
dependencyPath(computed) {
|
|
206
256
|
return [];
|
|
207
257
|
}
|
|
208
|
-
getTarget(classConstructor) {
|
|
209
|
-
return this.static
|
|
210
|
-
? (this.key instanceof PrivateIdentifier ? classConstructor[PRIVATE_SYMBOL] : classConstructor)
|
|
211
|
-
: (this.key instanceof PrivateIdentifier ? classConstructor[INSTANCE_PRIVATE_SYMBOL] : classConstructor.prototype);
|
|
212
|
-
}
|
|
213
258
|
getKeyName(stack) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
default: return this.key.toString();
|
|
259
|
+
if (this.computed) {
|
|
260
|
+
// private properties can't be computed
|
|
261
|
+
return this.key.get(stack);
|
|
262
|
+
}
|
|
263
|
+
if (this.key instanceof Identifier) {
|
|
264
|
+
return this.key.getName();
|
|
221
265
|
}
|
|
266
|
+
return this.key.toString();
|
|
222
267
|
}
|
|
223
268
|
}
|
|
224
269
|
/**
|
|
225
270
|
* - When key is a PrivateIdentifier, computed must be false and kind can not be "constructor".
|
|
226
271
|
*/
|
|
227
272
|
let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends AbstractDefinition {
|
|
228
|
-
constructor(kind, key, value, decorators, computed, isStatic) {
|
|
229
|
-
super(key, decorators, computed, isStatic, value);
|
|
230
|
-
this.kind = kind;
|
|
231
|
-
}
|
|
232
273
|
static fromJSON(node, deserializer) {
|
|
233
|
-
return new MethodDefinition_1(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static);
|
|
274
|
+
return new MethodDefinition_1(node.kind, deserializer(node.key), deserializer(node.value), node.decorators.map(deserializer), node.computed, node.static, node.range, node.loc);
|
|
234
275
|
}
|
|
235
276
|
static visit(node, visitNode) {
|
|
236
277
|
visitNode(node.key);
|
|
237
278
|
visitNode(node.value);
|
|
238
279
|
node.decorators.forEach(visitNode);
|
|
239
280
|
}
|
|
281
|
+
constructor(kind, key, value, decorators, computed, isStatic, range, loc) {
|
|
282
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
283
|
+
this.kind = kind;
|
|
284
|
+
}
|
|
240
285
|
getKind() {
|
|
241
286
|
return this.kind;
|
|
242
287
|
}
|
|
243
288
|
getValue() {
|
|
244
289
|
return this.value;
|
|
245
290
|
}
|
|
246
|
-
get(stack,
|
|
291
|
+
get(stack, initializer) {
|
|
247
292
|
if (this.kind === 'constructor') {
|
|
248
|
-
this.initConstructor(stack,
|
|
293
|
+
this.initConstructor(stack, initializer);
|
|
249
294
|
return;
|
|
250
295
|
}
|
|
251
|
-
const target = this.getTarget(classConstructor);
|
|
252
296
|
const name = this.getKeyName(stack);
|
|
253
297
|
const value = this.value?.get(stack);
|
|
298
|
+
const attributes = this.getPropertyAttributes(value);
|
|
299
|
+
if (this.isStatic() && this.isPrivate()) {
|
|
300
|
+
initializer.addStaticPrivateInitializer(name, attributes);
|
|
301
|
+
}
|
|
302
|
+
else if (this.isStatic()) {
|
|
303
|
+
initializer.addStaticInitializer(name, attributes);
|
|
304
|
+
}
|
|
305
|
+
else if (this.isPrivate()) {
|
|
306
|
+
initializer.addPrivateInstanceMethod(name, attributes);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
initializer.addInstanceMethod(name, attributes);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
getPropertyAttributes(value) {
|
|
254
313
|
switch (this.kind) {
|
|
255
|
-
case '
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
configurable: true,
|
|
268
|
-
enumerable: false,
|
|
269
|
-
get: value,
|
|
270
|
-
});
|
|
271
|
-
break;
|
|
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
|
+
};
|
|
272
326
|
default:
|
|
273
|
-
|
|
327
|
+
case 'method': return {
|
|
328
|
+
writable: true,
|
|
329
|
+
configurable: true,
|
|
330
|
+
enumerable: false,
|
|
331
|
+
value: value
|
|
332
|
+
};
|
|
274
333
|
}
|
|
275
|
-
const decorators = this.decorators.map(decorator => decorator.get(stack));
|
|
276
|
-
decorators.length && __decorate(decorators, target, name, null);
|
|
277
334
|
}
|
|
278
|
-
initConstructor(stack,
|
|
335
|
+
initConstructor(stack, initializer) {
|
|
279
336
|
const body = this.value.getBody().getBody();
|
|
280
337
|
let superIndex = body
|
|
281
|
-
.findIndex(call => call instanceof CallExpression &&
|
|
282
|
-
if (superIndex === -1) {
|
|
283
|
-
superIndex = body.length;
|
|
284
|
-
}
|
|
285
|
-
const superCall = body[superIndex];
|
|
286
|
-
const blockBeforeSuper = new BlockStatement(body.slice(0, superIndex));
|
|
338
|
+
.findIndex(call => call instanceof CallExpression && call.getCallee() instanceof Super);
|
|
287
339
|
const blockAfterSuper = new BlockStatement(body.slice(superIndex + 1));
|
|
288
|
-
|
|
289
|
-
|
|
340
|
+
initializer.setConstructor(function (params) {
|
|
341
|
+
const scope = stack.pushBlockScope();
|
|
342
|
+
blockAfterSuper.get(stack);
|
|
343
|
+
stack.clearTo(scope);
|
|
344
|
+
});
|
|
345
|
+
if (superIndex >= 0) {
|
|
346
|
+
const blockBeforeSuper = new BlockStatement(body.slice(0, superIndex));
|
|
347
|
+
const superCall = body[superIndex];
|
|
348
|
+
const cstrExpr = this;
|
|
349
|
+
initializer.setParameterResolver(function (params) {
|
|
290
350
|
const scope = stack.pushBlockScope();
|
|
291
|
-
|
|
351
|
+
cstrExpr.value.defineFunctionArguments(stack, params);
|
|
292
352
|
blockBeforeSuper.get(stack);
|
|
293
353
|
const parameters = superCall.getCallParameters(stack);
|
|
294
354
|
stack.clearTo(scope);
|
|
295
355
|
return parameters;
|
|
296
|
-
};
|
|
356
|
+
});
|
|
297
357
|
}
|
|
298
|
-
classConstructor[CONSTRUCTOR] = function (params) {
|
|
299
|
-
const scope = this[STACK].pushBlockScope();
|
|
300
|
-
blockAfterSuper.get(this[STACK]);
|
|
301
|
-
stack.clearTo(scope);
|
|
302
|
-
};
|
|
303
358
|
}
|
|
304
359
|
toString() {
|
|
305
360
|
let str = this.decorators.map(decorator => decorator.toString()).join(' ');
|
|
@@ -349,9 +404,9 @@ let MethodDefinition = MethodDefinition_1 = class MethodDefinition extends Abstr
|
|
|
349
404
|
};
|
|
350
405
|
}
|
|
351
406
|
};
|
|
352
|
-
MethodDefinition = MethodDefinition_1 =
|
|
407
|
+
MethodDefinition = MethodDefinition_1 = __decorate([
|
|
353
408
|
Deserializer('MethodDefinition'),
|
|
354
|
-
__metadata("design:paramtypes", [String, Object, FunctionExpression, Array, Boolean, Boolean])
|
|
409
|
+
__metadata("design:paramtypes", [String, Object, FunctionExpression, Array, Boolean, Boolean, Array, Object])
|
|
355
410
|
], MethodDefinition);
|
|
356
411
|
export { MethodDefinition };
|
|
357
412
|
/**
|
|
@@ -359,22 +414,29 @@ export { MethodDefinition };
|
|
|
359
414
|
*/
|
|
360
415
|
let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends AbstractDefinition {
|
|
361
416
|
static fromJSON(node, deserializer) {
|
|
362
|
-
return new PropertyDefinition_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value));
|
|
417
|
+
return new PropertyDefinition_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value && deserializer(node.value), node.range, node.loc);
|
|
363
418
|
}
|
|
364
419
|
static visit(node, visitNode) {
|
|
365
420
|
visitNode(node.key);
|
|
366
421
|
node.value && visitNode(node.value);
|
|
367
422
|
}
|
|
368
|
-
constructor(key, decorators, computed, isStatic, value) {
|
|
369
|
-
super(key, decorators, computed, isStatic, value);
|
|
423
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
424
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
370
425
|
}
|
|
371
|
-
get(stack,
|
|
372
|
-
const target = this.getTarget(classConstructor);
|
|
426
|
+
get(stack, initializer) {
|
|
373
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;
|
|
431
|
+
}
|
|
374
432
|
const value = this.value?.get(stack);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
433
|
+
const attributes = { writable: true, configurable: true, enumerable: true, value };
|
|
434
|
+
if (this.isPrivate()) {
|
|
435
|
+
initializer.addStaticPrivateInitializer(name, attributes);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
initializer.addStaticInitializer(name, attributes);
|
|
439
|
+
}
|
|
378
440
|
}
|
|
379
441
|
toString() {
|
|
380
442
|
const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
|
|
@@ -391,45 +453,45 @@ let PropertyDefinition = PropertyDefinition_1 = class PropertyDefinition extends
|
|
|
391
453
|
};
|
|
392
454
|
}
|
|
393
455
|
};
|
|
394
|
-
PropertyDefinition = PropertyDefinition_1 =
|
|
456
|
+
PropertyDefinition = PropertyDefinition_1 = __decorate([
|
|
395
457
|
Deserializer('PropertyDefinition'),
|
|
396
|
-
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object])
|
|
458
|
+
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object, Array, Object])
|
|
397
459
|
], PropertyDefinition);
|
|
398
460
|
export { PropertyDefinition };
|
|
399
461
|
let AccessorProperty = AccessorProperty_1 = class AccessorProperty extends AbstractDefinition {
|
|
400
462
|
static fromJSON(node, deserializer) {
|
|
401
|
-
return new AccessorProperty_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0);
|
|
463
|
+
return new AccessorProperty_1(deserializer(node.key), node.decorators.map(deserializer), node.computed, node.static, node.value ? deserializer(node.value) : void 0, node.range, node.loc);
|
|
402
464
|
}
|
|
403
465
|
static visit(node, visitNode) {
|
|
404
466
|
visitNode(node.key);
|
|
405
467
|
node.value && visitNode(node.value);
|
|
406
468
|
node.decorators.forEach(visitNode);
|
|
407
469
|
}
|
|
408
|
-
constructor(key, decorators, computed, isStatic, value) {
|
|
409
|
-
super(key, decorators, computed, isStatic, value);
|
|
470
|
+
constructor(key, decorators, computed, isStatic, value, range, loc) {
|
|
471
|
+
super(key, decorators, computed, isStatic, value, range, loc);
|
|
410
472
|
}
|
|
411
|
-
get(stack,
|
|
412
|
-
const target = this.getTarget(classConstructor);
|
|
473
|
+
get(stack, initializer) {
|
|
413
474
|
const name = this.getKeyName(stack);
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
const ref = this.static ? classConstructor : classConstructor.prototype;
|
|
417
|
-
Object.defineProperty(ref, name, {
|
|
475
|
+
const accessorAttributes = {
|
|
476
|
+
writable: false,
|
|
418
477
|
configurable: true,
|
|
419
478
|
enumerable: false,
|
|
420
|
-
set: function (
|
|
421
|
-
this[PRIVATE_SYMBOL][name] =
|
|
479
|
+
set: function (value) {
|
|
480
|
+
this[PRIVATE_SYMBOL][name] = value;
|
|
422
481
|
},
|
|
423
|
-
});
|
|
424
|
-
Object.defineProperty(ref, name, {
|
|
425
|
-
configurable: true,
|
|
426
|
-
enumerable: false,
|
|
427
482
|
get: function () {
|
|
428
483
|
return this[PRIVATE_SYMBOL][name];
|
|
429
484
|
},
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
485
|
+
};
|
|
486
|
+
if (!this.isStatic()) {
|
|
487
|
+
initializer.addInstanceInitializer(() => ({ isPrivate: true, key: name, value: this.value?.get(stack) }));
|
|
488
|
+
initializer.addInstanceMethod(name, accessorAttributes);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const value = this.value?.get(stack);
|
|
492
|
+
const valueAttribute = { writable: true, configurable: true, enumerable: true, value };
|
|
493
|
+
initializer.addStaticInitializer(name, accessorAttributes);
|
|
494
|
+
initializer.addStaticPrivateInitializer(name, valueAttribute);
|
|
433
495
|
}
|
|
434
496
|
toString() {
|
|
435
497
|
const decorators = this.decorators.map(decorator => decorator.toString()).join('\n');
|
|
@@ -446,31 +508,30 @@ let AccessorProperty = AccessorProperty_1 = class AccessorProperty extends Abstr
|
|
|
446
508
|
};
|
|
447
509
|
}
|
|
448
510
|
};
|
|
449
|
-
AccessorProperty = AccessorProperty_1 =
|
|
511
|
+
AccessorProperty = AccessorProperty_1 = __decorate([
|
|
450
512
|
Deserializer('AccessorProperty'),
|
|
451
|
-
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object])
|
|
513
|
+
__metadata("design:paramtypes", [Object, Array, Boolean, Boolean, Object, Array, Object])
|
|
452
514
|
], AccessorProperty);
|
|
453
515
|
export { AccessorProperty };
|
|
454
516
|
let ClassBody = ClassBody_1 = class ClassBody extends AbstractExpressionNode {
|
|
455
|
-
constructor(body) {
|
|
456
|
-
super();
|
|
457
|
-
this.body = body;
|
|
458
|
-
}
|
|
459
517
|
static fromJSON(node, deserializer) {
|
|
460
|
-
return new ClassBody_1(node.body.map(deserializer));
|
|
518
|
+
return new ClassBody_1(node.body.map(deserializer), node.range, node.loc);
|
|
461
519
|
}
|
|
462
520
|
static visit(node, visitNode) {
|
|
463
521
|
node.body.forEach(visitNode);
|
|
464
522
|
}
|
|
523
|
+
constructor(body, range, loc) {
|
|
524
|
+
super(range, loc);
|
|
525
|
+
this.body = body;
|
|
526
|
+
}
|
|
465
527
|
getBody() {
|
|
466
528
|
return this.body;
|
|
467
529
|
}
|
|
468
|
-
shareVariables(scopeList) { }
|
|
469
530
|
set(stack, value) {
|
|
470
531
|
throw new Error('Method not implemented.');
|
|
471
532
|
}
|
|
472
|
-
get(stack,
|
|
473
|
-
this.body.forEach(definition => definition.get(stack,
|
|
533
|
+
get(stack, initializer) {
|
|
534
|
+
this.body.forEach(definition => definition.get(stack, initializer));
|
|
474
535
|
}
|
|
475
536
|
dependency(computed) {
|
|
476
537
|
throw new Error('Method not implemented.');
|
|
@@ -487,14 +548,14 @@ let ClassBody = ClassBody_1 = class ClassBody extends AbstractExpressionNode {
|
|
|
487
548
|
};
|
|
488
549
|
}
|
|
489
550
|
};
|
|
490
|
-
ClassBody = ClassBody_1 =
|
|
551
|
+
ClassBody = ClassBody_1 = __decorate([
|
|
491
552
|
Deserializer('ClassBody'),
|
|
492
|
-
__metadata("design:paramtypes", [Array])
|
|
553
|
+
__metadata("design:paramtypes", [Array, Array, Object])
|
|
493
554
|
], ClassBody);
|
|
494
555
|
export { ClassBody };
|
|
495
556
|
export class Class extends AbstractExpressionNode {
|
|
496
|
-
constructor(body, decorators, id, superClass) {
|
|
497
|
-
super();
|
|
557
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
558
|
+
super(range, loc);
|
|
498
559
|
this.body = body;
|
|
499
560
|
this.decorators = decorators;
|
|
500
561
|
this.id = id;
|
|
@@ -512,58 +573,45 @@ export class Class extends AbstractExpressionNode {
|
|
|
512
573
|
getSuperClass() {
|
|
513
574
|
return this.superClass;
|
|
514
575
|
}
|
|
515
|
-
shareVariables(scopeList) {
|
|
516
|
-
this.sharedVariables = scopeList;
|
|
517
|
-
}
|
|
518
576
|
set(stack) {
|
|
519
577
|
throw new Error(`Class.#set() has no implementation.`);
|
|
520
578
|
}
|
|
521
579
|
get(stack) {
|
|
522
|
-
|
|
523
|
-
|
|
580
|
+
// freeze stack
|
|
581
|
+
stack = stack.copyStack();
|
|
582
|
+
const className = this.id?.getName() ?? TEMP_CLASS_NAME;
|
|
583
|
+
const SuperClass = this.superClass?.get(stack) ?? class {
|
|
524
584
|
};
|
|
525
|
-
|
|
585
|
+
const initializer = new ClassInitializer();
|
|
586
|
+
const ClassConstructor = this.createClass(SuperClass, className, initializer);
|
|
526
587
|
// build class body
|
|
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
|
-
static [GET_PARAMETERS](args) {
|
|
556
|
-
return args;
|
|
557
|
-
}
|
|
558
|
-
static [(_a = STATIC_INITIALIZATION_BLOCK, _b = PRIVATE_SYMBOL, _c = INSTANCE_PRIVATE_SYMBOL, CONSTRUCTOR)]() { }
|
|
559
|
-
},
|
|
560
|
-
_d = PRIVATE_SYMBOL,
|
|
561
|
-
_e[_a] = [],
|
|
562
|
-
_e[_b] = {},
|
|
563
|
-
_e[_c] = {},
|
|
564
|
-
_e);
|
|
565
|
-
Reflect.set(ClassDeclaration, 'name', className);
|
|
566
|
-
return ClassDeclaration;
|
|
588
|
+
stack.pushBlockScopeFor({
|
|
589
|
+
'this': ClassConstructor,
|
|
590
|
+
'super': SuperClass,
|
|
591
|
+
});
|
|
592
|
+
this.body.get(stack, initializer);
|
|
593
|
+
initializer.initClass(ClassConstructor);
|
|
594
|
+
return ClassConstructor;
|
|
595
|
+
}
|
|
596
|
+
createClass(parentClass, className, initializer) {
|
|
597
|
+
var _a, _b, _c, _d;
|
|
598
|
+
const nameClassDeclaration = {
|
|
599
|
+
[className]: (_d = class extends parentClass {
|
|
600
|
+
constructor(...params) {
|
|
601
|
+
const parameters = initializer.getSuperArguments(params);
|
|
602
|
+
super(...parameters);
|
|
603
|
+
this[_c] = {};
|
|
604
|
+
initializer.initInstance(this);
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
_a = Symbol.toStringTag,
|
|
608
|
+
_b = PRIVATE_SYMBOL,
|
|
609
|
+
_c = PRIVATE_SYMBOL,
|
|
610
|
+
_d[_a] = className,
|
|
611
|
+
_d[_b] = {},
|
|
612
|
+
_d)
|
|
613
|
+
};
|
|
614
|
+
return nameClassDeclaration[className];
|
|
567
615
|
}
|
|
568
616
|
dependency(computed) {
|
|
569
617
|
throw new Error('Method not implemented.');
|
|
@@ -593,7 +641,7 @@ export class Class extends AbstractExpressionNode {
|
|
|
593
641
|
}
|
|
594
642
|
let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class {
|
|
595
643
|
static fromJSON(node, deserializer) {
|
|
596
|
-
return new ClassDeclaration_1(deserializer(node.body), deserializer(node.id), node.superClass && deserializer(node.superClass));
|
|
644
|
+
return new ClassDeclaration_1(deserializer(node.body), node.decorators.map(deserializer), deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
|
|
597
645
|
}
|
|
598
646
|
static visit(node, visitNode) {
|
|
599
647
|
visitNode(node.body);
|
|
@@ -601,8 +649,8 @@ let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class
|
|
|
601
649
|
visitNode(node.id);
|
|
602
650
|
node.superClass && visitNode(node.superClass);
|
|
603
651
|
}
|
|
604
|
-
constructor(body, decorators, id, superClass) {
|
|
605
|
-
super(body, decorators, id, superClass);
|
|
652
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
653
|
+
super(body, decorators, id, superClass, range, loc);
|
|
606
654
|
}
|
|
607
655
|
declareVariable(stack, propertyValue) {
|
|
608
656
|
stack.declareVariable(this.id.getName(), propertyValue);
|
|
@@ -616,14 +664,14 @@ let ClassDeclaration = ClassDeclaration_1 = class ClassDeclaration extends Class
|
|
|
616
664
|
return classConstructor;
|
|
617
665
|
}
|
|
618
666
|
};
|
|
619
|
-
ClassDeclaration = ClassDeclaration_1 =
|
|
667
|
+
ClassDeclaration = ClassDeclaration_1 = __decorate([
|
|
620
668
|
Deserializer('ClassDeclaration'),
|
|
621
|
-
__metadata("design:paramtypes", [ClassBody, Array, Identifier, Object])
|
|
669
|
+
__metadata("design:paramtypes", [ClassBody, Array, Identifier, Object, Array, Object])
|
|
622
670
|
], ClassDeclaration);
|
|
623
671
|
export { ClassDeclaration };
|
|
624
672
|
let ClassExpression = ClassExpression_1 = class ClassExpression extends Class {
|
|
625
673
|
static fromJSON(node, deserializer) {
|
|
626
|
-
return new ClassExpression_1(deserializer(node.body), node.superClass && deserializer(node.superClass));
|
|
674
|
+
return new ClassExpression_1(deserializer(node.body), node.decorators.map(deserializer), node.id && deserializer(node.id), node.superClass && deserializer(node.superClass), node.range, node.loc);
|
|
627
675
|
}
|
|
628
676
|
static visit(node, visitNode) {
|
|
629
677
|
visitNode(node.body);
|
|
@@ -631,9 +679,13 @@ let ClassExpression = ClassExpression_1 = class ClassExpression extends Class {
|
|
|
631
679
|
node.id && visitNode(node.id);
|
|
632
680
|
node.superClass && visitNode(node.superClass);
|
|
633
681
|
}
|
|
682
|
+
constructor(body, decorators, id, superClass, range, loc) {
|
|
683
|
+
super(body, decorators, id, superClass, range, loc);
|
|
684
|
+
}
|
|
634
685
|
};
|
|
635
|
-
ClassExpression = ClassExpression_1 =
|
|
636
|
-
Deserializer('ClassExpression')
|
|
686
|
+
ClassExpression = ClassExpression_1 = __decorate([
|
|
687
|
+
Deserializer('ClassExpression'),
|
|
688
|
+
__metadata("design:paramtypes", [ClassBody, Array, Identifier, Object, Array, Object])
|
|
637
689
|
], ClassExpression);
|
|
638
690
|
export { ClassExpression };
|
|
639
691
|
//# sourceMappingURL=class.js.map
|