sval 0.5.1 → 0.5.3
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/dist/sval.es6.js +584 -564
- package/dist/sval.js +594 -571
- package/dist/sval.min.js +1 -1
- package/package.json +2 -2
package/dist/sval.js
CHANGED
|
@@ -1,45 +1,9 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('acorn')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['acorn'], factory) :
|
|
4
|
-
(global = global || self, global.Sval = factory(global.acorn));
|
|
5
|
-
}(this, (function (acorn) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Sval = factory(global.acorn));
|
|
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
|
-
});
|
|
28
|
-
var declaration = /*#__PURE__*/Object.freeze({
|
|
29
|
-
__proto__: null,
|
|
30
|
-
get FunctionDeclaration () { return FunctionDeclaration; },
|
|
31
|
-
get VariableDeclaration () { return VariableDeclaration; },
|
|
32
|
-
get VariableDeclarator () { return VariableDeclarator; },
|
|
33
|
-
get ClassDeclaration () { return ClassDeclaration; },
|
|
34
|
-
get ClassBody () { return ClassBody; },
|
|
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
7
|
var statement$1 = /*#__PURE__*/Object.freeze({
|
|
44
8
|
__proto__: null,
|
|
45
9
|
get ExpressionStatement () { return ExpressionStatement$1; },
|
|
@@ -76,6 +40,42 @@
|
|
|
76
40
|
get ExportNamedDeclaration () { return ExportNamedDeclaration$1; },
|
|
77
41
|
get ExportAllDeclaration () { return ExportAllDeclaration$1; }
|
|
78
42
|
});
|
|
43
|
+
var statement = /*#__PURE__*/Object.freeze({
|
|
44
|
+
__proto__: null,
|
|
45
|
+
get ExpressionStatement () { return ExpressionStatement; },
|
|
46
|
+
get BlockStatement () { return BlockStatement; },
|
|
47
|
+
get EmptyStatement () { return EmptyStatement; },
|
|
48
|
+
get DebuggerStatement () { return DebuggerStatement; },
|
|
49
|
+
get ReturnStatement () { return ReturnStatement; },
|
|
50
|
+
get BreakStatement () { return BreakStatement; },
|
|
51
|
+
get ContinueStatement () { return ContinueStatement; },
|
|
52
|
+
get IfStatement () { return IfStatement; },
|
|
53
|
+
get SwitchStatement () { return SwitchStatement; },
|
|
54
|
+
get SwitchCase () { return SwitchCase; },
|
|
55
|
+
get ThrowStatement () { return ThrowStatement; },
|
|
56
|
+
get TryStatement () { return TryStatement; },
|
|
57
|
+
get CatchClause () { return CatchClause; },
|
|
58
|
+
get WhileStatement () { return WhileStatement; },
|
|
59
|
+
get DoWhileStatement () { return DoWhileStatement; },
|
|
60
|
+
get ForStatement () { return ForStatement; },
|
|
61
|
+
get ForInStatement () { return ForInStatement; },
|
|
62
|
+
get ForOfStatement () { return ForOfStatement; }
|
|
63
|
+
});
|
|
64
|
+
var declaration = /*#__PURE__*/Object.freeze({
|
|
65
|
+
__proto__: null,
|
|
66
|
+
get FunctionDeclaration () { return FunctionDeclaration; },
|
|
67
|
+
get VariableDeclaration () { return VariableDeclaration; },
|
|
68
|
+
get VariableDeclarator () { return VariableDeclarator; },
|
|
69
|
+
get ClassDeclaration () { return ClassDeclaration; },
|
|
70
|
+
get ClassBody () { return ClassBody; },
|
|
71
|
+
get MethodDefinition () { return MethodDefinition; },
|
|
72
|
+
get PropertyDefinition () { return PropertyDefinition; },
|
|
73
|
+
get StaticBlock () { return StaticBlock; },
|
|
74
|
+
get ImportDeclaration () { return ImportDeclaration; },
|
|
75
|
+
get ExportDefaultDeclaration () { return ExportDefaultDeclaration; },
|
|
76
|
+
get ExportNamedDeclaration () { return ExportNamedDeclaration; },
|
|
77
|
+
get ExportAllDeclaration () { return ExportAllDeclaration; }
|
|
78
|
+
});
|
|
79
79
|
|
|
80
80
|
var freeze = Object.freeze;
|
|
81
81
|
var define = Object.defineProperty;
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
var IMPORT = createSymbol('import');
|
|
458
458
|
var EXPORTS = createSymbol('exports');
|
|
459
459
|
|
|
460
|
-
var version = "0.5.
|
|
460
|
+
var version = "0.5.3";
|
|
461
461
|
|
|
462
462
|
var Var = (function () {
|
|
463
463
|
function Var(kind, value) {
|
|
@@ -668,7 +668,7 @@
|
|
|
668
668
|
return ar;
|
|
669
669
|
}
|
|
670
670
|
|
|
671
|
-
function Identifier(node, scope, options) {
|
|
671
|
+
function Identifier$1(node, scope, options) {
|
|
672
672
|
if (options === void 0) { options = {}; }
|
|
673
673
|
var _a = options.getVar, getVar = _a === void 0 ? false : _a, _b = options.throwErr, throwErr = _b === void 0 ? true : _b;
|
|
674
674
|
if (node.name === 'undefined') {
|
|
@@ -697,21 +697,21 @@
|
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
-
var identifier = /*#__PURE__*/Object.freeze({
|
|
700
|
+
var identifier$1 = /*#__PURE__*/Object.freeze({
|
|
701
701
|
__proto__: null,
|
|
702
|
-
Identifier: Identifier
|
|
702
|
+
Identifier: Identifier$1
|
|
703
703
|
});
|
|
704
704
|
|
|
705
|
-
function Literal(node, scope) {
|
|
705
|
+
function Literal$1(node, scope) {
|
|
706
706
|
return node.value;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
var literal = /*#__PURE__*/Object.freeze({
|
|
709
|
+
var literal$1 = /*#__PURE__*/Object.freeze({
|
|
710
710
|
__proto__: null,
|
|
711
|
-
Literal: Literal
|
|
711
|
+
Literal: Literal$1
|
|
712
712
|
});
|
|
713
713
|
|
|
714
|
-
function ThisExpression(node, scope) {
|
|
714
|
+
function ThisExpression$1(node, scope) {
|
|
715
715
|
var superCall = scope.find(SUPERCALL);
|
|
716
716
|
if (superCall && !superCall.get()) {
|
|
717
717
|
throw new ReferenceError('Must call super constructor in derived class '
|
|
@@ -721,41 +721,41 @@
|
|
|
721
721
|
return scope.find('this').get();
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
function ArrayExpression(node, scope) {
|
|
724
|
+
function ArrayExpression$1(node, scope) {
|
|
725
725
|
var results = [];
|
|
726
726
|
for (var i = 0; i < node.elements.length; i++) {
|
|
727
727
|
var item = node.elements[i];
|
|
728
728
|
if (item.type === 'SpreadElement') {
|
|
729
|
-
results = results.concat(SpreadElement(item, scope));
|
|
729
|
+
results = results.concat(SpreadElement$1(item, scope));
|
|
730
730
|
}
|
|
731
731
|
else {
|
|
732
|
-
results.push(evaluate(item, scope));
|
|
732
|
+
results.push(evaluate$1(item, scope));
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
return results;
|
|
736
736
|
}
|
|
737
|
-
function ObjectExpression(node, scope) {
|
|
737
|
+
function ObjectExpression$1(node, scope) {
|
|
738
738
|
var object = {};
|
|
739
739
|
for (var i = 0; i < node.properties.length; i++) {
|
|
740
740
|
var property = node.properties[i];
|
|
741
741
|
if (property.type === 'SpreadElement') {
|
|
742
|
-
assign(object, SpreadElement(property, scope));
|
|
742
|
+
assign(object, SpreadElement$1(property, scope));
|
|
743
743
|
}
|
|
744
744
|
else {
|
|
745
745
|
var key = void 0;
|
|
746
746
|
var propKey = property.key;
|
|
747
747
|
if (property.computed) {
|
|
748
|
-
key = evaluate(propKey, scope);
|
|
748
|
+
key = evaluate$1(propKey, scope);
|
|
749
749
|
}
|
|
750
750
|
else {
|
|
751
751
|
if (propKey.type === 'Identifier') {
|
|
752
752
|
key = propKey.name;
|
|
753
753
|
}
|
|
754
754
|
else {
|
|
755
|
-
key = '' + (Literal(propKey));
|
|
755
|
+
key = '' + (Literal$1(propKey));
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
var value = evaluate(property.value, scope);
|
|
758
|
+
var value = evaluate$1(property.value, scope);
|
|
759
759
|
var propKind = property.kind;
|
|
760
760
|
if (propKind === 'init') {
|
|
761
761
|
object[key] = value;
|
|
@@ -782,55 +782,55 @@
|
|
|
782
782
|
}
|
|
783
783
|
return object;
|
|
784
784
|
}
|
|
785
|
-
function FunctionExpression(node, scope) {
|
|
785
|
+
function FunctionExpression$1(node, scope) {
|
|
786
786
|
if (node.id && node.id.name) {
|
|
787
787
|
var tmpScope = new Scope(scope);
|
|
788
|
-
var func = createFunc
|
|
788
|
+
var func = createFunc(node, tmpScope);
|
|
789
789
|
tmpScope.const(node.id.name, func);
|
|
790
790
|
return func;
|
|
791
791
|
}
|
|
792
792
|
else {
|
|
793
|
-
return createFunc
|
|
793
|
+
return createFunc(node, scope);
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
|
-
function UnaryExpression(node, scope) {
|
|
796
|
+
function UnaryExpression$1(node, scope) {
|
|
797
797
|
var arg = node.argument;
|
|
798
798
|
switch (node.operator) {
|
|
799
|
-
case '+': return +(evaluate(arg, scope));
|
|
800
|
-
case '-': return -(evaluate(arg, scope));
|
|
801
|
-
case '!': return !(evaluate(arg, scope));
|
|
802
|
-
case '~': return ~(evaluate(arg, scope));
|
|
803
|
-
case 'void': return void (evaluate(arg, scope));
|
|
799
|
+
case '+': return +(evaluate$1(arg, scope));
|
|
800
|
+
case '-': return -(evaluate$1(arg, scope));
|
|
801
|
+
case '!': return !(evaluate$1(arg, scope));
|
|
802
|
+
case '~': return ~(evaluate$1(arg, scope));
|
|
803
|
+
case 'void': return void (evaluate$1(arg, scope));
|
|
804
804
|
case 'typeof':
|
|
805
805
|
if (arg.type === 'Identifier') {
|
|
806
|
-
return typeof (Identifier(arg, scope, { throwErr: false }));
|
|
806
|
+
return typeof (Identifier$1(arg, scope, { throwErr: false }));
|
|
807
807
|
}
|
|
808
808
|
else {
|
|
809
|
-
return typeof (evaluate(arg, scope));
|
|
809
|
+
return typeof (evaluate$1(arg, scope));
|
|
810
810
|
}
|
|
811
811
|
case 'delete':
|
|
812
812
|
if (arg.type === 'MemberExpression') {
|
|
813
|
-
var variable = MemberExpression(arg, scope, { getVar: true });
|
|
813
|
+
var variable = MemberExpression$1(arg, scope, { getVar: true });
|
|
814
814
|
return variable.del();
|
|
815
815
|
}
|
|
816
816
|
else if (arg.type === 'Identifier') {
|
|
817
817
|
throw new SyntaxError('Delete of an unqualified identifier in strict mode');
|
|
818
818
|
}
|
|
819
819
|
else {
|
|
820
|
-
evaluate(arg, scope);
|
|
820
|
+
evaluate$1(arg, scope);
|
|
821
821
|
return true;
|
|
822
822
|
}
|
|
823
823
|
default: throw new SyntaxError("Unexpected token " + node.operator);
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
function UpdateExpression(node, scope) {
|
|
826
|
+
function UpdateExpression$1(node, scope) {
|
|
827
827
|
var arg = node.argument;
|
|
828
828
|
var variable;
|
|
829
829
|
if (arg.type === 'Identifier') {
|
|
830
|
-
variable = Identifier(arg, scope, { getVar: true });
|
|
830
|
+
variable = Identifier$1(arg, scope, { getVar: true });
|
|
831
831
|
}
|
|
832
832
|
else if (arg.type === 'MemberExpression') {
|
|
833
|
-
variable = MemberExpression(arg, scope, { getVar: true });
|
|
833
|
+
variable = MemberExpression$1(arg, scope, { getVar: true });
|
|
834
834
|
}
|
|
835
835
|
else {
|
|
836
836
|
throw new SyntaxError('Unexpected token');
|
|
@@ -848,17 +848,17 @@
|
|
|
848
848
|
throw new SyntaxError("Unexpected token " + node.operator);
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
function BinaryExpression(node, scope) {
|
|
851
|
+
function BinaryExpression$1(node, scope) {
|
|
852
852
|
var left;
|
|
853
853
|
var right;
|
|
854
854
|
if (node.left.type === 'PrivateIdentifier') {
|
|
855
855
|
left = node.left.name;
|
|
856
|
-
right = evaluate(node.right, scope);
|
|
856
|
+
right = evaluate$1(node.right, scope);
|
|
857
857
|
right = right[PRIVATE];
|
|
858
858
|
}
|
|
859
859
|
else {
|
|
860
|
-
left = evaluate(node.left, scope);
|
|
861
|
-
right = evaluate(node.right, scope);
|
|
860
|
+
left = evaluate$1(node.left, scope);
|
|
861
|
+
right = evaluate$1(node.right, scope);
|
|
862
862
|
}
|
|
863
863
|
switch (node.operator) {
|
|
864
864
|
case '==': return left == right;
|
|
@@ -886,25 +886,25 @@
|
|
|
886
886
|
default: throw new SyntaxError("Unexpected token " + node.operator);
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
|
-
function AssignmentExpression(node, scope) {
|
|
889
|
+
function AssignmentExpression$1(node, scope) {
|
|
890
890
|
var _a;
|
|
891
891
|
var left = node.left;
|
|
892
892
|
var variable;
|
|
893
893
|
if (left.type === 'Identifier') {
|
|
894
|
-
variable = Identifier(left, scope, { getVar: true, throwErr: false });
|
|
894
|
+
variable = Identifier$1(left, scope, { getVar: true, throwErr: false });
|
|
895
895
|
if (!variable) {
|
|
896
896
|
var win = scope.global().find('window').get();
|
|
897
897
|
variable = new Prop(win, left.name);
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
else if (left.type === 'MemberExpression') {
|
|
901
|
-
variable = MemberExpression(left, scope, { getVar: true });
|
|
901
|
+
variable = MemberExpression$1(left, scope, { getVar: true });
|
|
902
902
|
}
|
|
903
903
|
else {
|
|
904
|
-
var value_1 = evaluate(node.right, scope);
|
|
905
|
-
return pattern
|
|
904
|
+
var value_1 = evaluate$1(node.right, scope);
|
|
905
|
+
return pattern(left, scope, { feed: value_1 });
|
|
906
906
|
}
|
|
907
|
-
var value = evaluate(node.right, scope);
|
|
907
|
+
var value = evaluate$1(node.right, scope);
|
|
908
908
|
switch (node.operator) {
|
|
909
909
|
case '=':
|
|
910
910
|
variable.set(value);
|
|
@@ -957,35 +957,35 @@
|
|
|
957
957
|
default: throw new SyntaxError("Unexpected token " + node.operator);
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
|
-
function LogicalExpression(node, scope) {
|
|
960
|
+
function LogicalExpression$1(node, scope) {
|
|
961
961
|
var _a;
|
|
962
962
|
switch (node.operator) {
|
|
963
963
|
case '||':
|
|
964
|
-
return (evaluate(node.left, scope)) || (evaluate(node.right, scope));
|
|
964
|
+
return (evaluate$1(node.left, scope)) || (evaluate$1(node.right, scope));
|
|
965
965
|
case '&&':
|
|
966
|
-
return (evaluate(node.left, scope)) && (evaluate(node.right, scope));
|
|
966
|
+
return (evaluate$1(node.left, scope)) && (evaluate$1(node.right, scope));
|
|
967
967
|
case '??':
|
|
968
|
-
return (_a = (evaluate(node.left, scope))) !== null && _a !== void 0 ? _a : (evaluate(node.right, scope));
|
|
968
|
+
return (_a = (evaluate$1(node.left, scope))) !== null && _a !== void 0 ? _a : (evaluate$1(node.right, scope));
|
|
969
969
|
default:
|
|
970
970
|
throw new SyntaxError("Unexpected token " + node.operator);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
function MemberExpression(node, scope, options) {
|
|
973
|
+
function MemberExpression$1(node, scope, options) {
|
|
974
974
|
if (options === void 0) { options = {}; }
|
|
975
975
|
var _a = options.getObj, getObj = _a === void 0 ? false : _a, _b = options.getVar, getVar = _b === void 0 ? false : _b;
|
|
976
976
|
var object;
|
|
977
977
|
if (node.object.type === 'Super') {
|
|
978
|
-
object = Super(node.object, scope, { getProto: true });
|
|
978
|
+
object = Super$1(node.object, scope, { getProto: true });
|
|
979
979
|
}
|
|
980
980
|
else {
|
|
981
|
-
object = evaluate(node.object, scope);
|
|
981
|
+
object = evaluate$1(node.object, scope);
|
|
982
982
|
}
|
|
983
983
|
if (getObj)
|
|
984
984
|
return object;
|
|
985
985
|
var key;
|
|
986
986
|
var priv = false;
|
|
987
987
|
if (node.computed) {
|
|
988
|
-
key = evaluate(node.property, scope);
|
|
988
|
+
key = evaluate$1(node.property, scope);
|
|
989
989
|
}
|
|
990
990
|
else if (node.property.type === 'PrivateIdentifier') {
|
|
991
991
|
key = node.property.name;
|
|
@@ -1026,23 +1026,23 @@
|
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
|
-
function ConditionalExpression(node, scope) {
|
|
1030
|
-
return (evaluate(node.test, scope))
|
|
1031
|
-
? (evaluate(node.consequent, scope))
|
|
1032
|
-
: (evaluate(node.alternate, scope));
|
|
1029
|
+
function ConditionalExpression$1(node, scope) {
|
|
1030
|
+
return (evaluate$1(node.test, scope))
|
|
1031
|
+
? (evaluate$1(node.consequent, scope))
|
|
1032
|
+
: (evaluate$1(node.alternate, scope));
|
|
1033
1033
|
}
|
|
1034
|
-
function CallExpression(node, scope) {
|
|
1034
|
+
function CallExpression$1(node, scope) {
|
|
1035
1035
|
var func;
|
|
1036
1036
|
var object;
|
|
1037
1037
|
if (node.callee.type === 'MemberExpression') {
|
|
1038
|
-
object = MemberExpression(node.callee, scope, { getObj: true });
|
|
1038
|
+
object = MemberExpression$1(node.callee, scope, { getObj: true });
|
|
1039
1039
|
if (node.callee.optional && object == null) {
|
|
1040
1040
|
return undefined;
|
|
1041
1041
|
}
|
|
1042
1042
|
var key = void 0;
|
|
1043
1043
|
var priv = false;
|
|
1044
1044
|
if (node.callee.computed) {
|
|
1045
|
-
key = evaluate(node.callee.property, scope);
|
|
1045
|
+
key = evaluate$1(node.callee.property, scope);
|
|
1046
1046
|
}
|
|
1047
1047
|
else if (node.callee.property.type === 'PrivateIdentifier') {
|
|
1048
1048
|
key = node.callee.property.name;
|
|
@@ -1074,7 +1074,7 @@
|
|
|
1074
1074
|
}
|
|
1075
1075
|
else {
|
|
1076
1076
|
object = scope.find('this').get();
|
|
1077
|
-
func = evaluate(node.callee, scope);
|
|
1077
|
+
func = evaluate$1(node.callee, scope);
|
|
1078
1078
|
if (node.optional && func == null) {
|
|
1079
1079
|
return undefined;
|
|
1080
1080
|
}
|
|
@@ -1103,10 +1103,10 @@
|
|
|
1103
1103
|
for (var i = 0; i < node.arguments.length; i++) {
|
|
1104
1104
|
var arg = node.arguments[i];
|
|
1105
1105
|
if (arg.type === 'SpreadElement') {
|
|
1106
|
-
args = args.concat(SpreadElement(arg, scope));
|
|
1106
|
+
args = args.concat(SpreadElement$1(arg, scope));
|
|
1107
1107
|
}
|
|
1108
1108
|
else {
|
|
1109
|
-
args.push(evaluate(arg, scope));
|
|
1109
|
+
args.push(evaluate$1(arg, scope));
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
1112
|
if (node.callee.type === 'Super') {
|
|
@@ -1118,13 +1118,22 @@
|
|
|
1118
1118
|
scope.find(SUPERCALL).set(true);
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
-
|
|
1122
|
-
return func.apply(object
|
|
1121
|
+
try {
|
|
1122
|
+
return func.apply(object, args);
|
|
1123
|
+
}
|
|
1124
|
+
catch (err) {
|
|
1125
|
+
if (err instanceof TypeError && err.message === 'Illegal invocation'
|
|
1126
|
+
&& func.toString().indexOf('[native code]') !== -1) {
|
|
1127
|
+
var win = scope.global().find('window').get();
|
|
1128
|
+
if (win && win[WINDOW]) {
|
|
1129
|
+
return func.apply(win[WINDOW], args);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
throw err;
|
|
1123
1133
|
}
|
|
1124
|
-
return func.apply(object, args);
|
|
1125
1134
|
}
|
|
1126
|
-
function NewExpression(node, scope) {
|
|
1127
|
-
var constructor = evaluate(node.callee, scope);
|
|
1135
|
+
function NewExpression$1(node, scope) {
|
|
1136
|
+
var constructor = evaluate$1(node.callee, scope);
|
|
1128
1137
|
if (typeof constructor !== 'function') {
|
|
1129
1138
|
var name_2;
|
|
1130
1139
|
if (node.callee.type === 'Identifier') {
|
|
@@ -1147,15 +1156,15 @@
|
|
|
1147
1156
|
for (var i = 0; i < node.arguments.length; i++) {
|
|
1148
1157
|
var arg = node.arguments[i];
|
|
1149
1158
|
if (arg.type === 'SpreadElement') {
|
|
1150
|
-
args = args.concat(SpreadElement(arg, scope));
|
|
1159
|
+
args = args.concat(SpreadElement$1(arg, scope));
|
|
1151
1160
|
}
|
|
1152
1161
|
else {
|
|
1153
|
-
args.push(evaluate(arg, scope));
|
|
1162
|
+
args.push(evaluate$1(arg, scope));
|
|
1154
1163
|
}
|
|
1155
1164
|
}
|
|
1156
1165
|
return new (constructor.bind.apply(constructor, __spread([void 0], args)))();
|
|
1157
1166
|
}
|
|
1158
|
-
function MetaProperty(node, scope) {
|
|
1167
|
+
function MetaProperty$1(node, scope) {
|
|
1159
1168
|
if (node.meta.name === 'new' && node.property.name === 'target') {
|
|
1160
1169
|
return scope.find(NEWTARGET).get();
|
|
1161
1170
|
}
|
|
@@ -1163,33 +1172,33 @@
|
|
|
1163
1172
|
return { url: '' };
|
|
1164
1173
|
}
|
|
1165
1174
|
}
|
|
1166
|
-
function SequenceExpression(node, scope) {
|
|
1175
|
+
function SequenceExpression$1(node, scope) {
|
|
1167
1176
|
var result;
|
|
1168
1177
|
for (var i = 0; i < node.expressions.length; i++) {
|
|
1169
|
-
result = evaluate(node.expressions[i], scope);
|
|
1178
|
+
result = evaluate$1(node.expressions[i], scope);
|
|
1170
1179
|
}
|
|
1171
1180
|
return result;
|
|
1172
1181
|
}
|
|
1173
|
-
function ArrowFunctionExpression(node, scope) {
|
|
1174
|
-
return createFunc
|
|
1182
|
+
function ArrowFunctionExpression$1(node, scope) {
|
|
1183
|
+
return createFunc(node, scope);
|
|
1175
1184
|
}
|
|
1176
|
-
function TemplateLiteral(node, scope) {
|
|
1185
|
+
function TemplateLiteral$1(node, scope) {
|
|
1177
1186
|
var quasis = node.quasis.slice();
|
|
1178
1187
|
var expressions = node.expressions.slice();
|
|
1179
1188
|
var result = '';
|
|
1180
1189
|
var temEl;
|
|
1181
1190
|
var expr;
|
|
1182
1191
|
while (temEl = quasis.shift()) {
|
|
1183
|
-
result += TemplateElement(temEl);
|
|
1192
|
+
result += TemplateElement$1(temEl);
|
|
1184
1193
|
expr = expressions.shift();
|
|
1185
1194
|
if (expr) {
|
|
1186
|
-
result += evaluate(expr, scope);
|
|
1195
|
+
result += evaluate$1(expr, scope);
|
|
1187
1196
|
}
|
|
1188
1197
|
}
|
|
1189
1198
|
return result;
|
|
1190
1199
|
}
|
|
1191
|
-
function TaggedTemplateExpression(node, scope) {
|
|
1192
|
-
var tagFunc = evaluate(node.tag, scope);
|
|
1200
|
+
function TaggedTemplateExpression$1(node, scope) {
|
|
1201
|
+
var tagFunc = evaluate$1(node.tag, scope);
|
|
1193
1202
|
var quasis = node.quasi.quasis;
|
|
1194
1203
|
var str = quasis.map(function (v) { return v.value.cooked; });
|
|
1195
1204
|
var raw = quasis.map(function (v) { return v.value.raw; });
|
|
@@ -1200,40 +1209,41 @@
|
|
|
1200
1209
|
var args = [];
|
|
1201
1210
|
if (expressions) {
|
|
1202
1211
|
for (var i = 0; i < expressions.length; i++) {
|
|
1203
|
-
args.push(evaluate(expressions[i], scope));
|
|
1212
|
+
args.push(evaluate$1(expressions[i], scope));
|
|
1204
1213
|
}
|
|
1205
1214
|
}
|
|
1206
1215
|
return tagFunc.apply(void 0, __spread([freeze(str)], args));
|
|
1207
1216
|
}
|
|
1208
|
-
function TemplateElement(node, scope) {
|
|
1217
|
+
function TemplateElement$1(node, scope) {
|
|
1209
1218
|
return node.value.raw;
|
|
1210
1219
|
}
|
|
1211
|
-
function ClassExpression(node, scope) {
|
|
1220
|
+
function ClassExpression$1(node, scope) {
|
|
1212
1221
|
if (node.id && node.id.name) {
|
|
1213
1222
|
var tmpScope = new Scope(scope);
|
|
1214
|
-
var klass = createClass
|
|
1223
|
+
var klass = createClass(node, tmpScope);
|
|
1215
1224
|
tmpScope.const(node.id.name, klass);
|
|
1216
1225
|
return klass;
|
|
1217
1226
|
}
|
|
1218
1227
|
else {
|
|
1219
|
-
return createClass
|
|
1228
|
+
return createClass(node, scope);
|
|
1220
1229
|
}
|
|
1221
1230
|
}
|
|
1222
|
-
function Super(node, scope, options) {
|
|
1231
|
+
function Super$1(node, scope, options) {
|
|
1223
1232
|
if (options === void 0) { options = {}; }
|
|
1224
1233
|
var _a = options.getProto, getProto = _a === void 0 ? false : _a;
|
|
1225
1234
|
var superClass = scope.find(SUPER).get();
|
|
1226
1235
|
return getProto ? superClass.prototype : superClass;
|
|
1227
1236
|
}
|
|
1228
|
-
function SpreadElement(node, scope) {
|
|
1229
|
-
|
|
1237
|
+
function SpreadElement$1(node, scope) {
|
|
1238
|
+
var result = evaluate$1(node.argument, scope);
|
|
1239
|
+
return typeof result === 'string' ? __spread(result) : result;
|
|
1230
1240
|
}
|
|
1231
|
-
function ChainExpression(node, scope) {
|
|
1232
|
-
return evaluate(node.expression, scope);
|
|
1241
|
+
function ChainExpression$1(node, scope) {
|
|
1242
|
+
return evaluate$1(node.expression, scope);
|
|
1233
1243
|
}
|
|
1234
|
-
function ImportExpression(node, scope) {
|
|
1244
|
+
function ImportExpression$1(node, scope) {
|
|
1235
1245
|
var globalScope = scope.global();
|
|
1236
|
-
var source = evaluate(node.source, scope);
|
|
1246
|
+
var source = evaluate$1(node.source, scope);
|
|
1237
1247
|
var module = globalScope.find(IMPORT + source);
|
|
1238
1248
|
var value;
|
|
1239
1249
|
if (module) {
|
|
@@ -1253,35 +1263,35 @@
|
|
|
1253
1263
|
return Promise.resolve(value);
|
|
1254
1264
|
}
|
|
1255
1265
|
|
|
1256
|
-
var expression = /*#__PURE__*/Object.freeze({
|
|
1266
|
+
var expression$1 = /*#__PURE__*/Object.freeze({
|
|
1257
1267
|
__proto__: null,
|
|
1258
|
-
ThisExpression: ThisExpression,
|
|
1259
|
-
ArrayExpression: ArrayExpression,
|
|
1260
|
-
ObjectExpression: ObjectExpression,
|
|
1261
|
-
FunctionExpression: FunctionExpression,
|
|
1262
|
-
UnaryExpression: UnaryExpression,
|
|
1263
|
-
UpdateExpression: UpdateExpression,
|
|
1264
|
-
BinaryExpression: BinaryExpression,
|
|
1265
|
-
AssignmentExpression: AssignmentExpression,
|
|
1266
|
-
LogicalExpression: LogicalExpression,
|
|
1267
|
-
MemberExpression: MemberExpression,
|
|
1268
|
-
ConditionalExpression: ConditionalExpression,
|
|
1269
|
-
CallExpression: CallExpression,
|
|
1270
|
-
NewExpression: NewExpression,
|
|
1271
|
-
MetaProperty: MetaProperty,
|
|
1272
|
-
SequenceExpression: SequenceExpression,
|
|
1273
|
-
ArrowFunctionExpression: ArrowFunctionExpression,
|
|
1274
|
-
TemplateLiteral: TemplateLiteral,
|
|
1275
|
-
TaggedTemplateExpression: TaggedTemplateExpression,
|
|
1276
|
-
TemplateElement: TemplateElement,
|
|
1277
|
-
ClassExpression: ClassExpression,
|
|
1278
|
-
Super: Super,
|
|
1279
|
-
SpreadElement: SpreadElement,
|
|
1280
|
-
ChainExpression: ChainExpression,
|
|
1281
|
-
ImportExpression: ImportExpression
|
|
1268
|
+
ThisExpression: ThisExpression$1,
|
|
1269
|
+
ArrayExpression: ArrayExpression$1,
|
|
1270
|
+
ObjectExpression: ObjectExpression$1,
|
|
1271
|
+
FunctionExpression: FunctionExpression$1,
|
|
1272
|
+
UnaryExpression: UnaryExpression$1,
|
|
1273
|
+
UpdateExpression: UpdateExpression$1,
|
|
1274
|
+
BinaryExpression: BinaryExpression$1,
|
|
1275
|
+
AssignmentExpression: AssignmentExpression$1,
|
|
1276
|
+
LogicalExpression: LogicalExpression$1,
|
|
1277
|
+
MemberExpression: MemberExpression$1,
|
|
1278
|
+
ConditionalExpression: ConditionalExpression$1,
|
|
1279
|
+
CallExpression: CallExpression$1,
|
|
1280
|
+
NewExpression: NewExpression$1,
|
|
1281
|
+
MetaProperty: MetaProperty$1,
|
|
1282
|
+
SequenceExpression: SequenceExpression$1,
|
|
1283
|
+
ArrowFunctionExpression: ArrowFunctionExpression$1,
|
|
1284
|
+
TemplateLiteral: TemplateLiteral$1,
|
|
1285
|
+
TaggedTemplateExpression: TaggedTemplateExpression$1,
|
|
1286
|
+
TemplateElement: TemplateElement$1,
|
|
1287
|
+
ClassExpression: ClassExpression$1,
|
|
1288
|
+
Super: Super$1,
|
|
1289
|
+
SpreadElement: SpreadElement$1,
|
|
1290
|
+
ChainExpression: ChainExpression$1,
|
|
1291
|
+
ImportExpression: ImportExpression$1
|
|
1282
1292
|
});
|
|
1283
1293
|
|
|
1284
|
-
function ObjectPattern(node, scope, options) {
|
|
1294
|
+
function ObjectPattern$1(node, scope, options) {
|
|
1285
1295
|
if (options === void 0) { options = {}; }
|
|
1286
1296
|
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
1297
|
var fedKeys = [];
|
|
@@ -1295,18 +1305,18 @@
|
|
|
1295
1305
|
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1296
1306
|
}
|
|
1297
1307
|
else {
|
|
1298
|
-
pattern
|
|
1308
|
+
pattern(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1299
1309
|
}
|
|
1300
1310
|
}
|
|
1301
1311
|
else {
|
|
1302
|
-
RestElement(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1312
|
+
RestElement$1(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1303
1313
|
}
|
|
1304
1314
|
}
|
|
1305
1315
|
}
|
|
1306
1316
|
else if (property.type === 'Property') {
|
|
1307
1317
|
var key = void 0;
|
|
1308
1318
|
if (property.computed) {
|
|
1309
|
-
key = evaluate(property.key, scope);
|
|
1319
|
+
key = evaluate$1(property.key, scope);
|
|
1310
1320
|
}
|
|
1311
1321
|
else {
|
|
1312
1322
|
key = property.key.name;
|
|
@@ -1317,18 +1327,18 @@
|
|
|
1317
1327
|
scope[kind](value.name, feed[key]);
|
|
1318
1328
|
}
|
|
1319
1329
|
else {
|
|
1320
|
-
pattern
|
|
1330
|
+
pattern(value, scope, { kind: kind, feed: feed[key] });
|
|
1321
1331
|
}
|
|
1322
1332
|
}
|
|
1323
1333
|
else {
|
|
1324
1334
|
var rest = assign({}, feed);
|
|
1325
1335
|
for (var i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
1326
1336
|
delete rest[fedKeys[i_1]];
|
|
1327
|
-
RestElement(property, scope, { kind: kind, feed: rest });
|
|
1337
|
+
RestElement$1(property, scope, { kind: kind, feed: rest });
|
|
1328
1338
|
}
|
|
1329
1339
|
}
|
|
1330
1340
|
}
|
|
1331
|
-
function ArrayPattern(node, scope, options) {
|
|
1341
|
+
function ArrayPattern$1(node, scope, options) {
|
|
1332
1342
|
if (options === void 0) { options = {}; }
|
|
1333
1343
|
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
1344
|
var result = [];
|
|
@@ -1342,7 +1352,7 @@
|
|
|
1342
1352
|
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1343
1353
|
}
|
|
1344
1354
|
else {
|
|
1345
|
-
pattern
|
|
1355
|
+
pattern(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1346
1356
|
}
|
|
1347
1357
|
}
|
|
1348
1358
|
}
|
|
@@ -1351,23 +1361,23 @@
|
|
|
1351
1361
|
scope[kind](element.name, feed[i]);
|
|
1352
1362
|
}
|
|
1353
1363
|
else {
|
|
1354
|
-
var variable = Identifier(element, scope, { getVar: true });
|
|
1364
|
+
var variable = Identifier$1(element, scope, { getVar: true });
|
|
1355
1365
|
variable.set(feed[i]);
|
|
1356
1366
|
result.push(variable.get());
|
|
1357
1367
|
}
|
|
1358
1368
|
}
|
|
1359
1369
|
else if (element.type === 'RestElement') {
|
|
1360
|
-
RestElement(element, scope, { kind: kind, feed: feed.slice(i) });
|
|
1370
|
+
RestElement$1(element, scope, { kind: kind, feed: feed.slice(i) });
|
|
1361
1371
|
}
|
|
1362
1372
|
else {
|
|
1363
|
-
pattern
|
|
1373
|
+
pattern(element, scope, { kind: kind, feed: feed[i] });
|
|
1364
1374
|
}
|
|
1365
1375
|
}
|
|
1366
1376
|
if (result.length) {
|
|
1367
1377
|
return result;
|
|
1368
1378
|
}
|
|
1369
1379
|
}
|
|
1370
|
-
function RestElement(node, scope, options) {
|
|
1380
|
+
function RestElement$1(node, scope, options) {
|
|
1371
1381
|
if (options === void 0) { options = {}; }
|
|
1372
1382
|
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
1383
|
var arg = node.argument;
|
|
@@ -1377,7 +1387,7 @@
|
|
|
1377
1387
|
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1378
1388
|
}
|
|
1379
1389
|
else {
|
|
1380
|
-
pattern
|
|
1390
|
+
pattern(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1381
1391
|
}
|
|
1382
1392
|
}
|
|
1383
1393
|
}
|
|
@@ -1386,17 +1396,17 @@
|
|
|
1386
1396
|
scope[kind](arg.name, feed);
|
|
1387
1397
|
}
|
|
1388
1398
|
else {
|
|
1389
|
-
var variable = Identifier(arg, scope, { getVar: true });
|
|
1399
|
+
var variable = Identifier$1(arg, scope, { getVar: true });
|
|
1390
1400
|
variable.set(feed);
|
|
1391
1401
|
}
|
|
1392
1402
|
}
|
|
1393
1403
|
else {
|
|
1394
|
-
pattern
|
|
1404
|
+
pattern(arg, scope, { kind: kind, feed: feed });
|
|
1395
1405
|
}
|
|
1396
1406
|
}
|
|
1397
|
-
function AssignmentPattern(node, scope, options) {
|
|
1407
|
+
function AssignmentPattern$1(node, scope, options) {
|
|
1398
1408
|
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;
|
|
1409
|
+
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$1(node.right, scope) : _d;
|
|
1400
1410
|
var left = node.left;
|
|
1401
1411
|
if (hoist) {
|
|
1402
1412
|
if (onlyBlock || kind === 'var') {
|
|
@@ -1404,7 +1414,7 @@
|
|
|
1404
1414
|
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1405
1415
|
}
|
|
1406
1416
|
else {
|
|
1407
|
-
pattern
|
|
1417
|
+
pattern(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1408
1418
|
}
|
|
1409
1419
|
}
|
|
1410
1420
|
}
|
|
@@ -1412,21 +1422,21 @@
|
|
|
1412
1422
|
scope[kind](left.name, feed);
|
|
1413
1423
|
}
|
|
1414
1424
|
else {
|
|
1415
|
-
pattern
|
|
1425
|
+
pattern(left, scope, { kind: kind, feed: feed });
|
|
1416
1426
|
}
|
|
1417
1427
|
}
|
|
1418
1428
|
|
|
1419
|
-
var pattern = /*#__PURE__*/Object.freeze({
|
|
1429
|
+
var pattern$3 = /*#__PURE__*/Object.freeze({
|
|
1420
1430
|
__proto__: null,
|
|
1421
|
-
ObjectPattern: ObjectPattern,
|
|
1422
|
-
ArrayPattern: ArrayPattern,
|
|
1423
|
-
RestElement: RestElement,
|
|
1424
|
-
AssignmentPattern: AssignmentPattern
|
|
1431
|
+
ObjectPattern: ObjectPattern$1,
|
|
1432
|
+
ArrayPattern: ArrayPattern$1,
|
|
1433
|
+
RestElement: RestElement$1,
|
|
1434
|
+
AssignmentPattern: AssignmentPattern$1
|
|
1425
1435
|
});
|
|
1426
1436
|
|
|
1427
1437
|
function Program(program, scope) {
|
|
1428
1438
|
for (var i = 0; i < program.body.length; i++) {
|
|
1429
|
-
evaluate(program.body[i], scope);
|
|
1439
|
+
evaluate$1(program.body[i], scope);
|
|
1430
1440
|
}
|
|
1431
1441
|
}
|
|
1432
1442
|
|
|
@@ -1435,14 +1445,14 @@
|
|
|
1435
1445
|
Program: Program
|
|
1436
1446
|
});
|
|
1437
1447
|
|
|
1438
|
-
var evaluateOps;
|
|
1439
|
-
function evaluate(node, scope) {
|
|
1448
|
+
var evaluateOps$1;
|
|
1449
|
+
function evaluate$1(node, scope) {
|
|
1440
1450
|
if (!node)
|
|
1441
1451
|
return;
|
|
1442
|
-
if (!evaluateOps) {
|
|
1443
|
-
evaluateOps = assign({}, declaration, expression, identifier, statement, literal, pattern, program);
|
|
1452
|
+
if (!evaluateOps$1) {
|
|
1453
|
+
evaluateOps$1 = assign({}, declaration$1, expression$1, identifier$1, statement$1, literal$1, pattern$3, program);
|
|
1444
1454
|
}
|
|
1445
|
-
var handler = evaluateOps[node.type];
|
|
1455
|
+
var handler = evaluateOps$1[node.type];
|
|
1446
1456
|
if (handler) {
|
|
1447
1457
|
return handler(node, scope);
|
|
1448
1458
|
}
|
|
@@ -1451,58 +1461,58 @@
|
|
|
1451
1461
|
}
|
|
1452
1462
|
}
|
|
1453
1463
|
|
|
1454
|
-
function ExpressionStatement(node, scope) {
|
|
1455
|
-
evaluate(node.expression, scope);
|
|
1464
|
+
function ExpressionStatement$1(node, scope) {
|
|
1465
|
+
evaluate$1(node.expression, scope);
|
|
1456
1466
|
}
|
|
1457
|
-
function BlockStatement(block, scope, options) {
|
|
1467
|
+
function BlockStatement$1(block, scope, options) {
|
|
1458
1468
|
if (options === void 0) { options = {}; }
|
|
1459
1469
|
var _a = options.invasived, invasived = _a === void 0 ? false : _a, _b = options.hoisted, hoisted = _b === void 0 ? false : _b;
|
|
1460
1470
|
var subScope = invasived ? scope : new Scope(scope);
|
|
1461
1471
|
if (!hoisted) {
|
|
1462
|
-
hoist
|
|
1472
|
+
hoist(block, subScope, { onlyBlock: true });
|
|
1463
1473
|
}
|
|
1464
1474
|
for (var i = 0; i < block.body.length; i++) {
|
|
1465
|
-
var result = evaluate(block.body[i], subScope);
|
|
1475
|
+
var result = evaluate$1(block.body[i], subScope);
|
|
1466
1476
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
1467
1477
|
return result;
|
|
1468
1478
|
}
|
|
1469
1479
|
}
|
|
1470
1480
|
}
|
|
1471
|
-
function EmptyStatement() {
|
|
1481
|
+
function EmptyStatement$1() {
|
|
1472
1482
|
}
|
|
1473
|
-
function DebuggerStatement() {
|
|
1483
|
+
function DebuggerStatement$1() {
|
|
1474
1484
|
debugger;
|
|
1475
1485
|
}
|
|
1476
|
-
function ReturnStatement(node, scope) {
|
|
1477
|
-
RETURN.RES = node.argument ? (evaluate(node.argument, scope)) : undefined;
|
|
1486
|
+
function ReturnStatement$1(node, scope) {
|
|
1487
|
+
RETURN.RES = node.argument ? (evaluate$1(node.argument, scope)) : undefined;
|
|
1478
1488
|
return RETURN;
|
|
1479
1489
|
}
|
|
1480
|
-
function BreakStatement() {
|
|
1490
|
+
function BreakStatement$1() {
|
|
1481
1491
|
return BREAK;
|
|
1482
1492
|
}
|
|
1483
|
-
function ContinueStatement() {
|
|
1493
|
+
function ContinueStatement$1() {
|
|
1484
1494
|
return CONTINUE;
|
|
1485
1495
|
}
|
|
1486
|
-
function IfStatement(node, scope) {
|
|
1487
|
-
if (evaluate(node.test, scope)) {
|
|
1488
|
-
return evaluate(node.consequent, scope);
|
|
1496
|
+
function IfStatement$1(node, scope) {
|
|
1497
|
+
if (evaluate$1(node.test, scope)) {
|
|
1498
|
+
return evaluate$1(node.consequent, scope);
|
|
1489
1499
|
}
|
|
1490
1500
|
else {
|
|
1491
|
-
return evaluate(node.alternate, scope);
|
|
1501
|
+
return evaluate$1(node.alternate, scope);
|
|
1492
1502
|
}
|
|
1493
1503
|
}
|
|
1494
|
-
function SwitchStatement(node, scope) {
|
|
1495
|
-
var discriminant = evaluate(node.discriminant, scope);
|
|
1504
|
+
function SwitchStatement$1(node, scope) {
|
|
1505
|
+
var discriminant = evaluate$1(node.discriminant, scope);
|
|
1496
1506
|
var matched = false;
|
|
1497
1507
|
for (var i = 0; i < node.cases.length; i++) {
|
|
1498
1508
|
var eachCase = node.cases[i];
|
|
1499
1509
|
if (!matched
|
|
1500
1510
|
&& (!eachCase.test
|
|
1501
|
-
|| (evaluate(eachCase.test, scope)) === discriminant)) {
|
|
1511
|
+
|| (evaluate$1(eachCase.test, scope)) === discriminant)) {
|
|
1502
1512
|
matched = true;
|
|
1503
1513
|
}
|
|
1504
1514
|
if (matched) {
|
|
1505
|
-
var result = SwitchCase(eachCase, scope);
|
|
1515
|
+
var result = SwitchCase$1(eachCase, scope);
|
|
1506
1516
|
if (result === BREAK) {
|
|
1507
1517
|
break;
|
|
1508
1518
|
}
|
|
@@ -1512,20 +1522,20 @@
|
|
|
1512
1522
|
}
|
|
1513
1523
|
}
|
|
1514
1524
|
}
|
|
1515
|
-
function SwitchCase(node, scope) {
|
|
1525
|
+
function SwitchCase$1(node, scope) {
|
|
1516
1526
|
for (var i = 0; i < node.consequent.length; i++) {
|
|
1517
|
-
var result = evaluate(node.consequent[i], scope);
|
|
1527
|
+
var result = evaluate$1(node.consequent[i], scope);
|
|
1518
1528
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
1519
1529
|
return result;
|
|
1520
1530
|
}
|
|
1521
1531
|
}
|
|
1522
1532
|
}
|
|
1523
|
-
function ThrowStatement(node, scope) {
|
|
1524
|
-
throw evaluate(node.argument, scope);
|
|
1533
|
+
function ThrowStatement$1(node, scope) {
|
|
1534
|
+
throw evaluate$1(node.argument, scope);
|
|
1525
1535
|
}
|
|
1526
|
-
function TryStatement(node, scope) {
|
|
1536
|
+
function TryStatement$1(node, scope) {
|
|
1527
1537
|
try {
|
|
1528
|
-
return BlockStatement(node.block, scope);
|
|
1538
|
+
return BlockStatement$1(node.block, scope);
|
|
1529
1539
|
}
|
|
1530
1540
|
catch (err) {
|
|
1531
1541
|
if (node.handler) {
|
|
@@ -1537,10 +1547,10 @@
|
|
|
1537
1547
|
subScope.var(name_1, err);
|
|
1538
1548
|
}
|
|
1539
1549
|
else {
|
|
1540
|
-
pattern
|
|
1550
|
+
pattern(param, scope, { feed: err });
|
|
1541
1551
|
}
|
|
1542
1552
|
}
|
|
1543
|
-
return CatchClause(node.handler, subScope);
|
|
1553
|
+
return CatchClause$1(node.handler, subScope);
|
|
1544
1554
|
}
|
|
1545
1555
|
else {
|
|
1546
1556
|
throw err;
|
|
@@ -1548,19 +1558,19 @@
|
|
|
1548
1558
|
}
|
|
1549
1559
|
finally {
|
|
1550
1560
|
if (node.finalizer) {
|
|
1551
|
-
var result = BlockStatement(node.finalizer, scope);
|
|
1561
|
+
var result = BlockStatement$1(node.finalizer, scope);
|
|
1552
1562
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
1553
1563
|
return result;
|
|
1554
1564
|
}
|
|
1555
1565
|
}
|
|
1556
1566
|
}
|
|
1557
1567
|
}
|
|
1558
|
-
function CatchClause(node, scope) {
|
|
1559
|
-
return BlockStatement(node.body, scope, { invasived: true });
|
|
1568
|
+
function CatchClause$1(node, scope) {
|
|
1569
|
+
return BlockStatement$1(node.body, scope, { invasived: true });
|
|
1560
1570
|
}
|
|
1561
|
-
function WhileStatement(node, scope) {
|
|
1562
|
-
while (evaluate(node.test, scope)) {
|
|
1563
|
-
var result = evaluate(node.body, scope);
|
|
1571
|
+
function WhileStatement$1(node, scope) {
|
|
1572
|
+
while (evaluate$1(node.test, scope)) {
|
|
1573
|
+
var result = evaluate$1(node.body, scope);
|
|
1564
1574
|
if (result === BREAK) {
|
|
1565
1575
|
break;
|
|
1566
1576
|
}
|
|
@@ -1572,9 +1582,9 @@
|
|
|
1572
1582
|
}
|
|
1573
1583
|
}
|
|
1574
1584
|
}
|
|
1575
|
-
function DoWhileStatement(node, scope) {
|
|
1585
|
+
function DoWhileStatement$1(node, scope) {
|
|
1576
1586
|
do {
|
|
1577
|
-
var result = evaluate(node.body, scope);
|
|
1587
|
+
var result = evaluate$1(node.body, scope);
|
|
1578
1588
|
if (result === BREAK) {
|
|
1579
1589
|
break;
|
|
1580
1590
|
}
|
|
@@ -1584,18 +1594,18 @@
|
|
|
1584
1594
|
else if (result === RETURN) {
|
|
1585
1595
|
return result;
|
|
1586
1596
|
}
|
|
1587
|
-
} while (evaluate(node.test, scope));
|
|
1597
|
+
} while (evaluate$1(node.test, scope));
|
|
1588
1598
|
}
|
|
1589
|
-
function ForStatement(node, scope) {
|
|
1599
|
+
function ForStatement$1(node, scope) {
|
|
1590
1600
|
var forScope = new Scope(scope);
|
|
1591
|
-
for (evaluate(node.init, forScope); node.test ? (evaluate(node.test, forScope)) : true; evaluate(node.update, forScope)) {
|
|
1601
|
+
for (evaluate$1(node.init, forScope); node.test ? (evaluate$1(node.test, forScope)) : true; evaluate$1(node.update, forScope)) {
|
|
1592
1602
|
var subScope = new Scope(forScope);
|
|
1593
1603
|
var result = void 0;
|
|
1594
1604
|
if (node.body.type === 'BlockStatement') {
|
|
1595
|
-
result = BlockStatement(node.body, subScope, { invasived: true });
|
|
1605
|
+
result = BlockStatement$1(node.body, subScope, { invasived: true });
|
|
1596
1606
|
}
|
|
1597
1607
|
else {
|
|
1598
|
-
result = evaluate(node.body, subScope);
|
|
1608
|
+
result = evaluate$1(node.body, subScope);
|
|
1599
1609
|
}
|
|
1600
1610
|
if (result === BREAK) {
|
|
1601
1611
|
break;
|
|
@@ -1608,9 +1618,9 @@
|
|
|
1608
1618
|
}
|
|
1609
1619
|
}
|
|
1610
1620
|
}
|
|
1611
|
-
function ForInStatement(node, scope) {
|
|
1612
|
-
for (var value in evaluate(node.right, scope)) {
|
|
1613
|
-
var result = ForXHandler
|
|
1621
|
+
function ForInStatement$1(node, scope) {
|
|
1622
|
+
for (var value in evaluate$1(node.right, scope)) {
|
|
1623
|
+
var result = ForXHandler(node, scope, { value: value });
|
|
1614
1624
|
if (result === BREAK) {
|
|
1615
1625
|
break;
|
|
1616
1626
|
}
|
|
@@ -1622,13 +1632,13 @@
|
|
|
1622
1632
|
}
|
|
1623
1633
|
}
|
|
1624
1634
|
}
|
|
1625
|
-
function ForOfStatement(node, scope) {
|
|
1635
|
+
function ForOfStatement$1(node, scope) {
|
|
1626
1636
|
var e_1, _a;
|
|
1627
|
-
var right = evaluate(node.right, scope);
|
|
1637
|
+
var right = evaluate$1(node.right, scope);
|
|
1628
1638
|
try {
|
|
1629
1639
|
for (var right_1 = __values(right), right_1_1 = right_1.next(); !right_1_1.done; right_1_1 = right_1.next()) {
|
|
1630
1640
|
var value = right_1_1.value;
|
|
1631
|
-
var result = ForXHandler
|
|
1641
|
+
var result = ForXHandler(node, scope, { value: value });
|
|
1632
1642
|
if (result === BREAK) {
|
|
1633
1643
|
break;
|
|
1634
1644
|
}
|
|
@@ -1649,16 +1659,16 @@
|
|
|
1649
1659
|
}
|
|
1650
1660
|
}
|
|
1651
1661
|
|
|
1652
|
-
function FunctionDeclaration(node, scope) {
|
|
1653
|
-
scope.func(node.id.name, createFunc
|
|
1662
|
+
function FunctionDeclaration$1(node, scope) {
|
|
1663
|
+
scope.func(node.id.name, createFunc(node, scope));
|
|
1654
1664
|
}
|
|
1655
|
-
function VariableDeclaration(node, scope, options) {
|
|
1665
|
+
function VariableDeclaration$1(node, scope, options) {
|
|
1656
1666
|
if (options === void 0) { options = {}; }
|
|
1657
1667
|
for (var i = 0; i < node.declarations.length; i++) {
|
|
1658
|
-
VariableDeclarator(node.declarations[i], scope, assign({ kind: node.kind }, options));
|
|
1668
|
+
VariableDeclarator$1(node.declarations[i], scope, assign({ kind: node.kind }, options));
|
|
1659
1669
|
}
|
|
1660
1670
|
}
|
|
1661
|
-
function VariableDeclarator(node, scope, options) {
|
|
1671
|
+
function VariableDeclarator$1(node, scope, options) {
|
|
1662
1672
|
if (options === void 0) { options = {}; }
|
|
1663
1673
|
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
1674
|
if (hoist) {
|
|
@@ -1667,13 +1677,13 @@
|
|
|
1667
1677
|
scope[kind](node.id.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1668
1678
|
}
|
|
1669
1679
|
else {
|
|
1670
|
-
pattern
|
|
1680
|
+
pattern(node.id, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1671
1681
|
}
|
|
1672
1682
|
}
|
|
1673
1683
|
}
|
|
1674
1684
|
else {
|
|
1675
1685
|
var hasFeed = 'feed' in options;
|
|
1676
|
-
var value = hasFeed ? feed : evaluate(node.init, scope);
|
|
1686
|
+
var value = hasFeed ? feed : evaluate$1(node.init, scope);
|
|
1677
1687
|
if (node.id.type === 'Identifier') {
|
|
1678
1688
|
var name_1 = node.id.name;
|
|
1679
1689
|
if (kind === 'var' && !node.init && !hasFeed) {
|
|
@@ -1693,36 +1703,36 @@
|
|
|
1693
1703
|
}
|
|
1694
1704
|
}
|
|
1695
1705
|
else {
|
|
1696
|
-
pattern
|
|
1706
|
+
pattern(node.id, scope, { kind: kind, feed: value });
|
|
1697
1707
|
}
|
|
1698
1708
|
}
|
|
1699
1709
|
}
|
|
1700
|
-
function ClassDeclaration(node, scope) {
|
|
1701
|
-
scope.func(node.id.name, createClass
|
|
1710
|
+
function ClassDeclaration$1(node, scope) {
|
|
1711
|
+
scope.func(node.id.name, createClass(node, scope));
|
|
1702
1712
|
}
|
|
1703
|
-
function ClassBody(node, scope, options) {
|
|
1713
|
+
function ClassBody$1(node, scope, options) {
|
|
1704
1714
|
if (options === void 0) { options = {}; }
|
|
1705
1715
|
var klass = options.klass, superClass = options.superClass;
|
|
1706
1716
|
for (var i = 0; i < node.body.length; i++) {
|
|
1707
1717
|
var def = node.body[i];
|
|
1708
1718
|
if (def.type === 'MethodDefinition') {
|
|
1709
|
-
MethodDefinition(def, scope, { klass: klass, superClass: superClass });
|
|
1719
|
+
MethodDefinition$1(def, scope, { klass: klass, superClass: superClass });
|
|
1710
1720
|
}
|
|
1711
1721
|
else if (def.type === 'PropertyDefinition' && def.static) {
|
|
1712
|
-
PropertyDefinition(def, scope, { klass: klass, superClass: superClass });
|
|
1722
|
+
PropertyDefinition$1(def, scope, { klass: klass, superClass: superClass });
|
|
1713
1723
|
}
|
|
1714
1724
|
else if (def.type === 'StaticBlock') {
|
|
1715
|
-
StaticBlock(def, scope, { klass: klass, superClass: superClass });
|
|
1725
|
+
StaticBlock$1(def, scope, { klass: klass, superClass: superClass });
|
|
1716
1726
|
}
|
|
1717
1727
|
}
|
|
1718
1728
|
}
|
|
1719
|
-
function MethodDefinition(node, scope, options) {
|
|
1729
|
+
function MethodDefinition$1(node, scope, options) {
|
|
1720
1730
|
if (options === void 0) { options = {}; }
|
|
1721
1731
|
var klass = options.klass, superClass = options.superClass;
|
|
1722
1732
|
var key;
|
|
1723
1733
|
var priv = false;
|
|
1724
1734
|
if (node.computed) {
|
|
1725
|
-
key = evaluate(node.key, scope);
|
|
1735
|
+
key = evaluate$1(node.key, scope);
|
|
1726
1736
|
}
|
|
1727
1737
|
else if (node.key.type === 'Identifier') {
|
|
1728
1738
|
key = node.key.name;
|
|
@@ -1741,7 +1751,7 @@
|
|
|
1741
1751
|
}
|
|
1742
1752
|
obj = obj[PRIVATE];
|
|
1743
1753
|
}
|
|
1744
|
-
var value = createFunc
|
|
1754
|
+
var value = createFunc(node.value, scope, { superClass: superClass });
|
|
1745
1755
|
switch (node.kind) {
|
|
1746
1756
|
case 'constructor':
|
|
1747
1757
|
break;
|
|
@@ -1774,13 +1784,13 @@
|
|
|
1774
1784
|
throw new SyntaxError('Unexpected token');
|
|
1775
1785
|
}
|
|
1776
1786
|
}
|
|
1777
|
-
function PropertyDefinition(node, scope, options) {
|
|
1787
|
+
function PropertyDefinition$1(node, scope, options) {
|
|
1778
1788
|
if (options === void 0) { options = {}; }
|
|
1779
1789
|
var klass = options.klass, superClass = options.superClass;
|
|
1780
1790
|
var key;
|
|
1781
1791
|
var priv = false;
|
|
1782
1792
|
if (node.computed) {
|
|
1783
|
-
key = evaluate(node.key, scope);
|
|
1793
|
+
key = evaluate$1(node.key, scope);
|
|
1784
1794
|
}
|
|
1785
1795
|
else if (node.key.type === 'Identifier') {
|
|
1786
1796
|
key = node.key.name;
|
|
@@ -1802,20 +1812,20 @@
|
|
|
1802
1812
|
obj = obj[PRIVATE];
|
|
1803
1813
|
}
|
|
1804
1814
|
if (node.value.type === 'FunctionExpression' || node.value.type === 'ArrowFunctionExpression') {
|
|
1805
|
-
obj[key] = createFunc
|
|
1815
|
+
obj[key] = createFunc(node.value, subScope, { superClass: superClass });
|
|
1806
1816
|
}
|
|
1807
1817
|
else {
|
|
1808
|
-
obj[key] = evaluate(node.value, subScope);
|
|
1818
|
+
obj[key] = evaluate$1(node.value, subScope);
|
|
1809
1819
|
}
|
|
1810
1820
|
}
|
|
1811
|
-
function StaticBlock(node, scope, options) {
|
|
1821
|
+
function StaticBlock$1(node, scope, options) {
|
|
1812
1822
|
if (options === void 0) { options = {}; }
|
|
1813
1823
|
var klass = options.klass;
|
|
1814
1824
|
var subScope = new Scope(scope, true);
|
|
1815
1825
|
subScope.const('this', klass);
|
|
1816
|
-
return BlockStatement(node, subScope, { invasived: true });
|
|
1826
|
+
return BlockStatement$1(node, subScope, { invasived: true });
|
|
1817
1827
|
}
|
|
1818
|
-
function ImportDeclaration(node, scope) {
|
|
1828
|
+
function ImportDeclaration$1(node, scope) {
|
|
1819
1829
|
var globalScope = scope.global();
|
|
1820
1830
|
var module = globalScope.find(IMPORT + node.source.value);
|
|
1821
1831
|
var value;
|
|
@@ -1852,19 +1862,19 @@
|
|
|
1852
1862
|
scope.var(spec.local.name, name_2 === '*' ? assign({}, value) : value[name_2]);
|
|
1853
1863
|
}
|
|
1854
1864
|
}
|
|
1855
|
-
function ExportDefaultDeclaration(node, scope) {
|
|
1865
|
+
function ExportDefaultDeclaration$1(node, scope) {
|
|
1856
1866
|
var globalScope = scope.global();
|
|
1857
1867
|
var value;
|
|
1858
1868
|
if (node.declaration.type === 'FunctionDeclaration') {
|
|
1859
|
-
value = createFunc
|
|
1869
|
+
value = createFunc(node.declaration, scope);
|
|
1860
1870
|
scope.func(node.declaration.id.name, value);
|
|
1861
1871
|
}
|
|
1862
1872
|
else if (node.declaration.type === 'ClassDeclaration') {
|
|
1863
|
-
value = createClass
|
|
1873
|
+
value = createClass(node.declaration, scope);
|
|
1864
1874
|
scope.func(node.declaration.id.name, value);
|
|
1865
1875
|
}
|
|
1866
1876
|
else {
|
|
1867
|
-
value = evaluate(node.declaration, scope);
|
|
1877
|
+
value = evaluate$1(node.declaration, scope);
|
|
1868
1878
|
}
|
|
1869
1879
|
var variable = globalScope.find(EXPORTS);
|
|
1870
1880
|
if (variable) {
|
|
@@ -1874,11 +1884,11 @@
|
|
|
1874
1884
|
}
|
|
1875
1885
|
}
|
|
1876
1886
|
}
|
|
1877
|
-
function ExportNamedDeclaration(node, scope) {
|
|
1887
|
+
function ExportNamedDeclaration$1(node, scope) {
|
|
1878
1888
|
var globalScope = scope.global();
|
|
1879
1889
|
if (node.declaration) {
|
|
1880
1890
|
if (node.declaration.type === 'FunctionDeclaration') {
|
|
1881
|
-
var value = createFunc
|
|
1891
|
+
var value = createFunc(node.declaration, scope);
|
|
1882
1892
|
scope.func(node.declaration.id.name, value);
|
|
1883
1893
|
var variable = globalScope.find(EXPORTS);
|
|
1884
1894
|
if (variable) {
|
|
@@ -1889,7 +1899,7 @@
|
|
|
1889
1899
|
}
|
|
1890
1900
|
}
|
|
1891
1901
|
else if (node.declaration.type === 'ClassDeclaration') {
|
|
1892
|
-
var value = createClass
|
|
1902
|
+
var value = createClass(node.declaration, scope);
|
|
1893
1903
|
scope.func(node.declaration.id.name, value);
|
|
1894
1904
|
var variable = globalScope.find(EXPORTS);
|
|
1895
1905
|
if (variable) {
|
|
@@ -1900,7 +1910,7 @@
|
|
|
1900
1910
|
}
|
|
1901
1911
|
}
|
|
1902
1912
|
else if (node.declaration.type === 'VariableDeclaration') {
|
|
1903
|
-
VariableDeclaration(node.declaration, scope);
|
|
1913
|
+
VariableDeclaration$1(node.declaration, scope);
|
|
1904
1914
|
var variable = globalScope.find(EXPORTS);
|
|
1905
1915
|
if (variable) {
|
|
1906
1916
|
var exports_4 = variable.get();
|
|
@@ -1935,7 +1945,7 @@
|
|
|
1935
1945
|
}
|
|
1936
1946
|
}
|
|
1937
1947
|
}
|
|
1938
|
-
function ExportAllDeclaration(node, scope) {
|
|
1948
|
+
function ExportAllDeclaration$1(node, scope) {
|
|
1939
1949
|
var globalScope = scope.global();
|
|
1940
1950
|
var module = globalScope.find(IMPORT + node.source.value);
|
|
1941
1951
|
var value;
|
|
@@ -1962,7 +1972,7 @@
|
|
|
1962
1972
|
}
|
|
1963
1973
|
}
|
|
1964
1974
|
|
|
1965
|
-
function Identifier
|
|
1975
|
+
function Identifier(node, scope, options) {
|
|
1966
1976
|
var _a, getVar, _b, throwErr, variable, value;
|
|
1967
1977
|
if (options === void 0) { options = {}; }
|
|
1968
1978
|
return __generator(this, function (_c) {
|
|
@@ -1994,23 +2004,23 @@
|
|
|
1994
2004
|
});
|
|
1995
2005
|
}
|
|
1996
2006
|
|
|
1997
|
-
var identifier
|
|
2007
|
+
var identifier = /*#__PURE__*/Object.freeze({
|
|
1998
2008
|
__proto__: null,
|
|
1999
|
-
Identifier: Identifier
|
|
2009
|
+
Identifier: Identifier
|
|
2000
2010
|
});
|
|
2001
2011
|
|
|
2002
|
-
function Literal
|
|
2012
|
+
function Literal(node, scope) {
|
|
2003
2013
|
return __generator(this, function (_a) {
|
|
2004
2014
|
return [2, node.value];
|
|
2005
2015
|
});
|
|
2006
2016
|
}
|
|
2007
2017
|
|
|
2008
|
-
var literal
|
|
2018
|
+
var literal = /*#__PURE__*/Object.freeze({
|
|
2009
2019
|
__proto__: null,
|
|
2010
|
-
Literal: Literal
|
|
2020
|
+
Literal: Literal
|
|
2011
2021
|
});
|
|
2012
2022
|
|
|
2013
|
-
function ThisExpression
|
|
2023
|
+
function ThisExpression(node, scope) {
|
|
2014
2024
|
var superCall;
|
|
2015
2025
|
return __generator(this, function (_a) {
|
|
2016
2026
|
superCall = scope.find(SUPERCALL);
|
|
@@ -2023,7 +2033,7 @@
|
|
|
2023
2033
|
}
|
|
2024
2034
|
});
|
|
2025
2035
|
}
|
|
2026
|
-
function ArrayExpression
|
|
2036
|
+
function ArrayExpression(node, scope) {
|
|
2027
2037
|
var results, i, item, _a, _b, _c, _d;
|
|
2028
2038
|
return __generator(this, function (_e) {
|
|
2029
2039
|
switch (_e.label) {
|
|
@@ -2036,13 +2046,13 @@
|
|
|
2036
2046
|
item = node.elements[i];
|
|
2037
2047
|
if (!(item.type === 'SpreadElement')) return [3, 3];
|
|
2038
2048
|
_b = (_a = results).concat;
|
|
2039
|
-
return [5, __values(SpreadElement
|
|
2049
|
+
return [5, __values(SpreadElement(item, scope))];
|
|
2040
2050
|
case 2:
|
|
2041
2051
|
results = _b.apply(_a, [_e.sent()]);
|
|
2042
2052
|
return [3, 5];
|
|
2043
2053
|
case 3:
|
|
2044
2054
|
_d = (_c = results).push;
|
|
2045
|
-
return [5, __values(evaluate
|
|
2055
|
+
return [5, __values(evaluate(item, scope))];
|
|
2046
2056
|
case 4:
|
|
2047
2057
|
_d.apply(_c, [_e.sent()]);
|
|
2048
2058
|
_e.label = 5;
|
|
@@ -2053,7 +2063,7 @@
|
|
|
2053
2063
|
}
|
|
2054
2064
|
});
|
|
2055
2065
|
}
|
|
2056
|
-
function ObjectExpression
|
|
2066
|
+
function ObjectExpression(node, scope) {
|
|
2057
2067
|
var object, i, property, _a, _b, key, propKey, _c, value, propKind, oriDptor, oriDptor;
|
|
2058
2068
|
return __generator(this, function (_d) {
|
|
2059
2069
|
switch (_d.label) {
|
|
@@ -2067,7 +2077,7 @@
|
|
|
2067
2077
|
if (!(property.type === 'SpreadElement')) return [3, 3];
|
|
2068
2078
|
_a = assign;
|
|
2069
2079
|
_b = [object];
|
|
2070
|
-
return [5, __values(SpreadElement
|
|
2080
|
+
return [5, __values(SpreadElement(property, scope))];
|
|
2071
2081
|
case 2:
|
|
2072
2082
|
_a.apply(void 0, _b.concat([_d.sent()]));
|
|
2073
2083
|
return [3, 10];
|
|
@@ -2075,7 +2085,7 @@
|
|
|
2075
2085
|
key = void 0;
|
|
2076
2086
|
propKey = property.key;
|
|
2077
2087
|
if (!property.computed) return [3, 5];
|
|
2078
|
-
return [5, __values(evaluate
|
|
2088
|
+
return [5, __values(evaluate(propKey, scope))];
|
|
2079
2089
|
case 4:
|
|
2080
2090
|
key = _d.sent();
|
|
2081
2091
|
return [3, 8];
|
|
@@ -2085,11 +2095,11 @@
|
|
|
2085
2095
|
return [3, 8];
|
|
2086
2096
|
case 6:
|
|
2087
2097
|
_c = '';
|
|
2088
|
-
return [5, __values(Literal
|
|
2098
|
+
return [5, __values(Literal(propKey))];
|
|
2089
2099
|
case 7:
|
|
2090
2100
|
key = _c + (_d.sent());
|
|
2091
2101
|
_d.label = 8;
|
|
2092
|
-
case 8: return [5, __values(evaluate
|
|
2102
|
+
case 8: return [5, __values(evaluate(property.value, scope))];
|
|
2093
2103
|
case 9:
|
|
2094
2104
|
value = _d.sent();
|
|
2095
2105
|
propKind = property.kind;
|
|
@@ -2122,21 +2132,21 @@
|
|
|
2122
2132
|
}
|
|
2123
2133
|
});
|
|
2124
2134
|
}
|
|
2125
|
-
function FunctionExpression
|
|
2135
|
+
function FunctionExpression(node, scope) {
|
|
2126
2136
|
var tmpScope, func;
|
|
2127
2137
|
return __generator(this, function (_a) {
|
|
2128
2138
|
if (node.id && node.id.name) {
|
|
2129
2139
|
tmpScope = new Scope(scope);
|
|
2130
|
-
func = createFunc(node, tmpScope);
|
|
2140
|
+
func = createFunc$1(node, tmpScope);
|
|
2131
2141
|
tmpScope.const(node.id.name, func);
|
|
2132
2142
|
return [2, func];
|
|
2133
2143
|
}
|
|
2134
2144
|
else {
|
|
2135
|
-
return [2, createFunc(node, scope)];
|
|
2145
|
+
return [2, createFunc$1(node, scope)];
|
|
2136
2146
|
}
|
|
2137
2147
|
});
|
|
2138
2148
|
}
|
|
2139
|
-
function UnaryExpression
|
|
2149
|
+
function UnaryExpression(node, scope) {
|
|
2140
2150
|
var arg, _a, variable;
|
|
2141
2151
|
return __generator(this, function (_b) {
|
|
2142
2152
|
switch (_b.label) {
|
|
@@ -2153,32 +2163,32 @@
|
|
|
2153
2163
|
case 'delete': return [3, 15];
|
|
2154
2164
|
}
|
|
2155
2165
|
return [3, 20];
|
|
2156
|
-
case 1: return [5, __values(evaluate
|
|
2166
|
+
case 1: return [5, __values(evaluate(arg, scope))];
|
|
2157
2167
|
case 2: return [2, +(_b.sent())];
|
|
2158
|
-
case 3: return [5, __values(evaluate
|
|
2168
|
+
case 3: return [5, __values(evaluate(arg, scope))];
|
|
2159
2169
|
case 4: return [2, -(_b.sent())];
|
|
2160
|
-
case 5: return [5, __values(evaluate
|
|
2170
|
+
case 5: return [5, __values(evaluate(arg, scope))];
|
|
2161
2171
|
case 6: return [2, !(_b.sent())];
|
|
2162
|
-
case 7: return [5, __values(evaluate
|
|
2172
|
+
case 7: return [5, __values(evaluate(arg, scope))];
|
|
2163
2173
|
case 8: return [2, ~(_b.sent())];
|
|
2164
|
-
case 9: return [5, __values(evaluate
|
|
2174
|
+
case 9: return [5, __values(evaluate(arg, scope))];
|
|
2165
2175
|
case 10: return [2, void (_b.sent())];
|
|
2166
2176
|
case 11:
|
|
2167
2177
|
if (!(arg.type === 'Identifier')) return [3, 13];
|
|
2168
|
-
return [5, __values(Identifier
|
|
2178
|
+
return [5, __values(Identifier(arg, scope, { throwErr: false }))];
|
|
2169
2179
|
case 12: return [2, typeof (_b.sent())];
|
|
2170
|
-
case 13: return [5, __values(evaluate
|
|
2180
|
+
case 13: return [5, __values(evaluate(arg, scope))];
|
|
2171
2181
|
case 14: return [2, typeof (_b.sent())];
|
|
2172
2182
|
case 15:
|
|
2173
2183
|
if (!(arg.type === 'MemberExpression')) return [3, 17];
|
|
2174
|
-
return [5, __values(MemberExpression
|
|
2184
|
+
return [5, __values(MemberExpression(arg, scope, { getVar: true }))];
|
|
2175
2185
|
case 16:
|
|
2176
2186
|
variable = _b.sent();
|
|
2177
2187
|
return [2, variable.del()];
|
|
2178
2188
|
case 17:
|
|
2179
2189
|
if (!(arg.type === 'Identifier')) return [3, 18];
|
|
2180
2190
|
throw new SyntaxError('Delete of an unqualified identifier in strict mode');
|
|
2181
|
-
case 18: return [5, __values(evaluate
|
|
2191
|
+
case 18: return [5, __values(evaluate(arg, scope))];
|
|
2182
2192
|
case 19:
|
|
2183
2193
|
_b.sent();
|
|
2184
2194
|
return [2, true];
|
|
@@ -2186,20 +2196,20 @@
|
|
|
2186
2196
|
}
|
|
2187
2197
|
});
|
|
2188
2198
|
}
|
|
2189
|
-
function UpdateExpression
|
|
2199
|
+
function UpdateExpression(node, scope) {
|
|
2190
2200
|
var arg, variable, value;
|
|
2191
2201
|
return __generator(this, function (_a) {
|
|
2192
2202
|
switch (_a.label) {
|
|
2193
2203
|
case 0:
|
|
2194
2204
|
arg = node.argument;
|
|
2195
2205
|
if (!(arg.type === 'Identifier')) return [3, 2];
|
|
2196
|
-
return [5, __values(Identifier
|
|
2206
|
+
return [5, __values(Identifier(arg, scope, { getVar: true }))];
|
|
2197
2207
|
case 1:
|
|
2198
2208
|
variable = _a.sent();
|
|
2199
2209
|
return [3, 5];
|
|
2200
2210
|
case 2:
|
|
2201
2211
|
if (!(arg.type === 'MemberExpression')) return [3, 4];
|
|
2202
|
-
return [5, __values(MemberExpression
|
|
2212
|
+
return [5, __values(MemberExpression(arg, scope, { getVar: true }))];
|
|
2203
2213
|
case 3:
|
|
2204
2214
|
variable = _a.sent();
|
|
2205
2215
|
return [3, 5];
|
|
@@ -2220,22 +2230,22 @@
|
|
|
2220
2230
|
}
|
|
2221
2231
|
});
|
|
2222
2232
|
}
|
|
2223
|
-
function BinaryExpression
|
|
2233
|
+
function BinaryExpression(node, scope) {
|
|
2224
2234
|
var left, right;
|
|
2225
2235
|
return __generator(this, function (_a) {
|
|
2226
2236
|
switch (_a.label) {
|
|
2227
2237
|
case 0:
|
|
2228
2238
|
if (!(node.left.type === 'PrivateIdentifier')) return [3, 2];
|
|
2229
2239
|
left = node.left.name;
|
|
2230
|
-
return [5, __values(evaluate
|
|
2240
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2231
2241
|
case 1:
|
|
2232
2242
|
right = _a.sent();
|
|
2233
2243
|
right = right[PRIVATE];
|
|
2234
2244
|
return [3, 5];
|
|
2235
|
-
case 2: return [5, __values(evaluate
|
|
2245
|
+
case 2: return [5, __values(evaluate(node.left, scope))];
|
|
2236
2246
|
case 3:
|
|
2237
2247
|
left = _a.sent();
|
|
2238
|
-
return [5, __values(evaluate
|
|
2248
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2239
2249
|
case 4:
|
|
2240
2250
|
right = _a.sent();
|
|
2241
2251
|
_a.label = 5;
|
|
@@ -2268,7 +2278,7 @@
|
|
|
2268
2278
|
}
|
|
2269
2279
|
});
|
|
2270
2280
|
}
|
|
2271
|
-
function AssignmentExpression
|
|
2281
|
+
function AssignmentExpression(node, scope) {
|
|
2272
2282
|
var left, variable, win, value_1, value;
|
|
2273
2283
|
var _a;
|
|
2274
2284
|
return __generator(this, function (_b) {
|
|
@@ -2276,7 +2286,7 @@
|
|
|
2276
2286
|
case 0:
|
|
2277
2287
|
left = node.left;
|
|
2278
2288
|
if (!(left.type === 'Identifier')) return [3, 2];
|
|
2279
|
-
return [5, __values(Identifier
|
|
2289
|
+
return [5, __values(Identifier(left, scope, { getVar: true, throwErr: false }))];
|
|
2280
2290
|
case 1:
|
|
2281
2291
|
variable = _b.sent();
|
|
2282
2292
|
if (!variable) {
|
|
@@ -2286,16 +2296,16 @@
|
|
|
2286
2296
|
return [3, 7];
|
|
2287
2297
|
case 2:
|
|
2288
2298
|
if (!(left.type === 'MemberExpression')) return [3, 4];
|
|
2289
|
-
return [5, __values(MemberExpression
|
|
2299
|
+
return [5, __values(MemberExpression(left, scope, { getVar: true }))];
|
|
2290
2300
|
case 3:
|
|
2291
2301
|
variable = _b.sent();
|
|
2292
2302
|
return [3, 7];
|
|
2293
|
-
case 4: return [5, __values(evaluate
|
|
2303
|
+
case 4: return [5, __values(evaluate(node.right, scope))];
|
|
2294
2304
|
case 5:
|
|
2295
2305
|
value_1 = _b.sent();
|
|
2296
|
-
return [5, __values(pattern$
|
|
2306
|
+
return [5, __values(pattern$1(left, scope, { feed: value_1 }))];
|
|
2297
2307
|
case 6: return [2, _b.sent()];
|
|
2298
|
-
case 7: return [5, __values(evaluate
|
|
2308
|
+
case 7: return [5, __values(evaluate(node.right, scope))];
|
|
2299
2309
|
case 8:
|
|
2300
2310
|
value = _b.sent();
|
|
2301
2311
|
switch (node.operator) {
|
|
@@ -2352,7 +2362,7 @@
|
|
|
2352
2362
|
}
|
|
2353
2363
|
});
|
|
2354
2364
|
}
|
|
2355
|
-
function LogicalExpression
|
|
2365
|
+
function LogicalExpression(node, scope) {
|
|
2356
2366
|
var _a, _b, _c, _d;
|
|
2357
2367
|
var _e;
|
|
2358
2368
|
return __generator(this, function (_f) {
|
|
@@ -2365,30 +2375,30 @@
|
|
|
2365
2375
|
case '??': return [3, 9];
|
|
2366
2376
|
}
|
|
2367
2377
|
return [3, 14];
|
|
2368
|
-
case 1: return [5, __values(evaluate
|
|
2378
|
+
case 1: return [5, __values(evaluate(node.left, scope))];
|
|
2369
2379
|
case 2:
|
|
2370
2380
|
_b = (_f.sent());
|
|
2371
2381
|
if (_b) return [3, 4];
|
|
2372
|
-
return [5, __values(evaluate
|
|
2382
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2373
2383
|
case 3:
|
|
2374
2384
|
_b = (_f.sent());
|
|
2375
2385
|
_f.label = 4;
|
|
2376
2386
|
case 4: return [2, _b];
|
|
2377
|
-
case 5: return [5, __values(evaluate
|
|
2387
|
+
case 5: return [5, __values(evaluate(node.left, scope))];
|
|
2378
2388
|
case 6:
|
|
2379
2389
|
_c = (_f.sent());
|
|
2380
2390
|
if (!_c) return [3, 8];
|
|
2381
|
-
return [5, __values(evaluate
|
|
2391
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2382
2392
|
case 7:
|
|
2383
2393
|
_c = (_f.sent());
|
|
2384
2394
|
_f.label = 8;
|
|
2385
2395
|
case 8: return [2, _c];
|
|
2386
|
-
case 9: return [5, __values(evaluate
|
|
2396
|
+
case 9: return [5, __values(evaluate(node.left, scope))];
|
|
2387
2397
|
case 10:
|
|
2388
2398
|
if (!((_e = (_f.sent())) !== null && _e !== void 0)) return [3, 11];
|
|
2389
2399
|
_d = _e;
|
|
2390
2400
|
return [3, 13];
|
|
2391
|
-
case 11: return [5, __values(evaluate
|
|
2401
|
+
case 11: return [5, __values(evaluate(node.right, scope))];
|
|
2392
2402
|
case 12:
|
|
2393
2403
|
_d = (_f.sent());
|
|
2394
2404
|
_f.label = 13;
|
|
@@ -2397,7 +2407,7 @@
|
|
|
2397
2407
|
}
|
|
2398
2408
|
});
|
|
2399
2409
|
}
|
|
2400
|
-
function MemberExpression
|
|
2410
|
+
function MemberExpression(node, scope, options) {
|
|
2401
2411
|
var _a, getObj, _b, getVar, object, key, priv, setter, thisObject, privateKey, getter, thisObject;
|
|
2402
2412
|
if (options === void 0) { options = {}; }
|
|
2403
2413
|
return __generator(this, function (_c) {
|
|
@@ -2405,11 +2415,11 @@
|
|
|
2405
2415
|
case 0:
|
|
2406
2416
|
_a = options.getObj, getObj = _a === void 0 ? false : _a, _b = options.getVar, getVar = _b === void 0 ? false : _b;
|
|
2407
2417
|
if (!(node.object.type === 'Super')) return [3, 2];
|
|
2408
|
-
return [5, __values(Super
|
|
2418
|
+
return [5, __values(Super(node.object, scope, { getProto: true }))];
|
|
2409
2419
|
case 1:
|
|
2410
2420
|
object = _c.sent();
|
|
2411
2421
|
return [3, 4];
|
|
2412
|
-
case 2: return [5, __values(evaluate
|
|
2422
|
+
case 2: return [5, __values(evaluate(node.object, scope))];
|
|
2413
2423
|
case 3:
|
|
2414
2424
|
object = _c.sent();
|
|
2415
2425
|
_c.label = 4;
|
|
@@ -2418,7 +2428,7 @@
|
|
|
2418
2428
|
return [2, object];
|
|
2419
2429
|
priv = false;
|
|
2420
2430
|
if (!node.computed) return [3, 6];
|
|
2421
|
-
return [5, __values(evaluate
|
|
2431
|
+
return [5, __values(evaluate(node.property, scope))];
|
|
2422
2432
|
case 5:
|
|
2423
2433
|
key = _c.sent();
|
|
2424
2434
|
return [3, 7];
|
|
@@ -2466,18 +2476,18 @@
|
|
|
2466
2476
|
}
|
|
2467
2477
|
});
|
|
2468
2478
|
}
|
|
2469
|
-
function ConditionalExpression
|
|
2479
|
+
function ConditionalExpression(node, scope) {
|
|
2470
2480
|
var _a;
|
|
2471
2481
|
return __generator(this, function (_b) {
|
|
2472
2482
|
switch (_b.label) {
|
|
2473
|
-
case 0: return [5, __values(evaluate
|
|
2483
|
+
case 0: return [5, __values(evaluate(node.test, scope))];
|
|
2474
2484
|
case 1:
|
|
2475
2485
|
if (!(_b.sent())) return [3, 3];
|
|
2476
|
-
return [5, __values(evaluate
|
|
2486
|
+
return [5, __values(evaluate(node.consequent, scope))];
|
|
2477
2487
|
case 2:
|
|
2478
2488
|
_a = (_b.sent());
|
|
2479
2489
|
return [3, 5];
|
|
2480
|
-
case 3: return [5, __values(evaluate
|
|
2490
|
+
case 3: return [5, __values(evaluate(node.alternate, scope))];
|
|
2481
2491
|
case 4:
|
|
2482
2492
|
_a = (_b.sent());
|
|
2483
2493
|
_b.label = 5;
|
|
@@ -2485,13 +2495,13 @@
|
|
|
2485
2495
|
}
|
|
2486
2496
|
});
|
|
2487
2497
|
}
|
|
2488
|
-
function CallExpression
|
|
2489
|
-
var func, object, key, priv, obj, thisObject, name_1, args, i, arg, _a, _b, _c, _d, superCall;
|
|
2498
|
+
function CallExpression(node, scope) {
|
|
2499
|
+
var func, object, key, priv, obj, thisObject, name_1, args, i, arg, _a, _b, _c, _d, superCall, win;
|
|
2490
2500
|
return __generator(this, function (_e) {
|
|
2491
2501
|
switch (_e.label) {
|
|
2492
2502
|
case 0:
|
|
2493
2503
|
if (!(node.callee.type === 'MemberExpression')) return [3, 5];
|
|
2494
|
-
return [5, __values(MemberExpression
|
|
2504
|
+
return [5, __values(MemberExpression(node.callee, scope, { getObj: true }))];
|
|
2495
2505
|
case 1:
|
|
2496
2506
|
object = _e.sent();
|
|
2497
2507
|
if (node.callee.optional && object == null) {
|
|
@@ -2500,7 +2510,7 @@
|
|
|
2500
2510
|
key = void 0;
|
|
2501
2511
|
priv = false;
|
|
2502
2512
|
if (!node.callee.computed) return [3, 3];
|
|
2503
|
-
return [5, __values(evaluate
|
|
2513
|
+
return [5, __values(evaluate(node.callee.property, scope))];
|
|
2504
2514
|
case 2:
|
|
2505
2515
|
key = _e.sent();
|
|
2506
2516
|
return [3, 4];
|
|
@@ -2537,7 +2547,7 @@
|
|
|
2537
2547
|
return [3, 7];
|
|
2538
2548
|
case 5:
|
|
2539
2549
|
object = scope.find('this').get();
|
|
2540
|
-
return [5, __values(evaluate
|
|
2550
|
+
return [5, __values(evaluate(node.callee, scope))];
|
|
2541
2551
|
case 6:
|
|
2542
2552
|
func = _e.sent();
|
|
2543
2553
|
if (node.optional && func == null) {
|
|
@@ -2572,13 +2582,13 @@
|
|
|
2572
2582
|
arg = node.arguments[i];
|
|
2573
2583
|
if (!(arg.type === 'SpreadElement')) return [3, 10];
|
|
2574
2584
|
_b = (_a = args).concat;
|
|
2575
|
-
return [5, __values(SpreadElement
|
|
2585
|
+
return [5, __values(SpreadElement(arg, scope))];
|
|
2576
2586
|
case 9:
|
|
2577
2587
|
args = _b.apply(_a, [_e.sent()]);
|
|
2578
2588
|
return [3, 12];
|
|
2579
2589
|
case 10:
|
|
2580
2590
|
_d = (_c = args).push;
|
|
2581
|
-
return [5, __values(evaluate
|
|
2591
|
+
return [5, __values(evaluate(arg, scope))];
|
|
2582
2592
|
case 11:
|
|
2583
2593
|
_d.apply(_c, [_e.sent()]);
|
|
2584
2594
|
_e.label = 12;
|
|
@@ -2595,18 +2605,28 @@
|
|
|
2595
2605
|
scope.find(SUPERCALL).set(true);
|
|
2596
2606
|
}
|
|
2597
2607
|
}
|
|
2598
|
-
|
|
2599
|
-
return [2, func.apply(object
|
|
2608
|
+
try {
|
|
2609
|
+
return [2, func.apply(object, args)];
|
|
2610
|
+
}
|
|
2611
|
+
catch (err) {
|
|
2612
|
+
if (err instanceof TypeError && err.message === 'Illegal invocation'
|
|
2613
|
+
&& func.toString().indexOf('[native code]') !== -1) {
|
|
2614
|
+
win = scope.global().find('window').get();
|
|
2615
|
+
if (win && win[WINDOW]) {
|
|
2616
|
+
return [2, func.apply(win[WINDOW], args)];
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
throw err;
|
|
2600
2620
|
}
|
|
2601
|
-
return [2
|
|
2621
|
+
return [2];
|
|
2602
2622
|
}
|
|
2603
2623
|
});
|
|
2604
2624
|
}
|
|
2605
|
-
function NewExpression
|
|
2625
|
+
function NewExpression(node, scope) {
|
|
2606
2626
|
var constructor, name_2, args, i, arg, _a, _b, _c, _d;
|
|
2607
2627
|
return __generator(this, function (_e) {
|
|
2608
2628
|
switch (_e.label) {
|
|
2609
|
-
case 0: return [5, __values(evaluate
|
|
2629
|
+
case 0: return [5, __values(evaluate(node.callee, scope))];
|
|
2610
2630
|
case 1:
|
|
2611
2631
|
constructor = _e.sent();
|
|
2612
2632
|
if (typeof constructor !== 'function') {
|
|
@@ -2634,13 +2654,13 @@
|
|
|
2634
2654
|
arg = node.arguments[i];
|
|
2635
2655
|
if (!(arg.type === 'SpreadElement')) return [3, 4];
|
|
2636
2656
|
_b = (_a = args).concat;
|
|
2637
|
-
return [5, __values(SpreadElement
|
|
2657
|
+
return [5, __values(SpreadElement(arg, scope))];
|
|
2638
2658
|
case 3:
|
|
2639
2659
|
args = _b.apply(_a, [_e.sent()]);
|
|
2640
2660
|
return [3, 6];
|
|
2641
2661
|
case 4:
|
|
2642
2662
|
_d = (_c = args).push;
|
|
2643
|
-
return [5, __values(evaluate
|
|
2663
|
+
return [5, __values(evaluate(arg, scope))];
|
|
2644
2664
|
case 5:
|
|
2645
2665
|
_d.apply(_c, [_e.sent()]);
|
|
2646
2666
|
_e.label = 6;
|
|
@@ -2651,7 +2671,7 @@
|
|
|
2651
2671
|
}
|
|
2652
2672
|
});
|
|
2653
2673
|
}
|
|
2654
|
-
function MetaProperty
|
|
2674
|
+
function MetaProperty(node, scope) {
|
|
2655
2675
|
return __generator(this, function (_a) {
|
|
2656
2676
|
if (node.meta.name === 'new' && node.property.name === 'target') {
|
|
2657
2677
|
return [2, scope.find(NEWTARGET).get()];
|
|
@@ -2662,7 +2682,7 @@
|
|
|
2662
2682
|
return [2];
|
|
2663
2683
|
});
|
|
2664
2684
|
}
|
|
2665
|
-
function SequenceExpression
|
|
2685
|
+
function SequenceExpression(node, scope) {
|
|
2666
2686
|
var result, i;
|
|
2667
2687
|
return __generator(this, function (_a) {
|
|
2668
2688
|
switch (_a.label) {
|
|
@@ -2671,7 +2691,7 @@
|
|
|
2671
2691
|
_a.label = 1;
|
|
2672
2692
|
case 1:
|
|
2673
2693
|
if (!(i < node.expressions.length)) return [3, 4];
|
|
2674
|
-
return [5, __values(evaluate
|
|
2694
|
+
return [5, __values(evaluate(node.expressions[i], scope))];
|
|
2675
2695
|
case 2:
|
|
2676
2696
|
result = _a.sent();
|
|
2677
2697
|
_a.label = 3;
|
|
@@ -2682,12 +2702,12 @@
|
|
|
2682
2702
|
}
|
|
2683
2703
|
});
|
|
2684
2704
|
}
|
|
2685
|
-
function ArrowFunctionExpression
|
|
2705
|
+
function ArrowFunctionExpression(node, scope) {
|
|
2686
2706
|
return __generator(this, function (_a) {
|
|
2687
|
-
return [2, createFunc(node, scope)];
|
|
2707
|
+
return [2, createFunc$1(node, scope)];
|
|
2688
2708
|
});
|
|
2689
2709
|
}
|
|
2690
|
-
function TemplateLiteral
|
|
2710
|
+
function TemplateLiteral(node, scope) {
|
|
2691
2711
|
var quasis, expressions, result, temEl, expr, _a, _b;
|
|
2692
2712
|
return __generator(this, function (_c) {
|
|
2693
2713
|
switch (_c.label) {
|
|
@@ -2699,13 +2719,13 @@
|
|
|
2699
2719
|
case 1:
|
|
2700
2720
|
if (!(temEl = quasis.shift())) return [3, 5];
|
|
2701
2721
|
_a = result;
|
|
2702
|
-
return [5, __values(TemplateElement
|
|
2722
|
+
return [5, __values(TemplateElement(temEl))];
|
|
2703
2723
|
case 2:
|
|
2704
2724
|
result = _a + _c.sent();
|
|
2705
2725
|
expr = expressions.shift();
|
|
2706
2726
|
if (!expr) return [3, 4];
|
|
2707
2727
|
_b = result;
|
|
2708
|
-
return [5, __values(evaluate
|
|
2728
|
+
return [5, __values(evaluate(expr, scope))];
|
|
2709
2729
|
case 3:
|
|
2710
2730
|
result = _b + _c.sent();
|
|
2711
2731
|
_c.label = 4;
|
|
@@ -2714,11 +2734,11 @@
|
|
|
2714
2734
|
}
|
|
2715
2735
|
});
|
|
2716
2736
|
}
|
|
2717
|
-
function TaggedTemplateExpression
|
|
2737
|
+
function TaggedTemplateExpression(node, scope) {
|
|
2718
2738
|
var tagFunc, quasis, str, raw, expressions, args, i, _a, _b;
|
|
2719
2739
|
return __generator(this, function (_c) {
|
|
2720
2740
|
switch (_c.label) {
|
|
2721
|
-
case 0: return [5, __values(evaluate
|
|
2741
|
+
case 0: return [5, __values(evaluate(node.tag, scope))];
|
|
2722
2742
|
case 1:
|
|
2723
2743
|
tagFunc = _c.sent();
|
|
2724
2744
|
quasis = node.quasi.quasis;
|
|
@@ -2735,7 +2755,7 @@
|
|
|
2735
2755
|
case 2:
|
|
2736
2756
|
if (!(i < expressions.length)) return [3, 5];
|
|
2737
2757
|
_b = (_a = args).push;
|
|
2738
|
-
return [5, __values(evaluate
|
|
2758
|
+
return [5, __values(evaluate(expressions[i], scope))];
|
|
2739
2759
|
case 3:
|
|
2740
2760
|
_b.apply(_a, [_c.sent()]);
|
|
2741
2761
|
_c.label = 4;
|
|
@@ -2746,29 +2766,29 @@
|
|
|
2746
2766
|
}
|
|
2747
2767
|
});
|
|
2748
2768
|
}
|
|
2749
|
-
function TemplateElement
|
|
2769
|
+
function TemplateElement(node, scope) {
|
|
2750
2770
|
return __generator(this, function (_a) {
|
|
2751
2771
|
return [2, node.value.raw];
|
|
2752
2772
|
});
|
|
2753
2773
|
}
|
|
2754
|
-
function ClassExpression
|
|
2774
|
+
function ClassExpression(node, scope) {
|
|
2755
2775
|
var tmpScope, klass;
|
|
2756
2776
|
return __generator(this, function (_a) {
|
|
2757
2777
|
switch (_a.label) {
|
|
2758
2778
|
case 0:
|
|
2759
2779
|
if (!(node.id && node.id.name)) return [3, 2];
|
|
2760
2780
|
tmpScope = new Scope(scope);
|
|
2761
|
-
return [5, __values(createClass(node, tmpScope))];
|
|
2781
|
+
return [5, __values(createClass$1(node, tmpScope))];
|
|
2762
2782
|
case 1:
|
|
2763
2783
|
klass = _a.sent();
|
|
2764
2784
|
tmpScope.const(node.id.name, klass);
|
|
2765
2785
|
return [2, klass];
|
|
2766
|
-
case 2: return [5, __values(createClass(node, scope))];
|
|
2786
|
+
case 2: return [5, __values(createClass$1(node, scope))];
|
|
2767
2787
|
case 3: return [2, _a.sent()];
|
|
2768
2788
|
}
|
|
2769
2789
|
});
|
|
2770
2790
|
}
|
|
2771
|
-
function Super
|
|
2791
|
+
function Super(node, scope, options) {
|
|
2772
2792
|
var _a, getProto, superClass;
|
|
2773
2793
|
if (options === void 0) { options = {}; }
|
|
2774
2794
|
return __generator(this, function (_b) {
|
|
@@ -2777,29 +2797,32 @@
|
|
|
2777
2797
|
return [2, getProto ? superClass.prototype : superClass];
|
|
2778
2798
|
});
|
|
2779
2799
|
}
|
|
2780
|
-
function SpreadElement
|
|
2800
|
+
function SpreadElement(node, scope) {
|
|
2801
|
+
var result;
|
|
2781
2802
|
return __generator(this, function (_a) {
|
|
2782
2803
|
switch (_a.label) {
|
|
2783
|
-
case 0: return [5, __values(evaluate
|
|
2784
|
-
case 1:
|
|
2804
|
+
case 0: return [5, __values(evaluate(node.argument, scope))];
|
|
2805
|
+
case 1:
|
|
2806
|
+
result = _a.sent();
|
|
2807
|
+
return [2, typeof result === 'string' ? __spread(result) : result];
|
|
2785
2808
|
}
|
|
2786
2809
|
});
|
|
2787
2810
|
}
|
|
2788
|
-
function ChainExpression
|
|
2811
|
+
function ChainExpression(node, scope) {
|
|
2789
2812
|
return __generator(this, function (_a) {
|
|
2790
2813
|
switch (_a.label) {
|
|
2791
|
-
case 0: return [5, __values(evaluate
|
|
2814
|
+
case 0: return [5, __values(evaluate(node.expression, scope))];
|
|
2792
2815
|
case 1: return [2, _a.sent()];
|
|
2793
2816
|
}
|
|
2794
2817
|
});
|
|
2795
2818
|
}
|
|
2796
|
-
function ImportExpression
|
|
2819
|
+
function ImportExpression(node, scope) {
|
|
2797
2820
|
var globalScope, source, module, value, result;
|
|
2798
2821
|
return __generator(this, function (_a) {
|
|
2799
2822
|
switch (_a.label) {
|
|
2800
2823
|
case 0:
|
|
2801
2824
|
globalScope = scope.global();
|
|
2802
|
-
return [5, __values(evaluate
|
|
2825
|
+
return [5, __values(evaluate(node.source, scope))];
|
|
2803
2826
|
case 1:
|
|
2804
2827
|
source = _a.sent();
|
|
2805
2828
|
module = globalScope.find(IMPORT + source);
|
|
@@ -2825,7 +2848,7 @@
|
|
|
2825
2848
|
var res, _a;
|
|
2826
2849
|
return __generator(this, function (_b) {
|
|
2827
2850
|
switch (_b.label) {
|
|
2828
|
-
case 0: return [5, __values(evaluate
|
|
2851
|
+
case 0: return [5, __values(evaluate(node.argument, scope))];
|
|
2829
2852
|
case 1:
|
|
2830
2853
|
res = _b.sent();
|
|
2831
2854
|
if (!node.delegate) return [3, 3];
|
|
@@ -2847,7 +2870,7 @@
|
|
|
2847
2870
|
switch (_b.label) {
|
|
2848
2871
|
case 0:
|
|
2849
2872
|
_a = AWAIT;
|
|
2850
|
-
return [5, __values(evaluate
|
|
2873
|
+
return [5, __values(evaluate(node.argument, scope))];
|
|
2851
2874
|
case 1:
|
|
2852
2875
|
_a.RES = _b.sent();
|
|
2853
2876
|
return [4, AWAIT];
|
|
@@ -2856,37 +2879,37 @@
|
|
|
2856
2879
|
});
|
|
2857
2880
|
}
|
|
2858
2881
|
|
|
2859
|
-
var expression
|
|
2882
|
+
var expression = /*#__PURE__*/Object.freeze({
|
|
2860
2883
|
__proto__: null,
|
|
2861
|
-
ThisExpression: ThisExpression
|
|
2862
|
-
ArrayExpression: ArrayExpression
|
|
2863
|
-
ObjectExpression: ObjectExpression
|
|
2864
|
-
FunctionExpression: FunctionExpression
|
|
2865
|
-
UnaryExpression: UnaryExpression
|
|
2866
|
-
UpdateExpression: UpdateExpression
|
|
2867
|
-
BinaryExpression: BinaryExpression
|
|
2868
|
-
AssignmentExpression: AssignmentExpression
|
|
2869
|
-
LogicalExpression: LogicalExpression
|
|
2870
|
-
MemberExpression: MemberExpression
|
|
2871
|
-
ConditionalExpression: ConditionalExpression
|
|
2872
|
-
CallExpression: CallExpression
|
|
2873
|
-
NewExpression: NewExpression
|
|
2874
|
-
MetaProperty: MetaProperty
|
|
2875
|
-
SequenceExpression: SequenceExpression
|
|
2876
|
-
ArrowFunctionExpression: ArrowFunctionExpression
|
|
2877
|
-
TemplateLiteral: TemplateLiteral
|
|
2878
|
-
TaggedTemplateExpression: TaggedTemplateExpression
|
|
2879
|
-
TemplateElement: TemplateElement
|
|
2880
|
-
ClassExpression: ClassExpression
|
|
2881
|
-
Super: Super
|
|
2882
|
-
SpreadElement: SpreadElement
|
|
2883
|
-
ChainExpression: ChainExpression
|
|
2884
|
-
ImportExpression: ImportExpression
|
|
2884
|
+
ThisExpression: ThisExpression,
|
|
2885
|
+
ArrayExpression: ArrayExpression,
|
|
2886
|
+
ObjectExpression: ObjectExpression,
|
|
2887
|
+
FunctionExpression: FunctionExpression,
|
|
2888
|
+
UnaryExpression: UnaryExpression,
|
|
2889
|
+
UpdateExpression: UpdateExpression,
|
|
2890
|
+
BinaryExpression: BinaryExpression,
|
|
2891
|
+
AssignmentExpression: AssignmentExpression,
|
|
2892
|
+
LogicalExpression: LogicalExpression,
|
|
2893
|
+
MemberExpression: MemberExpression,
|
|
2894
|
+
ConditionalExpression: ConditionalExpression,
|
|
2895
|
+
CallExpression: CallExpression,
|
|
2896
|
+
NewExpression: NewExpression,
|
|
2897
|
+
MetaProperty: MetaProperty,
|
|
2898
|
+
SequenceExpression: SequenceExpression,
|
|
2899
|
+
ArrowFunctionExpression: ArrowFunctionExpression,
|
|
2900
|
+
TemplateLiteral: TemplateLiteral,
|
|
2901
|
+
TaggedTemplateExpression: TaggedTemplateExpression,
|
|
2902
|
+
TemplateElement: TemplateElement,
|
|
2903
|
+
ClassExpression: ClassExpression,
|
|
2904
|
+
Super: Super,
|
|
2905
|
+
SpreadElement: SpreadElement,
|
|
2906
|
+
ChainExpression: ChainExpression,
|
|
2907
|
+
ImportExpression: ImportExpression,
|
|
2885
2908
|
YieldExpression: YieldExpression,
|
|
2886
2909
|
AwaitExpression: AwaitExpression
|
|
2887
2910
|
});
|
|
2888
2911
|
|
|
2889
|
-
function ObjectPattern
|
|
2912
|
+
function ObjectPattern(node, scope, options) {
|
|
2890
2913
|
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, fedKeys, i, property, value, key, value, rest, i_1;
|
|
2891
2914
|
if (options === void 0) { options = {}; }
|
|
2892
2915
|
return __generator(this, function (_e) {
|
|
@@ -2906,12 +2929,12 @@
|
|
|
2906
2929
|
if (!(value.type === 'Identifier')) return [3, 2];
|
|
2907
2930
|
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2908
2931
|
return [3, 4];
|
|
2909
|
-
case 2: return [5, __values(pattern$
|
|
2932
|
+
case 2: return [5, __values(pattern$1(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2910
2933
|
case 3:
|
|
2911
2934
|
_e.sent();
|
|
2912
2935
|
_e.label = 4;
|
|
2913
2936
|
case 4: return [3, 7];
|
|
2914
|
-
case 5: return [5, __values(RestElement
|
|
2937
|
+
case 5: return [5, __values(RestElement(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2915
2938
|
case 6:
|
|
2916
2939
|
_e.sent();
|
|
2917
2940
|
_e.label = 7;
|
|
@@ -2920,7 +2943,7 @@
|
|
|
2920
2943
|
if (!(property.type === 'Property')) return [3, 15];
|
|
2921
2944
|
key = void 0;
|
|
2922
2945
|
if (!property.computed) return [3, 10];
|
|
2923
|
-
return [5, __values(evaluate
|
|
2946
|
+
return [5, __values(evaluate(property.key, scope))];
|
|
2924
2947
|
case 9:
|
|
2925
2948
|
key = _e.sent();
|
|
2926
2949
|
return [3, 11];
|
|
@@ -2933,7 +2956,7 @@
|
|
|
2933
2956
|
if (!(value.type === 'Identifier')) return [3, 12];
|
|
2934
2957
|
scope[kind](value.name, feed[key]);
|
|
2935
2958
|
return [3, 14];
|
|
2936
|
-
case 12: return [5, __values(pattern$
|
|
2959
|
+
case 12: return [5, __values(pattern$1(value, scope, { kind: kind, feed: feed[key] }))];
|
|
2937
2960
|
case 13:
|
|
2938
2961
|
_e.sent();
|
|
2939
2962
|
_e.label = 14;
|
|
@@ -2942,7 +2965,7 @@
|
|
|
2942
2965
|
rest = assign({}, feed);
|
|
2943
2966
|
for (i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
2944
2967
|
delete rest[fedKeys[i_1]];
|
|
2945
|
-
return [5, __values(RestElement
|
|
2968
|
+
return [5, __values(RestElement(property, scope, { kind: kind, feed: rest }))];
|
|
2946
2969
|
case 16:
|
|
2947
2970
|
_e.sent();
|
|
2948
2971
|
_e.label = 17;
|
|
@@ -2953,7 +2976,7 @@
|
|
|
2953
2976
|
}
|
|
2954
2977
|
});
|
|
2955
2978
|
}
|
|
2956
|
-
function ArrayPattern
|
|
2979
|
+
function ArrayPattern(node, scope, options) {
|
|
2957
2980
|
var kind, _a, hoist, _b, onlyBlock, _c, feed, result, i, element, variable;
|
|
2958
2981
|
if (options === void 0) { options = {}; }
|
|
2959
2982
|
return __generator(this, function (_d) {
|
|
@@ -2973,7 +2996,7 @@
|
|
|
2973
2996
|
if (!(element.type === 'Identifier')) return [3, 2];
|
|
2974
2997
|
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2975
2998
|
return [3, 4];
|
|
2976
|
-
case 2: return [5, __values(pattern$
|
|
2999
|
+
case 2: return [5, __values(pattern$1(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2977
3000
|
case 3:
|
|
2978
3001
|
_d.sent();
|
|
2979
3002
|
_d.label = 4;
|
|
@@ -2983,7 +3006,7 @@
|
|
|
2983
3006
|
if (!kind) return [3, 6];
|
|
2984
3007
|
scope[kind](element.name, feed[i]);
|
|
2985
3008
|
return [3, 8];
|
|
2986
|
-
case 6: return [5, __values(Identifier
|
|
3009
|
+
case 6: return [5, __values(Identifier(element, scope, { getVar: true }))];
|
|
2987
3010
|
case 7:
|
|
2988
3011
|
variable = _d.sent();
|
|
2989
3012
|
variable.set(feed[i]);
|
|
@@ -2992,11 +3015,11 @@
|
|
|
2992
3015
|
case 8: return [3, 13];
|
|
2993
3016
|
case 9:
|
|
2994
3017
|
if (!(element.type === 'RestElement')) return [3, 11];
|
|
2995
|
-
return [5, __values(RestElement
|
|
3018
|
+
return [5, __values(RestElement(element, scope, { kind: kind, feed: feed.slice(i) }))];
|
|
2996
3019
|
case 10:
|
|
2997
3020
|
_d.sent();
|
|
2998
3021
|
return [3, 13];
|
|
2999
|
-
case 11: return [5, __values(pattern$
|
|
3022
|
+
case 11: return [5, __values(pattern$1(element, scope, { kind: kind, feed: feed[i] }))];
|
|
3000
3023
|
case 12:
|
|
3001
3024
|
_d.sent();
|
|
3002
3025
|
_d.label = 13;
|
|
@@ -3011,7 +3034,7 @@
|
|
|
3011
3034
|
}
|
|
3012
3035
|
});
|
|
3013
3036
|
}
|
|
3014
|
-
function RestElement
|
|
3037
|
+
function RestElement(node, scope, options) {
|
|
3015
3038
|
var kind, _a, hoist, _b, onlyBlock, _c, feed, arg, variable;
|
|
3016
3039
|
if (options === void 0) { options = {}; }
|
|
3017
3040
|
return __generator(this, function (_d) {
|
|
@@ -3024,7 +3047,7 @@
|
|
|
3024
3047
|
if (!(arg.type === 'Identifier')) return [3, 1];
|
|
3025
3048
|
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3026
3049
|
return [3, 3];
|
|
3027
|
-
case 1: return [5, __values(pattern$
|
|
3050
|
+
case 1: return [5, __values(pattern$1(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3028
3051
|
case 2:
|
|
3029
3052
|
_d.sent();
|
|
3030
3053
|
_d.label = 3;
|
|
@@ -3034,13 +3057,13 @@
|
|
|
3034
3057
|
if (!kind) return [3, 5];
|
|
3035
3058
|
scope[kind](arg.name, feed);
|
|
3036
3059
|
return [3, 7];
|
|
3037
|
-
case 5: return [5, __values(Identifier
|
|
3060
|
+
case 5: return [5, __values(Identifier(arg, scope, { getVar: true }))];
|
|
3038
3061
|
case 6:
|
|
3039
3062
|
variable = _d.sent();
|
|
3040
3063
|
variable.set(feed);
|
|
3041
3064
|
_d.label = 7;
|
|
3042
3065
|
case 7: return [3, 10];
|
|
3043
|
-
case 8: return [5, __values(pattern$
|
|
3066
|
+
case 8: return [5, __values(pattern$1(arg, scope, { kind: kind, feed: feed }))];
|
|
3044
3067
|
case 9:
|
|
3045
3068
|
_d.sent();
|
|
3046
3069
|
_d.label = 10;
|
|
@@ -3048,7 +3071,7 @@
|
|
|
3048
3071
|
}
|
|
3049
3072
|
});
|
|
3050
3073
|
}
|
|
3051
|
-
function AssignmentPattern
|
|
3074
|
+
function AssignmentPattern(node, scope, options) {
|
|
3052
3075
|
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, _e, left;
|
|
3053
3076
|
if (options === void 0) { options = {}; }
|
|
3054
3077
|
return __generator(this, function (_f) {
|
|
@@ -3056,7 +3079,7 @@
|
|
|
3056
3079
|
case 0:
|
|
3057
3080
|
_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
3081
|
if (!(_d === void 0)) return [3, 2];
|
|
3059
|
-
return [5, __values(evaluate
|
|
3082
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
3060
3083
|
case 1:
|
|
3061
3084
|
_e = _f.sent();
|
|
3062
3085
|
return [3, 3];
|
|
@@ -3071,7 +3094,7 @@
|
|
|
3071
3094
|
if (!(left.type === 'Identifier')) return [3, 4];
|
|
3072
3095
|
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3073
3096
|
return [3, 6];
|
|
3074
|
-
case 4: return [5, __values(pattern$
|
|
3097
|
+
case 4: return [5, __values(pattern$1(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3075
3098
|
case 5:
|
|
3076
3099
|
_f.sent();
|
|
3077
3100
|
_f.label = 6;
|
|
@@ -3080,7 +3103,7 @@
|
|
|
3080
3103
|
if (!(left.type === 'Identifier')) return [3, 8];
|
|
3081
3104
|
scope[kind](left.name, feed);
|
|
3082
3105
|
return [3, 10];
|
|
3083
|
-
case 8: return [5, __values(pattern$
|
|
3106
|
+
case 8: return [5, __values(pattern$1(left, scope, { kind: kind, feed: feed }))];
|
|
3084
3107
|
case 9:
|
|
3085
3108
|
_f.sent();
|
|
3086
3109
|
_f.label = 10;
|
|
@@ -3089,26 +3112,26 @@
|
|
|
3089
3112
|
});
|
|
3090
3113
|
}
|
|
3091
3114
|
|
|
3092
|
-
var pattern$
|
|
3115
|
+
var pattern$2 = /*#__PURE__*/Object.freeze({
|
|
3093
3116
|
__proto__: null,
|
|
3094
|
-
ObjectPattern: ObjectPattern
|
|
3095
|
-
ArrayPattern: ArrayPattern
|
|
3096
|
-
RestElement: RestElement
|
|
3097
|
-
AssignmentPattern: AssignmentPattern
|
|
3117
|
+
ObjectPattern: ObjectPattern,
|
|
3118
|
+
ArrayPattern: ArrayPattern,
|
|
3119
|
+
RestElement: RestElement,
|
|
3120
|
+
AssignmentPattern: AssignmentPattern
|
|
3098
3121
|
});
|
|
3099
3122
|
|
|
3100
|
-
var evaluateOps
|
|
3101
|
-
function evaluate
|
|
3123
|
+
var evaluateOps;
|
|
3124
|
+
function evaluate(node, scope) {
|
|
3102
3125
|
var handler;
|
|
3103
3126
|
return __generator(this, function (_a) {
|
|
3104
3127
|
switch (_a.label) {
|
|
3105
3128
|
case 0:
|
|
3106
3129
|
if (!node)
|
|
3107
3130
|
return [2];
|
|
3108
|
-
if (!evaluateOps
|
|
3109
|
-
evaluateOps
|
|
3131
|
+
if (!evaluateOps) {
|
|
3132
|
+
evaluateOps = assign({}, declaration, expression, identifier, statement, literal, pattern$2);
|
|
3110
3133
|
}
|
|
3111
|
-
handler = evaluateOps
|
|
3134
|
+
handler = evaluateOps[node.type];
|
|
3112
3135
|
if (!handler) return [3, 2];
|
|
3113
3136
|
return [5, __values(handler(node, scope))];
|
|
3114
3137
|
case 1: return [2, _a.sent()];
|
|
@@ -3117,17 +3140,17 @@
|
|
|
3117
3140
|
});
|
|
3118
3141
|
}
|
|
3119
3142
|
|
|
3120
|
-
function ExpressionStatement
|
|
3143
|
+
function ExpressionStatement(node, scope) {
|
|
3121
3144
|
return __generator(this, function (_a) {
|
|
3122
3145
|
switch (_a.label) {
|
|
3123
|
-
case 0: return [5, __values(evaluate
|
|
3146
|
+
case 0: return [5, __values(evaluate(node.expression, scope))];
|
|
3124
3147
|
case 1:
|
|
3125
3148
|
_a.sent();
|
|
3126
3149
|
return [2];
|
|
3127
3150
|
}
|
|
3128
3151
|
});
|
|
3129
3152
|
}
|
|
3130
|
-
function BlockStatement
|
|
3153
|
+
function BlockStatement(block, scope, options) {
|
|
3131
3154
|
var _a, invasived, _b, hoisted, subScope, i, result;
|
|
3132
3155
|
if (options === void 0) { options = {}; }
|
|
3133
3156
|
return __generator(this, function (_c) {
|
|
@@ -3136,7 +3159,7 @@
|
|
|
3136
3159
|
_a = options.invasived, invasived = _a === void 0 ? false : _a, _b = options.hoisted, hoisted = _b === void 0 ? false : _b;
|
|
3137
3160
|
subScope = invasived ? scope : new Scope(scope);
|
|
3138
3161
|
if (!!hoisted) return [3, 2];
|
|
3139
|
-
return [5, __values(hoist(block, subScope, { onlyBlock: true }))];
|
|
3162
|
+
return [5, __values(hoist$1(block, subScope, { onlyBlock: true }))];
|
|
3140
3163
|
case 1:
|
|
3141
3164
|
_c.sent();
|
|
3142
3165
|
_c.label = 2;
|
|
@@ -3145,7 +3168,7 @@
|
|
|
3145
3168
|
_c.label = 3;
|
|
3146
3169
|
case 3:
|
|
3147
3170
|
if (!(i < block.body.length)) return [3, 6];
|
|
3148
|
-
return [5, __values(evaluate
|
|
3171
|
+
return [5, __values(evaluate(block.body[i], subScope))];
|
|
3149
3172
|
case 4:
|
|
3150
3173
|
result = _c.sent();
|
|
3151
3174
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
@@ -3159,25 +3182,25 @@
|
|
|
3159
3182
|
}
|
|
3160
3183
|
});
|
|
3161
3184
|
}
|
|
3162
|
-
function EmptyStatement
|
|
3185
|
+
function EmptyStatement() {
|
|
3163
3186
|
return __generator(this, function (_a) {
|
|
3164
3187
|
return [2];
|
|
3165
3188
|
});
|
|
3166
3189
|
}
|
|
3167
|
-
function DebuggerStatement
|
|
3190
|
+
function DebuggerStatement() {
|
|
3168
3191
|
return __generator(this, function (_a) {
|
|
3169
3192
|
debugger;
|
|
3170
3193
|
return [2];
|
|
3171
3194
|
});
|
|
3172
3195
|
}
|
|
3173
|
-
function ReturnStatement
|
|
3196
|
+
function ReturnStatement(node, scope) {
|
|
3174
3197
|
var _a, _b;
|
|
3175
3198
|
return __generator(this, function (_c) {
|
|
3176
3199
|
switch (_c.label) {
|
|
3177
3200
|
case 0:
|
|
3178
3201
|
_a = RETURN;
|
|
3179
3202
|
if (!node.argument) return [3, 2];
|
|
3180
|
-
return [5, __values(evaluate
|
|
3203
|
+
return [5, __values(evaluate(node.argument, scope))];
|
|
3181
3204
|
case 1:
|
|
3182
3205
|
_b = (_c.sent());
|
|
3183
3206
|
return [3, 3];
|
|
@@ -3190,34 +3213,34 @@
|
|
|
3190
3213
|
}
|
|
3191
3214
|
});
|
|
3192
3215
|
}
|
|
3193
|
-
function BreakStatement
|
|
3216
|
+
function BreakStatement() {
|
|
3194
3217
|
return __generator(this, function (_a) {
|
|
3195
3218
|
return [2, BREAK];
|
|
3196
3219
|
});
|
|
3197
3220
|
}
|
|
3198
|
-
function ContinueStatement
|
|
3221
|
+
function ContinueStatement() {
|
|
3199
3222
|
return __generator(this, function (_a) {
|
|
3200
3223
|
return [2, CONTINUE];
|
|
3201
3224
|
});
|
|
3202
3225
|
}
|
|
3203
|
-
function IfStatement
|
|
3226
|
+
function IfStatement(node, scope) {
|
|
3204
3227
|
return __generator(this, function (_a) {
|
|
3205
3228
|
switch (_a.label) {
|
|
3206
|
-
case 0: return [5, __values(evaluate
|
|
3229
|
+
case 0: return [5, __values(evaluate(node.test, scope))];
|
|
3207
3230
|
case 1:
|
|
3208
3231
|
if (!_a.sent()) return [3, 3];
|
|
3209
|
-
return [5, __values(evaluate
|
|
3232
|
+
return [5, __values(evaluate(node.consequent, scope))];
|
|
3210
3233
|
case 2: return [2, _a.sent()];
|
|
3211
|
-
case 3: return [5, __values(evaluate
|
|
3234
|
+
case 3: return [5, __values(evaluate(node.alternate, scope))];
|
|
3212
3235
|
case 4: return [2, _a.sent()];
|
|
3213
3236
|
}
|
|
3214
3237
|
});
|
|
3215
3238
|
}
|
|
3216
|
-
function SwitchStatement
|
|
3239
|
+
function SwitchStatement(node, scope) {
|
|
3217
3240
|
var discriminant, matched, i, eachCase, _a, _b, result;
|
|
3218
3241
|
return __generator(this, function (_c) {
|
|
3219
3242
|
switch (_c.label) {
|
|
3220
|
-
case 0: return [5, __values(evaluate
|
|
3243
|
+
case 0: return [5, __values(evaluate(node.discriminant, scope))];
|
|
3221
3244
|
case 1:
|
|
3222
3245
|
discriminant = _c.sent();
|
|
3223
3246
|
matched = false;
|
|
@@ -3230,7 +3253,7 @@
|
|
|
3230
3253
|
if (!_a) return [3, 5];
|
|
3231
3254
|
_b = !eachCase.test;
|
|
3232
3255
|
if (_b) return [3, 4];
|
|
3233
|
-
return [5, __values(evaluate
|
|
3256
|
+
return [5, __values(evaluate(eachCase.test, scope))];
|
|
3234
3257
|
case 3:
|
|
3235
3258
|
_b = (_c.sent()) === discriminant;
|
|
3236
3259
|
_c.label = 4;
|
|
@@ -3242,7 +3265,7 @@
|
|
|
3242
3265
|
matched = true;
|
|
3243
3266
|
}
|
|
3244
3267
|
if (!matched) return [3, 7];
|
|
3245
|
-
return [5, __values(SwitchCase
|
|
3268
|
+
return [5, __values(SwitchCase(eachCase, scope))];
|
|
3246
3269
|
case 6:
|
|
3247
3270
|
result = _c.sent();
|
|
3248
3271
|
if (result === BREAK) {
|
|
@@ -3259,7 +3282,7 @@
|
|
|
3259
3282
|
}
|
|
3260
3283
|
});
|
|
3261
3284
|
}
|
|
3262
|
-
function SwitchCase
|
|
3285
|
+
function SwitchCase(node, scope) {
|
|
3263
3286
|
var i, result;
|
|
3264
3287
|
return __generator(this, function (_a) {
|
|
3265
3288
|
switch (_a.label) {
|
|
@@ -3268,7 +3291,7 @@
|
|
|
3268
3291
|
_a.label = 1;
|
|
3269
3292
|
case 1:
|
|
3270
3293
|
if (!(i < node.consequent.length)) return [3, 4];
|
|
3271
|
-
return [5, __values(evaluate
|
|
3294
|
+
return [5, __values(evaluate(node.consequent[i], scope))];
|
|
3272
3295
|
case 2:
|
|
3273
3296
|
result = _a.sent();
|
|
3274
3297
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
@@ -3282,21 +3305,21 @@
|
|
|
3282
3305
|
}
|
|
3283
3306
|
});
|
|
3284
3307
|
}
|
|
3285
|
-
function ThrowStatement
|
|
3308
|
+
function ThrowStatement(node, scope) {
|
|
3286
3309
|
return __generator(this, function (_a) {
|
|
3287
3310
|
switch (_a.label) {
|
|
3288
|
-
case 0: return [5, __values(evaluate
|
|
3311
|
+
case 0: return [5, __values(evaluate(node.argument, scope))];
|
|
3289
3312
|
case 1: throw _a.sent();
|
|
3290
3313
|
}
|
|
3291
3314
|
});
|
|
3292
3315
|
}
|
|
3293
|
-
function TryStatement
|
|
3316
|
+
function TryStatement(node, scope) {
|
|
3294
3317
|
var err_1, subScope, param, name_1, result;
|
|
3295
3318
|
return __generator(this, function (_a) {
|
|
3296
3319
|
switch (_a.label) {
|
|
3297
3320
|
case 0:
|
|
3298
3321
|
_a.trys.push([0, 2, 9, 12]);
|
|
3299
|
-
return [5, __values(BlockStatement
|
|
3322
|
+
return [5, __values(BlockStatement(node.block, scope))];
|
|
3300
3323
|
case 1: return [2, _a.sent()];
|
|
3301
3324
|
case 2:
|
|
3302
3325
|
err_1 = _a.sent();
|
|
@@ -3308,17 +3331,17 @@
|
|
|
3308
3331
|
name_1 = param.name;
|
|
3309
3332
|
subScope.var(name_1, err_1);
|
|
3310
3333
|
return [3, 5];
|
|
3311
|
-
case 3: return [5, __values(pattern$
|
|
3334
|
+
case 3: return [5, __values(pattern$1(param, scope, { feed: err_1 }))];
|
|
3312
3335
|
case 4:
|
|
3313
3336
|
_a.sent();
|
|
3314
3337
|
_a.label = 5;
|
|
3315
|
-
case 5: return [5, __values(CatchClause
|
|
3338
|
+
case 5: return [5, __values(CatchClause(node.handler, subScope))];
|
|
3316
3339
|
case 6: return [2, _a.sent()];
|
|
3317
3340
|
case 7: throw err_1;
|
|
3318
3341
|
case 8: return [3, 12];
|
|
3319
3342
|
case 9:
|
|
3320
3343
|
if (!node.finalizer) return [3, 11];
|
|
3321
|
-
return [5, __values(BlockStatement
|
|
3344
|
+
return [5, __values(BlockStatement(node.finalizer, scope))];
|
|
3322
3345
|
case 10:
|
|
3323
3346
|
result = _a.sent();
|
|
3324
3347
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
@@ -3330,22 +3353,22 @@
|
|
|
3330
3353
|
}
|
|
3331
3354
|
});
|
|
3332
3355
|
}
|
|
3333
|
-
function CatchClause
|
|
3356
|
+
function CatchClause(node, scope) {
|
|
3334
3357
|
return __generator(this, function (_a) {
|
|
3335
3358
|
switch (_a.label) {
|
|
3336
|
-
case 0: return [5, __values(BlockStatement
|
|
3359
|
+
case 0: return [5, __values(BlockStatement(node.body, scope, { invasived: true }))];
|
|
3337
3360
|
case 1: return [2, _a.sent()];
|
|
3338
3361
|
}
|
|
3339
3362
|
});
|
|
3340
3363
|
}
|
|
3341
|
-
function WhileStatement
|
|
3364
|
+
function WhileStatement(node, scope) {
|
|
3342
3365
|
var result;
|
|
3343
3366
|
return __generator(this, function (_a) {
|
|
3344
3367
|
switch (_a.label) {
|
|
3345
|
-
case 0: return [5, __values(evaluate
|
|
3368
|
+
case 0: return [5, __values(evaluate(node.test, scope))];
|
|
3346
3369
|
case 1:
|
|
3347
3370
|
if (!_a.sent()) return [3, 3];
|
|
3348
|
-
return [5, __values(evaluate
|
|
3371
|
+
return [5, __values(evaluate(node.body, scope))];
|
|
3349
3372
|
case 2:
|
|
3350
3373
|
result = _a.sent();
|
|
3351
3374
|
if (result === BREAK) {
|
|
@@ -3362,11 +3385,11 @@
|
|
|
3362
3385
|
}
|
|
3363
3386
|
});
|
|
3364
3387
|
}
|
|
3365
|
-
function DoWhileStatement
|
|
3388
|
+
function DoWhileStatement(node, scope) {
|
|
3366
3389
|
var result;
|
|
3367
3390
|
return __generator(this, function (_a) {
|
|
3368
3391
|
switch (_a.label) {
|
|
3369
|
-
case 0: return [5, __values(evaluate
|
|
3392
|
+
case 0: return [5, __values(evaluate(node.body, scope))];
|
|
3370
3393
|
case 1:
|
|
3371
3394
|
result = _a.sent();
|
|
3372
3395
|
if (result === BREAK) {
|
|
@@ -3379,7 +3402,7 @@
|
|
|
3379
3402
|
return [2, result];
|
|
3380
3403
|
}
|
|
3381
3404
|
_a.label = 2;
|
|
3382
|
-
case 2: return [5, __values(evaluate
|
|
3405
|
+
case 2: return [5, __values(evaluate(node.test, scope))];
|
|
3383
3406
|
case 3:
|
|
3384
3407
|
if (_a.sent()) return [3, 0];
|
|
3385
3408
|
_a.label = 4;
|
|
@@ -3387,19 +3410,19 @@
|
|
|
3387
3410
|
}
|
|
3388
3411
|
});
|
|
3389
3412
|
}
|
|
3390
|
-
function ForStatement
|
|
3413
|
+
function ForStatement(node, scope) {
|
|
3391
3414
|
var forScope, _a, subScope, result;
|
|
3392
3415
|
return __generator(this, function (_b) {
|
|
3393
3416
|
switch (_b.label) {
|
|
3394
3417
|
case 0:
|
|
3395
3418
|
forScope = new Scope(scope);
|
|
3396
|
-
return [5, __values(evaluate
|
|
3419
|
+
return [5, __values(evaluate(node.init, forScope))];
|
|
3397
3420
|
case 1:
|
|
3398
3421
|
_b.sent();
|
|
3399
3422
|
_b.label = 2;
|
|
3400
3423
|
case 2:
|
|
3401
3424
|
if (!node.test) return [3, 4];
|
|
3402
|
-
return [5, __values(evaluate
|
|
3425
|
+
return [5, __values(evaluate(node.test, forScope))];
|
|
3403
3426
|
case 3:
|
|
3404
3427
|
_a = (_b.sent());
|
|
3405
3428
|
return [3, 5];
|
|
@@ -3411,11 +3434,11 @@
|
|
|
3411
3434
|
subScope = new Scope(forScope);
|
|
3412
3435
|
result = void 0;
|
|
3413
3436
|
if (!(node.body.type === 'BlockStatement')) return [3, 7];
|
|
3414
|
-
return [5, __values(BlockStatement
|
|
3437
|
+
return [5, __values(BlockStatement(node.body, subScope, { invasived: true }))];
|
|
3415
3438
|
case 6:
|
|
3416
3439
|
result = _b.sent();
|
|
3417
3440
|
return [3, 9];
|
|
3418
|
-
case 7: return [5, __values(evaluate
|
|
3441
|
+
case 7: return [5, __values(evaluate(node.body, subScope))];
|
|
3419
3442
|
case 8:
|
|
3420
3443
|
result = _b.sent();
|
|
3421
3444
|
_b.label = 9;
|
|
@@ -3430,7 +3453,7 @@
|
|
|
3430
3453
|
return [2, result];
|
|
3431
3454
|
}
|
|
3432
3455
|
_b.label = 10;
|
|
3433
|
-
case 10: return [5, __values(evaluate
|
|
3456
|
+
case 10: return [5, __values(evaluate(node.update, forScope))];
|
|
3434
3457
|
case 11:
|
|
3435
3458
|
_b.sent();
|
|
3436
3459
|
return [3, 2];
|
|
@@ -3438,13 +3461,13 @@
|
|
|
3438
3461
|
}
|
|
3439
3462
|
});
|
|
3440
3463
|
}
|
|
3441
|
-
function ForInStatement
|
|
3464
|
+
function ForInStatement(node, scope) {
|
|
3442
3465
|
var _a, _b, _i, value, result;
|
|
3443
3466
|
return __generator(this, function (_c) {
|
|
3444
3467
|
switch (_c.label) {
|
|
3445
3468
|
case 0:
|
|
3446
3469
|
_a = [];
|
|
3447
|
-
return [5, __values(evaluate
|
|
3470
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
3448
3471
|
case 1:
|
|
3449
3472
|
for (_b in _c.sent())
|
|
3450
3473
|
_a.push(_b);
|
|
@@ -3453,7 +3476,7 @@
|
|
|
3453
3476
|
case 2:
|
|
3454
3477
|
if (!(_i < _a.length)) return [3, 5];
|
|
3455
3478
|
value = _a[_i];
|
|
3456
|
-
return [5, __values(ForXHandler(node, scope, { value: value }))];
|
|
3479
|
+
return [5, __values(ForXHandler$1(node, scope, { value: value }))];
|
|
3457
3480
|
case 3:
|
|
3458
3481
|
result = _c.sent();
|
|
3459
3482
|
if (result === BREAK) {
|
|
@@ -3473,12 +3496,12 @@
|
|
|
3473
3496
|
}
|
|
3474
3497
|
});
|
|
3475
3498
|
}
|
|
3476
|
-
function ForOfStatement
|
|
3499
|
+
function ForOfStatement(node, scope) {
|
|
3477
3500
|
var right, iterator, ret, result, right_1, right_1_1, value, result, e_1_1;
|
|
3478
3501
|
var e_1, _a;
|
|
3479
3502
|
return __generator(this, function (_b) {
|
|
3480
3503
|
switch (_b.label) {
|
|
3481
|
-
case 0: return [5, __values(evaluate
|
|
3504
|
+
case 0: return [5, __values(evaluate(node.right, scope))];
|
|
3482
3505
|
case 1:
|
|
3483
3506
|
right = _b.sent();
|
|
3484
3507
|
if (!node.await) return [3, 8];
|
|
@@ -3491,7 +3514,7 @@
|
|
|
3491
3514
|
_b.label = 3;
|
|
3492
3515
|
case 3:
|
|
3493
3516
|
if (!!ret.done) return [3, 7];
|
|
3494
|
-
return [5, __values(ForXHandler(node, scope, { value: ret.value }))];
|
|
3517
|
+
return [5, __values(ForXHandler$1(node, scope, { value: ret.value }))];
|
|
3495
3518
|
case 4:
|
|
3496
3519
|
result = _b.sent();
|
|
3497
3520
|
if (result === BREAK) {
|
|
@@ -3518,7 +3541,7 @@
|
|
|
3518
3541
|
case 9:
|
|
3519
3542
|
if (!!right_1_1.done) return [3, 12];
|
|
3520
3543
|
value = right_1_1.value;
|
|
3521
|
-
return [5, __values(ForXHandler(node, scope, { value: value }))];
|
|
3544
|
+
return [5, __values(ForXHandler$1(node, scope, { value: value }))];
|
|
3522
3545
|
case 10:
|
|
3523
3546
|
result = _b.sent();
|
|
3524
3547
|
if (result === BREAK) {
|
|
@@ -3550,13 +3573,13 @@
|
|
|
3550
3573
|
});
|
|
3551
3574
|
}
|
|
3552
3575
|
|
|
3553
|
-
function FunctionDeclaration
|
|
3576
|
+
function FunctionDeclaration(node, scope) {
|
|
3554
3577
|
return __generator(this, function (_a) {
|
|
3555
|
-
scope.func(node.id.name, createFunc(node, scope));
|
|
3578
|
+
scope.func(node.id.name, createFunc$1(node, scope));
|
|
3556
3579
|
return [2];
|
|
3557
3580
|
});
|
|
3558
3581
|
}
|
|
3559
|
-
function VariableDeclaration
|
|
3582
|
+
function VariableDeclaration(node, scope, options) {
|
|
3560
3583
|
var i;
|
|
3561
3584
|
if (options === void 0) { options = {}; }
|
|
3562
3585
|
return __generator(this, function (_a) {
|
|
@@ -3566,7 +3589,7 @@
|
|
|
3566
3589
|
_a.label = 1;
|
|
3567
3590
|
case 1:
|
|
3568
3591
|
if (!(i < node.declarations.length)) return [3, 4];
|
|
3569
|
-
return [5, __values(VariableDeclarator
|
|
3592
|
+
return [5, __values(VariableDeclarator(node.declarations[i], scope, assign({ kind: node.kind }, options)))];
|
|
3570
3593
|
case 2:
|
|
3571
3594
|
_a.sent();
|
|
3572
3595
|
_a.label = 3;
|
|
@@ -3577,7 +3600,7 @@
|
|
|
3577
3600
|
}
|
|
3578
3601
|
});
|
|
3579
3602
|
}
|
|
3580
|
-
function VariableDeclarator
|
|
3603
|
+
function VariableDeclarator(node, scope, options) {
|
|
3581
3604
|
var _a, kind, _b, hoist, _c, onlyBlock, feed, hasFeed, value, _d, name_1;
|
|
3582
3605
|
if (options === void 0) { options = {}; }
|
|
3583
3606
|
return __generator(this, function (_e) {
|
|
@@ -3589,7 +3612,7 @@
|
|
|
3589
3612
|
if (!(node.id.type === 'Identifier')) return [3, 1];
|
|
3590
3613
|
scope[kind](node.id.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3591
3614
|
return [3, 3];
|
|
3592
|
-
case 1: return [5, __values(pattern$
|
|
3615
|
+
case 1: return [5, __values(pattern$1(node.id, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3593
3616
|
case 2:
|
|
3594
3617
|
_e.sent();
|
|
3595
3618
|
_e.label = 3;
|
|
@@ -3599,7 +3622,7 @@
|
|
|
3599
3622
|
if (!hasFeed) return [3, 5];
|
|
3600
3623
|
_d = feed;
|
|
3601
3624
|
return [3, 7];
|
|
3602
|
-
case 5: return [5, __values(evaluate
|
|
3625
|
+
case 5: return [5, __values(evaluate(node.init, scope))];
|
|
3603
3626
|
case 6:
|
|
3604
3627
|
_d = _e.sent();
|
|
3605
3628
|
_e.label = 7;
|
|
@@ -3623,7 +3646,7 @@
|
|
|
3623
3646
|
});
|
|
3624
3647
|
}
|
|
3625
3648
|
return [3, 10];
|
|
3626
|
-
case 8: return [5, __values(pattern$
|
|
3649
|
+
case 8: return [5, __values(pattern$1(node.id, scope, { kind: kind, feed: value }))];
|
|
3627
3650
|
case 9:
|
|
3628
3651
|
_e.sent();
|
|
3629
3652
|
_e.label = 10;
|
|
@@ -3631,21 +3654,21 @@
|
|
|
3631
3654
|
}
|
|
3632
3655
|
});
|
|
3633
3656
|
}
|
|
3634
|
-
function ClassDeclaration
|
|
3657
|
+
function ClassDeclaration(node, scope) {
|
|
3635
3658
|
var _a, _b, _c;
|
|
3636
3659
|
return __generator(this, function (_d) {
|
|
3637
3660
|
switch (_d.label) {
|
|
3638
3661
|
case 0:
|
|
3639
3662
|
_b = (_a = scope).func;
|
|
3640
3663
|
_c = [node.id.name];
|
|
3641
|
-
return [5, __values(createClass(node, scope))];
|
|
3664
|
+
return [5, __values(createClass$1(node, scope))];
|
|
3642
3665
|
case 1:
|
|
3643
3666
|
_b.apply(_a, _c.concat([_d.sent()]));
|
|
3644
3667
|
return [2];
|
|
3645
3668
|
}
|
|
3646
3669
|
});
|
|
3647
3670
|
}
|
|
3648
|
-
function ClassBody
|
|
3671
|
+
function ClassBody(node, scope, options) {
|
|
3649
3672
|
var klass, superClass, i, def;
|
|
3650
3673
|
if (options === void 0) { options = {}; }
|
|
3651
3674
|
return __generator(this, function (_a) {
|
|
@@ -3658,19 +3681,19 @@
|
|
|
3658
3681
|
if (!(i < node.body.length)) return [3, 8];
|
|
3659
3682
|
def = node.body[i];
|
|
3660
3683
|
if (!(def.type === 'MethodDefinition')) return [3, 3];
|
|
3661
|
-
return [5, __values(MethodDefinition
|
|
3684
|
+
return [5, __values(MethodDefinition(def, scope, { klass: klass, superClass: superClass }))];
|
|
3662
3685
|
case 2:
|
|
3663
3686
|
_a.sent();
|
|
3664
3687
|
return [3, 7];
|
|
3665
3688
|
case 3:
|
|
3666
3689
|
if (!(def.type === 'PropertyDefinition' && def.static)) return [3, 5];
|
|
3667
|
-
return [5, __values(PropertyDefinition
|
|
3690
|
+
return [5, __values(PropertyDefinition(def, scope, { klass: klass, superClass: superClass }))];
|
|
3668
3691
|
case 4:
|
|
3669
3692
|
_a.sent();
|
|
3670
3693
|
return [3, 7];
|
|
3671
3694
|
case 5:
|
|
3672
3695
|
if (!(def.type === 'StaticBlock')) return [3, 7];
|
|
3673
|
-
return [5, __values(StaticBlock
|
|
3696
|
+
return [5, __values(StaticBlock(def, scope, { klass: klass, superClass: superClass }))];
|
|
3674
3697
|
case 6:
|
|
3675
3698
|
_a.sent();
|
|
3676
3699
|
_a.label = 7;
|
|
@@ -3681,7 +3704,7 @@
|
|
|
3681
3704
|
}
|
|
3682
3705
|
});
|
|
3683
3706
|
}
|
|
3684
|
-
function MethodDefinition
|
|
3707
|
+
function MethodDefinition(node, scope, options) {
|
|
3685
3708
|
var klass, superClass, key, priv, obj, value, oriDptor, oriDptor;
|
|
3686
3709
|
if (options === void 0) { options = {}; }
|
|
3687
3710
|
return __generator(this, function (_a) {
|
|
@@ -3690,7 +3713,7 @@
|
|
|
3690
3713
|
klass = options.klass, superClass = options.superClass;
|
|
3691
3714
|
priv = false;
|
|
3692
3715
|
if (!node.computed) return [3, 2];
|
|
3693
|
-
return [5, __values(evaluate
|
|
3716
|
+
return [5, __values(evaluate(node.key, scope))];
|
|
3694
3717
|
case 1:
|
|
3695
3718
|
key = _a.sent();
|
|
3696
3719
|
return [3, 3];
|
|
@@ -3714,7 +3737,7 @@
|
|
|
3714
3737
|
}
|
|
3715
3738
|
obj = obj[PRIVATE];
|
|
3716
3739
|
}
|
|
3717
|
-
value = createFunc(node.value, scope, { superClass: superClass });
|
|
3740
|
+
value = createFunc$1(node.value, scope, { superClass: superClass });
|
|
3718
3741
|
switch (node.kind) {
|
|
3719
3742
|
case 'constructor':
|
|
3720
3743
|
break;
|
|
@@ -3750,7 +3773,7 @@
|
|
|
3750
3773
|
}
|
|
3751
3774
|
});
|
|
3752
3775
|
}
|
|
3753
|
-
function PropertyDefinition
|
|
3776
|
+
function PropertyDefinition(node, scope, options) {
|
|
3754
3777
|
var klass, superClass, key, priv, subScope, obj, _a, _b;
|
|
3755
3778
|
if (options === void 0) { options = {}; }
|
|
3756
3779
|
return __generator(this, function (_c) {
|
|
@@ -3759,7 +3782,7 @@
|
|
|
3759
3782
|
klass = options.klass, superClass = options.superClass;
|
|
3760
3783
|
priv = false;
|
|
3761
3784
|
if (!node.computed) return [3, 2];
|
|
3762
|
-
return [5, __values(evaluate
|
|
3785
|
+
return [5, __values(evaluate(node.key, scope))];
|
|
3763
3786
|
case 1:
|
|
3764
3787
|
key = _c.sent();
|
|
3765
3788
|
return [3, 3];
|
|
@@ -3786,12 +3809,12 @@
|
|
|
3786
3809
|
obj = obj[PRIVATE];
|
|
3787
3810
|
}
|
|
3788
3811
|
if (!(node.value.type === 'FunctionExpression' || node.value.type === 'ArrowFunctionExpression')) return [3, 4];
|
|
3789
|
-
obj[key] = createFunc(node.value, subScope, { superClass: superClass });
|
|
3812
|
+
obj[key] = createFunc$1(node.value, subScope, { superClass: superClass });
|
|
3790
3813
|
return [3, 6];
|
|
3791
3814
|
case 4:
|
|
3792
3815
|
_a = obj;
|
|
3793
3816
|
_b = key;
|
|
3794
|
-
return [5, __values(evaluate
|
|
3817
|
+
return [5, __values(evaluate(node.value, subScope))];
|
|
3795
3818
|
case 5:
|
|
3796
3819
|
_a[_b] = _c.sent();
|
|
3797
3820
|
_c.label = 6;
|
|
@@ -3799,7 +3822,7 @@
|
|
|
3799
3822
|
}
|
|
3800
3823
|
});
|
|
3801
3824
|
}
|
|
3802
|
-
function StaticBlock
|
|
3825
|
+
function StaticBlock(node, scope, options) {
|
|
3803
3826
|
var klass, subScope;
|
|
3804
3827
|
if (options === void 0) { options = {}; }
|
|
3805
3828
|
return __generator(this, function (_a) {
|
|
@@ -3808,12 +3831,12 @@
|
|
|
3808
3831
|
klass = options.klass;
|
|
3809
3832
|
subScope = new Scope(scope, true);
|
|
3810
3833
|
subScope.const('this', klass);
|
|
3811
|
-
return [5, __values(BlockStatement
|
|
3834
|
+
return [5, __values(BlockStatement(node, subScope, { invasived: true }))];
|
|
3812
3835
|
case 1: return [2, _a.sent()];
|
|
3813
3836
|
}
|
|
3814
3837
|
});
|
|
3815
3838
|
}
|
|
3816
|
-
function ImportDeclaration
|
|
3839
|
+
function ImportDeclaration(node, scope) {
|
|
3817
3840
|
var globalScope, module, value, result, i, spec, name_2;
|
|
3818
3841
|
return __generator(this, function (_a) {
|
|
3819
3842
|
globalScope = scope.global();
|
|
@@ -3853,24 +3876,24 @@
|
|
|
3853
3876
|
return [2];
|
|
3854
3877
|
});
|
|
3855
3878
|
}
|
|
3856
|
-
function ExportDefaultDeclaration
|
|
3879
|
+
function ExportDefaultDeclaration(node, scope) {
|
|
3857
3880
|
var globalScope, value, variable, exports_1;
|
|
3858
3881
|
return __generator(this, function (_a) {
|
|
3859
3882
|
switch (_a.label) {
|
|
3860
3883
|
case 0:
|
|
3861
3884
|
globalScope = scope.global();
|
|
3862
3885
|
if (!(node.declaration.type === 'FunctionDeclaration')) return [3, 1];
|
|
3863
|
-
value = createFunc(node.declaration, scope);
|
|
3886
|
+
value = createFunc$1(node.declaration, scope);
|
|
3864
3887
|
scope.func(node.declaration.id.name, value);
|
|
3865
3888
|
return [3, 5];
|
|
3866
3889
|
case 1:
|
|
3867
3890
|
if (!(node.declaration.type === 'ClassDeclaration')) return [3, 3];
|
|
3868
|
-
return [5, __values(createClass(node.declaration, scope))];
|
|
3891
|
+
return [5, __values(createClass$1(node.declaration, scope))];
|
|
3869
3892
|
case 2:
|
|
3870
3893
|
value = _a.sent();
|
|
3871
3894
|
scope.func(node.declaration.id.name, value);
|
|
3872
3895
|
return [3, 5];
|
|
3873
|
-
case 3: return [5, __values(evaluate
|
|
3896
|
+
case 3: return [5, __values(evaluate(node.declaration, scope))];
|
|
3874
3897
|
case 4:
|
|
3875
3898
|
value = _a.sent();
|
|
3876
3899
|
_a.label = 5;
|
|
@@ -3886,7 +3909,7 @@
|
|
|
3886
3909
|
}
|
|
3887
3910
|
});
|
|
3888
3911
|
}
|
|
3889
|
-
function ExportNamedDeclaration
|
|
3912
|
+
function ExportNamedDeclaration(node, scope) {
|
|
3890
3913
|
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
3914
|
return __generator(this, function (_a) {
|
|
3892
3915
|
switch (_a.label) {
|
|
@@ -3894,7 +3917,7 @@
|
|
|
3894
3917
|
globalScope = scope.global();
|
|
3895
3918
|
if (!node.declaration) return [3, 6];
|
|
3896
3919
|
if (!(node.declaration.type === 'FunctionDeclaration')) return [3, 1];
|
|
3897
|
-
value = createFunc(node.declaration, scope);
|
|
3920
|
+
value = createFunc$1(node.declaration, scope);
|
|
3898
3921
|
scope.func(node.declaration.id.name, value);
|
|
3899
3922
|
variable = globalScope.find(EXPORTS);
|
|
3900
3923
|
if (variable) {
|
|
@@ -3906,7 +3929,7 @@
|
|
|
3906
3929
|
return [3, 5];
|
|
3907
3930
|
case 1:
|
|
3908
3931
|
if (!(node.declaration.type === 'ClassDeclaration')) return [3, 3];
|
|
3909
|
-
return [5, __values(createClass(node.declaration, scope))];
|
|
3932
|
+
return [5, __values(createClass$1(node.declaration, scope))];
|
|
3910
3933
|
case 2:
|
|
3911
3934
|
value = _a.sent();
|
|
3912
3935
|
scope.func(node.declaration.id.name, value);
|
|
@@ -3920,7 +3943,7 @@
|
|
|
3920
3943
|
return [3, 5];
|
|
3921
3944
|
case 3:
|
|
3922
3945
|
if (!(node.declaration.type === 'VariableDeclaration')) return [3, 5];
|
|
3923
|
-
return [5, __values(VariableDeclaration
|
|
3946
|
+
return [5, __values(VariableDeclaration(node.declaration, scope))];
|
|
3924
3947
|
case 4:
|
|
3925
3948
|
_a.sent();
|
|
3926
3949
|
variable = globalScope.find(EXPORTS);
|
|
@@ -3962,7 +3985,7 @@
|
|
|
3962
3985
|
}
|
|
3963
3986
|
});
|
|
3964
3987
|
}
|
|
3965
|
-
function ExportAllDeclaration
|
|
3988
|
+
function ExportAllDeclaration(node, scope) {
|
|
3966
3989
|
var globalScope, module, value, result, variable, exports_6;
|
|
3967
3990
|
return __generator(this, function (_a) {
|
|
3968
3991
|
globalScope = scope.global();
|
|
@@ -4039,7 +4062,7 @@
|
|
|
4039
4062
|
});
|
|
4040
4063
|
}
|
|
4041
4064
|
|
|
4042
|
-
function hoist(block, scope, options) {
|
|
4065
|
+
function hoist$1(block, scope, options) {
|
|
4043
4066
|
var _a, onlyBlock, funcDclrList, funcDclrIdxs, i, statement, i;
|
|
4044
4067
|
if (options === void 0) { options = {}; }
|
|
4045
4068
|
return __generator(this, function (_b) {
|
|
@@ -4060,13 +4083,13 @@
|
|
|
4060
4083
|
case 2:
|
|
4061
4084
|
if (!(statement.type === 'VariableDeclaration'
|
|
4062
4085
|
&& ['const', 'let'].indexOf(statement.kind) !== -1)) return [3, 4];
|
|
4063
|
-
return [5, __values(VariableDeclaration
|
|
4086
|
+
return [5, __values(VariableDeclaration(statement, scope, { hoist: true, onlyBlock: true }))];
|
|
4064
4087
|
case 3:
|
|
4065
4088
|
_b.sent();
|
|
4066
4089
|
return [3, 6];
|
|
4067
4090
|
case 4:
|
|
4068
4091
|
if (!!onlyBlock) return [3, 6];
|
|
4069
|
-
return [5, __values(hoistVarRecursion(statement, scope))];
|
|
4092
|
+
return [5, __values(hoistVarRecursion$1(statement, scope))];
|
|
4070
4093
|
case 5:
|
|
4071
4094
|
_b.sent();
|
|
4072
4095
|
_b.label = 6;
|
|
@@ -4084,7 +4107,7 @@
|
|
|
4084
4107
|
}
|
|
4085
4108
|
});
|
|
4086
4109
|
}
|
|
4087
|
-
function hoistVarRecursion(statement, scope) {
|
|
4110
|
+
function hoistVarRecursion$1(statement, scope) {
|
|
4088
4111
|
var _a, i, i, j, tryBlock, i, catchBlock, i, finalBlock, i;
|
|
4089
4112
|
return __generator(this, function (_b) {
|
|
4090
4113
|
switch (_b.label) {
|
|
@@ -4103,31 +4126,31 @@
|
|
|
4103
4126
|
case 'TryStatement': return [3, 25];
|
|
4104
4127
|
}
|
|
4105
4128
|
return [3, 38];
|
|
4106
|
-
case 1: return [5, __values(VariableDeclaration
|
|
4129
|
+
case 1: return [5, __values(VariableDeclaration(statement, scope, { hoist: true }))];
|
|
4107
4130
|
case 2:
|
|
4108
4131
|
_b.sent();
|
|
4109
4132
|
return [3, 38];
|
|
4110
4133
|
case 3:
|
|
4111
4134
|
if (!(statement.left.type === 'VariableDeclaration')) return [3, 5];
|
|
4112
|
-
return [5, __values(VariableDeclaration
|
|
4135
|
+
return [5, __values(VariableDeclaration(statement.left, scope, { hoist: true }))];
|
|
4113
4136
|
case 4:
|
|
4114
4137
|
_b.sent();
|
|
4115
4138
|
_b.label = 5;
|
|
4116
4139
|
case 5:
|
|
4117
4140
|
if (!(statement.type === 'ForStatement' && statement.init.type === 'VariableDeclaration')) return [3, 7];
|
|
4118
|
-
return [5, __values(VariableDeclaration
|
|
4141
|
+
return [5, __values(VariableDeclaration(statement.init, scope, { hoist: true }))];
|
|
4119
4142
|
case 6:
|
|
4120
4143
|
_b.sent();
|
|
4121
4144
|
_b.label = 7;
|
|
4122
|
-
case 7: return [5, __values(hoistVarRecursion(statement.body, scope))];
|
|
4145
|
+
case 7: return [5, __values(hoistVarRecursion$1(statement.body, scope))];
|
|
4123
4146
|
case 8:
|
|
4124
4147
|
_b.sent();
|
|
4125
4148
|
return [3, 38];
|
|
4126
|
-
case 9: return [5, __values(hoistVarRecursion(statement.consequent, scope))];
|
|
4149
|
+
case 9: return [5, __values(hoistVarRecursion$1(statement.consequent, scope))];
|
|
4127
4150
|
case 10:
|
|
4128
4151
|
_b.sent();
|
|
4129
4152
|
if (!statement.alternate) return [3, 12];
|
|
4130
|
-
return [5, __values(hoistVarRecursion(statement.alternate, scope))];
|
|
4153
|
+
return [5, __values(hoistVarRecursion$1(statement.alternate, scope))];
|
|
4131
4154
|
case 11:
|
|
4132
4155
|
_b.sent();
|
|
4133
4156
|
_b.label = 12;
|
|
@@ -4137,7 +4160,7 @@
|
|
|
4137
4160
|
_b.label = 14;
|
|
4138
4161
|
case 14:
|
|
4139
4162
|
if (!(i < statement.body.length)) return [3, 17];
|
|
4140
|
-
return [5, __values(hoistVarRecursion(statement.body[i], scope))];
|
|
4163
|
+
return [5, __values(hoistVarRecursion$1(statement.body[i], scope))];
|
|
4141
4164
|
case 15:
|
|
4142
4165
|
_b.sent();
|
|
4143
4166
|
_b.label = 16;
|
|
@@ -4154,7 +4177,7 @@
|
|
|
4154
4177
|
_b.label = 20;
|
|
4155
4178
|
case 20:
|
|
4156
4179
|
if (!(j < statement.cases[i].consequent.length)) return [3, 23];
|
|
4157
|
-
return [5, __values(hoistVarRecursion(statement.cases[i].consequent[j], scope))];
|
|
4180
|
+
return [5, __values(hoistVarRecursion$1(statement.cases[i].consequent[j], scope))];
|
|
4158
4181
|
case 21:
|
|
4159
4182
|
_b.sent();
|
|
4160
4183
|
_b.label = 22;
|
|
@@ -4171,7 +4194,7 @@
|
|
|
4171
4194
|
_b.label = 26;
|
|
4172
4195
|
case 26:
|
|
4173
4196
|
if (!(i < tryBlock.length)) return [3, 29];
|
|
4174
|
-
return [5, __values(hoistVarRecursion(tryBlock[i], scope))];
|
|
4197
|
+
return [5, __values(hoistVarRecursion$1(tryBlock[i], scope))];
|
|
4175
4198
|
case 27:
|
|
4176
4199
|
_b.sent();
|
|
4177
4200
|
_b.label = 28;
|
|
@@ -4185,7 +4208,7 @@
|
|
|
4185
4208
|
_b.label = 30;
|
|
4186
4209
|
case 30:
|
|
4187
4210
|
if (!(i < catchBlock.length)) return [3, 33];
|
|
4188
|
-
return [5, __values(hoistVarRecursion(catchBlock[i], scope))];
|
|
4211
|
+
return [5, __values(hoistVarRecursion$1(catchBlock[i], scope))];
|
|
4189
4212
|
case 31:
|
|
4190
4213
|
_b.sent();
|
|
4191
4214
|
_b.label = 32;
|
|
@@ -4199,7 +4222,7 @@
|
|
|
4199
4222
|
_b.label = 34;
|
|
4200
4223
|
case 34:
|
|
4201
4224
|
if (!(i < finalBlock.length)) return [3, 37];
|
|
4202
|
-
return [5, __values(hoistVarRecursion(finalBlock[i], scope))];
|
|
4225
|
+
return [5, __values(hoistVarRecursion$1(finalBlock[i], scope))];
|
|
4203
4226
|
case 35:
|
|
4204
4227
|
_b.sent();
|
|
4205
4228
|
_b.label = 36;
|
|
@@ -4211,7 +4234,7 @@
|
|
|
4211
4234
|
}
|
|
4212
4235
|
});
|
|
4213
4236
|
}
|
|
4214
|
-
function pattern$
|
|
4237
|
+
function pattern$1(node, scope, options) {
|
|
4215
4238
|
var _a;
|
|
4216
4239
|
if (options === void 0) { options = {}; }
|
|
4217
4240
|
return __generator(this, function (_b) {
|
|
@@ -4225,22 +4248,22 @@
|
|
|
4225
4248
|
case 'AssignmentPattern': return [3, 7];
|
|
4226
4249
|
}
|
|
4227
4250
|
return [3, 9];
|
|
4228
|
-
case 1: return [5, __values(ObjectPattern
|
|
4251
|
+
case 1: return [5, __values(ObjectPattern(node, scope, options))];
|
|
4229
4252
|
case 2: return [2, _b.sent()];
|
|
4230
|
-
case 3: return [5, __values(ArrayPattern
|
|
4253
|
+
case 3: return [5, __values(ArrayPattern(node, scope, options))];
|
|
4231
4254
|
case 4: return [2, _b.sent()];
|
|
4232
|
-
case 5: return [5, __values(RestElement
|
|
4255
|
+
case 5: return [5, __values(RestElement(node, scope, options))];
|
|
4233
4256
|
case 6: return [2, _b.sent()];
|
|
4234
|
-
case 7: return [5, __values(AssignmentPattern
|
|
4257
|
+
case 7: return [5, __values(AssignmentPattern(node, scope, options))];
|
|
4235
4258
|
case 8: return [2, _b.sent()];
|
|
4236
4259
|
case 9: throw new SyntaxError('Unexpected token');
|
|
4237
4260
|
}
|
|
4238
4261
|
});
|
|
4239
4262
|
}
|
|
4240
|
-
function createFunc(node, scope, options) {
|
|
4263
|
+
function createFunc$1(node, scope, options) {
|
|
4241
4264
|
if (options === void 0) { options = {}; }
|
|
4242
4265
|
if (!node.generator && !node.async) {
|
|
4243
|
-
return createFunc
|
|
4266
|
+
return createFunc(node, scope, options);
|
|
4244
4267
|
}
|
|
4245
4268
|
var superClass = options.superClass, construct = options.construct;
|
|
4246
4269
|
var params = node.params;
|
|
@@ -4282,11 +4305,11 @@
|
|
|
4282
4305
|
return [3, 9];
|
|
4283
4306
|
case 5:
|
|
4284
4307
|
if (!(param.type === 'RestElement')) return [3, 7];
|
|
4285
|
-
return [5, __values(RestElement
|
|
4308
|
+
return [5, __values(RestElement(param, subScope, { kind: 'var', feed: args.slice(i) }))];
|
|
4286
4309
|
case 6:
|
|
4287
4310
|
_a.sent();
|
|
4288
4311
|
return [3, 9];
|
|
4289
|
-
case 7: return [5, __values(pattern$
|
|
4312
|
+
case 7: return [5, __values(pattern$1(param, subScope, { kind: 'var', feed: args[i] }))];
|
|
4290
4313
|
case 8:
|
|
4291
4314
|
_a.sent();
|
|
4292
4315
|
_a.label = 9;
|
|
@@ -4295,17 +4318,17 @@
|
|
|
4295
4318
|
return [3, 4];
|
|
4296
4319
|
case 10:
|
|
4297
4320
|
if (!(node.body.type === 'BlockStatement')) return [3, 13];
|
|
4298
|
-
return [5, __values(hoist(node.body, subScope))];
|
|
4321
|
+
return [5, __values(hoist$1(node.body, subScope))];
|
|
4299
4322
|
case 11:
|
|
4300
4323
|
_a.sent();
|
|
4301
|
-
return [5, __values(BlockStatement
|
|
4324
|
+
return [5, __values(BlockStatement(node.body, subScope, {
|
|
4302
4325
|
invasived: true,
|
|
4303
4326
|
hoisted: true
|
|
4304
4327
|
}))];
|
|
4305
4328
|
case 12:
|
|
4306
4329
|
result = _a.sent();
|
|
4307
4330
|
return [3, 15];
|
|
4308
|
-
case 13: return [5, __values(evaluate
|
|
4331
|
+
case 13: return [5, __values(evaluate(node.body, subScope))];
|
|
4309
4332
|
case 14:
|
|
4310
4333
|
result = _a.sent();
|
|
4311
4334
|
if (node.type === 'ArrowFunctionExpression') {
|
|
@@ -4367,11 +4390,11 @@
|
|
|
4367
4390
|
});
|
|
4368
4391
|
return func;
|
|
4369
4392
|
}
|
|
4370
|
-
function createClass(node, scope) {
|
|
4393
|
+
function createClass$1(node, scope) {
|
|
4371
4394
|
var superClass, methodBody, construct, klass, i, method;
|
|
4372
4395
|
return __generator(this, function (_a) {
|
|
4373
4396
|
switch (_a.label) {
|
|
4374
|
-
case 0: return [5, __values(evaluate
|
|
4397
|
+
case 0: return [5, __values(evaluate(node.superClass, scope))];
|
|
4375
4398
|
case 1:
|
|
4376
4399
|
superClass = _a.sent();
|
|
4377
4400
|
methodBody = node.body.body;
|
|
@@ -4386,7 +4409,7 @@
|
|
|
4386
4409
|
if (!(i < methodBody.length)) return [3, 4];
|
|
4387
4410
|
def = methodBody[i];
|
|
4388
4411
|
if (!(def.type === 'PropertyDefinition' && !def.static)) return [3, 3];
|
|
4389
|
-
return [5, __values(PropertyDefinition
|
|
4412
|
+
return [5, __values(PropertyDefinition(def, scope, { klass: object, superClass: superClass }))];
|
|
4390
4413
|
case 2:
|
|
4391
4414
|
_a.sent();
|
|
4392
4415
|
_a.label = 3;
|
|
@@ -4413,14 +4436,14 @@
|
|
|
4413
4436
|
for (i = 0; i < methodBody.length; i++) {
|
|
4414
4437
|
method = methodBody[i];
|
|
4415
4438
|
if (method.type === 'MethodDefinition' && method.kind === 'constructor') {
|
|
4416
|
-
klass = createFunc(method.value, scope, { superClass: superClass, construct: construct });
|
|
4439
|
+
klass = createFunc$1(method.value, scope, { superClass: superClass, construct: construct });
|
|
4417
4440
|
break;
|
|
4418
4441
|
}
|
|
4419
4442
|
}
|
|
4420
4443
|
if (superClass) {
|
|
4421
4444
|
inherits(klass, superClass);
|
|
4422
4445
|
}
|
|
4423
|
-
return [5, __values(ClassBody
|
|
4446
|
+
return [5, __values(ClassBody(node.body, scope, { klass: klass, superClass: superClass }))];
|
|
4424
4447
|
case 2:
|
|
4425
4448
|
_a.sent();
|
|
4426
4449
|
define(klass, CLSCTOR, { value: true });
|
|
@@ -4432,7 +4455,7 @@
|
|
|
4432
4455
|
}
|
|
4433
4456
|
});
|
|
4434
4457
|
}
|
|
4435
|
-
function ForXHandler(node, scope, options) {
|
|
4458
|
+
function ForXHandler$1(node, scope, options) {
|
|
4436
4459
|
var value, left, subScope, variable, result;
|
|
4437
4460
|
return __generator(this, function (_a) {
|
|
4438
4461
|
switch (_a.label) {
|
|
@@ -4441,28 +4464,28 @@
|
|
|
4441
4464
|
left = node.left;
|
|
4442
4465
|
subScope = new Scope(scope);
|
|
4443
4466
|
if (!(left.type === 'VariableDeclaration')) return [3, 2];
|
|
4444
|
-
return [5, __values(VariableDeclaration
|
|
4467
|
+
return [5, __values(VariableDeclaration(left, subScope, { feed: value }))];
|
|
4445
4468
|
case 1:
|
|
4446
4469
|
_a.sent();
|
|
4447
4470
|
return [3, 6];
|
|
4448
4471
|
case 2:
|
|
4449
4472
|
if (!(left.type === 'Identifier')) return [3, 4];
|
|
4450
|
-
return [5, __values(Identifier(left, scope, { getVar: true }))];
|
|
4473
|
+
return [5, __values(Identifier$1(left, scope, { getVar: true }))];
|
|
4451
4474
|
case 3:
|
|
4452
4475
|
variable = _a.sent();
|
|
4453
4476
|
variable.set(value);
|
|
4454
4477
|
return [3, 6];
|
|
4455
|
-
case 4: return [5, __values(pattern$
|
|
4478
|
+
case 4: return [5, __values(pattern$1(left, scope, { feed: value }))];
|
|
4456
4479
|
case 5:
|
|
4457
4480
|
_a.sent();
|
|
4458
4481
|
_a.label = 6;
|
|
4459
4482
|
case 6:
|
|
4460
4483
|
if (!(node.body.type === 'BlockStatement')) return [3, 8];
|
|
4461
|
-
return [5, __values(BlockStatement
|
|
4484
|
+
return [5, __values(BlockStatement(node.body, subScope, { invasived: true }))];
|
|
4462
4485
|
case 7:
|
|
4463
4486
|
result = _a.sent();
|
|
4464
4487
|
return [3, 10];
|
|
4465
|
-
case 8: return [5, __values(evaluate
|
|
4488
|
+
case 8: return [5, __values(evaluate(node.body, subScope))];
|
|
4466
4489
|
case 9:
|
|
4467
4490
|
result = _a.sent();
|
|
4468
4491
|
_a.label = 10;
|
|
@@ -4471,7 +4494,7 @@
|
|
|
4471
4494
|
});
|
|
4472
4495
|
}
|
|
4473
4496
|
|
|
4474
|
-
function hoist
|
|
4497
|
+
function hoist(block, scope, options) {
|
|
4475
4498
|
if (options === void 0) { options = {}; }
|
|
4476
4499
|
var _a = options.onlyBlock, onlyBlock = _a === void 0 ? false : _a;
|
|
4477
4500
|
var funcDclrList = [];
|
|
@@ -4484,10 +4507,10 @@
|
|
|
4484
4507
|
}
|
|
4485
4508
|
else if (statement.type === 'VariableDeclaration'
|
|
4486
4509
|
&& ['const', 'let'].indexOf(statement.kind) !== -1) {
|
|
4487
|
-
VariableDeclaration(statement, scope, { hoist: true, onlyBlock: true });
|
|
4510
|
+
VariableDeclaration$1(statement, scope, { hoist: true, onlyBlock: true });
|
|
4488
4511
|
}
|
|
4489
4512
|
else if (!onlyBlock) {
|
|
4490
|
-
hoistVarRecursion
|
|
4513
|
+
hoistVarRecursion(statement, scope);
|
|
4491
4514
|
}
|
|
4492
4515
|
}
|
|
4493
4516
|
if (funcDclrIdxs.length) {
|
|
@@ -4497,82 +4520,82 @@
|
|
|
4497
4520
|
block.body = funcDclrList.concat(block.body);
|
|
4498
4521
|
}
|
|
4499
4522
|
}
|
|
4500
|
-
function hoistVarRecursion
|
|
4523
|
+
function hoistVarRecursion(statement, scope) {
|
|
4501
4524
|
switch (statement.type) {
|
|
4502
4525
|
case 'VariableDeclaration':
|
|
4503
|
-
VariableDeclaration(statement, scope, { hoist: true });
|
|
4526
|
+
VariableDeclaration$1(statement, scope, { hoist: true });
|
|
4504
4527
|
break;
|
|
4505
4528
|
case 'ForInStatement':
|
|
4506
4529
|
case 'ForOfStatement':
|
|
4507
4530
|
if (statement.left.type === 'VariableDeclaration') {
|
|
4508
|
-
VariableDeclaration(statement.left, scope, { hoist: true });
|
|
4531
|
+
VariableDeclaration$1(statement.left, scope, { hoist: true });
|
|
4509
4532
|
}
|
|
4510
4533
|
case 'ForStatement':
|
|
4511
4534
|
if (statement.type === 'ForStatement' && statement.init.type === 'VariableDeclaration') {
|
|
4512
|
-
VariableDeclaration(statement.init, scope, { hoist: true });
|
|
4535
|
+
VariableDeclaration$1(statement.init, scope, { hoist: true });
|
|
4513
4536
|
}
|
|
4514
4537
|
case 'WhileStatement':
|
|
4515
4538
|
case 'DoWhileStatement':
|
|
4516
|
-
hoistVarRecursion
|
|
4539
|
+
hoistVarRecursion(statement.body, scope);
|
|
4517
4540
|
break;
|
|
4518
4541
|
case 'IfStatement':
|
|
4519
|
-
hoistVarRecursion
|
|
4542
|
+
hoistVarRecursion(statement.consequent, scope);
|
|
4520
4543
|
if (statement.alternate) {
|
|
4521
|
-
hoistVarRecursion
|
|
4544
|
+
hoistVarRecursion(statement.alternate, scope);
|
|
4522
4545
|
}
|
|
4523
4546
|
break;
|
|
4524
4547
|
case 'BlockStatement':
|
|
4525
4548
|
for (var i = 0; i < statement.body.length; i++) {
|
|
4526
|
-
hoistVarRecursion
|
|
4549
|
+
hoistVarRecursion(statement.body[i], scope);
|
|
4527
4550
|
}
|
|
4528
4551
|
break;
|
|
4529
4552
|
case 'SwitchStatement':
|
|
4530
4553
|
for (var i = 0; i < statement.cases.length; i++) {
|
|
4531
4554
|
for (var j = 0; j < statement.cases[i].consequent.length; j++) {
|
|
4532
|
-
hoistVarRecursion
|
|
4555
|
+
hoistVarRecursion(statement.cases[i].consequent[j], scope);
|
|
4533
4556
|
}
|
|
4534
4557
|
}
|
|
4535
4558
|
break;
|
|
4536
4559
|
case 'TryStatement': {
|
|
4537
4560
|
var tryBlock = statement.block.body;
|
|
4538
4561
|
for (var i = 0; i < tryBlock.length; i++) {
|
|
4539
|
-
hoistVarRecursion
|
|
4562
|
+
hoistVarRecursion(tryBlock[i], scope);
|
|
4540
4563
|
}
|
|
4541
4564
|
var catchBlock = statement.handler && statement.handler.body.body;
|
|
4542
4565
|
if (catchBlock) {
|
|
4543
4566
|
for (var i = 0; i < catchBlock.length; i++) {
|
|
4544
|
-
hoistVarRecursion
|
|
4567
|
+
hoistVarRecursion(catchBlock[i], scope);
|
|
4545
4568
|
}
|
|
4546
4569
|
}
|
|
4547
4570
|
var finalBlock = statement.finalizer && statement.finalizer.body;
|
|
4548
4571
|
if (finalBlock) {
|
|
4549
4572
|
for (var i = 0; i < finalBlock.length; i++) {
|
|
4550
|
-
hoistVarRecursion
|
|
4573
|
+
hoistVarRecursion(finalBlock[i], scope);
|
|
4551
4574
|
}
|
|
4552
4575
|
}
|
|
4553
4576
|
break;
|
|
4554
4577
|
}
|
|
4555
4578
|
}
|
|
4556
4579
|
}
|
|
4557
|
-
function pattern
|
|
4580
|
+
function pattern(node, scope, options) {
|
|
4558
4581
|
if (options === void 0) { options = {}; }
|
|
4559
4582
|
switch (node.type) {
|
|
4560
4583
|
case 'ObjectPattern':
|
|
4561
|
-
return ObjectPattern(node, scope, options);
|
|
4584
|
+
return ObjectPattern$1(node, scope, options);
|
|
4562
4585
|
case 'ArrayPattern':
|
|
4563
|
-
return ArrayPattern(node, scope, options);
|
|
4586
|
+
return ArrayPattern$1(node, scope, options);
|
|
4564
4587
|
case 'RestElement':
|
|
4565
|
-
return RestElement(node, scope, options);
|
|
4588
|
+
return RestElement$1(node, scope, options);
|
|
4566
4589
|
case 'AssignmentPattern':
|
|
4567
|
-
return AssignmentPattern(node, scope, options);
|
|
4590
|
+
return AssignmentPattern$1(node, scope, options);
|
|
4568
4591
|
default:
|
|
4569
4592
|
throw new SyntaxError('Unexpected token');
|
|
4570
4593
|
}
|
|
4571
4594
|
}
|
|
4572
|
-
function createFunc
|
|
4595
|
+
function createFunc(node, scope, options) {
|
|
4573
4596
|
if (options === void 0) { options = {}; }
|
|
4574
4597
|
if (node.generator || node.async) {
|
|
4575
|
-
return createFunc(node, scope, options);
|
|
4598
|
+
return createFunc$1(node, scope, options);
|
|
4576
4599
|
}
|
|
4577
4600
|
var superClass = options.superClass, construct = options.construct;
|
|
4578
4601
|
var params = node.params;
|
|
@@ -4602,22 +4625,22 @@
|
|
|
4602
4625
|
subScope.var(param.name, args[i]);
|
|
4603
4626
|
}
|
|
4604
4627
|
else if (param.type === 'RestElement') {
|
|
4605
|
-
RestElement(param, subScope, { kind: 'var', feed: args.slice(i) });
|
|
4628
|
+
RestElement$1(param, subScope, { kind: 'var', feed: args.slice(i) });
|
|
4606
4629
|
}
|
|
4607
4630
|
else {
|
|
4608
|
-
pattern
|
|
4631
|
+
pattern(param, subScope, { kind: 'var', feed: args[i] });
|
|
4609
4632
|
}
|
|
4610
4633
|
}
|
|
4611
4634
|
var result;
|
|
4612
4635
|
if (node.body.type === 'BlockStatement') {
|
|
4613
|
-
hoist
|
|
4614
|
-
result = BlockStatement(node.body, subScope, {
|
|
4636
|
+
hoist(node.body, subScope);
|
|
4637
|
+
result = BlockStatement$1(node.body, subScope, {
|
|
4615
4638
|
invasived: true,
|
|
4616
4639
|
hoisted: true
|
|
4617
4640
|
});
|
|
4618
4641
|
}
|
|
4619
4642
|
else {
|
|
4620
|
-
result = evaluate(node.body, subScope);
|
|
4643
|
+
result = evaluate$1(node.body, subScope);
|
|
4621
4644
|
if (node.type === 'ArrowFunctionExpression') {
|
|
4622
4645
|
RETURN.RES = result;
|
|
4623
4646
|
result = RETURN;
|
|
@@ -4643,14 +4666,14 @@
|
|
|
4643
4666
|
});
|
|
4644
4667
|
return func;
|
|
4645
4668
|
}
|
|
4646
|
-
function createClass
|
|
4647
|
-
var superClass = evaluate(node.superClass, scope);
|
|
4669
|
+
function createClass(node, scope) {
|
|
4670
|
+
var superClass = evaluate$1(node.superClass, scope);
|
|
4648
4671
|
var methodBody = node.body.body;
|
|
4649
4672
|
var construct = function (object) {
|
|
4650
4673
|
for (var i = 0; i < methodBody.length; i++) {
|
|
4651
4674
|
var def = methodBody[i];
|
|
4652
4675
|
if (def.type === 'PropertyDefinition' && !def.static) {
|
|
4653
|
-
PropertyDefinition(def, scope, { klass: object, superClass: superClass });
|
|
4676
|
+
PropertyDefinition$1(def, scope, { klass: object, superClass: superClass });
|
|
4654
4677
|
}
|
|
4655
4678
|
}
|
|
4656
4679
|
};
|
|
@@ -4663,14 +4686,14 @@
|
|
|
4663
4686
|
for (var i = 0; i < methodBody.length; i++) {
|
|
4664
4687
|
var method = methodBody[i];
|
|
4665
4688
|
if (method.type === 'MethodDefinition' && method.kind === 'constructor') {
|
|
4666
|
-
klass = createFunc
|
|
4689
|
+
klass = createFunc(method.value, scope, { superClass: superClass, construct: construct });
|
|
4667
4690
|
break;
|
|
4668
4691
|
}
|
|
4669
4692
|
}
|
|
4670
4693
|
if (superClass) {
|
|
4671
4694
|
inherits(klass, superClass);
|
|
4672
4695
|
}
|
|
4673
|
-
ClassBody(node.body, scope, { klass: klass, superClass: superClass });
|
|
4696
|
+
ClassBody$1(node.body, scope, { klass: klass, superClass: superClass });
|
|
4674
4697
|
define(klass, CLSCTOR, { value: true });
|
|
4675
4698
|
define(klass, 'name', {
|
|
4676
4699
|
value: node.id && node.id.name || '',
|
|
@@ -4678,26 +4701,26 @@
|
|
|
4678
4701
|
});
|
|
4679
4702
|
return klass;
|
|
4680
4703
|
}
|
|
4681
|
-
function ForXHandler
|
|
4704
|
+
function ForXHandler(node, scope, options) {
|
|
4682
4705
|
var value = options.value;
|
|
4683
4706
|
var left = node.left;
|
|
4684
4707
|
var subScope = new Scope(scope);
|
|
4685
4708
|
if (left.type === 'VariableDeclaration') {
|
|
4686
|
-
VariableDeclaration(left, subScope, { feed: value });
|
|
4709
|
+
VariableDeclaration$1(left, subScope, { feed: value });
|
|
4687
4710
|
}
|
|
4688
4711
|
else if (left.type === 'Identifier') {
|
|
4689
|
-
var variable = Identifier(left, scope, { getVar: true });
|
|
4712
|
+
var variable = Identifier$1(left, scope, { getVar: true });
|
|
4690
4713
|
variable.set(value);
|
|
4691
4714
|
}
|
|
4692
4715
|
else {
|
|
4693
|
-
pattern
|
|
4716
|
+
pattern(left, scope, { feed: value });
|
|
4694
4717
|
}
|
|
4695
4718
|
var result;
|
|
4696
4719
|
if (node.body.type === 'BlockStatement') {
|
|
4697
|
-
result = BlockStatement(node.body, subScope, { invasived: true });
|
|
4720
|
+
result = BlockStatement$1(node.body, subScope, { invasived: true });
|
|
4698
4721
|
}
|
|
4699
4722
|
else {
|
|
4700
|
-
result = evaluate(node.body, subScope);
|
|
4723
|
+
result = evaluate$1(node.body, subScope);
|
|
4701
4724
|
}
|
|
4702
4725
|
return result;
|
|
4703
4726
|
}
|
|
@@ -4753,8 +4776,8 @@
|
|
|
4753
4776
|
};
|
|
4754
4777
|
Sval.prototype.run = function (code) {
|
|
4755
4778
|
var ast = typeof code === 'string' ? acorn.parse(code, this.options) : code;
|
|
4756
|
-
hoist
|
|
4757
|
-
evaluate(ast, this.scope);
|
|
4779
|
+
hoist(ast, this.scope);
|
|
4780
|
+
evaluate$1(ast, this.scope);
|
|
4758
4781
|
};
|
|
4759
4782
|
Sval.version = version;
|
|
4760
4783
|
return Sval;
|
|
@@ -4762,4 +4785,4 @@
|
|
|
4762
4785
|
|
|
4763
4786
|
return Sval;
|
|
4764
4787
|
|
|
4765
|
-
}))
|
|
4788
|
+
}));
|