@ibyar/expressions 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -0
- package/api/abstract.d.ts +3 -3
- package/api/abstract.js +2 -2
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +18 -12
- package/api/class/class.js +122 -81
- package/api/class/class.js.map +1 -1
- package/api/computing/debugger.d.ts +15 -0
- package/api/computing/debugger.js +35 -0
- package/api/computing/debugger.js.map +1 -0
- package/api/computing/rest.d.ts +4 -4
- package/api/computing/rest.js.map +1 -1
- package/api/definition/array.d.ts +7 -6
- package/api/definition/array.js +20 -14
- package/api/definition/array.js.map +1 -1
- package/api/definition/function.d.ts +35 -46
- package/api/definition/function.js +281 -299
- package/api/definition/function.js.map +1 -1
- package/api/definition/object.d.ts +9 -6
- package/api/definition/object.js +34 -4
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.js +5 -1
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +31 -47
- package/api/definition/values.js +59 -145
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +2 -1
- package/api/deserialize/deserialize.js +4 -1
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +2 -2
- package/api/deserialize/type-store.js.map +1 -1
- package/api/expression.d.ts +5 -7
- package/api/expression.js.map +1 -1
- package/api/index.d.ts +2 -0
- package/api/index.js +2 -0
- package/api/index.js.map +1 -1
- package/api/module/common.d.ts +29 -0
- package/api/module/common.js +71 -0
- package/api/module/common.js.map +1 -0
- package/api/module/export.d.ts +15 -9
- package/api/module/export.js +57 -15
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +3 -8
- package/api/module/import.js +9 -19
- package/api/module/import.js.map +1 -1
- package/api/{module/app/program.d.ts → program.d.ts} +4 -4
- package/api/{module/app/program.js → program.js} +3 -3
- package/api/program.js.map +1 -0
- package/api/statement/control/block.d.ts +1 -2
- package/api/statement/control/block.js +20 -21
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/switch.js +8 -3
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +36 -11
- package/api/statement/control/terminate.js +79 -18
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +7 -7
- package/api/statement/declarations/declares.js +1 -1
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.js +22 -16
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.js +15 -11
- package/api/statement/iterations/while.js.map +1 -1
- package/api/utils.d.ts +2 -0
- package/api/utils.js +3 -1
- package/api/utils.js.map +1 -1
- package/package.json +4 -4
- package/scope/proxy.d.ts +0 -2
- package/scope/proxy.js +4 -24
- package/scope/proxy.js.map +1 -1
- package/scope/stack.d.ts +2 -2
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +204 -0
- package/v8/enums.js +375 -0
- package/v8/enums.js.map +1 -0
- package/v8/index.d.ts +2 -1
- package/v8/index.js +2 -1
- package/v8/index.js.map +1 -1
- package/v8/inline.d.ts +177 -0
- package/v8/inline.js +1973 -0
- package/v8/inline.js.map +1 -0
- package/v8/nodes.d.ts +8 -7
- package/v8/nodes.js +37 -63
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +41 -151
- package/v8/parser.js +507 -1579
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +35 -3
- package/v8/stream.js +616 -164
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +15 -9
- package/v8/token.js +79 -46
- package/v8/token.js.map +1 -1
- package/visit/visitor.js.map +1 -1
- package/api/module/app/program.js.map +0 -1
- package/v8/app.d.ts +0 -0
- package/v8/app.js +0 -2
- package/v8/app.js.map +0 -1
package/api/definition/values.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Identifier_1, Literal_1
|
|
1
|
+
var Identifier_1, Literal_1;
|
|
2
2
|
import { __decorate, __metadata } from "tslib";
|
|
3
3
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
@@ -55,17 +55,48 @@ Identifier = Identifier_1 = __decorate([
|
|
|
55
55
|
__metadata("design:paramtypes", [Object])
|
|
56
56
|
], Identifier);
|
|
57
57
|
export { Identifier };
|
|
58
|
+
let ThisExpression = class ThisExpression extends Identifier {
|
|
59
|
+
static fromJSON(node) {
|
|
60
|
+
return ThisNode;
|
|
61
|
+
}
|
|
62
|
+
constructor() {
|
|
63
|
+
super('this');
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
ThisExpression = __decorate([
|
|
67
|
+
Deserializer('ThisExpression'),
|
|
68
|
+
__metadata("design:paramtypes", [])
|
|
69
|
+
], ThisExpression);
|
|
70
|
+
export { ThisExpression };
|
|
58
71
|
let Literal = Literal_1 = class Literal extends AbstractExpressionNode {
|
|
59
|
-
constructor(value) {
|
|
72
|
+
constructor(value, raw, regex, bigint) {
|
|
60
73
|
super();
|
|
61
74
|
this.value = value;
|
|
75
|
+
this.raw = raw;
|
|
76
|
+
this.regex = regex;
|
|
77
|
+
this.bigint = bigint;
|
|
62
78
|
}
|
|
63
79
|
static fromJSON(node) {
|
|
64
|
-
|
|
80
|
+
if (node.bigint) {
|
|
81
|
+
return new Literal_1(BigInt(node.bigint), node.raw, undefined, node.bigint);
|
|
82
|
+
}
|
|
83
|
+
else if (node.regex) {
|
|
84
|
+
return new Literal_1(RegExp(node.regex.pattern, node.regex.flags), node.raw, node.regex);
|
|
85
|
+
}
|
|
86
|
+
return new Literal_1(node.value, node.raw);
|
|
65
87
|
}
|
|
66
88
|
getValue() {
|
|
67
89
|
return this.value;
|
|
68
90
|
}
|
|
91
|
+
getRegex() {
|
|
92
|
+
return this.regex;
|
|
93
|
+
}
|
|
94
|
+
getBigint() {
|
|
95
|
+
return this.bigint;
|
|
96
|
+
}
|
|
97
|
+
geRaw() {
|
|
98
|
+
return this.raw;
|
|
99
|
+
}
|
|
69
100
|
shareVariables(scopeList) { }
|
|
70
101
|
set() {
|
|
71
102
|
throw new Error(`${this.constructor.name}#set() has no implementation.`);
|
|
@@ -87,55 +118,32 @@ let Literal = Literal_1 = class Literal extends AbstractExpressionNode {
|
|
|
87
118
|
return computed ? [{ computed: false, path: this.toString() }] : [];
|
|
88
119
|
}
|
|
89
120
|
toString() {
|
|
90
|
-
return String(this.value);
|
|
121
|
+
return this.raw ?? String(this.value);
|
|
91
122
|
}
|
|
92
123
|
toJson() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
__metadata("design:paramtypes", [Object])
|
|
99
|
-
], Literal);
|
|
100
|
-
export { Literal };
|
|
101
|
-
let StringLiteral = StringLiteral_1 = class StringLiteral extends Literal {
|
|
102
|
-
constructor(value, quote) {
|
|
103
|
-
super(value);
|
|
104
|
-
const firstChar = value.charAt(0);
|
|
105
|
-
if (quote) {
|
|
106
|
-
this.quote = quote;
|
|
107
|
-
this.value = value;
|
|
108
|
-
}
|
|
109
|
-
else if (firstChar === '"' || firstChar == `'` || firstChar === '`') {
|
|
110
|
-
this.quote = firstChar;
|
|
111
|
-
this.value = `"${value.substring(1, value.length - 1)}"`;
|
|
124
|
+
if (this.bigint) {
|
|
125
|
+
return {
|
|
126
|
+
bigint: this.bigint,
|
|
127
|
+
raw: this.raw,
|
|
128
|
+
};
|
|
112
129
|
}
|
|
113
|
-
else {
|
|
114
|
-
|
|
115
|
-
|
|
130
|
+
else if (this.regex) {
|
|
131
|
+
return {
|
|
132
|
+
regex: { pattern: this.regex?.pattern, flags: this.regex?.flags },
|
|
133
|
+
raw: this.raw,
|
|
134
|
+
};
|
|
116
135
|
}
|
|
117
|
-
}
|
|
118
|
-
static fromJSON(node) {
|
|
119
|
-
return new StringLiteral_1(node.value, node.quote);
|
|
120
|
-
}
|
|
121
|
-
getQuote() {
|
|
122
|
-
return this.quote;
|
|
123
|
-
}
|
|
124
|
-
toString() {
|
|
125
|
-
return `${this.quote}${this.value}${this.quote}`;
|
|
126
|
-
}
|
|
127
|
-
toJson() {
|
|
128
136
|
return {
|
|
129
137
|
value: this.value,
|
|
130
|
-
|
|
138
|
+
raw: this.raw,
|
|
131
139
|
};
|
|
132
140
|
}
|
|
133
141
|
};
|
|
134
|
-
|
|
135
|
-
Deserializer('
|
|
136
|
-
__metadata("design:paramtypes", [String, String])
|
|
137
|
-
],
|
|
138
|
-
export {
|
|
142
|
+
Literal = Literal_1 = __decorate([
|
|
143
|
+
Deserializer('Literal'),
|
|
144
|
+
__metadata("design:paramtypes", [Object, String, Object, String])
|
|
145
|
+
], Literal);
|
|
146
|
+
export { Literal };
|
|
139
147
|
class TemplateArray extends Array {
|
|
140
148
|
constructor(strings) {
|
|
141
149
|
super(...strings);
|
|
@@ -229,117 +237,20 @@ TaggedTemplateExpression = __decorate([
|
|
|
229
237
|
__metadata("design:paramtypes", [Object, Array, Array])
|
|
230
238
|
], TaggedTemplateExpression);
|
|
231
239
|
export { TaggedTemplateExpression };
|
|
232
|
-
let NumberLiteral = NumberLiteral_1 = class NumberLiteral extends Literal {
|
|
233
|
-
static fromJSON(node) {
|
|
234
|
-
return new NumberLiteral_1(node.value);
|
|
235
|
-
}
|
|
236
|
-
constructor(value) {
|
|
237
|
-
super(value);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
NumberLiteral = NumberLiteral_1 = __decorate([
|
|
241
|
-
Deserializer('NumberLiteral'),
|
|
242
|
-
__metadata("design:paramtypes", [Number])
|
|
243
|
-
], NumberLiteral);
|
|
244
|
-
export { NumberLiteral };
|
|
245
|
-
let BigIntLiteral = BigIntLiteral_1 = class BigIntLiteral extends Literal {
|
|
246
|
-
static fromJSON(node) {
|
|
247
|
-
return new BigIntLiteral_1(BigInt(String(node.value)));
|
|
248
|
-
}
|
|
249
|
-
toString() {
|
|
250
|
-
return `${this.value}n`;
|
|
251
|
-
}
|
|
252
|
-
toJson() {
|
|
253
|
-
return { value: this.value.toString() };
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
BigIntLiteral = BigIntLiteral_1 = __decorate([
|
|
257
|
-
Deserializer('BigIntLiteral')
|
|
258
|
-
], BigIntLiteral);
|
|
259
|
-
export { BigIntLiteral };
|
|
260
|
-
let RegExpLiteral = RegExpLiteral_1 = class RegExpLiteral extends Literal {
|
|
261
|
-
static fromJSON(node) {
|
|
262
|
-
return new RegExpLiteral_1(new RegExp(node.regex.pattern, node.regex.flags));
|
|
263
|
-
}
|
|
264
|
-
toString() {
|
|
265
|
-
return `${this.value}n`;
|
|
266
|
-
}
|
|
267
|
-
toJson() {
|
|
268
|
-
return {
|
|
269
|
-
regex: {
|
|
270
|
-
pattern: this.value.source,
|
|
271
|
-
flags: this.value.flags
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
RegExpLiteral = RegExpLiteral_1 = __decorate([
|
|
278
|
-
Deserializer('RegExpLiteral')
|
|
279
|
-
], RegExpLiteral);
|
|
280
|
-
export { RegExpLiteral };
|
|
281
240
|
export const TRUE = String(true);
|
|
282
241
|
export const FALSE = String(false);
|
|
283
|
-
let BooleanLiteral = class BooleanLiteral extends Literal {
|
|
284
|
-
static fromJSON(node) {
|
|
285
|
-
switch (String(node.value)) {
|
|
286
|
-
case TRUE: return TrueNode;
|
|
287
|
-
case FALSE:
|
|
288
|
-
default:
|
|
289
|
-
return FalseNode;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
BooleanLiteral = __decorate([
|
|
294
|
-
Deserializer('BooleanLiteral')
|
|
295
|
-
], BooleanLiteral);
|
|
296
|
-
export { BooleanLiteral };
|
|
297
242
|
export const NULL = String(null);
|
|
298
243
|
export const UNDEFINED = String(undefined);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
case UNDEFINED:
|
|
304
|
-
default: return UndefinedNode;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
toString() {
|
|
308
|
-
if (typeof this.value === 'undefined') {
|
|
309
|
-
return UNDEFINED;
|
|
310
|
-
}
|
|
311
|
-
return NULL;
|
|
312
|
-
}
|
|
313
|
-
toJson() {
|
|
314
|
-
return { value: this.toString() };
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
NullishLiteral = __decorate([
|
|
318
|
-
Deserializer('NullishLiteral')
|
|
319
|
-
], NullishLiteral);
|
|
320
|
-
export { NullishLiteral };
|
|
321
|
-
let ThisExpression = class ThisExpression extends Identifier {
|
|
322
|
-
static fromJSON(node) {
|
|
323
|
-
return ThisNode;
|
|
324
|
-
}
|
|
325
|
-
constructor() {
|
|
326
|
-
super('this');
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
ThisExpression = __decorate([
|
|
330
|
-
Deserializer('ThisExpression'),
|
|
331
|
-
__metadata("design:paramtypes", [])
|
|
332
|
-
], ThisExpression);
|
|
333
|
-
export { ThisExpression };
|
|
334
|
-
export const NullNode = Object.freeze(new NullishLiteral(null));
|
|
335
|
-
export const UndefinedNode = Object.freeze(new NullishLiteral(undefined));
|
|
336
|
-
export const TrueNode = Object.freeze(new BooleanLiteral(true));
|
|
337
|
-
export const FalseNode = Object.freeze(new BooleanLiteral(false));
|
|
244
|
+
export const NullNode = Object.freeze(new Literal(null));
|
|
245
|
+
export const UndefinedNode = Object.freeze(new Literal(undefined));
|
|
246
|
+
export const TrueNode = Object.freeze(new Literal(true));
|
|
247
|
+
export const FalseNode = Object.freeze(new Literal(false));
|
|
338
248
|
export const ThisNode = Object.freeze(new ThisExpression());
|
|
339
249
|
export const GlobalThisNode = Object.freeze(new Identifier('globalThis'));
|
|
340
250
|
export const SymbolNode = Object.freeze(new Identifier('Symbol'));
|
|
341
251
|
export const OfNode = Object.freeze(new Identifier('of'));
|
|
342
252
|
export const AsNode = Object.freeze(new Identifier('as'));
|
|
253
|
+
export const DefaultNode = Object.freeze(new Identifier('default'));
|
|
343
254
|
export const GetIdentifier = Object.freeze(new Identifier('get'));
|
|
344
255
|
export const SetIdentifier = Object.freeze(new Identifier('set'));
|
|
345
256
|
export const AsyncIdentifier = Object.freeze(new Identifier('async'));
|
|
@@ -348,4 +259,7 @@ export const ConstructorIdentifier = Object.freeze(new Identifier('constructor')
|
|
|
348
259
|
export const NameIdentifier = Object.freeze(new Identifier('name'));
|
|
349
260
|
export const EvalIdentifier = Object.freeze(new Identifier('eval'));
|
|
350
261
|
export const ArgumentsIdentifier = Object.freeze(new Identifier('arguments'));
|
|
262
|
+
export const YieldIdentifier = Object.freeze(new Identifier('yield'));
|
|
263
|
+
export const SuperIdentifier = Object.freeze(new Identifier('super'));
|
|
264
|
+
export const LetIdentifier = Object.freeze(new Identifier('let'));
|
|
351
265
|
//# sourceMappingURL=values.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../../src/expressions/api/definition/values.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAYxD,IAAa,UAAU,kBAAvB,MAAa,UAAW,SAAQ,sBAAsB;IAIrD,YAAsB,IAAqB;QAC1C,KAAK,EAAE,CAAC;QADa,SAAI,GAAJ,IAAI,CAAiB;IAE3C,CAAC;IALD,MAAM,CAAC,QAAQ,CAAC,IAAgB;QAC/B,OAAO,IAAI,YAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAID,OAAO;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IACD,cAAc,CAAC,SAAuB,IAAU,CAAC;IACjD,GAAG,CAAC,KAAY,EAAE,KAAU;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC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I,UAAU,CAAC,IAAI,CAAC,CAAe,CAAC;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAe,CAAC;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAe,CAAC;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAe,CAAC;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAe,CAAC;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,aAAa,CAAC,CAAe,CAAC;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAe,CAAC;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAe,CAAC;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAe,CAAC","sourcesContent":["import type {\n\tCanDeclareExpression, ExpressionNode, NodeDeserializer,\n\tCanFindScope, ExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { AbstractExpressionNode } from '../abstract.js';\n\n/**\n * An identifier is a sequence of characters in the code that identifies a variable, function, or property.\n * In JavaScript, identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9),\n * but may not start with a digit.\n * An identifier differs from a string in that a string is data,\n * while an identifier is part of the code. In JavaScript,\n * there is no way to convert identifiers to strings,\n * but sometimes it is possible to parse strings into identifiers.\n */\n@Deserializer('Identifier')\nexport class Identifier extends AbstractExpressionNode implements CanDeclareExpression, CanFindScope {\n\tstatic fromJSON(node: Identifier): Identifier {\n\t\treturn new Identifier(node.name);\n\t}\n\tconstructor(protected name: string | number) {\n\t\tsuper();\n\t}\n\tgetName() {\n\t\treturn this.name;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\treturn stack.set(this.name, value) ? value : void 0;\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tif (thisContext) {\n\t\t\treturn thisContext[this.name];\n\t\t}\n\t\treturn stack.get(this.name);\n\t}\n\tfindScope<T extends object>(stack: Stack): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope: Scope<any>): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope?: Scope<any>): Scope<T> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getScope(this.name);\n\t\t}\n\t\tscope = stack.findScope(this.name);\n\t\treturn scope.getScope(this.name);\n\t}\n\tdeclareVariable(stack: Stack, propertyValue: any): any {\n\t\treturn stack.declareVariable(this.name, propertyValue);\n\t}\n\tgetDeclarationName(): string {\n\t\treturn this.toString();\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [this];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tconst path: ExpressionEventPath[] = [{ computed: false, path: this.toString() }];\n\t\treturn computed ? [{ computed, path: this.toString(), computedPath: [path] }] : path;\n\t}\n\ttoString(): string {\n\t\treturn String(this.name);\n\t}\n\ttoJson(): object {\n\t\treturn { name: this.name };\n\t}\n}\n\n@Deserializer('Literal')\nexport class Literal<T> extends AbstractExpressionNode implements CanFindScope {\n\tstatic fromJSON(node: Literal<any>):\n\t\tLiteral<string>\n\t\t| Literal<number>\n\t\t| Literal<bigint>\n\t\t| Literal<boolean>\n\t\t| Literal<RegExp>\n\t\t| Literal<null | undefined> {\n\t\treturn new Literal(node.value);\n\t}\n\tconstructor(protected value: T) {\n\t\tsuper();\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset() {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\tget(): T {\n\t\treturn this.value;\n\t}\n\tfindScope<V extends object>(stack: Stack): Scope<V>;\n\tfindScope<V extends object>(stack: Stack, scope: Scope<any>): Scope<V>;\n\tfindScope<V extends object>(stack: Stack, scope?: Scope<any>): Scope<V> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getScope<V>(this.value as any);\n\t\t}\n\t\tscope = stack.findScope<V>(this.value as any);\n\t\treturn scope.getScope<V>(this.value as any);\n\t}\n\tdependency(computed: true): ExpressionNode[] {\n\t\treturn computed ? [this] : [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn computed ? [{ computed: false, path: this.toString() }] : [];\n\t}\n\ttoString(): string {\n\t\treturn String(this.value);\n\t}\n\ttoJson(): object {\n\t\treturn { value: this.value };\n\t}\n}\n\n@Deserializer('StringLiteral')\nexport class StringLiteral extends Literal<string> {\n\tstatic fromJSON(node: StringLiteral): StringLiteral {\n\t\treturn new StringLiteral(node.value, node.quote);\n\t}\n\tprivate quote: string;\n\tconstructor(value: string, quote?: string) {\n\t\tsuper(value);\n\t\tconst firstChar = value.charAt(0);\n\t\tif (quote) {\n\t\t\tthis.quote = quote;\n\t\t\tthis.value = value;\n\t\t} else if (firstChar === '\"' || firstChar == `'` || firstChar === '`') {\n\t\t\tthis.quote = firstChar;\n\t\t\tthis.value = `\"${value.substring(1, value.length - 1)}\"`;\n\t\t} else {\n\t\t\tthis.quote = '';\n\t\t\tthis.value = value;\n\t\t}\n\t}\n\tgetQuote() {\n\t\treturn this.quote;\n\t}\n\ttoString(): string {\n\t\treturn `${this.quote}${this.value}${this.quote}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t\tquote: this.quote\n\t\t};\n\t}\n}\n\nclass TemplateArray extends Array<string> implements TemplateStringsArray {\n\traw: readonly string[];\n\tconstructor(strings: string[]) {\n\t\tsuper(...strings);\n\t\tthis.raw = strings;\n\t}\n}\n\nexport class TemplateLiteralExpressionNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: TemplateLiteralExpressionNode, deserializer: NodeDeserializer): TemplateLiteralExpressionNode {\n\t\treturn new TemplateLiteralExpressionNode(\n\t\t\tnode.quasis,\n\t\t\tnode.expressions.map(deserializer),\n\t\t\tnode.tag ? deserializer(node.tag) : void 0\n\t\t);\n\t}\n\tstatic visit(node: TemplateLiteralExpressionNode, visitNode: VisitNodeType): void {\n\t\tnode.tag && visitNode(node.tag);\n\t\tnode.expressions.forEach(visitNode);\n\t}\n\tconstructor(protected quasis: string[], protected expressions: ExpressionNode[], protected tag?: ExpressionNode,) {\n\t\tsuper();\n\t}\n\tgetTag() {\n\t\treturn this.tag;\n\t}\n\tgetExpressions() {\n\t\treturn this.expressions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.expressions.forEach(value => value.shareVariables(scopeList));\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`TemplateLiteralExpressionNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst tagged: Function = this.tag?.get(stack) || String.raw;\n\t\tconst templateStringsArray = new TemplateArray(this.quasis);\n\t\ttemplateStringsArray.raw = templateStringsArray;\n\t\tconst values = this.expressions.map(expr => expr.get(stack));\n\t\treturn tagged(templateStringsArray, ...values);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\tlet str = this.tag?.toString() || '';\n\t\tstr += '`';\n\t\tlet i = 0;\n\t\tfor (; i < this.quasis.length - 1; i++) {\n\t\t\tstr += this.quasis[i];\n\t\t\tstr += '${';\n\t\t\tstr += this.expressions[i].toString();\n\t\t\tstr += '}';\n\t\t}\n\t\tstr += this.quasis[i];\n\t\tstr += '`';\n\t\treturn str;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tquasis: this.quasis,\n\t\t\texpressions: this.expressions.map(expr => expr.toJSON()),\n\t\t\ttag: this.tag?.toJSON(),\n\t\t};\n\t}\n}\n\n@Deserializer('TemplateLiteral')\nexport class TemplateLiteral extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: undefined;\n\tconstructor(quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions);\n\t}\n\toverride getTag(): undefined {\n\t\treturn undefined;\n\t}\n}\n\n@Deserializer('TaggedTemplateExpression')\nexport class TaggedTemplateExpression extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: ExpressionNode;\n\tconstructor(tag: ExpressionNode, quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions, tag);\n\t}\n\toverride getTag(): ExpressionNode {\n\t\treturn super.getTag()!;\n\t}\n}\n\n\n@Deserializer('NumberLiteral')\nexport class NumberLiteral extends Literal<number> {\n\tstatic fromJSON(node: NumberLiteral): NumberLiteral {\n\t\treturn new NumberLiteral(node.value);\n\t}\n\tconstructor(value: number) {\n\t\tsuper(value);\n\t}\n}\n\n@Deserializer('BigIntLiteral')\nexport class BigIntLiteral extends Literal<bigint> {\n\tstatic fromJSON(node: BigIntLiteral): BigIntLiteral {\n\t\treturn new BigIntLiteral(BigInt(String(node.value)));\n\t}\n\ttoString(): string {\n\t\treturn `${this.value}n`;\n\t}\n\ttoJson(): object {\n\t\treturn { value: this.value.toString() };\n\t}\n}\n@Deserializer('RegExpLiteral')\nexport class RegExpLiteral extends Literal<RegExp> {\n\tstatic fromJSON(node: RegExpLiteral & { regex: { pattern: string, flags: string } }): RegExpLiteral {\n\t\treturn new RegExpLiteral(new RegExp(node.regex.pattern, node.regex.flags));\n\t}\n\ttoString(): string {\n\t\treturn `${this.value}n`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tregex: {\n\t\t\t\tpattern: this.value.source,\n\t\t\t\tflags: this.value.flags\n\t\t\t}\n\t\t};;\n\t}\n}\n\nexport const TRUE = String(true);\nexport const FALSE = String(false);\n@Deserializer('BooleanLiteral')\nexport class BooleanLiteral extends Literal<boolean> {\n\tstatic fromJSON(node: BooleanLiteral): BooleanLiteral {\n\t\tswitch (String(node.value)) {\n\t\t\tcase TRUE: return TrueNode;\n\t\t\tcase FALSE:\n\t\t\tdefault:\n\t\t\t\treturn FalseNode;\n\t\t}\n\t}\n}\n\nexport const NULL = String(null);\nexport const UNDEFINED = String(undefined);\n\n@Deserializer('NullishLiteral')\nexport class NullishLiteral extends Literal<null | undefined> {\n\tstatic fromJSON(node: NullishLiteral): NullishLiteral {\n\t\tswitch (String(node.value)) {\n\t\t\tcase NULL: return NullNode;\n\t\t\tcase UNDEFINED:\n\t\t\tdefault: return UndefinedNode;\n\t\t}\n\t}\n\n\ttoString(): string {\n\t\tif (typeof this.value === 'undefined') {\n\t\t\treturn UNDEFINED;\n\t\t}\n\t\treturn NULL;\n\t}\n\ttoJson(): object {\n\t\treturn { value: this.toString() };\n\t}\n}\n\n@Deserializer('ThisExpression')\nexport class ThisExpression extends Identifier {\n\tstatic fromJSON(node: ThisExpression): ThisExpression {\n\t\treturn ThisNode;\n\t}\n\tconstructor() {\n\t\tsuper('this');\n\t}\n}\n\nexport const NullNode = Object.freeze(new NullishLiteral(null)) as NullishLiteral;\nexport const UndefinedNode = Object.freeze(new NullishLiteral(undefined)) as NullishLiteral;\nexport const TrueNode = Object.freeze(new BooleanLiteral(true)) as BooleanLiteral;\nexport const FalseNode = Object.freeze(new BooleanLiteral(false)) as BooleanLiteral;\nexport const ThisNode = Object.freeze(new ThisExpression()) as ThisExpression;\nexport const GlobalThisNode = Object.freeze(new Identifier('globalThis')) as Identifier;\nexport const SymbolNode = Object.freeze(new Identifier('Symbol')) as Identifier;\nexport const OfNode = Object.freeze(new Identifier('of')) as Identifier;\nexport const AsNode = Object.freeze(new Identifier('as')) as Identifier;\nexport const GetIdentifier = Object.freeze(new Identifier('get')) as Identifier;\nexport const SetIdentifier = Object.freeze(new Identifier('set')) as Identifier;\nexport const AsyncIdentifier = Object.freeze(new Identifier('async')) as Identifier;\nexport const AwaitIdentifier = Object.freeze(new Identifier('await')) as Identifier;\nexport const ConstructorIdentifier = Object.freeze(new Identifier('constructor')) as Identifier;\nexport const NameIdentifier = Object.freeze(new Identifier('name')) as Identifier;\nexport const EvalIdentifier = Object.freeze(new Identifier('eval')) as Identifier;\nexport const ArgumentsIdentifier = Object.freeze(new Identifier('arguments')) as Identifier;\n"]}
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../../src/expressions/api/definition/values.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAYxD,IAAa,UAAU,kBAAvB,MAAa,UAAW,SAAQ,sBAAsB;IAIrD,YAAsB,IAAqB;QAC1C,KAAK,EAAE,CAAC;QADa,SAAI,GAAJ,IAAI,CAAiB;IAE3C,CAAC;IALD,MAAM,CAAC,QAAQ,CAAC,IAAgB;QAC/B,OAAO,IAAI,YAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAID,OAAO;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IACD,cAAc,CAAC,SAAuB,IAAU,CAAC;IACjD,GAAG,CAAC,KAAY,EAAE,KAAU;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IACD,GAAG,CA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,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAe,CAAC","sourcesContent":["import type {\n\tDeclarationExpression, ExpressionNode, NodeDeserializer,\n\tCanFindScope, ExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { AbstractExpressionNode } from '../abstract.js';\n\n/**\n * An identifier is a sequence of characters in the code that identifies a variable, function, or property.\n * In JavaScript, identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9),\n * but may not start with a digit.\n * An identifier differs from a string in that a string is data,\n * while an identifier is part of the code. In JavaScript,\n * there is no way to convert identifiers to strings,\n * but sometimes it is possible to parse strings into identifiers.\n */\n@Deserializer('Identifier')\nexport class Identifier extends AbstractExpressionNode implements DeclarationExpression, CanFindScope {\n\tstatic fromJSON(node: Identifier): Identifier {\n\t\treturn new Identifier(node.name);\n\t}\n\tconstructor(protected name: string | number) {\n\t\tsuper();\n\t}\n\tgetName() {\n\t\treturn this.name;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\treturn stack.set(this.name, value) ? value : void 0;\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tif (thisContext) {\n\t\t\treturn thisContext[this.name];\n\t\t}\n\t\treturn stack.get(this.name);\n\t}\n\tfindScope<T extends object>(stack: Stack): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope: Scope<any>): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope?: Scope<any>): Scope<T> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getScope(this.name);\n\t\t}\n\t\tscope = stack.findScope(this.name);\n\t\treturn scope.getScope(this.name);\n\t}\n\tdeclareVariable(stack: Stack, propertyValue: any): any {\n\t\treturn stack.declareVariable(this.name, propertyValue);\n\t}\n\tgetDeclarationName(): string {\n\t\treturn this.toString();\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [this];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tconst path: ExpressionEventPath[] = [{ computed: false, path: this.toString() }];\n\t\treturn computed ? [{ computed, path: this.toString(), computedPath: [path] }] : path;\n\t}\n\ttoString(): string {\n\t\treturn String(this.name);\n\t}\n\ttoJson(): object {\n\t\treturn { name: this.name };\n\t}\n}\n\n@Deserializer('ThisExpression')\nexport class ThisExpression extends Identifier {\n\tstatic fromJSON(node: ThisExpression): ThisExpression {\n\t\treturn ThisNode;\n\t}\n\tconstructor() {\n\t\tsuper('this');\n\t}\n}\n\n@Deserializer('Literal')\nexport class Literal<T> extends AbstractExpressionNode implements CanFindScope {\n\tstatic fromJSON(node: Literal<any>):\n\t\tLiteral<string>\n\t\t| Literal<number>\n\t\t| Literal<boolean>\n\t\t| Literal<RegExp>\n\t\t| Literal<bigint>\n\t\t| Literal<null>\n\t\t| Literal<undefined> {\n\t\tif (node.bigint) {\n\t\t\treturn new Literal(BigInt(node.bigint), node.raw, undefined, node.bigint);\n\t\t} else if (node.regex) {\n\t\t\treturn new Literal(RegExp(node.regex.pattern, node.regex.flags), node.raw, node.regex);\n\t\t}\n\t\treturn new Literal(node.value, node.raw);\n\t}\n\tconstructor(protected value: T, protected raw?: string, protected regex?: { pattern: string, flags: string }, protected bigint?: string) {\n\t\tsuper();\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tgetRegex() {\n\t\treturn this.regex;\n\t}\n\tgetBigint() {\n\t\treturn this.bigint;\n\t}\n\tgeRaw() {\n\t\treturn this.raw;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset() {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\tget(): T {\n\t\treturn this.value;\n\t}\n\tfindScope<V extends object>(stack: Stack): Scope<V>;\n\tfindScope<V extends object>(stack: Stack, scope: Scope<any>): Scope<V>;\n\tfindScope<V extends object>(stack: Stack, scope?: Scope<any>): Scope<V> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getScope<V>(this.value as any);\n\t\t}\n\t\tscope = stack.findScope<V>(this.value as any);\n\t\treturn scope.getScope<V>(this.value as any);\n\t}\n\tdependency(computed: true): ExpressionNode[] {\n\t\treturn computed ? [this] : [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn computed ? [{ computed: false, path: this.toString() }] : [];\n\t}\n\ttoString(): string {\n\t\treturn this.raw ?? String(this.value);\n\t}\n\ttoJson(): object {\n\t\tif (this.bigint) {\n\t\t\treturn {\n\t\t\t\tbigint: this.bigint,\n\t\t\t\traw: this.raw,\n\t\t\t};\n\t\t} else if (this.regex) {\n\t\t\treturn {\n\t\t\t\tregex: { pattern: this.regex?.pattern, flags: this.regex?.flags },\n\t\t\t\traw: this.raw,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t\traw: this.raw,\n\t\t};\n\t}\n}\n\nclass TemplateArray extends Array<string> implements TemplateStringsArray {\n\traw: readonly string[];\n\tconstructor(strings: string[]) {\n\t\tsuper(...strings);\n\t\tthis.raw = strings;\n\t}\n}\n\nexport class TemplateLiteralExpressionNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: TemplateLiteralExpressionNode, deserializer: NodeDeserializer): TemplateLiteralExpressionNode {\n\t\treturn new TemplateLiteralExpressionNode(\n\t\t\tnode.quasis,\n\t\t\tnode.expressions.map(deserializer),\n\t\t\tnode.tag ? deserializer(node.tag) : void 0\n\t\t);\n\t}\n\tstatic visit(node: TemplateLiteralExpressionNode, visitNode: VisitNodeType): void {\n\t\tnode.tag && visitNode(node.tag);\n\t\tnode.expressions.forEach(visitNode);\n\t}\n\tconstructor(protected quasis: string[], protected expressions: ExpressionNode[], protected tag?: ExpressionNode,) {\n\t\tsuper();\n\t}\n\tgetTag() {\n\t\treturn this.tag;\n\t}\n\tgetExpressions() {\n\t\treturn this.expressions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.expressions.forEach(value => value.shareVariables(scopeList));\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`TemplateLiteralExpressionNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst tagged: Function = this.tag?.get(stack) || String.raw;\n\t\tconst templateStringsArray = new TemplateArray(this.quasis);\n\t\ttemplateStringsArray.raw = templateStringsArray;\n\t\tconst values = this.expressions.map(expr => expr.get(stack));\n\t\treturn tagged(templateStringsArray, ...values);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\tlet str = this.tag?.toString() || '';\n\t\tstr += '`';\n\t\tlet i = 0;\n\t\tfor (; i < this.quasis.length - 1; i++) {\n\t\t\tstr += this.quasis[i];\n\t\t\tstr += '${';\n\t\t\tstr += this.expressions[i].toString();\n\t\t\tstr += '}';\n\t\t}\n\t\tstr += this.quasis[i];\n\t\tstr += '`';\n\t\treturn str;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tquasis: this.quasis,\n\t\t\texpressions: this.expressions.map(expr => expr.toJSON()),\n\t\t\ttag: this.tag?.toJSON(),\n\t\t};\n\t}\n}\n\n@Deserializer('TemplateLiteral')\nexport class TemplateLiteral extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: undefined;\n\tconstructor(quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions);\n\t}\n\toverride getTag(): undefined {\n\t\treturn undefined;\n\t}\n}\n\n@Deserializer('TaggedTemplateExpression')\nexport class TaggedTemplateExpression extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: ExpressionNode;\n\tconstructor(tag: ExpressionNode, quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions, tag);\n\t}\n\toverride getTag(): ExpressionNode {\n\t\treturn super.getTag()!;\n\t}\n}\n\n\n// @Deserializer('BigIntLiteral')\n// export class BigIntLiteral extends Literal<bigint> {\n// \tstatic fromJSON(node: BigIntLiteral): BigIntLiteral {\n// \t\treturn new BigIntLiteral(BigInt(String(node.value)));\n// \t}\n// \ttoString(): string {\n// \t\treturn `${this.value}n`;\n// \t}\n// \ttoJson(): object {\n// \t\treturn { value: this.value.toString() };\n// \t}\n// }\n\n\nexport const TRUE = String(true);\nexport const FALSE = String(false);\n\nexport const NULL = String(null);\nexport const UNDEFINED = String(undefined);\n\nexport const NullNode = Object.freeze(new Literal<null>(null)) as Literal<null>;\nexport const UndefinedNode = Object.freeze(new Literal<undefined>(undefined)) as Literal<undefined>;\nexport const TrueNode = Object.freeze(new Literal<boolean>(true)) as Literal<boolean>;\nexport const FalseNode = Object.freeze(new Literal<boolean>(false)) as Literal<boolean>;\nexport const ThisNode = Object.freeze(new ThisExpression()) as ThisExpression;\nexport const GlobalThisNode = Object.freeze(new Identifier('globalThis')) as Identifier;\nexport const SymbolNode = Object.freeze(new Identifier('Symbol')) as Identifier;\nexport const OfNode = Object.freeze(new Identifier('of')) as Identifier;\nexport const AsNode = Object.freeze(new Identifier('as')) as Identifier;\nexport const DefaultNode = Object.freeze(new Identifier('default')) as Identifier;\nexport const GetIdentifier = Object.freeze(new Identifier('get')) as Identifier;\nexport const SetIdentifier = Object.freeze(new Identifier('set')) as Identifier;\nexport const AsyncIdentifier = Object.freeze(new Identifier('async')) as Identifier;\nexport const AwaitIdentifier = Object.freeze(new Identifier('await')) as Identifier;\nexport const ConstructorIdentifier = Object.freeze(new Identifier('constructor')) as Identifier;\nexport const NameIdentifier = Object.freeze(new Identifier('name')) as Identifier;\nexport const EvalIdentifier = Object.freeze(new Identifier('eval')) as Identifier;\nexport const ArgumentsIdentifier = Object.freeze(new Identifier('arguments')) as Identifier;\nexport const YieldIdentifier = Object.freeze(new Identifier('yield')) as Identifier;\nexport const SuperIdentifier = Object.freeze(new Identifier('super')) as Identifier;\nexport const LetIdentifier = Object.freeze(new Identifier('let')) as Identifier;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ExpressionNode } from '../expression.js';
|
|
1
|
+
import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';
|
|
2
2
|
export declare function Deserializer(type: string): Function;
|
|
3
|
+
export declare function getDeserializerType(target: ExpressionNodConstructor<ExpressionNode>): string;
|
|
3
4
|
export declare function serializeNode(node: ExpressionNode): string;
|
|
4
5
|
export declare function deserialize(node: ExpressionNode): ExpressionNode;
|
|
5
6
|
export declare function deserializeNode(node: string): ExpressionNode;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { expressionTypes } from './type-store.js';
|
|
2
2
|
export function Deserializer(type) {
|
|
3
3
|
return (target) => {
|
|
4
|
-
|
|
4
|
+
target.type = type;
|
|
5
5
|
expressionTypes.set(type, target);
|
|
6
6
|
return target;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
+
export function getDeserializerType(target) {
|
|
10
|
+
return target.type;
|
|
11
|
+
}
|
|
9
12
|
export function serializeNode(node) {
|
|
10
13
|
return JSON.stringify(node);
|
|
11
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deserialize.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/deserialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"deserialize.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/deserialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,CAAC,MAAgD,EAAE,EAAE;QAC3D,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAgD;IACnF,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAoB;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAQD,MAAM,UAAU,WAAW,CAAC,IAAoB;IAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAO,IAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACjE,IAAI,QAAQ,EAAE;QACb,OAAO,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KACnC;SAAM;QACN,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACrF;AACF,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';\nimport { expressionTypes } from './type-store.js';\n\n\n\nexport function Deserializer(type: string): Function {\n\treturn (target: ExpressionNodConstructor<ExpressionNode>) => {\n\t\ttarget.type = type;\n\t\texpressionTypes.set(type, target);\n\t\treturn target;\n\t};\n}\n\nexport function getDeserializerType(target: ExpressionNodConstructor<ExpressionNode>) {\n\treturn target.type;\n}\n\nexport function serializeNode(node: ExpressionNode) {\n\treturn JSON.stringify(node);\n}\n\n\n/**\n * convert from json expression `JSON.stringify(node)` or `serializeNode` to `ExpressionNode`\n * @param node as type `NodeJsonType`\n * @returns ExpressionNode\n */\nexport function deserialize(node: ExpressionNode) {\n\tconst fromJSON = expressionTypes.get((<any>node).type)?.fromJSON;\n\tif (fromJSON) {\n\t\treturn fromJSON(node, deserialize);\n\t} else {\n\t\tthrow new Error(`Couldn't find Expression class for name: ${JSON.stringify(node)}.`);\n\t}\n}\n\nexport function deserializeNode(node: string) {\n\tconst exp = JSON.parse(node);\n\treturn deserialize(exp);\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ExpressionNode,
|
|
2
|
-
export declare const expressionTypes: Map<string,
|
|
1
|
+
import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';
|
|
2
|
+
export declare const expressionTypes: Map<string, ExpressionNodConstructor<ExpressionNode>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-store.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/type-store.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"type-store.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/type-store.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAA0D,IAAI,GAAG,EAAE,CAAC","sourcesContent":["import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';\n\n\nexport const expressionTypes: Map<string, ExpressionNodConstructor<ExpressionNode>> = new Map();\n"]}
|
package/api/expression.d.ts
CHANGED
|
@@ -29,18 +29,16 @@ export interface ExpressionNode {
|
|
|
29
29
|
events(): ExpressionEventMap;
|
|
30
30
|
toString(): string;
|
|
31
31
|
toJSON(): NodeJsonType;
|
|
32
|
-
getClass():
|
|
32
|
+
getClass(): ExpressionNodConstructor<ExpressionNode>;
|
|
33
33
|
}
|
|
34
34
|
export declare type NodeDeserializer<N = ExpressionNode> = (node: N) => N;
|
|
35
35
|
export declare type VisitNodeType = (expression: ExpressionNode) => void;
|
|
36
|
-
export interface
|
|
37
|
-
fromJSON(node: N, deserializer: NodeDeserializer): N;
|
|
38
|
-
visit?(node: N, visitNode: VisitNodeType): void;
|
|
39
|
-
}
|
|
40
|
-
export interface NodeExpressionWithType<N extends ExpressionNode> extends NodeExpressionClass<N> {
|
|
36
|
+
export interface ExpressionNodConstructor<N extends ExpressionNode> extends TypeOf<N> {
|
|
41
37
|
type: string;
|
|
38
|
+
fromJSON(node: N, deserializer: NodeDeserializer): N;
|
|
39
|
+
visit?(node: N, visitNode: Object): void;
|
|
42
40
|
}
|
|
43
|
-
export interface
|
|
41
|
+
export interface DeclarationExpression extends ExpressionNode {
|
|
44
42
|
declareVariable(stack: Stack, propertyValue?: any): any;
|
|
45
43
|
getDeclarationName?(): string;
|
|
46
44
|
}
|
package/api/expression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/expressions/api/expression.ts"],"names":[],"mappings":"","sourcesContent":["import type { Scope, ScopeContext } from '../scope/scope.js';\nimport type { Stack } from '../scope/stack.js';\nimport { TypeOf } from './utils.js';\n\nexport type NodeType = { type: string };\nexport type NodeJsonType = { [key: string]: any } & NodeType;\n\nexport type ExpressionEventPathDotNotation = { computed: false, path: string };\nexport type ExpressionEventPathBracketNotation = { computed: true, path: string, computedPath: ExpressionEventPath[][] };\nexport type ExpressionEventPath = ExpressionEventPathDotNotation | ExpressionEventPathBracketNotation;\nexport type ExpressionEventMap = { [key: string]: ExpressionEventMap };\n\nexport interface ExpressionNode {\n\n\t/**\n\t * pass scope list from outer function to inner function,\n\t * \n\t * all other end point expression should do nothing,\n\t * if this function executed.\n\t * \n\t * @param scopeList all outer function scopes given to the inner function,\n\t * this solution ignore the fact that some inner function has no need to\n\t * get shared variables, as its implementation never say that\n\t * ```js\n\t * function f(d) {\n\t * \t\tfunction g() {\n\t * \t\t\tconst a = ({ d }) => d;\n\t * \t\t\treturn a;\n\t * \t\t}\n\t * \t\treturn [d, g];\n\t * }\n\t * ```\n\t */\n\tshareVariables(scopeList: Scope<ScopeContext>[]): void;\n\n\t/**\n\t * assign the value to this expression in stack.\n\t * \n\t * most ExpressionNode will not implement this method, and will throw an exception.\n\t * @param stack \n\t * @param value \n\t */\n\tset(stack: Stack, value: any): any;\n\n\t/**\n\t * execute/get the code for this expression and return the result value.\n\t * @param stack \n\t * @param thisContext \n\t */\n\tget(stack: Stack, thisContext?: any): any;\n\n\t/**\n\t * get all dependencies form an expression node\n\t *\n\t * tha return from this method, is represent an answer for what identifiers this expression depends-on.\n\t * \n\t *\n\t * ex:\n\t * ```js\n\t * x + y;\n\t * ```\n\t *\n\t * - for `+` operator :\tthe answer should be `lhs` and `rhs`,\n\t * - for `x` identifier:\tthe answer should be node `x`,\n\t * - for `y` identifier:\tthe answer should be node `y`.\n\t *\n\t * so, the return from `+` will be `[ node 'x', node 'y']`\n\t *\n\t * and:\n\t * - `x.y.z * a` ==> `[ member node `x.y.z`, identifier 'a']`\n\t * @param computed\n\t */\n\tdependency(computed?: true): ExpressionNode[];\n\n\t/**\n\t * ex:\n\t * ```js\n\t * x + y;\n\t * ```\n\t *\n\t * - for `+` operator :\tthe answer should be `lhs` and `rhs`,\n\t * - for `x` identifier:\tthe answer should be node `x`,\n\t * - for `y` identifier:\tthe answer should be node `y`.\n\t *\n\t * so, the return from `+` will be `['x', 'y']`\n\t *\n\t * and:\n\t * - `x.y.z` ==> `['x', 'y', 'z']`\n\t * - `x[y].z` ==> ['x', ]\n\t * @param computed required for member and chaining operators\n\t */\n\tdependencyPath(computed?: true): ExpressionEventPath[];\n\n\t/**\n\t * get all the events form this expression\n\t * \n\t * tha return from this method, is represent an answer for what is this expression depends-on as identifier name\n\t * \n\t * ex: \n\t * ```js\n\t * x + y;\n\t * ```\n\t * \n\t * - for `+` operator :\tthe answer should be `lhs` and `rhs`,\n\t * - for `x` identifier: the answer should be `x`\n\t * - for `y` identifier: the answer should be `y`\n\t * the final output will be \n\t * \n\t * so, the return from `+` will be `{ x: undefined, y: undefined }`\n\t * \n\t * and:\n\t * - `x.y.z * a` ==> `{ x: { y: { z: undefined }, a: undefined } }`\n\t * - `x.y.z > x.y.h.g` ==> `{ x: { y: { z: undefined, h: { g: undefined} } } }`\n\t * - `x[Symbol.toStringTag] + 'Class' + classType + array[3]` ==> `{ x: { 'Symbol.toStringTag': undefined }, classType: undefined, array: { 3: undefined } }`\n\t * - `'name'` ==> {}\n\t * - ```js\n\t * user[firstName + `son of ${fatherName}`]\n\t * ``` ==> `{ user: { 'firstName:fatherName': undefined }, firstName: undefined, fatherName: undefined }`\n\t * @param parent \n\t */\n\tevents(): ExpressionEventMap;\n\n\n\t/**\n\t * re-write this expression as a javascript source \n\t */\n\ttoString(): string;\n\n\t/**\n\t * used to map this object to represent an [ESTree](https://github.com/estree/estree) json object\n\t * @param key \n\t */\n\ttoJSON(): NodeJsonType;\n\n\t/**\n\t * just a helper method to force class that implement this interface to\n\t * have a static method `fromJSON` to help reconstruct this ExpressionNode\n\t * from an [ESTree](https://github.com/estree/estree) json object,\n\t * with all necessary implementation to execute the code\n\t */\n\tgetClass():
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/expressions/api/expression.ts"],"names":[],"mappings":"","sourcesContent":["import type { Scope, ScopeContext } from '../scope/scope.js';\nimport type { Stack } from '../scope/stack.js';\nimport { TypeOf } from './utils.js';\n\nexport type NodeType = { type: string };\nexport type NodeJsonType = { [key: string]: any } & NodeType;\n\nexport type ExpressionEventPathDotNotation = { computed: false, path: string };\nexport type ExpressionEventPathBracketNotation = { computed: true, path: string, computedPath: ExpressionEventPath[][] };\nexport type ExpressionEventPath = ExpressionEventPathDotNotation | ExpressionEventPathBracketNotation;\nexport type ExpressionEventMap = { [key: string]: ExpressionEventMap };\n\nexport interface ExpressionNode {\n\n\t/**\n\t * pass scope list from outer function to inner function,\n\t * \n\t * all other end point expression should do nothing,\n\t * if this function executed.\n\t * \n\t * @param scopeList all outer function scopes given to the inner function,\n\t * this solution ignore the fact that some inner function has no need to\n\t * get shared variables, as its implementation never say that\n\t * ```js\n\t * function f(d) {\n\t * \t\tfunction g() {\n\t * \t\t\tconst a = ({ d }) => d;\n\t * \t\t\treturn a;\n\t * \t\t}\n\t * \t\treturn [d, g];\n\t * }\n\t * ```\n\t */\n\tshareVariables(scopeList: Scope<ScopeContext>[]): void;\n\n\t/**\n\t * assign the value to this expression in stack.\n\t * \n\t * most ExpressionNode will not implement this method, and will throw an exception.\n\t * @param stack \n\t * @param value \n\t */\n\tset(stack: Stack, value: any): any;\n\n\t/**\n\t * execute/get the code for this expression and return the result value.\n\t * @param stack \n\t * @param thisContext \n\t */\n\tget(stack: Stack, thisContext?: any): any;\n\n\t/**\n\t * get all dependencies form an expression node\n\t *\n\t * tha return from this method, is represent an answer for what identifiers this expression depends-on.\n\t * \n\t *\n\t * ex:\n\t * ```js\n\t * x + y;\n\t * ```\n\t *\n\t * - for `+` operator :\tthe answer should be `lhs` and `rhs`,\n\t * - for `x` identifier:\tthe answer should be node `x`,\n\t * - for `y` identifier:\tthe answer should be node `y`.\n\t *\n\t * so, the return from `+` will be `[ node 'x', node 'y']`\n\t *\n\t * and:\n\t * - `x.y.z * a` ==> `[ member node `x.y.z`, identifier 'a']`\n\t * @param computed\n\t */\n\tdependency(computed?: true): ExpressionNode[];\n\n\t/**\n\t * ex:\n\t * ```js\n\t * x + y;\n\t * ```\n\t *\n\t * - for `+` operator :\tthe answer should be `lhs` and `rhs`,\n\t * - for `x` identifier:\tthe answer should be node `x`,\n\t * - for `y` identifier:\tthe answer should be node `y`.\n\t *\n\t * so, the return from `+` will be `['x', 'y']`\n\t *\n\t * and:\n\t * - `x.y.z` ==> `['x', 'y', 'z']`\n\t * - `x[y].z` ==> ['x', ]\n\t * @param computed required for member and chaining operators\n\t */\n\tdependencyPath(computed?: true): ExpressionEventPath[];\n\n\t/**\n\t * get all the events form this expression\n\t * \n\t * tha return from this method, is represent an answer for what is this expression depends-on as identifier name\n\t * \n\t * ex: \n\t * ```js\n\t * x + y;\n\t * ```\n\t * \n\t * - for `+` operator :\tthe answer should be `lhs` and `rhs`,\n\t * - for `x` identifier: the answer should be `x`\n\t * - for `y` identifier: the answer should be `y`\n\t * the final output will be \n\t * \n\t * so, the return from `+` will be `{ x: undefined, y: undefined }`\n\t * \n\t * and:\n\t * - `x.y.z * a` ==> `{ x: { y: { z: undefined }, a: undefined } }`\n\t * - `x.y.z > x.y.h.g` ==> `{ x: { y: { z: undefined, h: { g: undefined} } } }`\n\t * - `x[Symbol.toStringTag] + 'Class' + classType + array[3]` ==> `{ x: { 'Symbol.toStringTag': undefined }, classType: undefined, array: { 3: undefined } }`\n\t * - `'name'` ==> {}\n\t * - ```js\n\t * user[firstName + `son of ${fatherName}`]\n\t * ``` ==> `{ user: { 'firstName:fatherName': undefined }, firstName: undefined, fatherName: undefined }`\n\t * @param parent \n\t */\n\tevents(): ExpressionEventMap;\n\n\n\t/**\n\t * re-write this expression as a javascript source \n\t */\n\ttoString(): string;\n\n\t/**\n\t * used to map this object to represent an [ESTree](https://github.com/estree/estree) json object\n\t * @param key \n\t */\n\ttoJSON(): NodeJsonType;\n\n\t/**\n\t * just a helper method to force class that implement this interface to\n\t * have a static method `fromJSON` to help reconstruct this ExpressionNode\n\t * from an [ESTree](https://github.com/estree/estree) json object,\n\t * with all necessary implementation to execute the code\n\t */\n\tgetClass(): ExpressionNodConstructor<ExpressionNode>;\n}\n\nexport type NodeDeserializer<N = ExpressionNode> = (node: N) => N;\n\nexport type VisitNodeType = (expression: ExpressionNode) => void;\n\n/**\n * this is how to:\n * describe a class with it's static functions and properties\n * in the interface add getClass method\n */\nexport interface ExpressionNodConstructor<N extends ExpressionNode> extends TypeOf<N> {\n\n\t/**\n\t * the type of an expression\n\t */\n\ttype: string;\n\n\t/**\n\t * build expression node from [ESTree](https://github.com/estree/estree) json object\n\t * @param node \n\t * @param deserializer \n\t */\n\tfromJSON(node: N, deserializer: NodeDeserializer): N;\n\n\t/**\n\t * visit nodes inside expression\n\t * @param expression \n\t * @param callback \n\t */\n\tvisit?(node: N, visitNode: Object): void;\n}\n\nexport interface DeclarationExpression extends ExpressionNode {\n\t/**\n\t * declare variable in the current local scope (block),\n\t * or closest function scope (global) scop,\n\t * the propertyName will be calculated at runtime\n\t * @param stack the stack which an identifier will be declared\n\t * @param propertyValue the initial value of identifier\n\t * @param scope which scop to declare this identifier\n\t */\n\tdeclareVariable(stack: Stack, propertyValue?: any): any;\n\n\t/**\n\t * get the variable declaration name\n\t */\n\tgetDeclarationName?(): string;\n}\n\n\n/**\n * An interface meant to be implemented by MemberExpression,\n * Identifier and ChainExpression and all Literal expressions\n */\nexport interface CanFindScope {\n\t/**\n\t * try to search for scope of this expression\n\t * @param stack \n\t */\n\tfindScope<T extends ScopeContext>(stack: Stack): Scope<T>;\n\tfindScope<T extends ScopeContext>(stack: Stack, scope: Scope<ScopeContext>): Scope<T>;\n\tfindScope<T extends ScopeContext>(stack: Stack, scope?: Scope<ScopeContext>): Scope<T> | undefined;\n}\n"]}
|
package/api/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './expression.js';
|
|
2
2
|
export * from './abstract.js';
|
|
3
3
|
export * from './deserialize/deserialize.js';
|
|
4
|
+
export * from './program.js';
|
|
4
5
|
export * from './definition/values.js';
|
|
5
6
|
export * from './definition/array.js';
|
|
6
7
|
export * from './definition/comment.js';
|
|
@@ -10,6 +11,7 @@ export * from './definition/bind.js';
|
|
|
10
11
|
export * from './definition/object.js';
|
|
11
12
|
export * from './definition/statement.js';
|
|
12
13
|
export * from './computing/call.js';
|
|
14
|
+
export * from './computing/debugger.js';
|
|
13
15
|
export * from './computing/new.js';
|
|
14
16
|
export * from './computing/return.js';
|
|
15
17
|
export * from './computing/spread.js';
|
package/api/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './expression.js';
|
|
2
2
|
export * from './abstract.js';
|
|
3
3
|
export * from './deserialize/deserialize.js';
|
|
4
|
+
export * from './program.js';
|
|
4
5
|
export * from './definition/values.js';
|
|
5
6
|
export * from './definition/array.js';
|
|
6
7
|
export * from './definition/comment.js';
|
|
@@ -10,6 +11,7 @@ export * from './definition/bind.js';
|
|
|
10
11
|
export * from './definition/object.js';
|
|
11
12
|
export * from './definition/statement.js';
|
|
12
13
|
export * from './computing/call.js';
|
|
14
|
+
export * from './computing/debugger.js';
|
|
13
15
|
export * from './computing/new.js';
|
|
14
16
|
export * from './computing/return.js';
|
|
15
17
|
export * from './computing/spread.js';
|
package/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expressions/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AAErC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,sCAAsC,CAAC;AAErD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './expression.js';\nexport * from './abstract.js';\n\nexport * from './deserialize/deserialize.js';\n\nexport * from './definition/values.js';\nexport * from './definition/array.js';\nexport * from './definition/comment.js';\nexport * from './definition/function.js';\nexport * from './definition/member.js';\nexport * from './definition/bind.js';\nexport * from './definition/object.js';\nexport * from './definition/statement.js';\n\nexport * from './computing/call.js';\nexport * from './computing/new.js';\nexport * from './computing/return.js';\nexport * from './computing/spread.js';\nexport * from './computing/rest.js';\nexport * from './computing/throw.js';\nexport * from './computing/yield.js';\n\nexport * from './operators/assignment.js';\nexport * from './operators/await.js';\nexport * from './operators/binary.js';\nexport * from './operators/chaining.js';\nexport * from './operators/comma.js';\nexport * from './operators/grouping.js';\nexport * from './operators/logical.js';\nexport * from './operators/pipeline.js';\nexport * from './operators/ternary.js';\nexport * from './operators/types.js';\nexport * from './operators/unary.js';\nexport * from './operators/update.js';\n\nexport * from './statement/control/block.js';\nexport * from './statement/control/empty.js';\nexport * from './statement/control/if.js';\nexport * from './statement/control/switch.js';\nexport * from './statement/control/terminate.js';\n\nexport * from './statement/declarations/declares.js';\n\nexport * from './statement/iterations/for.js';\nexport * from './statement/iterations/while.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expressions/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,cAAc,CAAC;AAE7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AAErC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,sCAAsC,CAAC;AAErD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './expression.js';\nexport * from './abstract.js';\n\nexport * from './deserialize/deserialize.js';\n\nexport * from './program.js';\n\nexport * from './definition/values.js';\nexport * from './definition/array.js';\nexport * from './definition/comment.js';\nexport * from './definition/function.js';\nexport * from './definition/member.js';\nexport * from './definition/bind.js';\nexport * from './definition/object.js';\nexport * from './definition/statement.js';\n\nexport * from './computing/call.js';\nexport * from './computing/debugger.js';\nexport * from './computing/new.js';\nexport * from './computing/return.js';\nexport * from './computing/spread.js';\nexport * from './computing/rest.js';\nexport * from './computing/throw.js';\nexport * from './computing/yield.js';\n\nexport * from './operators/assignment.js';\nexport * from './operators/await.js';\nexport * from './operators/binary.js';\nexport * from './operators/chaining.js';\nexport * from './operators/comma.js';\nexport * from './operators/grouping.js';\nexport * from './operators/logical.js';\nexport * from './operators/pipeline.js';\nexport * from './operators/ternary.js';\nexport * from './operators/types.js';\nexport * from './operators/unary.js';\nexport * from './operators/update.js';\n\nexport * from './statement/control/block.js';\nexport * from './statement/control/empty.js';\nexport * from './statement/control/if.js';\nexport * from './statement/control/switch.js';\nexport * from './statement/control/terminate.js';\n\nexport * from './statement/declarations/declares.js';\n\nexport * from './statement/iterations/for.js';\nexport * from './statement/iterations/while.js';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Scope } from '../../scope/scope.js';
|
|
2
|
+
import { Stack } from '../../scope/stack.js';
|
|
3
|
+
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
|
+
import { Identifier, Literal } from '../definition/values.js';
|
|
5
|
+
import { ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from '../expression.js';
|
|
6
|
+
export declare abstract class ModuleSpecifier extends AbstractExpressionNode {
|
|
7
|
+
protected local: Identifier;
|
|
8
|
+
constructor(local: Identifier);
|
|
9
|
+
getLocal(): Identifier;
|
|
10
|
+
toJson(): object;
|
|
11
|
+
}
|
|
12
|
+
export declare class ImportAttribute extends AbstractExpressionNode {
|
|
13
|
+
private key;
|
|
14
|
+
private value;
|
|
15
|
+
static fromJSON(node: ImportAttribute, deserializer: NodeDeserializer): ImportAttribute;
|
|
16
|
+
static visit(node: ImportAttribute, visitNode: VisitNodeType): void;
|
|
17
|
+
constructor(key: Identifier | Literal<string>, value: Literal<string>);
|
|
18
|
+
getKey(): Identifier | Literal<string>;
|
|
19
|
+
getValue(): Literal<string>;
|
|
20
|
+
shareVariables(scopeList: Scope<any>[]): void;
|
|
21
|
+
set(stack: Stack, value: any): void;
|
|
22
|
+
get(stack: Stack, thisContext?: any): {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
dependency(computed?: true): ExpressionNode[];
|
|
26
|
+
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
27
|
+
toString(): string;
|
|
28
|
+
toJson(): object;
|
|
29
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var ImportAttribute_1;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
|
+
import { Literal } from '../definition/values.js';
|
|
5
|
+
import { Deserializer } from '../deserialize/deserialize.js';
|
|
6
|
+
export class ModuleSpecifier extends AbstractExpressionNode {
|
|
7
|
+
constructor(local) {
|
|
8
|
+
super();
|
|
9
|
+
this.local = local;
|
|
10
|
+
}
|
|
11
|
+
getLocal() {
|
|
12
|
+
return this.local;
|
|
13
|
+
}
|
|
14
|
+
toJson() {
|
|
15
|
+
return {
|
|
16
|
+
local: this.local.toJSON()
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
let ImportAttribute = ImportAttribute_1 = class ImportAttribute extends AbstractExpressionNode {
|
|
21
|
+
constructor(key, value) {
|
|
22
|
+
super();
|
|
23
|
+
this.key = key;
|
|
24
|
+
this.value = value;
|
|
25
|
+
}
|
|
26
|
+
static fromJSON(node, deserializer) {
|
|
27
|
+
return new ImportAttribute_1(deserializer(node.key), deserializer(node.value));
|
|
28
|
+
}
|
|
29
|
+
static visit(node, visitNode) {
|
|
30
|
+
visitNode(node.key);
|
|
31
|
+
visitNode(node.value);
|
|
32
|
+
}
|
|
33
|
+
getKey() {
|
|
34
|
+
return this.key;
|
|
35
|
+
}
|
|
36
|
+
getValue() {
|
|
37
|
+
return this.value;
|
|
38
|
+
}
|
|
39
|
+
shareVariables(scopeList) {
|
|
40
|
+
throw new Error('Method not implemented.');
|
|
41
|
+
}
|
|
42
|
+
set(stack, value) {
|
|
43
|
+
throw new Error('Method not implemented.');
|
|
44
|
+
}
|
|
45
|
+
get(stack, thisContext) {
|
|
46
|
+
const key = this.key.get(stack);
|
|
47
|
+
const value = this.value.get();
|
|
48
|
+
return { [key]: value };
|
|
49
|
+
}
|
|
50
|
+
dependency(computed) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
dependencyPath(computed) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
toString() {
|
|
57
|
+
return `${this.key.toString()}: ${this.value.toString()}`;
|
|
58
|
+
}
|
|
59
|
+
toJson() {
|
|
60
|
+
return {
|
|
61
|
+
key: this.key.toJSON(),
|
|
62
|
+
value: this.value.toJSON(),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
ImportAttribute = ImportAttribute_1 = __decorate([
|
|
67
|
+
Deserializer('ImportAttribute'),
|
|
68
|
+
__metadata("design:paramtypes", [Object, Literal])
|
|
69
|
+
], ImportAttribute);
|
|
70
|
+
export { ImportAttribute };
|
|
71
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/common.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAc,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,MAAM,OAAgB,eAAgB,SAAQ,sBAAsB;IACnE,YAAsB,KAAiB;QACtC,KAAK,EAAE,CAAC;QADa,UAAK,GAAL,KAAK,CAAY;IAEvC,CAAC;IACD,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IACD,MAAM;QACL,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;SAC1B,CAAC;IACH,CAAC;CACD;AAKD,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,sBAAsB;IAY1D,YAAoB,GAAiC,EAAU,KAAsB;QACpF,KAAK,EAAE,CAAC;QADW,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AM;QACL,OAAO;YACN,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;SAC1B,CAAC;IACH,CAAC;CACD,CAAA;AA/CY,eAAe;IAD3B,YAAY,CAAC,iBAAiB,CAAC;6CAauC,OAAO;GAZjE,eAAe,CA+C3B;SA/CY,eAAe","sourcesContent":["import { Scope } from '../../scope/scope.js';\nimport { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Identifier, Literal } from '../definition/values.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from '../expression.js';\n\nexport abstract class ModuleSpecifier extends AbstractExpressionNode {\n\tconstructor(protected local: Identifier) {\n\t\tsuper();\n\t}\n\tgetLocal() {\n\t\treturn this.local;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON()\n\t\t};\n\t}\n}\n\n\n\n@Deserializer('ImportAttribute')\nexport class ImportAttribute extends AbstractExpressionNode {\n\tstatic fromJSON(node: ImportAttribute, deserializer: NodeDeserializer): ImportAttribute {\n\t\treturn new ImportAttribute(\n\t\t\tdeserializer(node.key) as Identifier,\n\t\t\tdeserializer(node.value) as Literal<string>\n\t\t);\n\t}\n\tstatic visit(node: ImportAttribute, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.key);\n\t\tvisitNode(node.value);\n\t}\n\n\tconstructor(private key: Identifier | Literal<string>, private value: Literal<string>) {\n\t\tsuper();\n\t}\n\tgetKey() {\n\t\treturn this.key;\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any): { [key: string]: string } {\n\t\tconst key = this.key.get(stack);\n\t\tconst value = this.value.get();\n\t\treturn { [key]: value };\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn `${this.key.toString()}: ${this.value.toString()}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tkey: this.key.toJSON(),\n\t\t\tvalue: this.value.toJSON(),\n\t\t};\n\t}\n}\n"]}
|