sval 0.4.9 → 0.5.1
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/.github/workflows/coverage.yml +3 -3
- package/README.md +85 -30
- package/dist/sval.es6.js +1049 -419
- package/dist/sval.js +1439 -692
- package/dist/sval.min.js +1 -1
- package/package.json +3 -5
- package/types/index.d.ts +6 -9
package/dist/sval.js
CHANGED
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
(global = global || self, global.Sval = factory(global.acorn));
|
|
5
5
|
}(this, (function (acorn) { 'use strict';
|
|
6
6
|
|
|
7
|
+
var statement = /*#__PURE__*/Object.freeze({
|
|
8
|
+
__proto__: null,
|
|
9
|
+
get ExpressionStatement () { return ExpressionStatement; },
|
|
10
|
+
get BlockStatement () { return BlockStatement; },
|
|
11
|
+
get EmptyStatement () { return EmptyStatement; },
|
|
12
|
+
get DebuggerStatement () { return DebuggerStatement; },
|
|
13
|
+
get ReturnStatement () { return ReturnStatement; },
|
|
14
|
+
get BreakStatement () { return BreakStatement; },
|
|
15
|
+
get ContinueStatement () { return ContinueStatement; },
|
|
16
|
+
get IfStatement () { return IfStatement; },
|
|
17
|
+
get SwitchStatement () { return SwitchStatement; },
|
|
18
|
+
get SwitchCase () { return SwitchCase; },
|
|
19
|
+
get ThrowStatement () { return ThrowStatement; },
|
|
20
|
+
get TryStatement () { return TryStatement; },
|
|
21
|
+
get CatchClause () { return CatchClause; },
|
|
22
|
+
get WhileStatement () { return WhileStatement; },
|
|
23
|
+
get DoWhileStatement () { return DoWhileStatement; },
|
|
24
|
+
get ForStatement () { return ForStatement; },
|
|
25
|
+
get ForInStatement () { return ForInStatement; },
|
|
26
|
+
get ForOfStatement () { return ForOfStatement; }
|
|
27
|
+
});
|
|
7
28
|
var declaration = /*#__PURE__*/Object.freeze({
|
|
8
29
|
__proto__: null,
|
|
9
30
|
get FunctionDeclaration () { return FunctionDeclaration; },
|
|
@@ -11,7 +32,34 @@
|
|
|
11
32
|
get VariableDeclarator () { return VariableDeclarator; },
|
|
12
33
|
get ClassDeclaration () { return ClassDeclaration; },
|
|
13
34
|
get ClassBody () { return ClassBody; },
|
|
14
|
-
get MethodDefinition () { return MethodDefinition; }
|
|
35
|
+
get MethodDefinition () { return MethodDefinition; },
|
|
36
|
+
get PropertyDefinition () { return PropertyDefinition; },
|
|
37
|
+
get StaticBlock () { return StaticBlock; },
|
|
38
|
+
get ImportDeclaration () { return ImportDeclaration; },
|
|
39
|
+
get ExportDefaultDeclaration () { return ExportDefaultDeclaration; },
|
|
40
|
+
get ExportNamedDeclaration () { return ExportNamedDeclaration; },
|
|
41
|
+
get ExportAllDeclaration () { return ExportAllDeclaration; }
|
|
42
|
+
});
|
|
43
|
+
var statement$1 = /*#__PURE__*/Object.freeze({
|
|
44
|
+
__proto__: null,
|
|
45
|
+
get ExpressionStatement () { return ExpressionStatement$1; },
|
|
46
|
+
get BlockStatement () { return BlockStatement$1; },
|
|
47
|
+
get EmptyStatement () { return EmptyStatement$1; },
|
|
48
|
+
get DebuggerStatement () { return DebuggerStatement$1; },
|
|
49
|
+
get ReturnStatement () { return ReturnStatement$1; },
|
|
50
|
+
get BreakStatement () { return BreakStatement$1; },
|
|
51
|
+
get ContinueStatement () { return ContinueStatement$1; },
|
|
52
|
+
get IfStatement () { return IfStatement$1; },
|
|
53
|
+
get SwitchStatement () { return SwitchStatement$1; },
|
|
54
|
+
get SwitchCase () { return SwitchCase$1; },
|
|
55
|
+
get ThrowStatement () { return ThrowStatement$1; },
|
|
56
|
+
get TryStatement () { return TryStatement$1; },
|
|
57
|
+
get CatchClause () { return CatchClause$1; },
|
|
58
|
+
get WhileStatement () { return WhileStatement$1; },
|
|
59
|
+
get DoWhileStatement () { return DoWhileStatement$1; },
|
|
60
|
+
get ForStatement () { return ForStatement$1; },
|
|
61
|
+
get ForInStatement () { return ForInStatement$1; },
|
|
62
|
+
get ForOfStatement () { return ForOfStatement$1; }
|
|
15
63
|
});
|
|
16
64
|
var declaration$1 = /*#__PURE__*/Object.freeze({
|
|
17
65
|
__proto__: null,
|
|
@@ -20,7 +68,13 @@
|
|
|
20
68
|
get VariableDeclarator () { return VariableDeclarator$1; },
|
|
21
69
|
get ClassDeclaration () { return ClassDeclaration$1; },
|
|
22
70
|
get ClassBody () { return ClassBody$1; },
|
|
23
|
-
get MethodDefinition () { return MethodDefinition$1; }
|
|
71
|
+
get MethodDefinition () { return MethodDefinition$1; },
|
|
72
|
+
get PropertyDefinition () { return PropertyDefinition$1; },
|
|
73
|
+
get StaticBlock () { return StaticBlock$1; },
|
|
74
|
+
get ImportDeclaration () { return ImportDeclaration$1; },
|
|
75
|
+
get ExportDefaultDeclaration () { return ExportDefaultDeclaration$1; },
|
|
76
|
+
get ExportNamedDeclaration () { return ExportNamedDeclaration$1; },
|
|
77
|
+
get ExportAllDeclaration () { return ExportAllDeclaration$1; }
|
|
24
78
|
});
|
|
25
79
|
|
|
26
80
|
var freeze = Object.freeze;
|
|
@@ -269,6 +323,10 @@
|
|
|
269
323
|
globalObj.Reflect = Reflect;
|
|
270
324
|
}
|
|
271
325
|
catch (err) { }
|
|
326
|
+
try {
|
|
327
|
+
globalObj.BigInt = BigInt;
|
|
328
|
+
}
|
|
329
|
+
catch (err) { }
|
|
272
330
|
try {
|
|
273
331
|
globalObj.decodeURI = decodeURI;
|
|
274
332
|
}
|
|
@@ -384,8 +442,6 @@
|
|
|
384
442
|
}
|
|
385
443
|
}
|
|
386
444
|
|
|
387
|
-
var version = "0.4.9";
|
|
388
|
-
|
|
389
445
|
var AWAIT = { RES: undefined };
|
|
390
446
|
var RETURN = { RES: undefined };
|
|
391
447
|
var CONTINUE = createSymbol('continue');
|
|
@@ -395,8 +451,13 @@
|
|
|
395
451
|
var NOCTOR = createSymbol('noctor');
|
|
396
452
|
var CLSCTOR = createSymbol('clsctor');
|
|
397
453
|
var NEWTARGET = createSymbol('newtarget');
|
|
454
|
+
var PRIVATE = createSymbol('private');
|
|
398
455
|
var NOINIT = createSymbol('noinit');
|
|
399
|
-
var DEADZONE = createSymbol('deadzone');
|
|
456
|
+
var DEADZONE = createSymbol('deadzone');
|
|
457
|
+
var IMPORT = createSymbol('import');
|
|
458
|
+
var EXPORTS = createSymbol('exports');
|
|
459
|
+
|
|
460
|
+
var version = "0.5.1";
|
|
400
461
|
|
|
401
462
|
var Var = (function () {
|
|
402
463
|
function Var(kind, value) {
|
|
@@ -788,8 +849,17 @@
|
|
|
788
849
|
}
|
|
789
850
|
}
|
|
790
851
|
function BinaryExpression(node, scope) {
|
|
791
|
-
var left
|
|
792
|
-
var right
|
|
852
|
+
var left;
|
|
853
|
+
var right;
|
|
854
|
+
if (node.left.type === 'PrivateIdentifier') {
|
|
855
|
+
left = node.left.name;
|
|
856
|
+
right = evaluate(node.right, scope);
|
|
857
|
+
right = right[PRIVATE];
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
left = evaluate(node.left, scope);
|
|
861
|
+
right = evaluate(node.right, scope);
|
|
862
|
+
}
|
|
793
863
|
switch (node.operator) {
|
|
794
864
|
case '==': return left == right;
|
|
795
865
|
case '!=': return left != right;
|
|
@@ -817,7 +887,7 @@
|
|
|
817
887
|
}
|
|
818
888
|
}
|
|
819
889
|
function AssignmentExpression(node, scope) {
|
|
820
|
-
var
|
|
890
|
+
var _a;
|
|
821
891
|
var left = node.left;
|
|
822
892
|
var variable;
|
|
823
893
|
if (left.type === 'Identifier') {
|
|
@@ -831,8 +901,10 @@
|
|
|
831
901
|
variable = MemberExpression(left, scope, { getVar: true });
|
|
832
902
|
}
|
|
833
903
|
else {
|
|
834
|
-
|
|
904
|
+
var value_1 = evaluate(node.right, scope);
|
|
905
|
+
return pattern$3(left, scope, { feed: value_1 });
|
|
835
906
|
}
|
|
907
|
+
var value = evaluate(node.right, scope);
|
|
836
908
|
switch (node.operator) {
|
|
837
909
|
case '=':
|
|
838
910
|
variable.set(value);
|
|
@@ -873,15 +945,27 @@
|
|
|
873
945
|
case '&=':
|
|
874
946
|
variable.set(variable.get() & value);
|
|
875
947
|
return variable.get();
|
|
948
|
+
case '??=':
|
|
949
|
+
variable.set((_a = variable.get()) !== null && _a !== void 0 ? _a : value);
|
|
950
|
+
return variable.get();
|
|
951
|
+
case '&&=':
|
|
952
|
+
variable.set(variable.get() && value);
|
|
953
|
+
return variable.get();
|
|
954
|
+
case '||=':
|
|
955
|
+
variable.set(variable.get() || value);
|
|
956
|
+
return variable.get();
|
|
876
957
|
default: throw new SyntaxError("Unexpected token " + node.operator);
|
|
877
958
|
}
|
|
878
959
|
}
|
|
879
960
|
function LogicalExpression(node, scope) {
|
|
961
|
+
var _a;
|
|
880
962
|
switch (node.operator) {
|
|
881
963
|
case '||':
|
|
882
964
|
return (evaluate(node.left, scope)) || (evaluate(node.right, scope));
|
|
883
965
|
case '&&':
|
|
884
966
|
return (evaluate(node.left, scope)) && (evaluate(node.right, scope));
|
|
967
|
+
case '??':
|
|
968
|
+
return (_a = (evaluate(node.left, scope))) !== null && _a !== void 0 ? _a : (evaluate(node.right, scope));
|
|
885
969
|
default:
|
|
886
970
|
throw new SyntaxError("Unexpected token " + node.operator);
|
|
887
971
|
}
|
|
@@ -899,12 +983,20 @@
|
|
|
899
983
|
if (getObj)
|
|
900
984
|
return object;
|
|
901
985
|
var key;
|
|
986
|
+
var priv = false;
|
|
902
987
|
if (node.computed) {
|
|
903
988
|
key = evaluate(node.property, scope);
|
|
904
989
|
}
|
|
990
|
+
else if (node.property.type === 'PrivateIdentifier') {
|
|
991
|
+
key = node.property.name;
|
|
992
|
+
priv = true;
|
|
993
|
+
}
|
|
905
994
|
else {
|
|
906
995
|
key = node.property.name;
|
|
907
996
|
}
|
|
997
|
+
if (priv) {
|
|
998
|
+
object = object[PRIVATE];
|
|
999
|
+
}
|
|
908
1000
|
if (getVar) {
|
|
909
1001
|
var setter = getSetter(object, key);
|
|
910
1002
|
if (node.object.type === 'Super' && setter) {
|
|
@@ -921,9 +1013,15 @@
|
|
|
921
1013
|
var getter = getGetter(object, key);
|
|
922
1014
|
if (node.object.type === 'Super' && getter) {
|
|
923
1015
|
var thisObject = scope.find('this').get();
|
|
1016
|
+
if (node.optional && thisObject == null) {
|
|
1017
|
+
return undefined;
|
|
1018
|
+
}
|
|
924
1019
|
return getter.call(thisObject);
|
|
925
1020
|
}
|
|
926
1021
|
else {
|
|
1022
|
+
if (node.optional && object == null) {
|
|
1023
|
+
return undefined;
|
|
1024
|
+
}
|
|
927
1025
|
return object[key];
|
|
928
1026
|
}
|
|
929
1027
|
}
|
|
@@ -938,19 +1036,34 @@
|
|
|
938
1036
|
var object;
|
|
939
1037
|
if (node.callee.type === 'MemberExpression') {
|
|
940
1038
|
object = MemberExpression(node.callee, scope, { getObj: true });
|
|
1039
|
+
if (node.callee.optional && object == null) {
|
|
1040
|
+
return undefined;
|
|
1041
|
+
}
|
|
941
1042
|
var key = void 0;
|
|
1043
|
+
var priv = false;
|
|
942
1044
|
if (node.callee.computed) {
|
|
943
1045
|
key = evaluate(node.callee.property, scope);
|
|
944
1046
|
}
|
|
1047
|
+
else if (node.callee.property.type === 'PrivateIdentifier') {
|
|
1048
|
+
key = node.callee.property.name;
|
|
1049
|
+
priv = true;
|
|
1050
|
+
}
|
|
945
1051
|
else {
|
|
946
1052
|
key = node.callee.property.name;
|
|
947
1053
|
}
|
|
1054
|
+
var obj = object;
|
|
1055
|
+
if (priv) {
|
|
1056
|
+
obj = obj[PRIVATE];
|
|
1057
|
+
}
|
|
948
1058
|
if (node.callee.object.type === 'Super') {
|
|
949
1059
|
var thisObject = scope.find('this').get();
|
|
950
|
-
func =
|
|
1060
|
+
func = obj[key].bind(thisObject);
|
|
951
1061
|
}
|
|
952
1062
|
else {
|
|
953
|
-
func =
|
|
1063
|
+
func = obj[key];
|
|
1064
|
+
}
|
|
1065
|
+
if (node.optional && func == null) {
|
|
1066
|
+
return undefined;
|
|
954
1067
|
}
|
|
955
1068
|
if (typeof func !== 'function') {
|
|
956
1069
|
throw new TypeError(key + " is not a function");
|
|
@@ -962,6 +1075,9 @@
|
|
|
962
1075
|
else {
|
|
963
1076
|
object = scope.find('this').get();
|
|
964
1077
|
func = evaluate(node.callee, scope);
|
|
1078
|
+
if (node.optional && func == null) {
|
|
1079
|
+
return undefined;
|
|
1080
|
+
}
|
|
965
1081
|
if (typeof func !== 'function' || node.callee.type !== 'Super' && func[CLSCTOR]) {
|
|
966
1082
|
var name_1;
|
|
967
1083
|
if (node.callee.type === 'Identifier') {
|
|
@@ -1040,7 +1156,12 @@
|
|
|
1040
1156
|
return new (constructor.bind.apply(constructor, __spread([void 0], args)))();
|
|
1041
1157
|
}
|
|
1042
1158
|
function MetaProperty(node, scope) {
|
|
1043
|
-
|
|
1159
|
+
if (node.meta.name === 'new' && node.property.name === 'target') {
|
|
1160
|
+
return scope.find(NEWTARGET).get();
|
|
1161
|
+
}
|
|
1162
|
+
else if (node.meta.name === 'import' && node.property.name === 'meta') {
|
|
1163
|
+
return { url: '' };
|
|
1164
|
+
}
|
|
1044
1165
|
}
|
|
1045
1166
|
function SequenceExpression(node, scope) {
|
|
1046
1167
|
var result;
|
|
@@ -1106,6 +1227,30 @@
|
|
|
1106
1227
|
}
|
|
1107
1228
|
function SpreadElement(node, scope) {
|
|
1108
1229
|
return evaluate(node.argument, scope);
|
|
1230
|
+
}
|
|
1231
|
+
function ChainExpression(node, scope) {
|
|
1232
|
+
return evaluate(node.expression, scope);
|
|
1233
|
+
}
|
|
1234
|
+
function ImportExpression(node, scope) {
|
|
1235
|
+
var globalScope = scope.global();
|
|
1236
|
+
var source = evaluate(node.source, scope);
|
|
1237
|
+
var module = globalScope.find(IMPORT + source);
|
|
1238
|
+
var value;
|
|
1239
|
+
if (module) {
|
|
1240
|
+
var result = module.get();
|
|
1241
|
+
if (result) {
|
|
1242
|
+
if (typeof result === 'function') {
|
|
1243
|
+
value = result();
|
|
1244
|
+
}
|
|
1245
|
+
else if (typeof result === 'object') {
|
|
1246
|
+
value = result;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
if (!value || typeof value !== 'object') {
|
|
1251
|
+
return Promise.reject(new TypeError("Failed to resolve module specifier \"" + source + "\""));
|
|
1252
|
+
}
|
|
1253
|
+
return Promise.resolve(value);
|
|
1109
1254
|
}
|
|
1110
1255
|
|
|
1111
1256
|
var expression = /*#__PURE__*/Object.freeze({
|
|
@@ -1131,9 +1276,181 @@
|
|
|
1131
1276
|
TemplateElement: TemplateElement,
|
|
1132
1277
|
ClassExpression: ClassExpression,
|
|
1133
1278
|
Super: Super,
|
|
1134
|
-
SpreadElement: SpreadElement
|
|
1279
|
+
SpreadElement: SpreadElement,
|
|
1280
|
+
ChainExpression: ChainExpression,
|
|
1281
|
+
ImportExpression: ImportExpression
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
function ObjectPattern(node, scope, options) {
|
|
1285
|
+
if (options === void 0) { options = {}; }
|
|
1286
|
+
var _a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed, feed = _d === void 0 ? {} : _d;
|
|
1287
|
+
var fedKeys = [];
|
|
1288
|
+
for (var i = 0; i < node.properties.length; i++) {
|
|
1289
|
+
var property = node.properties[i];
|
|
1290
|
+
if (hoist) {
|
|
1291
|
+
if (onlyBlock || kind === 'var') {
|
|
1292
|
+
if (property.type === 'Property') {
|
|
1293
|
+
var value = property.value;
|
|
1294
|
+
if (value.type === 'Identifier') {
|
|
1295
|
+
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
pattern$3(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
RestElement(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
else if (property.type === 'Property') {
|
|
1307
|
+
var key = void 0;
|
|
1308
|
+
if (property.computed) {
|
|
1309
|
+
key = evaluate(property.key, scope);
|
|
1310
|
+
}
|
|
1311
|
+
else {
|
|
1312
|
+
key = property.key.name;
|
|
1313
|
+
}
|
|
1314
|
+
fedKeys.push(key);
|
|
1315
|
+
var value = property.value;
|
|
1316
|
+
if (value.type === 'Identifier') {
|
|
1317
|
+
scope[kind](value.name, feed[key]);
|
|
1318
|
+
}
|
|
1319
|
+
else {
|
|
1320
|
+
pattern$3(value, scope, { kind: kind, feed: feed[key] });
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
var rest = assign({}, feed);
|
|
1325
|
+
for (var i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
1326
|
+
delete rest[fedKeys[i_1]];
|
|
1327
|
+
RestElement(property, scope, { kind: kind, feed: rest });
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
function ArrayPattern(node, scope, options) {
|
|
1332
|
+
if (options === void 0) { options = {}; }
|
|
1333
|
+
var kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
1334
|
+
var result = [];
|
|
1335
|
+
for (var i = 0; i < node.elements.length; i++) {
|
|
1336
|
+
var element = node.elements[i];
|
|
1337
|
+
if (!element)
|
|
1338
|
+
continue;
|
|
1339
|
+
if (hoist) {
|
|
1340
|
+
if (onlyBlock || kind === 'var') {
|
|
1341
|
+
if (element.type === 'Identifier') {
|
|
1342
|
+
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
pattern$3(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
else if (element.type === 'Identifier') {
|
|
1350
|
+
if (kind) {
|
|
1351
|
+
scope[kind](element.name, feed[i]);
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
var variable = Identifier(element, scope, { getVar: true });
|
|
1355
|
+
variable.set(feed[i]);
|
|
1356
|
+
result.push(variable.get());
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
else if (element.type === 'RestElement') {
|
|
1360
|
+
RestElement(element, scope, { kind: kind, feed: feed.slice(i) });
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
pattern$3(element, scope, { kind: kind, feed: feed[i] });
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
if (result.length) {
|
|
1367
|
+
return result;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
function RestElement(node, scope, options) {
|
|
1371
|
+
if (options === void 0) { options = {}; }
|
|
1372
|
+
var kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
1373
|
+
var arg = node.argument;
|
|
1374
|
+
if (hoist) {
|
|
1375
|
+
if (onlyBlock || kind === 'var') {
|
|
1376
|
+
if (arg.type === 'Identifier') {
|
|
1377
|
+
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1378
|
+
}
|
|
1379
|
+
else {
|
|
1380
|
+
pattern$3(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
else if (arg.type === 'Identifier') {
|
|
1385
|
+
if (kind) {
|
|
1386
|
+
scope[kind](arg.name, feed);
|
|
1387
|
+
}
|
|
1388
|
+
else {
|
|
1389
|
+
var variable = Identifier(arg, scope, { getVar: true });
|
|
1390
|
+
variable.set(feed);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
pattern$3(arg, scope, { kind: kind, feed: feed });
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
function AssignmentPattern(node, scope, options) {
|
|
1398
|
+
if (options === void 0) { options = {}; }
|
|
1399
|
+
var _a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed, feed = _d === void 0 ? evaluate(node.right, scope) : _d;
|
|
1400
|
+
var left = node.left;
|
|
1401
|
+
if (hoist) {
|
|
1402
|
+
if (onlyBlock || kind === 'var') {
|
|
1403
|
+
if (left.type === 'Identifier') {
|
|
1404
|
+
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1405
|
+
}
|
|
1406
|
+
else {
|
|
1407
|
+
pattern$3(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
else if (left.type === 'Identifier') {
|
|
1412
|
+
scope[kind](left.name, feed);
|
|
1413
|
+
}
|
|
1414
|
+
else {
|
|
1415
|
+
pattern$3(left, scope, { kind: kind, feed: feed });
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
var pattern = /*#__PURE__*/Object.freeze({
|
|
1420
|
+
__proto__: null,
|
|
1421
|
+
ObjectPattern: ObjectPattern,
|
|
1422
|
+
ArrayPattern: ArrayPattern,
|
|
1423
|
+
RestElement: RestElement,
|
|
1424
|
+
AssignmentPattern: AssignmentPattern
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
function Program(program, scope) {
|
|
1428
|
+
for (var i = 0; i < program.body.length; i++) {
|
|
1429
|
+
evaluate(program.body[i], scope);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
var program = /*#__PURE__*/Object.freeze({
|
|
1434
|
+
__proto__: null,
|
|
1435
|
+
Program: Program
|
|
1135
1436
|
});
|
|
1136
1437
|
|
|
1438
|
+
var evaluateOps;
|
|
1439
|
+
function evaluate(node, scope) {
|
|
1440
|
+
if (!node)
|
|
1441
|
+
return;
|
|
1442
|
+
if (!evaluateOps) {
|
|
1443
|
+
evaluateOps = assign({}, declaration, expression, identifier, statement, literal, pattern, program);
|
|
1444
|
+
}
|
|
1445
|
+
var handler = evaluateOps[node.type];
|
|
1446
|
+
if (handler) {
|
|
1447
|
+
return handler(node, scope);
|
|
1448
|
+
}
|
|
1449
|
+
else {
|
|
1450
|
+
throw new Error(node.type + " isn't implemented");
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1137
1454
|
function ExpressionStatement(node, scope) {
|
|
1138
1455
|
evaluate(node.expression, scope);
|
|
1139
1456
|
}
|
|
@@ -1332,214 +1649,22 @@
|
|
|
1332
1649
|
}
|
|
1333
1650
|
}
|
|
1334
1651
|
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
EmptyStatement: EmptyStatement,
|
|
1340
|
-
DebuggerStatement: DebuggerStatement,
|
|
1341
|
-
ReturnStatement: ReturnStatement,
|
|
1342
|
-
BreakStatement: BreakStatement,
|
|
1343
|
-
ContinueStatement: ContinueStatement,
|
|
1344
|
-
IfStatement: IfStatement,
|
|
1345
|
-
SwitchStatement: SwitchStatement,
|
|
1346
|
-
SwitchCase: SwitchCase,
|
|
1347
|
-
ThrowStatement: ThrowStatement,
|
|
1348
|
-
TryStatement: TryStatement,
|
|
1349
|
-
CatchClause: CatchClause,
|
|
1350
|
-
WhileStatement: WhileStatement,
|
|
1351
|
-
DoWhileStatement: DoWhileStatement,
|
|
1352
|
-
ForStatement: ForStatement,
|
|
1353
|
-
ForInStatement: ForInStatement,
|
|
1354
|
-
ForOfStatement: ForOfStatement
|
|
1355
|
-
});
|
|
1356
|
-
|
|
1357
|
-
function ObjectPattern(node, scope, options) {
|
|
1652
|
+
function FunctionDeclaration(node, scope) {
|
|
1653
|
+
scope.func(node.id.name, createFunc$1(node, scope));
|
|
1654
|
+
}
|
|
1655
|
+
function VariableDeclaration(node, scope, options) {
|
|
1358
1656
|
if (options === void 0) { options = {}; }
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
else {
|
|
1371
|
-
pattern$3(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
else {
|
|
1375
|
-
RestElement(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
else if (property.type === 'Property') {
|
|
1380
|
-
var key = void 0;
|
|
1381
|
-
if (property.computed) {
|
|
1382
|
-
key = evaluate(property.key, scope);
|
|
1383
|
-
}
|
|
1384
|
-
else {
|
|
1385
|
-
key = property.key.name;
|
|
1386
|
-
}
|
|
1387
|
-
fedKeys.push(key);
|
|
1388
|
-
var value = property.value;
|
|
1389
|
-
if (value.type === 'Identifier') {
|
|
1390
|
-
scope[kind](value.name, feed[key]);
|
|
1391
|
-
}
|
|
1392
|
-
else {
|
|
1393
|
-
pattern$3(value, scope, { kind: kind, feed: feed[key] });
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
else {
|
|
1397
|
-
var rest = assign({}, feed);
|
|
1398
|
-
for (var i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
1399
|
-
delete rest[fedKeys[i_1]];
|
|
1400
|
-
RestElement(property, scope, { kind: kind, feed: rest });
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
function ArrayPattern(node, scope, options) {
|
|
1405
|
-
if (options === void 0) { options = {}; }
|
|
1406
|
-
var kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
1407
|
-
var result = [];
|
|
1408
|
-
for (var i = 0; i < node.elements.length; i++) {
|
|
1409
|
-
var element = node.elements[i];
|
|
1410
|
-
if (!element)
|
|
1411
|
-
continue;
|
|
1412
|
-
if (hoist) {
|
|
1413
|
-
if (onlyBlock || kind === 'var') {
|
|
1414
|
-
if (element.type === 'Identifier') {
|
|
1415
|
-
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1416
|
-
}
|
|
1417
|
-
else {
|
|
1418
|
-
pattern$3(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
else if (element.type === 'Identifier') {
|
|
1423
|
-
if (kind) {
|
|
1424
|
-
scope[kind](element.name, feed[i]);
|
|
1425
|
-
}
|
|
1426
|
-
else {
|
|
1427
|
-
var variable = Identifier(element, scope, { getVar: true });
|
|
1428
|
-
variable.set(feed[i]);
|
|
1429
|
-
result.push(variable.get());
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
else if (element.type === 'RestElement') {
|
|
1433
|
-
RestElement(element, scope, { kind: kind, feed: feed.slice(i) });
|
|
1434
|
-
}
|
|
1435
|
-
else {
|
|
1436
|
-
pattern$3(element, scope, { kind: kind, feed: feed[i] });
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
if (result.length) {
|
|
1440
|
-
return result;
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
function RestElement(node, scope, options) {
|
|
1444
|
-
if (options === void 0) { options = {}; }
|
|
1445
|
-
var kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
1446
|
-
var arg = node.argument;
|
|
1447
|
-
if (hoist) {
|
|
1448
|
-
if (onlyBlock || kind === 'var') {
|
|
1449
|
-
if (arg.type === 'Identifier') {
|
|
1450
|
-
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1451
|
-
}
|
|
1452
|
-
else {
|
|
1453
|
-
pattern$3(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
else if (arg.type === 'Identifier') {
|
|
1458
|
-
if (kind) {
|
|
1459
|
-
scope[kind](arg.name, feed);
|
|
1460
|
-
}
|
|
1461
|
-
else {
|
|
1462
|
-
var variable = Identifier(arg, scope, { getVar: true });
|
|
1463
|
-
variable.set(feed);
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
else {
|
|
1467
|
-
pattern$3(arg, scope, { kind: kind, feed: feed });
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
function AssignmentPattern(node, scope, options) {
|
|
1471
|
-
if (options === void 0) { options = {}; }
|
|
1472
|
-
var _a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed, feed = _d === void 0 ? evaluate(node.right, scope) : _d;
|
|
1473
|
-
var left = node.left;
|
|
1474
|
-
if (hoist) {
|
|
1475
|
-
if (onlyBlock || kind === 'var') {
|
|
1476
|
-
if (left.type === 'Identifier') {
|
|
1477
|
-
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1478
|
-
}
|
|
1479
|
-
else {
|
|
1480
|
-
pattern$3(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
else if (left.type === 'Identifier') {
|
|
1485
|
-
scope[kind](left.name, feed);
|
|
1486
|
-
}
|
|
1487
|
-
else {
|
|
1488
|
-
pattern$3(left, scope, { kind: kind, feed: feed });
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
var pattern = /*#__PURE__*/Object.freeze({
|
|
1493
|
-
__proto__: null,
|
|
1494
|
-
ObjectPattern: ObjectPattern,
|
|
1495
|
-
ArrayPattern: ArrayPattern,
|
|
1496
|
-
RestElement: RestElement,
|
|
1497
|
-
AssignmentPattern: AssignmentPattern
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
function Program(program, scope) {
|
|
1501
|
-
for (var i = 0; i < program.body.length; i++) {
|
|
1502
|
-
evaluate(program.body[i], scope);
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
var program = /*#__PURE__*/Object.freeze({
|
|
1507
|
-
__proto__: null,
|
|
1508
|
-
Program: Program
|
|
1509
|
-
});
|
|
1510
|
-
|
|
1511
|
-
var evaluateOps;
|
|
1512
|
-
function evaluate(node, scope) {
|
|
1513
|
-
if (!node)
|
|
1514
|
-
return;
|
|
1515
|
-
if (!evaluateOps) {
|
|
1516
|
-
evaluateOps = assign({}, declaration, expression, identifier, statement, literal, pattern, program);
|
|
1517
|
-
}
|
|
1518
|
-
var handler = evaluateOps[node.type];
|
|
1519
|
-
if (handler) {
|
|
1520
|
-
return handler(node, scope);
|
|
1521
|
-
}
|
|
1522
|
-
else {
|
|
1523
|
-
throw new Error(node.type + " isn't implemented");
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
function FunctionDeclaration(node, scope) {
|
|
1528
|
-
scope.func(node.id.name, createFunc$1(node, scope));
|
|
1529
|
-
}
|
|
1530
|
-
function VariableDeclaration(node, scope, options) {
|
|
1531
|
-
if (options === void 0) { options = {}; }
|
|
1532
|
-
for (var i = 0; i < node.declarations.length; i++) {
|
|
1533
|
-
VariableDeclarator(node.declarations[i], scope, assign({ kind: node.kind }, options));
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
function VariableDeclarator(node, scope, options) {
|
|
1537
|
-
if (options === void 0) { options = {}; }
|
|
1538
|
-
var _a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, feed = options.feed;
|
|
1539
|
-
if (hoist) {
|
|
1540
|
-
if (onlyBlock || kind === 'var') {
|
|
1541
|
-
if (node.id.type === 'Identifier') {
|
|
1542
|
-
scope[kind](node.id.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1657
|
+
for (var i = 0; i < node.declarations.length; i++) {
|
|
1658
|
+
VariableDeclarator(node.declarations[i], scope, assign({ kind: node.kind }, options));
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
function VariableDeclarator(node, scope, options) {
|
|
1662
|
+
if (options === void 0) { options = {}; }
|
|
1663
|
+
var _a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, feed = options.feed;
|
|
1664
|
+
if (hoist) {
|
|
1665
|
+
if (onlyBlock || kind === 'var') {
|
|
1666
|
+
if (node.id.type === 'Identifier') {
|
|
1667
|
+
scope[kind](node.id.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1543
1668
|
}
|
|
1544
1669
|
else {
|
|
1545
1670
|
pattern$3(node.id, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
@@ -1579,23 +1704,43 @@
|
|
|
1579
1704
|
if (options === void 0) { options = {}; }
|
|
1580
1705
|
var klass = options.klass, superClass = options.superClass;
|
|
1581
1706
|
for (var i = 0; i < node.body.length; i++) {
|
|
1582
|
-
|
|
1707
|
+
var def = node.body[i];
|
|
1708
|
+
if (def.type === 'MethodDefinition') {
|
|
1709
|
+
MethodDefinition(def, scope, { klass: klass, superClass: superClass });
|
|
1710
|
+
}
|
|
1711
|
+
else if (def.type === 'PropertyDefinition' && def.static) {
|
|
1712
|
+
PropertyDefinition(def, scope, { klass: klass, superClass: superClass });
|
|
1713
|
+
}
|
|
1714
|
+
else if (def.type === 'StaticBlock') {
|
|
1715
|
+
StaticBlock(def, scope, { klass: klass, superClass: superClass });
|
|
1716
|
+
}
|
|
1583
1717
|
}
|
|
1584
1718
|
}
|
|
1585
1719
|
function MethodDefinition(node, scope, options) {
|
|
1586
1720
|
if (options === void 0) { options = {}; }
|
|
1587
1721
|
var klass = options.klass, superClass = options.superClass;
|
|
1588
1722
|
var key;
|
|
1723
|
+
var priv = false;
|
|
1589
1724
|
if (node.computed) {
|
|
1590
1725
|
key = evaluate(node.key, scope);
|
|
1591
1726
|
}
|
|
1592
1727
|
else if (node.key.type === 'Identifier') {
|
|
1593
1728
|
key = node.key.name;
|
|
1594
1729
|
}
|
|
1730
|
+
else if (node.key.type === 'PrivateIdentifier') {
|
|
1731
|
+
key = node.key.name;
|
|
1732
|
+
priv = true;
|
|
1733
|
+
}
|
|
1595
1734
|
else {
|
|
1596
1735
|
throw new SyntaxError('Unexpected token');
|
|
1597
1736
|
}
|
|
1598
1737
|
var obj = node.static ? klass : klass.prototype;
|
|
1738
|
+
if (priv) {
|
|
1739
|
+
if (!obj[PRIVATE]) {
|
|
1740
|
+
define(obj, PRIVATE, { value: {} });
|
|
1741
|
+
}
|
|
1742
|
+
obj = obj[PRIVATE];
|
|
1743
|
+
}
|
|
1599
1744
|
var value = createFunc$1(node.value, scope, { superClass: superClass });
|
|
1600
1745
|
switch (node.kind) {
|
|
1601
1746
|
case 'constructor':
|
|
@@ -1628,6 +1773,193 @@
|
|
|
1628
1773
|
default:
|
|
1629
1774
|
throw new SyntaxError('Unexpected token');
|
|
1630
1775
|
}
|
|
1776
|
+
}
|
|
1777
|
+
function PropertyDefinition(node, scope, options) {
|
|
1778
|
+
if (options === void 0) { options = {}; }
|
|
1779
|
+
var klass = options.klass, superClass = options.superClass;
|
|
1780
|
+
var key;
|
|
1781
|
+
var priv = false;
|
|
1782
|
+
if (node.computed) {
|
|
1783
|
+
key = evaluate(node.key, scope);
|
|
1784
|
+
}
|
|
1785
|
+
else if (node.key.type === 'Identifier') {
|
|
1786
|
+
key = node.key.name;
|
|
1787
|
+
}
|
|
1788
|
+
else if (node.key.type === 'PrivateIdentifier') {
|
|
1789
|
+
key = node.key.name;
|
|
1790
|
+
priv = true;
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
throw new SyntaxError('Unexpected token');
|
|
1794
|
+
}
|
|
1795
|
+
var subScope = new Scope(scope, true);
|
|
1796
|
+
subScope.const('this', klass);
|
|
1797
|
+
var obj = klass;
|
|
1798
|
+
if (priv) {
|
|
1799
|
+
if (!obj[PRIVATE]) {
|
|
1800
|
+
define(obj, PRIVATE, { value: {} });
|
|
1801
|
+
}
|
|
1802
|
+
obj = obj[PRIVATE];
|
|
1803
|
+
}
|
|
1804
|
+
if (node.value.type === 'FunctionExpression' || node.value.type === 'ArrowFunctionExpression') {
|
|
1805
|
+
obj[key] = createFunc$1(node.value, subScope, { superClass: superClass });
|
|
1806
|
+
}
|
|
1807
|
+
else {
|
|
1808
|
+
obj[key] = evaluate(node.value, subScope);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
function StaticBlock(node, scope, options) {
|
|
1812
|
+
if (options === void 0) { options = {}; }
|
|
1813
|
+
var klass = options.klass;
|
|
1814
|
+
var subScope = new Scope(scope, true);
|
|
1815
|
+
subScope.const('this', klass);
|
|
1816
|
+
return BlockStatement(node, subScope, { invasived: true });
|
|
1817
|
+
}
|
|
1818
|
+
function ImportDeclaration(node, scope) {
|
|
1819
|
+
var globalScope = scope.global();
|
|
1820
|
+
var module = globalScope.find(IMPORT + node.source.value);
|
|
1821
|
+
var value;
|
|
1822
|
+
if (module) {
|
|
1823
|
+
var result = module.get();
|
|
1824
|
+
if (result) {
|
|
1825
|
+
if (typeof result === 'function') {
|
|
1826
|
+
value = result();
|
|
1827
|
+
}
|
|
1828
|
+
else if (typeof result === 'object') {
|
|
1829
|
+
value = result;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
if (!value || typeof value !== 'object') {
|
|
1834
|
+
throw new TypeError("Failed to resolve module specifier \"" + node.source.value + "\"");
|
|
1835
|
+
}
|
|
1836
|
+
for (var i = 0; i < node.specifiers.length; i++) {
|
|
1837
|
+
var spec = node.specifiers[i];
|
|
1838
|
+
var name_2 = void 0;
|
|
1839
|
+
if (spec.type === 'ImportSpecifier') {
|
|
1840
|
+
name_2 = spec.imported.type === 'Identifier'
|
|
1841
|
+
? spec.imported.name : spec.imported.value;
|
|
1842
|
+
}
|
|
1843
|
+
else if (spec.type === 'ImportDefaultSpecifier') {
|
|
1844
|
+
name_2 = 'default';
|
|
1845
|
+
}
|
|
1846
|
+
else if (spec.type === 'ImportNamespaceSpecifier') {
|
|
1847
|
+
name_2 = '*';
|
|
1848
|
+
}
|
|
1849
|
+
if (name_2 !== '*' && !hasOwn(value, name_2)) {
|
|
1850
|
+
throw new SyntaxError("The requested module \"" + node.source.value + "\" does not provide an export named \"" + name_2 + "\"");
|
|
1851
|
+
}
|
|
1852
|
+
scope.var(spec.local.name, name_2 === '*' ? assign({}, value) : value[name_2]);
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
function ExportDefaultDeclaration(node, scope) {
|
|
1856
|
+
var globalScope = scope.global();
|
|
1857
|
+
var value;
|
|
1858
|
+
if (node.declaration.type === 'FunctionDeclaration') {
|
|
1859
|
+
value = createFunc$1(node.declaration, scope);
|
|
1860
|
+
scope.func(node.declaration.id.name, value);
|
|
1861
|
+
}
|
|
1862
|
+
else if (node.declaration.type === 'ClassDeclaration') {
|
|
1863
|
+
value = createClass$1(node.declaration, scope);
|
|
1864
|
+
scope.func(node.declaration.id.name, value);
|
|
1865
|
+
}
|
|
1866
|
+
else {
|
|
1867
|
+
value = evaluate(node.declaration, scope);
|
|
1868
|
+
}
|
|
1869
|
+
var variable = globalScope.find(EXPORTS);
|
|
1870
|
+
if (variable) {
|
|
1871
|
+
var exports_1 = variable.get();
|
|
1872
|
+
if (exports_1 && typeof exports_1 === 'object') {
|
|
1873
|
+
exports_1.default = value;
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
function ExportNamedDeclaration(node, scope) {
|
|
1878
|
+
var globalScope = scope.global();
|
|
1879
|
+
if (node.declaration) {
|
|
1880
|
+
if (node.declaration.type === 'FunctionDeclaration') {
|
|
1881
|
+
var value = createFunc$1(node.declaration, scope);
|
|
1882
|
+
scope.func(node.declaration.id.name, value);
|
|
1883
|
+
var variable = globalScope.find(EXPORTS);
|
|
1884
|
+
if (variable) {
|
|
1885
|
+
var exports_2 = variable.get();
|
|
1886
|
+
if (exports_2 && typeof exports_2 === 'object') {
|
|
1887
|
+
exports_2[node.declaration.id.name] = value;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
else if (node.declaration.type === 'ClassDeclaration') {
|
|
1892
|
+
var value = createClass$1(node.declaration, scope);
|
|
1893
|
+
scope.func(node.declaration.id.name, value);
|
|
1894
|
+
var variable = globalScope.find(EXPORTS);
|
|
1895
|
+
if (variable) {
|
|
1896
|
+
var exports_3 = variable.get();
|
|
1897
|
+
if (exports_3 && typeof exports_3 === 'object') {
|
|
1898
|
+
exports_3[node.declaration.id.name] = value;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
else if (node.declaration.type === 'VariableDeclaration') {
|
|
1903
|
+
VariableDeclaration(node.declaration, scope);
|
|
1904
|
+
var variable = globalScope.find(EXPORTS);
|
|
1905
|
+
if (variable) {
|
|
1906
|
+
var exports_4 = variable.get();
|
|
1907
|
+
if (exports_4 && typeof exports_4 === 'object') {
|
|
1908
|
+
for (var i = 0; i < node.declaration.declarations.length; i++) {
|
|
1909
|
+
var name_3 = node.declaration.declarations[i].id.name;
|
|
1910
|
+
var item = scope.find(name_3);
|
|
1911
|
+
if (item) {
|
|
1912
|
+
exports_4[name_3] = item.get();
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
else if (node.specifiers) {
|
|
1920
|
+
var variable = globalScope.find(EXPORTS);
|
|
1921
|
+
if (variable) {
|
|
1922
|
+
var exports_5 = variable.get();
|
|
1923
|
+
if (exports_5 && typeof exports_5 === 'object') {
|
|
1924
|
+
for (var i = 0; i < node.specifiers.length; i++) {
|
|
1925
|
+
var spec = node.specifiers[i];
|
|
1926
|
+
var name_4 = spec.local.type === 'Identifier'
|
|
1927
|
+
? spec.local.name : spec.local.value;
|
|
1928
|
+
var item = scope.find(name_4);
|
|
1929
|
+
if (item) {
|
|
1930
|
+
exports_5[spec.exported.type === 'Identifier'
|
|
1931
|
+
? spec.exported.name : spec.exported.value] = item.get();
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
function ExportAllDeclaration(node, scope) {
|
|
1939
|
+
var globalScope = scope.global();
|
|
1940
|
+
var module = globalScope.find(IMPORT + node.source.value);
|
|
1941
|
+
var value;
|
|
1942
|
+
if (module) {
|
|
1943
|
+
var result = module.get();
|
|
1944
|
+
if (result) {
|
|
1945
|
+
if (typeof result === 'function') {
|
|
1946
|
+
value = result();
|
|
1947
|
+
}
|
|
1948
|
+
else if (typeof result === 'object') {
|
|
1949
|
+
value = result;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
if (!value || typeof value !== 'object') {
|
|
1954
|
+
throw new TypeError("Failed to resolve module specifier \"" + node.source.value + "\"");
|
|
1955
|
+
}
|
|
1956
|
+
var variable = globalScope.find(EXPORTS);
|
|
1957
|
+
if (variable) {
|
|
1958
|
+
var exports_6 = variable.get();
|
|
1959
|
+
if (exports_6 && typeof exports_6 === 'object') {
|
|
1960
|
+
assign(exports_6, value);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1631
1963
|
}
|
|
1632
1964
|
|
|
1633
1965
|
function Identifier$1(node, scope, options) {
|
|
@@ -1892,12 +2224,22 @@
|
|
|
1892
2224
|
var left, right;
|
|
1893
2225
|
return __generator(this, function (_a) {
|
|
1894
2226
|
switch (_a.label) {
|
|
1895
|
-
case 0:
|
|
2227
|
+
case 0:
|
|
2228
|
+
if (!(node.left.type === 'PrivateIdentifier')) return [3, 2];
|
|
2229
|
+
left = node.left.name;
|
|
2230
|
+
return [5, __values(evaluate$1(node.right, scope))];
|
|
1896
2231
|
case 1:
|
|
2232
|
+
right = _a.sent();
|
|
2233
|
+
right = right[PRIVATE];
|
|
2234
|
+
return [3, 5];
|
|
2235
|
+
case 2: return [5, __values(evaluate$1(node.left, scope))];
|
|
2236
|
+
case 3:
|
|
1897
2237
|
left = _a.sent();
|
|
1898
2238
|
return [5, __values(evaluate$1(node.right, scope))];
|
|
1899
|
-
case
|
|
2239
|
+
case 4:
|
|
1900
2240
|
right = _a.sent();
|
|
2241
|
+
_a.label = 5;
|
|
2242
|
+
case 5:
|
|
1901
2243
|
switch (node.operator) {
|
|
1902
2244
|
case '==': return [2, left == right];
|
|
1903
2245
|
case '!=': return [2, left != right];
|
|
@@ -1927,31 +2269,35 @@
|
|
|
1927
2269
|
});
|
|
1928
2270
|
}
|
|
1929
2271
|
function AssignmentExpression$1(node, scope) {
|
|
1930
|
-
var
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
case
|
|
1935
|
-
value = _a.sent();
|
|
2272
|
+
var left, variable, win, value_1, value;
|
|
2273
|
+
var _a;
|
|
2274
|
+
return __generator(this, function (_b) {
|
|
2275
|
+
switch (_b.label) {
|
|
2276
|
+
case 0:
|
|
1936
2277
|
left = node.left;
|
|
1937
|
-
if (!(left.type === 'Identifier')) return [3,
|
|
2278
|
+
if (!(left.type === 'Identifier')) return [3, 2];
|
|
1938
2279
|
return [5, __values(Identifier$1(left, scope, { getVar: true, throwErr: false }))];
|
|
1939
|
-
case
|
|
1940
|
-
variable =
|
|
1941
|
-
if (!variable) {
|
|
2280
|
+
case 1:
|
|
2281
|
+
variable = _b.sent();
|
|
2282
|
+
if (!variable) {
|
|
1942
2283
|
win = scope.global().find('window').get();
|
|
1943
2284
|
variable = new Prop(win, left.name);
|
|
1944
2285
|
}
|
|
1945
2286
|
return [3, 7];
|
|
1946
|
-
case
|
|
1947
|
-
if (!(left.type === 'MemberExpression')) return [3,
|
|
2287
|
+
case 2:
|
|
2288
|
+
if (!(left.type === 'MemberExpression')) return [3, 4];
|
|
1948
2289
|
return [5, __values(MemberExpression$1(left, scope, { getVar: true }))];
|
|
1949
|
-
case
|
|
1950
|
-
variable =
|
|
2290
|
+
case 3:
|
|
2291
|
+
variable = _b.sent();
|
|
1951
2292
|
return [3, 7];
|
|
1952
|
-
case
|
|
1953
|
-
case
|
|
1954
|
-
|
|
2293
|
+
case 4: return [5, __values(evaluate$1(node.right, scope))];
|
|
2294
|
+
case 5:
|
|
2295
|
+
value_1 = _b.sent();
|
|
2296
|
+
return [5, __values(pattern$2(left, scope, { feed: value_1 }))];
|
|
2297
|
+
case 6: return [2, _b.sent()];
|
|
2298
|
+
case 7: return [5, __values(evaluate$1(node.right, scope))];
|
|
2299
|
+
case 8:
|
|
2300
|
+
value = _b.sent();
|
|
1955
2301
|
switch (node.operator) {
|
|
1956
2302
|
case '=':
|
|
1957
2303
|
variable.set(value);
|
|
@@ -1992,46 +2338,67 @@
|
|
|
1992
2338
|
case '&=':
|
|
1993
2339
|
variable.set(variable.get() & value);
|
|
1994
2340
|
return [2, variable.get()];
|
|
2341
|
+
case '??=':
|
|
2342
|
+
variable.set((_a = variable.get()) !== null && _a !== void 0 ? _a : value);
|
|
2343
|
+
return [2, variable.get()];
|
|
2344
|
+
case '&&=':
|
|
2345
|
+
variable.set(variable.get() && value);
|
|
2346
|
+
return [2, variable.get()];
|
|
2347
|
+
case '||=':
|
|
2348
|
+
variable.set(variable.get() || value);
|
|
2349
|
+
return [2, variable.get()];
|
|
1995
2350
|
default: throw new SyntaxError("Unexpected token " + node.operator);
|
|
1996
2351
|
}
|
|
1997
2352
|
}
|
|
1998
2353
|
});
|
|
1999
2354
|
}
|
|
2000
2355
|
function LogicalExpression$1(node, scope) {
|
|
2001
|
-
var _a, _b, _c;
|
|
2002
|
-
|
|
2003
|
-
|
|
2356
|
+
var _a, _b, _c, _d;
|
|
2357
|
+
var _e;
|
|
2358
|
+
return __generator(this, function (_f) {
|
|
2359
|
+
switch (_f.label) {
|
|
2004
2360
|
case 0:
|
|
2005
2361
|
_a = node.operator;
|
|
2006
2362
|
switch (_a) {
|
|
2007
2363
|
case '||': return [3, 1];
|
|
2008
2364
|
case '&&': return [3, 5];
|
|
2365
|
+
case '??': return [3, 9];
|
|
2009
2366
|
}
|
|
2010
|
-
return [3,
|
|
2367
|
+
return [3, 14];
|
|
2011
2368
|
case 1: return [5, __values(evaluate$1(node.left, scope))];
|
|
2012
2369
|
case 2:
|
|
2013
|
-
_b = (
|
|
2370
|
+
_b = (_f.sent());
|
|
2014
2371
|
if (_b) return [3, 4];
|
|
2015
2372
|
return [5, __values(evaluate$1(node.right, scope))];
|
|
2016
2373
|
case 3:
|
|
2017
|
-
_b = (
|
|
2018
|
-
|
|
2374
|
+
_b = (_f.sent());
|
|
2375
|
+
_f.label = 4;
|
|
2019
2376
|
case 4: return [2, _b];
|
|
2020
2377
|
case 5: return [5, __values(evaluate$1(node.left, scope))];
|
|
2021
2378
|
case 6:
|
|
2022
|
-
_c = (
|
|
2379
|
+
_c = (_f.sent());
|
|
2023
2380
|
if (!_c) return [3, 8];
|
|
2024
2381
|
return [5, __values(evaluate$1(node.right, scope))];
|
|
2025
2382
|
case 7:
|
|
2026
|
-
_c = (
|
|
2027
|
-
|
|
2383
|
+
_c = (_f.sent());
|
|
2384
|
+
_f.label = 8;
|
|
2028
2385
|
case 8: return [2, _c];
|
|
2029
|
-
case 9:
|
|
2386
|
+
case 9: return [5, __values(evaluate$1(node.left, scope))];
|
|
2387
|
+
case 10:
|
|
2388
|
+
if (!((_e = (_f.sent())) !== null && _e !== void 0)) return [3, 11];
|
|
2389
|
+
_d = _e;
|
|
2390
|
+
return [3, 13];
|
|
2391
|
+
case 11: return [5, __values(evaluate$1(node.right, scope))];
|
|
2392
|
+
case 12:
|
|
2393
|
+
_d = (_f.sent());
|
|
2394
|
+
_f.label = 13;
|
|
2395
|
+
case 13: return [2, _d];
|
|
2396
|
+
case 14: throw new SyntaxError("Unexpected token " + node.operator);
|
|
2030
2397
|
}
|
|
2031
2398
|
});
|
|
2032
2399
|
}
|
|
2033
2400
|
function MemberExpression$1(node, scope, options) {
|
|
2034
|
-
var _a, getObj, _b, getVar, object, key, setter, thisObject, privateKey, getter, thisObject;
|
|
2401
|
+
var _a, getObj, _b, getVar, object, key, priv, setter, thisObject, privateKey, getter, thisObject;
|
|
2035
2402
|
if (options === void 0) { options = {}; }
|
|
2036
2403
|
return __generator(this, function (_c) {
|
|
2037
2404
|
switch (_c.label) {
|
|
@@ -2049,15 +2416,25 @@
|
|
|
2049
2416
|
case 4:
|
|
2050
2417
|
if (getObj)
|
|
2051
2418
|
return [2, object];
|
|
2419
|
+
priv = false;
|
|
2052
2420
|
if (!node.computed) return [3, 6];
|
|
2053
2421
|
return [5, __values(evaluate$1(node.property, scope))];
|
|
2054
2422
|
case 5:
|
|
2055
2423
|
key = _c.sent();
|
|
2056
2424
|
return [3, 7];
|
|
2057
2425
|
case 6:
|
|
2058
|
-
|
|
2426
|
+
if (node.property.type === 'PrivateIdentifier') {
|
|
2427
|
+
key = node.property.name;
|
|
2428
|
+
priv = true;
|
|
2429
|
+
}
|
|
2430
|
+
else {
|
|
2431
|
+
key = node.property.name;
|
|
2432
|
+
}
|
|
2059
2433
|
_c.label = 7;
|
|
2060
2434
|
case 7:
|
|
2435
|
+
if (priv) {
|
|
2436
|
+
object = object[PRIVATE];
|
|
2437
|
+
}
|
|
2061
2438
|
if (getVar) {
|
|
2062
2439
|
setter = getSetter(object, key);
|
|
2063
2440
|
if (node.object.type === 'Super' && setter) {
|
|
@@ -2074,9 +2451,15 @@
|
|
|
2074
2451
|
getter = getGetter(object, key);
|
|
2075
2452
|
if (node.object.type === 'Super' && getter) {
|
|
2076
2453
|
thisObject = scope.find('this').get();
|
|
2454
|
+
if (node.optional && thisObject == null) {
|
|
2455
|
+
return [2, undefined];
|
|
2456
|
+
}
|
|
2077
2457
|
return [2, getter.call(thisObject)];
|
|
2078
2458
|
}
|
|
2079
2459
|
else {
|
|
2460
|
+
if (node.optional && object == null) {
|
|
2461
|
+
return [2, undefined];
|
|
2462
|
+
}
|
|
2080
2463
|
return [2, object[key]];
|
|
2081
2464
|
}
|
|
2082
2465
|
}
|
|
@@ -2103,7 +2486,7 @@
|
|
|
2103
2486
|
});
|
|
2104
2487
|
}
|
|
2105
2488
|
function CallExpression$1(node, scope) {
|
|
2106
|
-
var func, object, key, thisObject, name_1, args, i, arg, _a, _b, _c, _d, superCall;
|
|
2489
|
+
var func, object, key, priv, obj, thisObject, name_1, args, i, arg, _a, _b, _c, _d, superCall;
|
|
2107
2490
|
return __generator(this, function (_e) {
|
|
2108
2491
|
switch (_e.label) {
|
|
2109
2492
|
case 0:
|
|
@@ -2111,22 +2494,39 @@
|
|
|
2111
2494
|
return [5, __values(MemberExpression$1(node.callee, scope, { getObj: true }))];
|
|
2112
2495
|
case 1:
|
|
2113
2496
|
object = _e.sent();
|
|
2497
|
+
if (node.callee.optional && object == null) {
|
|
2498
|
+
return [2, undefined];
|
|
2499
|
+
}
|
|
2114
2500
|
key = void 0;
|
|
2501
|
+
priv = false;
|
|
2115
2502
|
if (!node.callee.computed) return [3, 3];
|
|
2116
2503
|
return [5, __values(evaluate$1(node.callee.property, scope))];
|
|
2117
2504
|
case 2:
|
|
2118
2505
|
key = _e.sent();
|
|
2119
2506
|
return [3, 4];
|
|
2120
2507
|
case 3:
|
|
2121
|
-
|
|
2508
|
+
if (node.callee.property.type === 'PrivateIdentifier') {
|
|
2509
|
+
key = node.callee.property.name;
|
|
2510
|
+
priv = true;
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
key = node.callee.property.name;
|
|
2514
|
+
}
|
|
2122
2515
|
_e.label = 4;
|
|
2123
2516
|
case 4:
|
|
2517
|
+
obj = object;
|
|
2518
|
+
if (priv) {
|
|
2519
|
+
obj = obj[PRIVATE];
|
|
2520
|
+
}
|
|
2124
2521
|
if (node.callee.object.type === 'Super') {
|
|
2125
2522
|
thisObject = scope.find('this').get();
|
|
2126
|
-
func =
|
|
2523
|
+
func = obj[key].bind(thisObject);
|
|
2127
2524
|
}
|
|
2128
2525
|
else {
|
|
2129
|
-
func =
|
|
2526
|
+
func = obj[key];
|
|
2527
|
+
}
|
|
2528
|
+
if (node.optional && func == null) {
|
|
2529
|
+
return [2, undefined];
|
|
2130
2530
|
}
|
|
2131
2531
|
if (typeof func !== 'function') {
|
|
2132
2532
|
throw new TypeError(key + " is not a function");
|
|
@@ -2140,6 +2540,9 @@
|
|
|
2140
2540
|
return [5, __values(evaluate$1(node.callee, scope))];
|
|
2141
2541
|
case 6:
|
|
2142
2542
|
func = _e.sent();
|
|
2543
|
+
if (node.optional && func == null) {
|
|
2544
|
+
return [2, undefined];
|
|
2545
|
+
}
|
|
2143
2546
|
if (typeof func !== 'function' || node.callee.type !== 'Super' && func[CLSCTOR]) {
|
|
2144
2547
|
if (node.callee.type === 'Identifier') {
|
|
2145
2548
|
name_1 = node.callee.name;
|
|
@@ -2250,7 +2653,13 @@
|
|
|
2250
2653
|
}
|
|
2251
2654
|
function MetaProperty$1(node, scope) {
|
|
2252
2655
|
return __generator(this, function (_a) {
|
|
2253
|
-
|
|
2656
|
+
if (node.meta.name === 'new' && node.property.name === 'target') {
|
|
2657
|
+
return [2, scope.find(NEWTARGET).get()];
|
|
2658
|
+
}
|
|
2659
|
+
else if (node.meta.name === 'import' && node.property.name === 'meta') {
|
|
2660
|
+
return [2, { url: '' }];
|
|
2661
|
+
}
|
|
2662
|
+
return [2];
|
|
2254
2663
|
});
|
|
2255
2664
|
}
|
|
2256
2665
|
function SequenceExpression$1(node, scope) {
|
|
@@ -2376,6 +2785,42 @@
|
|
|
2376
2785
|
}
|
|
2377
2786
|
});
|
|
2378
2787
|
}
|
|
2788
|
+
function ChainExpression$1(node, scope) {
|
|
2789
|
+
return __generator(this, function (_a) {
|
|
2790
|
+
switch (_a.label) {
|
|
2791
|
+
case 0: return [5, __values(evaluate$1(node.expression, scope))];
|
|
2792
|
+
case 1: return [2, _a.sent()];
|
|
2793
|
+
}
|
|
2794
|
+
});
|
|
2795
|
+
}
|
|
2796
|
+
function ImportExpression$1(node, scope) {
|
|
2797
|
+
var globalScope, source, module, value, result;
|
|
2798
|
+
return __generator(this, function (_a) {
|
|
2799
|
+
switch (_a.label) {
|
|
2800
|
+
case 0:
|
|
2801
|
+
globalScope = scope.global();
|
|
2802
|
+
return [5, __values(evaluate$1(node.source, scope))];
|
|
2803
|
+
case 1:
|
|
2804
|
+
source = _a.sent();
|
|
2805
|
+
module = globalScope.find(IMPORT + source);
|
|
2806
|
+
if (module) {
|
|
2807
|
+
result = module.get();
|
|
2808
|
+
if (result) {
|
|
2809
|
+
if (typeof result === 'function') {
|
|
2810
|
+
value = result();
|
|
2811
|
+
}
|
|
2812
|
+
else if (typeof result === 'object') {
|
|
2813
|
+
value = result;
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
if (!value || typeof value !== 'object') {
|
|
2818
|
+
return [2, Promise.reject(new TypeError("Failed to resolve module specifier \"" + source + "\""))];
|
|
2819
|
+
}
|
|
2820
|
+
return [2, Promise.resolve(value)];
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2379
2824
|
function YieldExpression(node, scope) {
|
|
2380
2825
|
var res, _a;
|
|
2381
2826
|
return __generator(this, function (_b) {
|
|
@@ -2435,94 +2880,327 @@
|
|
|
2435
2880
|
ClassExpression: ClassExpression$1,
|
|
2436
2881
|
Super: Super$1,
|
|
2437
2882
|
SpreadElement: SpreadElement$1,
|
|
2883
|
+
ChainExpression: ChainExpression$1,
|
|
2884
|
+
ImportExpression: ImportExpression$1,
|
|
2438
2885
|
YieldExpression: YieldExpression,
|
|
2439
2886
|
AwaitExpression: AwaitExpression
|
|
2440
2887
|
});
|
|
2441
2888
|
|
|
2442
|
-
function
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2889
|
+
function ObjectPattern$1(node, scope, options) {
|
|
2890
|
+
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, fedKeys, i, property, value, key, value, rest, i_1;
|
|
2891
|
+
if (options === void 0) { options = {}; }
|
|
2892
|
+
return __generator(this, function (_e) {
|
|
2893
|
+
switch (_e.label) {
|
|
2894
|
+
case 0:
|
|
2895
|
+
_a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed, feed = _d === void 0 ? {} : _d;
|
|
2896
|
+
fedKeys = [];
|
|
2897
|
+
i = 0;
|
|
2898
|
+
_e.label = 1;
|
|
2446
2899
|
case 1:
|
|
2447
|
-
|
|
2448
|
-
|
|
2900
|
+
if (!(i < node.properties.length)) return [3, 18];
|
|
2901
|
+
property = node.properties[i];
|
|
2902
|
+
if (!hoist) return [3, 8];
|
|
2903
|
+
if (!(onlyBlock || kind === 'var')) return [3, 7];
|
|
2904
|
+
if (!(property.type === 'Property')) return [3, 5];
|
|
2905
|
+
value = property.value;
|
|
2906
|
+
if (!(value.type === 'Identifier')) return [3, 2];
|
|
2907
|
+
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2908
|
+
return [3, 4];
|
|
2909
|
+
case 2: return [5, __values(pattern$2(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2910
|
+
case 3:
|
|
2911
|
+
_e.sent();
|
|
2912
|
+
_e.label = 4;
|
|
2913
|
+
case 4: return [3, 7];
|
|
2914
|
+
case 5: return [5, __values(RestElement$1(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2915
|
+
case 6:
|
|
2916
|
+
_e.sent();
|
|
2917
|
+
_e.label = 7;
|
|
2918
|
+
case 7: return [3, 17];
|
|
2919
|
+
case 8:
|
|
2920
|
+
if (!(property.type === 'Property')) return [3, 15];
|
|
2921
|
+
key = void 0;
|
|
2922
|
+
if (!property.computed) return [3, 10];
|
|
2923
|
+
return [5, __values(evaluate$1(property.key, scope))];
|
|
2924
|
+
case 9:
|
|
2925
|
+
key = _e.sent();
|
|
2926
|
+
return [3, 11];
|
|
2927
|
+
case 10:
|
|
2928
|
+
key = property.key.name;
|
|
2929
|
+
_e.label = 11;
|
|
2930
|
+
case 11:
|
|
2931
|
+
fedKeys.push(key);
|
|
2932
|
+
value = property.value;
|
|
2933
|
+
if (!(value.type === 'Identifier')) return [3, 12];
|
|
2934
|
+
scope[kind](value.name, feed[key]);
|
|
2935
|
+
return [3, 14];
|
|
2936
|
+
case 12: return [5, __values(pattern$2(value, scope, { kind: kind, feed: feed[key] }))];
|
|
2937
|
+
case 13:
|
|
2938
|
+
_e.sent();
|
|
2939
|
+
_e.label = 14;
|
|
2940
|
+
case 14: return [3, 17];
|
|
2941
|
+
case 15:
|
|
2942
|
+
rest = assign({}, feed);
|
|
2943
|
+
for (i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
2944
|
+
delete rest[fedKeys[i_1]];
|
|
2945
|
+
return [5, __values(RestElement$1(property, scope, { kind: kind, feed: rest }))];
|
|
2946
|
+
case 16:
|
|
2947
|
+
_e.sent();
|
|
2948
|
+
_e.label = 17;
|
|
2949
|
+
case 17:
|
|
2950
|
+
i++;
|
|
2951
|
+
return [3, 1];
|
|
2952
|
+
case 18: return [2];
|
|
2449
2953
|
}
|
|
2450
2954
|
});
|
|
2451
2955
|
}
|
|
2452
|
-
function
|
|
2453
|
-
var _a,
|
|
2956
|
+
function ArrayPattern$1(node, scope, options) {
|
|
2957
|
+
var kind, _a, hoist, _b, onlyBlock, _c, feed, result, i, element, variable;
|
|
2454
2958
|
if (options === void 0) { options = {}; }
|
|
2455
|
-
return __generator(this, function (
|
|
2456
|
-
switch (
|
|
2959
|
+
return __generator(this, function (_d) {
|
|
2960
|
+
switch (_d.label) {
|
|
2457
2961
|
case 0:
|
|
2458
|
-
_a = options.
|
|
2459
|
-
|
|
2460
|
-
if (!!hoisted) return [3, 2];
|
|
2461
|
-
return [5, __values(hoist(block, subScope, { onlyBlock: true }))];
|
|
2462
|
-
case 1:
|
|
2463
|
-
_c.sent();
|
|
2464
|
-
_c.label = 2;
|
|
2465
|
-
case 2:
|
|
2962
|
+
kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
2963
|
+
result = [];
|
|
2466
2964
|
i = 0;
|
|
2467
|
-
|
|
2965
|
+
_d.label = 1;
|
|
2966
|
+
case 1:
|
|
2967
|
+
if (!(i < node.elements.length)) return [3, 14];
|
|
2968
|
+
element = node.elements[i];
|
|
2969
|
+
if (!element)
|
|
2970
|
+
return [3, 13];
|
|
2971
|
+
if (!hoist) return [3, 5];
|
|
2972
|
+
if (!(onlyBlock || kind === 'var')) return [3, 4];
|
|
2973
|
+
if (!(element.type === 'Identifier')) return [3, 2];
|
|
2974
|
+
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2975
|
+
return [3, 4];
|
|
2976
|
+
case 2: return [5, __values(pattern$2(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2468
2977
|
case 3:
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
case 4:
|
|
2472
|
-
result = _c.sent();
|
|
2473
|
-
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
2474
|
-
return [2, result];
|
|
2475
|
-
}
|
|
2476
|
-
_c.label = 5;
|
|
2978
|
+
_d.sent();
|
|
2979
|
+
_d.label = 4;
|
|
2980
|
+
case 4: return [3, 13];
|
|
2477
2981
|
case 5:
|
|
2982
|
+
if (!(element.type === 'Identifier')) return [3, 9];
|
|
2983
|
+
if (!kind) return [3, 6];
|
|
2984
|
+
scope[kind](element.name, feed[i]);
|
|
2985
|
+
return [3, 8];
|
|
2986
|
+
case 6: return [5, __values(Identifier$1(element, scope, { getVar: true }))];
|
|
2987
|
+
case 7:
|
|
2988
|
+
variable = _d.sent();
|
|
2989
|
+
variable.set(feed[i]);
|
|
2990
|
+
result.push(variable.get());
|
|
2991
|
+
_d.label = 8;
|
|
2992
|
+
case 8: return [3, 13];
|
|
2993
|
+
case 9:
|
|
2994
|
+
if (!(element.type === 'RestElement')) return [3, 11];
|
|
2995
|
+
return [5, __values(RestElement$1(element, scope, { kind: kind, feed: feed.slice(i) }))];
|
|
2996
|
+
case 10:
|
|
2997
|
+
_d.sent();
|
|
2998
|
+
return [3, 13];
|
|
2999
|
+
case 11: return [5, __values(pattern$2(element, scope, { kind: kind, feed: feed[i] }))];
|
|
3000
|
+
case 12:
|
|
3001
|
+
_d.sent();
|
|
3002
|
+
_d.label = 13;
|
|
3003
|
+
case 13:
|
|
2478
3004
|
i++;
|
|
2479
|
-
return [3,
|
|
2480
|
-
case
|
|
3005
|
+
return [3, 1];
|
|
3006
|
+
case 14:
|
|
3007
|
+
if (result.length) {
|
|
3008
|
+
return [2, result];
|
|
3009
|
+
}
|
|
3010
|
+
return [2];
|
|
2481
3011
|
}
|
|
2482
3012
|
});
|
|
2483
3013
|
}
|
|
2484
|
-
function
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
function DebuggerStatement$1() {
|
|
2490
|
-
return __generator(this, function (_a) {
|
|
2491
|
-
debugger;
|
|
2492
|
-
return [2];
|
|
2493
|
-
});
|
|
2494
|
-
}
|
|
2495
|
-
function ReturnStatement$1(node, scope) {
|
|
2496
|
-
var _a, _b;
|
|
2497
|
-
return __generator(this, function (_c) {
|
|
2498
|
-
switch (_c.label) {
|
|
3014
|
+
function RestElement$1(node, scope, options) {
|
|
3015
|
+
var kind, _a, hoist, _b, onlyBlock, _c, feed, arg, variable;
|
|
3016
|
+
if (options === void 0) { options = {}; }
|
|
3017
|
+
return __generator(this, function (_d) {
|
|
3018
|
+
switch (_d.label) {
|
|
2499
3019
|
case 0:
|
|
2500
|
-
_a =
|
|
2501
|
-
|
|
2502
|
-
return [
|
|
2503
|
-
|
|
2504
|
-
|
|
3020
|
+
kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
3021
|
+
arg = node.argument;
|
|
3022
|
+
if (!hoist) return [3, 4];
|
|
3023
|
+
if (!(onlyBlock || kind === 'var')) return [3, 3];
|
|
3024
|
+
if (!(arg.type === 'Identifier')) return [3, 1];
|
|
3025
|
+
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2505
3026
|
return [3, 3];
|
|
3027
|
+
case 1: return [5, __values(pattern$2(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2506
3028
|
case 2:
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
case 3:
|
|
2510
|
-
|
|
2511
|
-
return [
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
3029
|
+
_d.sent();
|
|
3030
|
+
_d.label = 3;
|
|
3031
|
+
case 3: return [3, 10];
|
|
3032
|
+
case 4:
|
|
3033
|
+
if (!(arg.type === 'Identifier')) return [3, 8];
|
|
3034
|
+
if (!kind) return [3, 5];
|
|
3035
|
+
scope[kind](arg.name, feed);
|
|
3036
|
+
return [3, 7];
|
|
3037
|
+
case 5: return [5, __values(Identifier$1(arg, scope, { getVar: true }))];
|
|
3038
|
+
case 6:
|
|
3039
|
+
variable = _d.sent();
|
|
3040
|
+
variable.set(feed);
|
|
3041
|
+
_d.label = 7;
|
|
3042
|
+
case 7: return [3, 10];
|
|
3043
|
+
case 8: return [5, __values(pattern$2(arg, scope, { kind: kind, feed: feed }))];
|
|
3044
|
+
case 9:
|
|
3045
|
+
_d.sent();
|
|
3046
|
+
_d.label = 10;
|
|
3047
|
+
case 10: return [2];
|
|
3048
|
+
}
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
function AssignmentPattern$1(node, scope, options) {
|
|
3052
|
+
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, _e, left;
|
|
3053
|
+
if (options === void 0) { options = {}; }
|
|
3054
|
+
return __generator(this, function (_f) {
|
|
3055
|
+
switch (_f.label) {
|
|
3056
|
+
case 0:
|
|
3057
|
+
_a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed;
|
|
3058
|
+
if (!(_d === void 0)) return [3, 2];
|
|
3059
|
+
return [5, __values(evaluate$1(node.right, scope))];
|
|
3060
|
+
case 1:
|
|
3061
|
+
_e = _f.sent();
|
|
3062
|
+
return [3, 3];
|
|
3063
|
+
case 2:
|
|
3064
|
+
_e = _d;
|
|
3065
|
+
_f.label = 3;
|
|
3066
|
+
case 3:
|
|
3067
|
+
feed = _e;
|
|
3068
|
+
left = node.left;
|
|
3069
|
+
if (!hoist) return [3, 7];
|
|
3070
|
+
if (!(onlyBlock || kind === 'var')) return [3, 6];
|
|
3071
|
+
if (!(left.type === 'Identifier')) return [3, 4];
|
|
3072
|
+
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3073
|
+
return [3, 6];
|
|
3074
|
+
case 4: return [5, __values(pattern$2(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3075
|
+
case 5:
|
|
3076
|
+
_f.sent();
|
|
3077
|
+
_f.label = 6;
|
|
3078
|
+
case 6: return [3, 10];
|
|
3079
|
+
case 7:
|
|
3080
|
+
if (!(left.type === 'Identifier')) return [3, 8];
|
|
3081
|
+
scope[kind](left.name, feed);
|
|
3082
|
+
return [3, 10];
|
|
3083
|
+
case 8: return [5, __values(pattern$2(left, scope, { kind: kind, feed: feed }))];
|
|
3084
|
+
case 9:
|
|
3085
|
+
_f.sent();
|
|
3086
|
+
_f.label = 10;
|
|
3087
|
+
case 10: return [2];
|
|
3088
|
+
}
|
|
3089
|
+
});
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
var pattern$1 = /*#__PURE__*/Object.freeze({
|
|
3093
|
+
__proto__: null,
|
|
3094
|
+
ObjectPattern: ObjectPattern$1,
|
|
3095
|
+
ArrayPattern: ArrayPattern$1,
|
|
3096
|
+
RestElement: RestElement$1,
|
|
3097
|
+
AssignmentPattern: AssignmentPattern$1
|
|
3098
|
+
});
|
|
3099
|
+
|
|
3100
|
+
var evaluateOps$1;
|
|
3101
|
+
function evaluate$1(node, scope) {
|
|
3102
|
+
var handler;
|
|
3103
|
+
return __generator(this, function (_a) {
|
|
3104
|
+
switch (_a.label) {
|
|
3105
|
+
case 0:
|
|
3106
|
+
if (!node)
|
|
3107
|
+
return [2];
|
|
3108
|
+
if (!evaluateOps$1) {
|
|
3109
|
+
evaluateOps$1 = assign({}, declaration$1, expression$1, identifier$1, statement$1, literal$1, pattern$1);
|
|
3110
|
+
}
|
|
3111
|
+
handler = evaluateOps$1[node.type];
|
|
3112
|
+
if (!handler) return [3, 2];
|
|
3113
|
+
return [5, __values(handler(node, scope))];
|
|
3114
|
+
case 1: return [2, _a.sent()];
|
|
3115
|
+
case 2: throw new Error(node.type + " isn't implemented");
|
|
3116
|
+
}
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
function ExpressionStatement$1(node, scope) {
|
|
3121
|
+
return __generator(this, function (_a) {
|
|
3122
|
+
switch (_a.label) {
|
|
3123
|
+
case 0: return [5, __values(evaluate$1(node.expression, scope))];
|
|
3124
|
+
case 1:
|
|
3125
|
+
_a.sent();
|
|
3126
|
+
return [2];
|
|
3127
|
+
}
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
function BlockStatement$1(block, scope, options) {
|
|
3131
|
+
var _a, invasived, _b, hoisted, subScope, i, result;
|
|
3132
|
+
if (options === void 0) { options = {}; }
|
|
3133
|
+
return __generator(this, function (_c) {
|
|
3134
|
+
switch (_c.label) {
|
|
3135
|
+
case 0:
|
|
3136
|
+
_a = options.invasived, invasived = _a === void 0 ? false : _a, _b = options.hoisted, hoisted = _b === void 0 ? false : _b;
|
|
3137
|
+
subScope = invasived ? scope : new Scope(scope);
|
|
3138
|
+
if (!!hoisted) return [3, 2];
|
|
3139
|
+
return [5, __values(hoist(block, subScope, { onlyBlock: true }))];
|
|
3140
|
+
case 1:
|
|
3141
|
+
_c.sent();
|
|
3142
|
+
_c.label = 2;
|
|
3143
|
+
case 2:
|
|
3144
|
+
i = 0;
|
|
3145
|
+
_c.label = 3;
|
|
3146
|
+
case 3:
|
|
3147
|
+
if (!(i < block.body.length)) return [3, 6];
|
|
3148
|
+
return [5, __values(evaluate$1(block.body[i], subScope))];
|
|
3149
|
+
case 4:
|
|
3150
|
+
result = _c.sent();
|
|
3151
|
+
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
3152
|
+
return [2, result];
|
|
3153
|
+
}
|
|
3154
|
+
_c.label = 5;
|
|
3155
|
+
case 5:
|
|
3156
|
+
i++;
|
|
3157
|
+
return [3, 3];
|
|
3158
|
+
case 6: return [2];
|
|
3159
|
+
}
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
function EmptyStatement$1() {
|
|
3163
|
+
return __generator(this, function (_a) {
|
|
3164
|
+
return [2];
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
function DebuggerStatement$1() {
|
|
3168
|
+
return __generator(this, function (_a) {
|
|
3169
|
+
debugger;
|
|
3170
|
+
return [2];
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
function ReturnStatement$1(node, scope) {
|
|
3174
|
+
var _a, _b;
|
|
3175
|
+
return __generator(this, function (_c) {
|
|
3176
|
+
switch (_c.label) {
|
|
3177
|
+
case 0:
|
|
3178
|
+
_a = RETURN;
|
|
3179
|
+
if (!node.argument) return [3, 2];
|
|
3180
|
+
return [5, __values(evaluate$1(node.argument, scope))];
|
|
3181
|
+
case 1:
|
|
3182
|
+
_b = (_c.sent());
|
|
3183
|
+
return [3, 3];
|
|
3184
|
+
case 2:
|
|
3185
|
+
_b = undefined;
|
|
3186
|
+
_c.label = 3;
|
|
3187
|
+
case 3:
|
|
3188
|
+
_a.RES = _b;
|
|
3189
|
+
return [2, RETURN];
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
function BreakStatement$1() {
|
|
3194
|
+
return __generator(this, function (_a) {
|
|
3195
|
+
return [2, BREAK];
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
function ContinueStatement$1() {
|
|
3199
|
+
return __generator(this, function (_a) {
|
|
3200
|
+
return [2, CONTINUE];
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
function IfStatement$1(node, scope) {
|
|
2526
3204
|
return __generator(this, function (_a) {
|
|
2527
3205
|
switch (_a.label) {
|
|
2528
3206
|
case 0: return [5, __values(evaluate$1(node.test, scope))];
|
|
@@ -2809,318 +3487,65 @@
|
|
|
2809
3487
|
AWAIT.RES = iterator.next();
|
|
2810
3488
|
return [4, AWAIT];
|
|
2811
3489
|
case 2:
|
|
2812
|
-
ret = _b.sent();
|
|
2813
|
-
_b.label = 3;
|
|
2814
|
-
case 3:
|
|
2815
|
-
if (!!ret.done) return [3, 7];
|
|
2816
|
-
return [5, __values(ForXHandler(node, scope, { value: ret.value }))];
|
|
2817
|
-
case 4:
|
|
2818
|
-
result = _b.sent();
|
|
2819
|
-
if (result === BREAK) {
|
|
2820
|
-
return [3, 7];
|
|
2821
|
-
}
|
|
2822
|
-
else if (result === CONTINUE) {
|
|
2823
|
-
return [3, 5];
|
|
2824
|
-
}
|
|
2825
|
-
else if (result === RETURN) {
|
|
2826
|
-
return [2, result];
|
|
2827
|
-
}
|
|
2828
|
-
_b.label = 5;
|
|
2829
|
-
case 5:
|
|
2830
|
-
AWAIT.RES = iterator.next();
|
|
2831
|
-
return [4, AWAIT];
|
|
2832
|
-
case 6:
|
|
2833
|
-
ret = _b.sent();
|
|
2834
|
-
return [3, 3];
|
|
2835
|
-
case 7: return [3, 15];
|
|
2836
|
-
case 8:
|
|
2837
|
-
_b.trys.push([8, 13, 14, 15]);
|
|
2838
|
-
right_1 = __values(right), right_1_1 = right_1.next();
|
|
2839
|
-
_b.label = 9;
|
|
2840
|
-
case 9:
|
|
2841
|
-
if (!!right_1_1.done) return [3, 12];
|
|
2842
|
-
value = right_1_1.value;
|
|
2843
|
-
return [5, __values(ForXHandler(node, scope, { value: value }))];
|
|
2844
|
-
case 10:
|
|
2845
|
-
result = _b.sent();
|
|
2846
|
-
if (result === BREAK) {
|
|
2847
|
-
return [3, 12];
|
|
2848
|
-
}
|
|
2849
|
-
else if (result === CONTINUE) {
|
|
2850
|
-
return [3, 11];
|
|
2851
|
-
}
|
|
2852
|
-
else if (result === RETURN) {
|
|
2853
|
-
return [2, result];
|
|
2854
|
-
}
|
|
2855
|
-
_b.label = 11;
|
|
2856
|
-
case 11:
|
|
2857
|
-
right_1_1 = right_1.next();
|
|
2858
|
-
return [3, 9];
|
|
2859
|
-
case 12: return [3, 15];
|
|
2860
|
-
case 13:
|
|
2861
|
-
e_1_1 = _b.sent();
|
|
2862
|
-
e_1 = { error: e_1_1 };
|
|
2863
|
-
return [3, 15];
|
|
2864
|
-
case 14:
|
|
2865
|
-
try {
|
|
2866
|
-
if (right_1_1 && !right_1_1.done && (_a = right_1.return)) _a.call(right_1);
|
|
2867
|
-
}
|
|
2868
|
-
finally { if (e_1) throw e_1.error; }
|
|
2869
|
-
return [7];
|
|
2870
|
-
case 15: return [2];
|
|
2871
|
-
}
|
|
2872
|
-
});
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
var statement$1 = /*#__PURE__*/Object.freeze({
|
|
2876
|
-
__proto__: null,
|
|
2877
|
-
ExpressionStatement: ExpressionStatement$1,
|
|
2878
|
-
BlockStatement: BlockStatement$1,
|
|
2879
|
-
EmptyStatement: EmptyStatement$1,
|
|
2880
|
-
DebuggerStatement: DebuggerStatement$1,
|
|
2881
|
-
ReturnStatement: ReturnStatement$1,
|
|
2882
|
-
BreakStatement: BreakStatement$1,
|
|
2883
|
-
ContinueStatement: ContinueStatement$1,
|
|
2884
|
-
IfStatement: IfStatement$1,
|
|
2885
|
-
SwitchStatement: SwitchStatement$1,
|
|
2886
|
-
SwitchCase: SwitchCase$1,
|
|
2887
|
-
ThrowStatement: ThrowStatement$1,
|
|
2888
|
-
TryStatement: TryStatement$1,
|
|
2889
|
-
CatchClause: CatchClause$1,
|
|
2890
|
-
WhileStatement: WhileStatement$1,
|
|
2891
|
-
DoWhileStatement: DoWhileStatement$1,
|
|
2892
|
-
ForStatement: ForStatement$1,
|
|
2893
|
-
ForInStatement: ForInStatement$1,
|
|
2894
|
-
ForOfStatement: ForOfStatement$1
|
|
2895
|
-
});
|
|
2896
|
-
|
|
2897
|
-
function ObjectPattern$1(node, scope, options) {
|
|
2898
|
-
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, fedKeys, i, property, value, key, value, rest, i_1;
|
|
2899
|
-
if (options === void 0) { options = {}; }
|
|
2900
|
-
return __generator(this, function (_e) {
|
|
2901
|
-
switch (_e.label) {
|
|
2902
|
-
case 0:
|
|
2903
|
-
_a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed, feed = _d === void 0 ? {} : _d;
|
|
2904
|
-
fedKeys = [];
|
|
2905
|
-
i = 0;
|
|
2906
|
-
_e.label = 1;
|
|
2907
|
-
case 1:
|
|
2908
|
-
if (!(i < node.properties.length)) return [3, 18];
|
|
2909
|
-
property = node.properties[i];
|
|
2910
|
-
if (!hoist) return [3, 8];
|
|
2911
|
-
if (!(onlyBlock || kind === 'var')) return [3, 7];
|
|
2912
|
-
if (!(property.type === 'Property')) return [3, 5];
|
|
2913
|
-
value = property.value;
|
|
2914
|
-
if (!(value.type === 'Identifier')) return [3, 2];
|
|
2915
|
-
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2916
|
-
return [3, 4];
|
|
2917
|
-
case 2: return [5, __values(pattern$2(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2918
|
-
case 3:
|
|
2919
|
-
_e.sent();
|
|
2920
|
-
_e.label = 4;
|
|
2921
|
-
case 4: return [3, 7];
|
|
2922
|
-
case 5: return [5, __values(RestElement$1(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2923
|
-
case 6:
|
|
2924
|
-
_e.sent();
|
|
2925
|
-
_e.label = 7;
|
|
2926
|
-
case 7: return [3, 17];
|
|
2927
|
-
case 8:
|
|
2928
|
-
if (!(property.type === 'Property')) return [3, 15];
|
|
2929
|
-
key = void 0;
|
|
2930
|
-
if (!property.computed) return [3, 10];
|
|
2931
|
-
return [5, __values(evaluate$1(property.key, scope))];
|
|
2932
|
-
case 9:
|
|
2933
|
-
key = _e.sent();
|
|
2934
|
-
return [3, 11];
|
|
2935
|
-
case 10:
|
|
2936
|
-
key = property.key.name;
|
|
2937
|
-
_e.label = 11;
|
|
2938
|
-
case 11:
|
|
2939
|
-
fedKeys.push(key);
|
|
2940
|
-
value = property.value;
|
|
2941
|
-
if (!(value.type === 'Identifier')) return [3, 12];
|
|
2942
|
-
scope[kind](value.name, feed[key]);
|
|
2943
|
-
return [3, 14];
|
|
2944
|
-
case 12: return [5, __values(pattern$2(value, scope, { kind: kind, feed: feed[key] }))];
|
|
2945
|
-
case 13:
|
|
2946
|
-
_e.sent();
|
|
2947
|
-
_e.label = 14;
|
|
2948
|
-
case 14: return [3, 17];
|
|
2949
|
-
case 15:
|
|
2950
|
-
rest = assign({}, feed);
|
|
2951
|
-
for (i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
2952
|
-
delete rest[fedKeys[i_1]];
|
|
2953
|
-
return [5, __values(RestElement$1(property, scope, { kind: kind, feed: rest }))];
|
|
2954
|
-
case 16:
|
|
2955
|
-
_e.sent();
|
|
2956
|
-
_e.label = 17;
|
|
2957
|
-
case 17:
|
|
2958
|
-
i++;
|
|
2959
|
-
return [3, 1];
|
|
2960
|
-
case 18: return [2];
|
|
2961
|
-
}
|
|
2962
|
-
});
|
|
2963
|
-
}
|
|
2964
|
-
function ArrayPattern$1(node, scope, options) {
|
|
2965
|
-
var kind, _a, hoist, _b, onlyBlock, _c, feed, result, i, element, variable;
|
|
2966
|
-
if (options === void 0) { options = {}; }
|
|
2967
|
-
return __generator(this, function (_d) {
|
|
2968
|
-
switch (_d.label) {
|
|
2969
|
-
case 0:
|
|
2970
|
-
kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
2971
|
-
result = [];
|
|
2972
|
-
i = 0;
|
|
2973
|
-
_d.label = 1;
|
|
2974
|
-
case 1:
|
|
2975
|
-
if (!(i < node.elements.length)) return [3, 14];
|
|
2976
|
-
element = node.elements[i];
|
|
2977
|
-
if (!element)
|
|
2978
|
-
return [3, 13];
|
|
2979
|
-
if (!hoist) return [3, 5];
|
|
2980
|
-
if (!(onlyBlock || kind === 'var')) return [3, 4];
|
|
2981
|
-
if (!(element.type === 'Identifier')) return [3, 2];
|
|
2982
|
-
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2983
|
-
return [3, 4];
|
|
2984
|
-
case 2: return [5, __values(pattern$2(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2985
|
-
case 3:
|
|
2986
|
-
_d.sent();
|
|
2987
|
-
_d.label = 4;
|
|
2988
|
-
case 4: return [3, 13];
|
|
2989
|
-
case 5:
|
|
2990
|
-
if (!(element.type === 'Identifier')) return [3, 9];
|
|
2991
|
-
if (!kind) return [3, 6];
|
|
2992
|
-
scope[kind](element.name, feed[i]);
|
|
2993
|
-
return [3, 8];
|
|
2994
|
-
case 6: return [5, __values(Identifier$1(element, scope, { getVar: true }))];
|
|
2995
|
-
case 7:
|
|
2996
|
-
variable = _d.sent();
|
|
2997
|
-
variable.set(feed[i]);
|
|
2998
|
-
result.push(variable.get());
|
|
2999
|
-
_d.label = 8;
|
|
3000
|
-
case 8: return [3, 13];
|
|
3001
|
-
case 9:
|
|
3002
|
-
if (!(element.type === 'RestElement')) return [3, 11];
|
|
3003
|
-
return [5, __values(RestElement$1(element, scope, { kind: kind, feed: feed.slice(i) }))];
|
|
3004
|
-
case 10:
|
|
3005
|
-
_d.sent();
|
|
3006
|
-
return [3, 13];
|
|
3007
|
-
case 11: return [5, __values(pattern$2(element, scope, { kind: kind, feed: feed[i] }))];
|
|
3008
|
-
case 12:
|
|
3009
|
-
_d.sent();
|
|
3010
|
-
_d.label = 13;
|
|
3011
|
-
case 13:
|
|
3012
|
-
i++;
|
|
3013
|
-
return [3, 1];
|
|
3014
|
-
case 14:
|
|
3015
|
-
if (result.length) {
|
|
3016
|
-
return [2, result];
|
|
3017
|
-
}
|
|
3018
|
-
return [2];
|
|
3019
|
-
}
|
|
3020
|
-
});
|
|
3021
|
-
}
|
|
3022
|
-
function RestElement$1(node, scope, options) {
|
|
3023
|
-
var kind, _a, hoist, _b, onlyBlock, _c, feed, arg, variable;
|
|
3024
|
-
if (options === void 0) { options = {}; }
|
|
3025
|
-
return __generator(this, function (_d) {
|
|
3026
|
-
switch (_d.label) {
|
|
3027
|
-
case 0:
|
|
3028
|
-
kind = options.kind, _a = options.hoist, hoist = _a === void 0 ? false : _a, _b = options.onlyBlock, onlyBlock = _b === void 0 ? false : _b, _c = options.feed, feed = _c === void 0 ? [] : _c;
|
|
3029
|
-
arg = node.argument;
|
|
3030
|
-
if (!hoist) return [3, 4];
|
|
3031
|
-
if (!(onlyBlock || kind === 'var')) return [3, 3];
|
|
3032
|
-
if (!(arg.type === 'Identifier')) return [3, 1];
|
|
3033
|
-
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3034
|
-
return [3, 3];
|
|
3035
|
-
case 1: return [5, __values(pattern$2(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3036
|
-
case 2:
|
|
3037
|
-
_d.sent();
|
|
3038
|
-
_d.label = 3;
|
|
3039
|
-
case 3: return [3, 10];
|
|
3040
|
-
case 4:
|
|
3041
|
-
if (!(arg.type === 'Identifier')) return [3, 8];
|
|
3042
|
-
if (!kind) return [3, 5];
|
|
3043
|
-
scope[kind](arg.name, feed);
|
|
3044
|
-
return [3, 7];
|
|
3045
|
-
case 5: return [5, __values(Identifier$1(arg, scope, { getVar: true }))];
|
|
3046
|
-
case 6:
|
|
3047
|
-
variable = _d.sent();
|
|
3048
|
-
variable.set(feed);
|
|
3049
|
-
_d.label = 7;
|
|
3050
|
-
case 7: return [3, 10];
|
|
3051
|
-
case 8: return [5, __values(pattern$2(arg, scope, { kind: kind, feed: feed }))];
|
|
3052
|
-
case 9:
|
|
3053
|
-
_d.sent();
|
|
3054
|
-
_d.label = 10;
|
|
3055
|
-
case 10: return [2];
|
|
3056
|
-
}
|
|
3057
|
-
});
|
|
3058
|
-
}
|
|
3059
|
-
function AssignmentPattern$1(node, scope, options) {
|
|
3060
|
-
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, _e, left;
|
|
3061
|
-
if (options === void 0) { options = {}; }
|
|
3062
|
-
return __generator(this, function (_f) {
|
|
3063
|
-
switch (_f.label) {
|
|
3064
|
-
case 0:
|
|
3065
|
-
_a = options.kind, kind = _a === void 0 ? 'var' : _a, _b = options.hoist, hoist = _b === void 0 ? false : _b, _c = options.onlyBlock, onlyBlock = _c === void 0 ? false : _c, _d = options.feed;
|
|
3066
|
-
if (!(_d === void 0)) return [3, 2];
|
|
3067
|
-
return [5, __values(evaluate$1(node.right, scope))];
|
|
3068
|
-
case 1:
|
|
3069
|
-
_e = _f.sent();
|
|
3070
|
-
return [3, 3];
|
|
3071
|
-
case 2:
|
|
3072
|
-
_e = _d;
|
|
3073
|
-
_f.label = 3;
|
|
3074
|
-
case 3:
|
|
3075
|
-
feed = _e;
|
|
3076
|
-
left = node.left;
|
|
3077
|
-
if (!hoist) return [3, 7];
|
|
3078
|
-
if (!(onlyBlock || kind === 'var')) return [3, 6];
|
|
3079
|
-
if (!(left.type === 'Identifier')) return [3, 4];
|
|
3080
|
-
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3081
|
-
return [3, 6];
|
|
3082
|
-
case 4: return [5, __values(pattern$2(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3490
|
+
ret = _b.sent();
|
|
3491
|
+
_b.label = 3;
|
|
3492
|
+
case 3:
|
|
3493
|
+
if (!!ret.done) return [3, 7];
|
|
3494
|
+
return [5, __values(ForXHandler(node, scope, { value: ret.value }))];
|
|
3495
|
+
case 4:
|
|
3496
|
+
result = _b.sent();
|
|
3497
|
+
if (result === BREAK) {
|
|
3498
|
+
return [3, 7];
|
|
3499
|
+
}
|
|
3500
|
+
else if (result === CONTINUE) {
|
|
3501
|
+
return [3, 5];
|
|
3502
|
+
}
|
|
3503
|
+
else if (result === RETURN) {
|
|
3504
|
+
return [2, result];
|
|
3505
|
+
}
|
|
3506
|
+
_b.label = 5;
|
|
3083
3507
|
case 5:
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
case 6:
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3508
|
+
AWAIT.RES = iterator.next();
|
|
3509
|
+
return [4, AWAIT];
|
|
3510
|
+
case 6:
|
|
3511
|
+
ret = _b.sent();
|
|
3512
|
+
return [3, 3];
|
|
3513
|
+
case 7: return [3, 15];
|
|
3514
|
+
case 8:
|
|
3515
|
+
_b.trys.push([8, 13, 14, 15]);
|
|
3516
|
+
right_1 = __values(right), right_1_1 = right_1.next();
|
|
3517
|
+
_b.label = 9;
|
|
3092
3518
|
case 9:
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
var pattern$1 = /*#__PURE__*/Object.freeze({
|
|
3101
|
-
__proto__: null,
|
|
3102
|
-
ObjectPattern: ObjectPattern$1,
|
|
3103
|
-
ArrayPattern: ArrayPattern$1,
|
|
3104
|
-
RestElement: RestElement$1,
|
|
3105
|
-
AssignmentPattern: AssignmentPattern$1
|
|
3106
|
-
});
|
|
3107
|
-
|
|
3108
|
-
var evaluateOps$1;
|
|
3109
|
-
function evaluate$1(node, scope) {
|
|
3110
|
-
var handler;
|
|
3111
|
-
return __generator(this, function (_a) {
|
|
3112
|
-
switch (_a.label) {
|
|
3113
|
-
case 0:
|
|
3114
|
-
if (!node)
|
|
3115
|
-
return [2];
|
|
3116
|
-
if (!evaluateOps$1) {
|
|
3117
|
-
evaluateOps$1 = assign({}, declaration$1, expression$1, identifier$1, statement$1, literal$1, pattern$1);
|
|
3519
|
+
if (!!right_1_1.done) return [3, 12];
|
|
3520
|
+
value = right_1_1.value;
|
|
3521
|
+
return [5, __values(ForXHandler(node, scope, { value: value }))];
|
|
3522
|
+
case 10:
|
|
3523
|
+
result = _b.sent();
|
|
3524
|
+
if (result === BREAK) {
|
|
3525
|
+
return [3, 12];
|
|
3118
3526
|
}
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3527
|
+
else if (result === CONTINUE) {
|
|
3528
|
+
return [3, 11];
|
|
3529
|
+
}
|
|
3530
|
+
else if (result === RETURN) {
|
|
3531
|
+
return [2, result];
|
|
3532
|
+
}
|
|
3533
|
+
_b.label = 11;
|
|
3534
|
+
case 11:
|
|
3535
|
+
right_1_1 = right_1.next();
|
|
3536
|
+
return [3, 9];
|
|
3537
|
+
case 12: return [3, 15];
|
|
3538
|
+
case 13:
|
|
3539
|
+
e_1_1 = _b.sent();
|
|
3540
|
+
e_1 = { error: e_1_1 };
|
|
3541
|
+
return [3, 15];
|
|
3542
|
+
case 14:
|
|
3543
|
+
try {
|
|
3544
|
+
if (right_1_1 && !right_1_1.done && (_a = right_1.return)) _a.call(right_1);
|
|
3545
|
+
}
|
|
3546
|
+
finally { if (e_1) throw e_1.error; }
|
|
3547
|
+
return [7];
|
|
3548
|
+
case 15: return [2];
|
|
3124
3549
|
}
|
|
3125
3550
|
});
|
|
3126
3551
|
}
|
|
@@ -3221,7 +3646,7 @@
|
|
|
3221
3646
|
});
|
|
3222
3647
|
}
|
|
3223
3648
|
function ClassBody$1(node, scope, options) {
|
|
3224
|
-
var klass, superClass, i;
|
|
3649
|
+
var klass, superClass, i, def;
|
|
3225
3650
|
if (options === void 0) { options = {}; }
|
|
3226
3651
|
return __generator(this, function (_a) {
|
|
3227
3652
|
switch (_a.label) {
|
|
@@ -3230,25 +3655,40 @@
|
|
|
3230
3655
|
i = 0;
|
|
3231
3656
|
_a.label = 1;
|
|
3232
3657
|
case 1:
|
|
3233
|
-
if (!(i < node.body.length)) return [3,
|
|
3234
|
-
|
|
3658
|
+
if (!(i < node.body.length)) return [3, 8];
|
|
3659
|
+
def = node.body[i];
|
|
3660
|
+
if (!(def.type === 'MethodDefinition')) return [3, 3];
|
|
3661
|
+
return [5, __values(MethodDefinition$1(def, scope, { klass: klass, superClass: superClass }))];
|
|
3235
3662
|
case 2:
|
|
3236
3663
|
_a.sent();
|
|
3237
|
-
|
|
3664
|
+
return [3, 7];
|
|
3238
3665
|
case 3:
|
|
3666
|
+
if (!(def.type === 'PropertyDefinition' && def.static)) return [3, 5];
|
|
3667
|
+
return [5, __values(PropertyDefinition$1(def, scope, { klass: klass, superClass: superClass }))];
|
|
3668
|
+
case 4:
|
|
3669
|
+
_a.sent();
|
|
3670
|
+
return [3, 7];
|
|
3671
|
+
case 5:
|
|
3672
|
+
if (!(def.type === 'StaticBlock')) return [3, 7];
|
|
3673
|
+
return [5, __values(StaticBlock$1(def, scope, { klass: klass, superClass: superClass }))];
|
|
3674
|
+
case 6:
|
|
3675
|
+
_a.sent();
|
|
3676
|
+
_a.label = 7;
|
|
3677
|
+
case 7:
|
|
3239
3678
|
i++;
|
|
3240
3679
|
return [3, 1];
|
|
3241
|
-
case
|
|
3680
|
+
case 8: return [2];
|
|
3242
3681
|
}
|
|
3243
3682
|
});
|
|
3244
3683
|
}
|
|
3245
3684
|
function MethodDefinition$1(node, scope, options) {
|
|
3246
|
-
var klass, superClass, key, obj, value, oriDptor, oriDptor;
|
|
3685
|
+
var klass, superClass, key, priv, obj, value, oriDptor, oriDptor;
|
|
3247
3686
|
if (options === void 0) { options = {}; }
|
|
3248
3687
|
return __generator(this, function (_a) {
|
|
3249
3688
|
switch (_a.label) {
|
|
3250
3689
|
case 0:
|
|
3251
3690
|
klass = options.klass, superClass = options.superClass;
|
|
3691
|
+
priv = false;
|
|
3252
3692
|
if (!node.computed) return [3, 2];
|
|
3253
3693
|
return [5, __values(evaluate$1(node.key, scope))];
|
|
3254
3694
|
case 1:
|
|
@@ -3258,12 +3698,22 @@
|
|
|
3258
3698
|
if (node.key.type === 'Identifier') {
|
|
3259
3699
|
key = node.key.name;
|
|
3260
3700
|
}
|
|
3701
|
+
else if (node.key.type === 'PrivateIdentifier') {
|
|
3702
|
+
key = node.key.name;
|
|
3703
|
+
priv = true;
|
|
3704
|
+
}
|
|
3261
3705
|
else {
|
|
3262
3706
|
throw new SyntaxError('Unexpected token');
|
|
3263
3707
|
}
|
|
3264
3708
|
_a.label = 3;
|
|
3265
3709
|
case 3:
|
|
3266
3710
|
obj = node.static ? klass : klass.prototype;
|
|
3711
|
+
if (priv) {
|
|
3712
|
+
if (!obj[PRIVATE]) {
|
|
3713
|
+
define(obj, PRIVATE, { value: {} });
|
|
3714
|
+
}
|
|
3715
|
+
obj = obj[PRIVATE];
|
|
3716
|
+
}
|
|
3267
3717
|
value = createFunc(node.value, scope, { superClass: superClass });
|
|
3268
3718
|
switch (node.kind) {
|
|
3269
3719
|
case 'constructor':
|
|
@@ -3299,6 +3749,247 @@
|
|
|
3299
3749
|
return [2];
|
|
3300
3750
|
}
|
|
3301
3751
|
});
|
|
3752
|
+
}
|
|
3753
|
+
function PropertyDefinition$1(node, scope, options) {
|
|
3754
|
+
var klass, superClass, key, priv, subScope, obj, _a, _b;
|
|
3755
|
+
if (options === void 0) { options = {}; }
|
|
3756
|
+
return __generator(this, function (_c) {
|
|
3757
|
+
switch (_c.label) {
|
|
3758
|
+
case 0:
|
|
3759
|
+
klass = options.klass, superClass = options.superClass;
|
|
3760
|
+
priv = false;
|
|
3761
|
+
if (!node.computed) return [3, 2];
|
|
3762
|
+
return [5, __values(evaluate$1(node.key, scope))];
|
|
3763
|
+
case 1:
|
|
3764
|
+
key = _c.sent();
|
|
3765
|
+
return [3, 3];
|
|
3766
|
+
case 2:
|
|
3767
|
+
if (node.key.type === 'Identifier') {
|
|
3768
|
+
key = node.key.name;
|
|
3769
|
+
}
|
|
3770
|
+
else if (node.key.type === 'PrivateIdentifier') {
|
|
3771
|
+
key = node.key.name;
|
|
3772
|
+
priv = true;
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
throw new SyntaxError('Unexpected token');
|
|
3776
|
+
}
|
|
3777
|
+
_c.label = 3;
|
|
3778
|
+
case 3:
|
|
3779
|
+
subScope = new Scope(scope, true);
|
|
3780
|
+
subScope.const('this', klass);
|
|
3781
|
+
obj = klass;
|
|
3782
|
+
if (priv) {
|
|
3783
|
+
if (!obj[PRIVATE]) {
|
|
3784
|
+
define(obj, PRIVATE, { value: {} });
|
|
3785
|
+
}
|
|
3786
|
+
obj = obj[PRIVATE];
|
|
3787
|
+
}
|
|
3788
|
+
if (!(node.value.type === 'FunctionExpression' || node.value.type === 'ArrowFunctionExpression')) return [3, 4];
|
|
3789
|
+
obj[key] = createFunc(node.value, subScope, { superClass: superClass });
|
|
3790
|
+
return [3, 6];
|
|
3791
|
+
case 4:
|
|
3792
|
+
_a = obj;
|
|
3793
|
+
_b = key;
|
|
3794
|
+
return [5, __values(evaluate$1(node.value, subScope))];
|
|
3795
|
+
case 5:
|
|
3796
|
+
_a[_b] = _c.sent();
|
|
3797
|
+
_c.label = 6;
|
|
3798
|
+
case 6: return [2];
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3802
|
+
function StaticBlock$1(node, scope, options) {
|
|
3803
|
+
var klass, subScope;
|
|
3804
|
+
if (options === void 0) { options = {}; }
|
|
3805
|
+
return __generator(this, function (_a) {
|
|
3806
|
+
switch (_a.label) {
|
|
3807
|
+
case 0:
|
|
3808
|
+
klass = options.klass;
|
|
3809
|
+
subScope = new Scope(scope, true);
|
|
3810
|
+
subScope.const('this', klass);
|
|
3811
|
+
return [5, __values(BlockStatement$1(node, subScope, { invasived: true }))];
|
|
3812
|
+
case 1: return [2, _a.sent()];
|
|
3813
|
+
}
|
|
3814
|
+
});
|
|
3815
|
+
}
|
|
3816
|
+
function ImportDeclaration$1(node, scope) {
|
|
3817
|
+
var globalScope, module, value, result, i, spec, name_2;
|
|
3818
|
+
return __generator(this, function (_a) {
|
|
3819
|
+
globalScope = scope.global();
|
|
3820
|
+
module = globalScope.find(IMPORT + node.source.value);
|
|
3821
|
+
if (module) {
|
|
3822
|
+
result = module.get();
|
|
3823
|
+
if (result) {
|
|
3824
|
+
if (typeof result === 'function') {
|
|
3825
|
+
value = result();
|
|
3826
|
+
}
|
|
3827
|
+
else if (typeof result === 'object') {
|
|
3828
|
+
value = result;
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
if (!value || typeof value !== 'object') {
|
|
3833
|
+
throw new TypeError("Failed to resolve module specifier \"" + node.source.value + "\"");
|
|
3834
|
+
}
|
|
3835
|
+
for (i = 0; i < node.specifiers.length; i++) {
|
|
3836
|
+
spec = node.specifiers[i];
|
|
3837
|
+
name_2 = void 0;
|
|
3838
|
+
if (spec.type === 'ImportSpecifier') {
|
|
3839
|
+
name_2 = spec.imported.type === 'Identifier'
|
|
3840
|
+
? spec.imported.name : spec.imported.value;
|
|
3841
|
+
}
|
|
3842
|
+
else if (spec.type === 'ImportDefaultSpecifier') {
|
|
3843
|
+
name_2 = 'default';
|
|
3844
|
+
}
|
|
3845
|
+
else if (spec.type === 'ImportNamespaceSpecifier') {
|
|
3846
|
+
name_2 = '*';
|
|
3847
|
+
}
|
|
3848
|
+
if (name_2 !== '*' && !hasOwn(value, name_2)) {
|
|
3849
|
+
throw new SyntaxError("The requested module \"" + node.source.value + "\" does not provide an export named \"" + name_2 + "\"");
|
|
3850
|
+
}
|
|
3851
|
+
scope.var(spec.local.name, name_2 === '*' ? assign({}, value) : value[name_2]);
|
|
3852
|
+
}
|
|
3853
|
+
return [2];
|
|
3854
|
+
});
|
|
3855
|
+
}
|
|
3856
|
+
function ExportDefaultDeclaration$1(node, scope) {
|
|
3857
|
+
var globalScope, value, variable, exports_1;
|
|
3858
|
+
return __generator(this, function (_a) {
|
|
3859
|
+
switch (_a.label) {
|
|
3860
|
+
case 0:
|
|
3861
|
+
globalScope = scope.global();
|
|
3862
|
+
if (!(node.declaration.type === 'FunctionDeclaration')) return [3, 1];
|
|
3863
|
+
value = createFunc(node.declaration, scope);
|
|
3864
|
+
scope.func(node.declaration.id.name, value);
|
|
3865
|
+
return [3, 5];
|
|
3866
|
+
case 1:
|
|
3867
|
+
if (!(node.declaration.type === 'ClassDeclaration')) return [3, 3];
|
|
3868
|
+
return [5, __values(createClass(node.declaration, scope))];
|
|
3869
|
+
case 2:
|
|
3870
|
+
value = _a.sent();
|
|
3871
|
+
scope.func(node.declaration.id.name, value);
|
|
3872
|
+
return [3, 5];
|
|
3873
|
+
case 3: return [5, __values(evaluate$1(node.declaration, scope))];
|
|
3874
|
+
case 4:
|
|
3875
|
+
value = _a.sent();
|
|
3876
|
+
_a.label = 5;
|
|
3877
|
+
case 5:
|
|
3878
|
+
variable = globalScope.find(EXPORTS);
|
|
3879
|
+
if (variable) {
|
|
3880
|
+
exports_1 = variable.get();
|
|
3881
|
+
if (exports_1 && typeof exports_1 === 'object') {
|
|
3882
|
+
exports_1.default = value;
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
return [2];
|
|
3886
|
+
}
|
|
3887
|
+
});
|
|
3888
|
+
}
|
|
3889
|
+
function ExportNamedDeclaration$1(node, scope) {
|
|
3890
|
+
var globalScope, value, variable, exports_2, value, variable, exports_3, variable, exports_4, i, name_3, item, variable, exports_5, i, spec, name_4, item;
|
|
3891
|
+
return __generator(this, function (_a) {
|
|
3892
|
+
switch (_a.label) {
|
|
3893
|
+
case 0:
|
|
3894
|
+
globalScope = scope.global();
|
|
3895
|
+
if (!node.declaration) return [3, 6];
|
|
3896
|
+
if (!(node.declaration.type === 'FunctionDeclaration')) return [3, 1];
|
|
3897
|
+
value = createFunc(node.declaration, scope);
|
|
3898
|
+
scope.func(node.declaration.id.name, value);
|
|
3899
|
+
variable = globalScope.find(EXPORTS);
|
|
3900
|
+
if (variable) {
|
|
3901
|
+
exports_2 = variable.get();
|
|
3902
|
+
if (exports_2 && typeof exports_2 === 'object') {
|
|
3903
|
+
exports_2[node.declaration.id.name] = value;
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
return [3, 5];
|
|
3907
|
+
case 1:
|
|
3908
|
+
if (!(node.declaration.type === 'ClassDeclaration')) return [3, 3];
|
|
3909
|
+
return [5, __values(createClass(node.declaration, scope))];
|
|
3910
|
+
case 2:
|
|
3911
|
+
value = _a.sent();
|
|
3912
|
+
scope.func(node.declaration.id.name, value);
|
|
3913
|
+
variable = globalScope.find(EXPORTS);
|
|
3914
|
+
if (variable) {
|
|
3915
|
+
exports_3 = variable.get();
|
|
3916
|
+
if (exports_3 && typeof exports_3 === 'object') {
|
|
3917
|
+
exports_3[node.declaration.id.name] = value;
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
return [3, 5];
|
|
3921
|
+
case 3:
|
|
3922
|
+
if (!(node.declaration.type === 'VariableDeclaration')) return [3, 5];
|
|
3923
|
+
return [5, __values(VariableDeclaration$1(node.declaration, scope))];
|
|
3924
|
+
case 4:
|
|
3925
|
+
_a.sent();
|
|
3926
|
+
variable = globalScope.find(EXPORTS);
|
|
3927
|
+
if (variable) {
|
|
3928
|
+
exports_4 = variable.get();
|
|
3929
|
+
if (exports_4 && typeof exports_4 === 'object') {
|
|
3930
|
+
for (i = 0; i < node.declaration.declarations.length; i++) {
|
|
3931
|
+
name_3 = node.declaration.declarations[i].id.name;
|
|
3932
|
+
item = scope.find(name_3);
|
|
3933
|
+
if (item) {
|
|
3934
|
+
exports_4[name_3] = item.get();
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
_a.label = 5;
|
|
3940
|
+
case 5: return [3, 7];
|
|
3941
|
+
case 6:
|
|
3942
|
+
if (node.specifiers) {
|
|
3943
|
+
variable = globalScope.find(EXPORTS);
|
|
3944
|
+
if (variable) {
|
|
3945
|
+
exports_5 = variable.get();
|
|
3946
|
+
if (exports_5 && typeof exports_5 === 'object') {
|
|
3947
|
+
for (i = 0; i < node.specifiers.length; i++) {
|
|
3948
|
+
spec = node.specifiers[i];
|
|
3949
|
+
name_4 = spec.local.type === 'Identifier'
|
|
3950
|
+
? spec.local.name : spec.local.value;
|
|
3951
|
+
item = scope.find(name_4);
|
|
3952
|
+
if (item) {
|
|
3953
|
+
exports_5[spec.exported.type === 'Identifier'
|
|
3954
|
+
? spec.exported.name : spec.exported.value] = item.get();
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
_a.label = 7;
|
|
3961
|
+
case 7: return [2];
|
|
3962
|
+
}
|
|
3963
|
+
});
|
|
3964
|
+
}
|
|
3965
|
+
function ExportAllDeclaration$1(node, scope) {
|
|
3966
|
+
var globalScope, module, value, result, variable, exports_6;
|
|
3967
|
+
return __generator(this, function (_a) {
|
|
3968
|
+
globalScope = scope.global();
|
|
3969
|
+
module = globalScope.find(IMPORT + node.source.value);
|
|
3970
|
+
if (module) {
|
|
3971
|
+
result = module.get();
|
|
3972
|
+
if (result) {
|
|
3973
|
+
if (typeof result === 'function') {
|
|
3974
|
+
value = result();
|
|
3975
|
+
}
|
|
3976
|
+
else if (typeof result === 'object') {
|
|
3977
|
+
value = result;
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
if (!value || typeof value !== 'object') {
|
|
3982
|
+
throw new TypeError("Failed to resolve module specifier \"" + node.source.value + "\"");
|
|
3983
|
+
}
|
|
3984
|
+
variable = globalScope.find(EXPORTS);
|
|
3985
|
+
if (variable) {
|
|
3986
|
+
exports_6 = variable.get();
|
|
3987
|
+
if (exports_6 && typeof exports_6 === 'object') {
|
|
3988
|
+
assign(exports_6, value);
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
return [2];
|
|
3992
|
+
});
|
|
3302
3993
|
}
|
|
3303
3994
|
|
|
3304
3995
|
function runAsync(iterator, options) {
|
|
@@ -3551,7 +4242,7 @@
|
|
|
3551
4242
|
if (!node.generator && !node.async) {
|
|
3552
4243
|
return createFunc$1(node, scope, options);
|
|
3553
4244
|
}
|
|
3554
|
-
var superClass = options.superClass,
|
|
4245
|
+
var superClass = options.superClass, construct = options.construct;
|
|
3555
4246
|
var params = node.params;
|
|
3556
4247
|
var tmpFunc = function _a() {
|
|
3557
4248
|
var _i, subScope, i, param, result;
|
|
@@ -3564,58 +4255,65 @@
|
|
|
3564
4255
|
switch (_a.label) {
|
|
3565
4256
|
case 0:
|
|
3566
4257
|
subScope = new Scope(scope, true);
|
|
3567
|
-
if (node.type !== 'ArrowFunctionExpression')
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
4258
|
+
if (!(node.type !== 'ArrowFunctionExpression')) return [3, 3];
|
|
4259
|
+
subScope.const('this', this);
|
|
4260
|
+
subScope.let('arguments', arguments);
|
|
4261
|
+
subScope.const(NEWTARGET, _newTarget);
|
|
4262
|
+
if (!construct) return [3, 2];
|
|
4263
|
+
return [5, __values(construct(this))];
|
|
4264
|
+
case 1:
|
|
4265
|
+
_a.sent();
|
|
4266
|
+
_a.label = 2;
|
|
4267
|
+
case 2:
|
|
4268
|
+
if (superClass) {
|
|
4269
|
+
subScope.const(SUPER, superClass);
|
|
4270
|
+
if (construct)
|
|
4271
|
+
subScope.let(SUPERCALL, false);
|
|
3576
4272
|
}
|
|
4273
|
+
_a.label = 3;
|
|
4274
|
+
case 3:
|
|
3577
4275
|
i = 0;
|
|
3578
|
-
_a.label =
|
|
3579
|
-
case
|
|
3580
|
-
if (!(i < params.length)) return [3,
|
|
4276
|
+
_a.label = 4;
|
|
4277
|
+
case 4:
|
|
4278
|
+
if (!(i < params.length)) return [3, 10];
|
|
3581
4279
|
param = params[i];
|
|
3582
|
-
if (!(param.type === 'Identifier')) return [3,
|
|
4280
|
+
if (!(param.type === 'Identifier')) return [3, 5];
|
|
3583
4281
|
subScope.var(param.name, args[i]);
|
|
3584
|
-
return [3,
|
|
3585
|
-
case
|
|
3586
|
-
if (!(param.type === 'RestElement')) return [3,
|
|
4282
|
+
return [3, 9];
|
|
4283
|
+
case 5:
|
|
4284
|
+
if (!(param.type === 'RestElement')) return [3, 7];
|
|
3587
4285
|
return [5, __values(RestElement$1(param, subScope, { kind: 'var', feed: args.slice(i) }))];
|
|
3588
|
-
case
|
|
4286
|
+
case 6:
|
|
3589
4287
|
_a.sent();
|
|
3590
|
-
return [3,
|
|
3591
|
-
case
|
|
3592
|
-
case
|
|
4288
|
+
return [3, 9];
|
|
4289
|
+
case 7: return [5, __values(pattern$2(param, subScope, { kind: 'var', feed: args[i] }))];
|
|
4290
|
+
case 8:
|
|
3593
4291
|
_a.sent();
|
|
3594
|
-
_a.label =
|
|
3595
|
-
case
|
|
4292
|
+
_a.label = 9;
|
|
4293
|
+
case 9:
|
|
3596
4294
|
i++;
|
|
3597
|
-
return [3,
|
|
3598
|
-
case
|
|
3599
|
-
if (!(node.body.type === 'BlockStatement')) return [3,
|
|
4295
|
+
return [3, 4];
|
|
4296
|
+
case 10:
|
|
4297
|
+
if (!(node.body.type === 'BlockStatement')) return [3, 13];
|
|
3600
4298
|
return [5, __values(hoist(node.body, subScope))];
|
|
3601
|
-
case
|
|
4299
|
+
case 11:
|
|
3602
4300
|
_a.sent();
|
|
3603
4301
|
return [5, __values(BlockStatement$1(node.body, subScope, {
|
|
3604
4302
|
invasived: true,
|
|
3605
4303
|
hoisted: true
|
|
3606
4304
|
}))];
|
|
3607
|
-
case
|
|
4305
|
+
case 12:
|
|
3608
4306
|
result = _a.sent();
|
|
3609
|
-
return [3,
|
|
3610
|
-
case
|
|
3611
|
-
case
|
|
4307
|
+
return [3, 15];
|
|
4308
|
+
case 13: return [5, __values(evaluate$1(node.body, subScope))];
|
|
4309
|
+
case 14:
|
|
3612
4310
|
result = _a.sent();
|
|
3613
4311
|
if (node.type === 'ArrowFunctionExpression') {
|
|
3614
4312
|
RETURN.RES = result;
|
|
3615
4313
|
result = RETURN;
|
|
3616
4314
|
}
|
|
3617
|
-
_a.label =
|
|
3618
|
-
case
|
|
4315
|
+
_a.label = 15;
|
|
4316
|
+
case 15:
|
|
3619
4317
|
if (result === RETURN) {
|
|
3620
4318
|
return [2, result.RES];
|
|
3621
4319
|
}
|
|
@@ -3670,22 +4368,52 @@
|
|
|
3670
4368
|
return func;
|
|
3671
4369
|
}
|
|
3672
4370
|
function createClass(node, scope) {
|
|
3673
|
-
var superClass,
|
|
4371
|
+
var superClass, methodBody, construct, klass, i, method;
|
|
3674
4372
|
return __generator(this, function (_a) {
|
|
3675
4373
|
switch (_a.label) {
|
|
3676
4374
|
case 0: return [5, __values(evaluate$1(node.superClass, scope))];
|
|
3677
4375
|
case 1:
|
|
3678
4376
|
superClass = _a.sent();
|
|
4377
|
+
methodBody = node.body.body;
|
|
4378
|
+
construct = function (object) {
|
|
4379
|
+
var i, def;
|
|
4380
|
+
return __generator(this, function (_a) {
|
|
4381
|
+
switch (_a.label) {
|
|
4382
|
+
case 0:
|
|
4383
|
+
i = 0;
|
|
4384
|
+
_a.label = 1;
|
|
4385
|
+
case 1:
|
|
4386
|
+
if (!(i < methodBody.length)) return [3, 4];
|
|
4387
|
+
def = methodBody[i];
|
|
4388
|
+
if (!(def.type === 'PropertyDefinition' && !def.static)) return [3, 3];
|
|
4389
|
+
return [5, __values(PropertyDefinition$1(def, scope, { klass: object, superClass: superClass }))];
|
|
4390
|
+
case 2:
|
|
4391
|
+
_a.sent();
|
|
4392
|
+
_a.label = 3;
|
|
4393
|
+
case 3:
|
|
4394
|
+
i++;
|
|
4395
|
+
return [3, 1];
|
|
4396
|
+
case 4: return [2];
|
|
4397
|
+
}
|
|
4398
|
+
});
|
|
4399
|
+
};
|
|
3679
4400
|
klass = function () {
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
4401
|
+
return __generator(this, function (_a) {
|
|
4402
|
+
switch (_a.label) {
|
|
4403
|
+
case 0: return [5, __values(construct(this))];
|
|
4404
|
+
case 1:
|
|
4405
|
+
_a.sent();
|
|
4406
|
+
if (superClass) {
|
|
4407
|
+
superClass.apply(this);
|
|
4408
|
+
}
|
|
4409
|
+
return [2];
|
|
4410
|
+
}
|
|
4411
|
+
});
|
|
3683
4412
|
};
|
|
3684
|
-
methodBody = node.body.body;
|
|
3685
4413
|
for (i = 0; i < methodBody.length; i++) {
|
|
3686
4414
|
method = methodBody[i];
|
|
3687
|
-
if (method.kind === 'constructor') {
|
|
3688
|
-
klass = createFunc(method.value, scope, { superClass: superClass,
|
|
4415
|
+
if (method.type === 'MethodDefinition' && method.kind === 'constructor') {
|
|
4416
|
+
klass = createFunc(method.value, scope, { superClass: superClass, construct: construct });
|
|
3689
4417
|
break;
|
|
3690
4418
|
}
|
|
3691
4419
|
}
|
|
@@ -3846,7 +4574,7 @@
|
|
|
3846
4574
|
if (node.generator || node.async) {
|
|
3847
4575
|
return createFunc(node, scope, options);
|
|
3848
4576
|
}
|
|
3849
|
-
var superClass = options.superClass,
|
|
4577
|
+
var superClass = options.superClass, construct = options.construct;
|
|
3850
4578
|
var params = node.params;
|
|
3851
4579
|
var tmpFunc = function _a() {
|
|
3852
4580
|
var _newTarget = this && this instanceof _a ? this.constructor : void 0;
|
|
@@ -3859,9 +4587,12 @@
|
|
|
3859
4587
|
subScope.const('this', this);
|
|
3860
4588
|
subScope.let('arguments', arguments);
|
|
3861
4589
|
subScope.const(NEWTARGET, _newTarget);
|
|
4590
|
+
if (construct) {
|
|
4591
|
+
construct(this);
|
|
4592
|
+
}
|
|
3862
4593
|
if (superClass) {
|
|
3863
4594
|
subScope.const(SUPER, superClass);
|
|
3864
|
-
if (
|
|
4595
|
+
if (construct)
|
|
3865
4596
|
subScope.let(SUPERCALL, false);
|
|
3866
4597
|
}
|
|
3867
4598
|
}
|
|
@@ -3914,16 +4645,25 @@
|
|
|
3914
4645
|
}
|
|
3915
4646
|
function createClass$1(node, scope) {
|
|
3916
4647
|
var superClass = evaluate(node.superClass, scope);
|
|
4648
|
+
var methodBody = node.body.body;
|
|
4649
|
+
var construct = function (object) {
|
|
4650
|
+
for (var i = 0; i < methodBody.length; i++) {
|
|
4651
|
+
var def = methodBody[i];
|
|
4652
|
+
if (def.type === 'PropertyDefinition' && !def.static) {
|
|
4653
|
+
PropertyDefinition(def, scope, { klass: object, superClass: superClass });
|
|
4654
|
+
}
|
|
4655
|
+
}
|
|
4656
|
+
};
|
|
3917
4657
|
var klass = function () {
|
|
4658
|
+
construct(this);
|
|
3918
4659
|
if (superClass) {
|
|
3919
4660
|
superClass.apply(this);
|
|
3920
4661
|
}
|
|
3921
4662
|
};
|
|
3922
|
-
var methodBody = node.body.body;
|
|
3923
4663
|
for (var i = 0; i < methodBody.length; i++) {
|
|
3924
4664
|
var method = methodBody[i];
|
|
3925
|
-
if (method.kind === 'constructor') {
|
|
3926
|
-
klass = createFunc$1(method.value, scope, { superClass: superClass,
|
|
4665
|
+
if (method.type === 'MethodDefinition' && method.kind === 'constructor') {
|
|
4666
|
+
klass = createFunc$1(method.value, scope, { superClass: superClass, construct: construct });
|
|
3927
4667
|
break;
|
|
3928
4668
|
}
|
|
3929
4669
|
}
|
|
@@ -3962,28 +4702,34 @@
|
|
|
3962
4702
|
return result;
|
|
3963
4703
|
}
|
|
3964
4704
|
|
|
4705
|
+
var latestVer = 15;
|
|
3965
4706
|
var Sval = (function () {
|
|
3966
4707
|
function Sval(options) {
|
|
3967
4708
|
if (options === void 0) { options = {}; }
|
|
3968
|
-
this.options = {};
|
|
4709
|
+
this.options = { ecmaVersion: 'latest' };
|
|
3969
4710
|
this.scope = new Scope(null, true);
|
|
3970
4711
|
this.exports = {};
|
|
3971
|
-
var _a = options.ecmaVer, ecmaVer = _a === void 0 ?
|
|
3972
|
-
|
|
3973
|
-
|
|
4712
|
+
var _a = options.ecmaVer, ecmaVer = _a === void 0 ? 'latest' : _a, _b = options.sandBox, sandBox = _b === void 0 ? true : _b, _c = options.sourceType, sourceType = _c === void 0 ? 'script' : _c;
|
|
4713
|
+
if (typeof ecmaVer === 'number') {
|
|
4714
|
+
ecmaVer -= ecmaVer < 2015 ? 0 : 2009;
|
|
4715
|
+
}
|
|
4716
|
+
if (ecmaVer !== 'latest' && ecmaVer !== 3 && (ecmaVer < 5 || ecmaVer > latestVer)) {
|
|
3974
4717
|
throw new Error("unsupported ecmaVer");
|
|
3975
4718
|
}
|
|
3976
4719
|
this.options.ecmaVersion = ecmaVer;
|
|
4720
|
+
this.options.sourceType = sourceType;
|
|
3977
4721
|
if (sandBox) {
|
|
3978
4722
|
var win = createSandBox();
|
|
4723
|
+
this.scope.let('globalThis', win);
|
|
3979
4724
|
this.scope.let('window', win);
|
|
3980
4725
|
this.scope.let('this', win);
|
|
3981
4726
|
}
|
|
3982
4727
|
else {
|
|
4728
|
+
this.scope.let('globalThis', globalObj);
|
|
3983
4729
|
this.scope.let('window', globalObj);
|
|
3984
4730
|
this.scope.let('this', globalObj);
|
|
3985
4731
|
}
|
|
3986
|
-
this.scope.const('exports', this.exports = {});
|
|
4732
|
+
this.scope.const(sourceType === 'module' ? EXPORTS : 'exports', this.exports = {});
|
|
3987
4733
|
}
|
|
3988
4734
|
Sval.prototype.import = function (nameOrModules, mod) {
|
|
3989
4735
|
var _a;
|
|
@@ -3995,7 +4741,8 @@
|
|
|
3995
4741
|
var names = getOwnNames(nameOrModules);
|
|
3996
4742
|
for (var i = 0; i < names.length; i++) {
|
|
3997
4743
|
var name_1 = names[i];
|
|
3998
|
-
this.
|
|
4744
|
+
var modName = this.options.sourceType === 'module' ? IMPORT + name_1 : name_1;
|
|
4745
|
+
this.scope.var(modName, nameOrModules[name_1]);
|
|
3999
4746
|
}
|
|
4000
4747
|
};
|
|
4001
4748
|
Sval.prototype.parse = function (code, parser) {
|