sval 0.5.2 → 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 +582 -564
- package/dist/sval.js +589 -570
- 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,41 +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
|
-
var result = evaluate(node.argument, scope);
|
|
1237
|
+
function SpreadElement$1(node, scope) {
|
|
1238
|
+
var result = evaluate$1(node.argument, scope);
|
|
1230
1239
|
return typeof result === 'string' ? __spread(result) : result;
|
|
1231
1240
|
}
|
|
1232
|
-
function ChainExpression(node, scope) {
|
|
1233
|
-
return evaluate(node.expression, scope);
|
|
1241
|
+
function ChainExpression$1(node, scope) {
|
|
1242
|
+
return evaluate$1(node.expression, scope);
|
|
1234
1243
|
}
|
|
1235
|
-
function ImportExpression(node, scope) {
|
|
1244
|
+
function ImportExpression$1(node, scope) {
|
|
1236
1245
|
var globalScope = scope.global();
|
|
1237
|
-
var source = evaluate(node.source, scope);
|
|
1246
|
+
var source = evaluate$1(node.source, scope);
|
|
1238
1247
|
var module = globalScope.find(IMPORT + source);
|
|
1239
1248
|
var value;
|
|
1240
1249
|
if (module) {
|
|
@@ -1254,35 +1263,35 @@
|
|
|
1254
1263
|
return Promise.resolve(value);
|
|
1255
1264
|
}
|
|
1256
1265
|
|
|
1257
|
-
var expression = /*#__PURE__*/Object.freeze({
|
|
1266
|
+
var expression$1 = /*#__PURE__*/Object.freeze({
|
|
1258
1267
|
__proto__: null,
|
|
1259
|
-
ThisExpression: ThisExpression,
|
|
1260
|
-
ArrayExpression: ArrayExpression,
|
|
1261
|
-
ObjectExpression: ObjectExpression,
|
|
1262
|
-
FunctionExpression: FunctionExpression,
|
|
1263
|
-
UnaryExpression: UnaryExpression,
|
|
1264
|
-
UpdateExpression: UpdateExpression,
|
|
1265
|
-
BinaryExpression: BinaryExpression,
|
|
1266
|
-
AssignmentExpression: AssignmentExpression,
|
|
1267
|
-
LogicalExpression: LogicalExpression,
|
|
1268
|
-
MemberExpression: MemberExpression,
|
|
1269
|
-
ConditionalExpression: ConditionalExpression,
|
|
1270
|
-
CallExpression: CallExpression,
|
|
1271
|
-
NewExpression: NewExpression,
|
|
1272
|
-
MetaProperty: MetaProperty,
|
|
1273
|
-
SequenceExpression: SequenceExpression,
|
|
1274
|
-
ArrowFunctionExpression: ArrowFunctionExpression,
|
|
1275
|
-
TemplateLiteral: TemplateLiteral,
|
|
1276
|
-
TaggedTemplateExpression: TaggedTemplateExpression,
|
|
1277
|
-
TemplateElement: TemplateElement,
|
|
1278
|
-
ClassExpression: ClassExpression,
|
|
1279
|
-
Super: Super,
|
|
1280
|
-
SpreadElement: SpreadElement,
|
|
1281
|
-
ChainExpression: ChainExpression,
|
|
1282
|
-
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
|
|
1283
1292
|
});
|
|
1284
1293
|
|
|
1285
|
-
function ObjectPattern(node, scope, options) {
|
|
1294
|
+
function ObjectPattern$1(node, scope, options) {
|
|
1286
1295
|
if (options === void 0) { options = {}; }
|
|
1287
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;
|
|
1288
1297
|
var fedKeys = [];
|
|
@@ -1296,18 +1305,18 @@
|
|
|
1296
1305
|
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1297
1306
|
}
|
|
1298
1307
|
else {
|
|
1299
|
-
pattern
|
|
1308
|
+
pattern(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1300
1309
|
}
|
|
1301
1310
|
}
|
|
1302
1311
|
else {
|
|
1303
|
-
RestElement(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1312
|
+
RestElement$1(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1304
1313
|
}
|
|
1305
1314
|
}
|
|
1306
1315
|
}
|
|
1307
1316
|
else if (property.type === 'Property') {
|
|
1308
1317
|
var key = void 0;
|
|
1309
1318
|
if (property.computed) {
|
|
1310
|
-
key = evaluate(property.key, scope);
|
|
1319
|
+
key = evaluate$1(property.key, scope);
|
|
1311
1320
|
}
|
|
1312
1321
|
else {
|
|
1313
1322
|
key = property.key.name;
|
|
@@ -1318,18 +1327,18 @@
|
|
|
1318
1327
|
scope[kind](value.name, feed[key]);
|
|
1319
1328
|
}
|
|
1320
1329
|
else {
|
|
1321
|
-
pattern
|
|
1330
|
+
pattern(value, scope, { kind: kind, feed: feed[key] });
|
|
1322
1331
|
}
|
|
1323
1332
|
}
|
|
1324
1333
|
else {
|
|
1325
1334
|
var rest = assign({}, feed);
|
|
1326
1335
|
for (var i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
1327
1336
|
delete rest[fedKeys[i_1]];
|
|
1328
|
-
RestElement(property, scope, { kind: kind, feed: rest });
|
|
1337
|
+
RestElement$1(property, scope, { kind: kind, feed: rest });
|
|
1329
1338
|
}
|
|
1330
1339
|
}
|
|
1331
1340
|
}
|
|
1332
|
-
function ArrayPattern(node, scope, options) {
|
|
1341
|
+
function ArrayPattern$1(node, scope, options) {
|
|
1333
1342
|
if (options === void 0) { options = {}; }
|
|
1334
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;
|
|
1335
1344
|
var result = [];
|
|
@@ -1343,7 +1352,7 @@
|
|
|
1343
1352
|
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1344
1353
|
}
|
|
1345
1354
|
else {
|
|
1346
|
-
pattern
|
|
1355
|
+
pattern(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1347
1356
|
}
|
|
1348
1357
|
}
|
|
1349
1358
|
}
|
|
@@ -1352,23 +1361,23 @@
|
|
|
1352
1361
|
scope[kind](element.name, feed[i]);
|
|
1353
1362
|
}
|
|
1354
1363
|
else {
|
|
1355
|
-
var variable = Identifier(element, scope, { getVar: true });
|
|
1364
|
+
var variable = Identifier$1(element, scope, { getVar: true });
|
|
1356
1365
|
variable.set(feed[i]);
|
|
1357
1366
|
result.push(variable.get());
|
|
1358
1367
|
}
|
|
1359
1368
|
}
|
|
1360
1369
|
else if (element.type === 'RestElement') {
|
|
1361
|
-
RestElement(element, scope, { kind: kind, feed: feed.slice(i) });
|
|
1370
|
+
RestElement$1(element, scope, { kind: kind, feed: feed.slice(i) });
|
|
1362
1371
|
}
|
|
1363
1372
|
else {
|
|
1364
|
-
pattern
|
|
1373
|
+
pattern(element, scope, { kind: kind, feed: feed[i] });
|
|
1365
1374
|
}
|
|
1366
1375
|
}
|
|
1367
1376
|
if (result.length) {
|
|
1368
1377
|
return result;
|
|
1369
1378
|
}
|
|
1370
1379
|
}
|
|
1371
|
-
function RestElement(node, scope, options) {
|
|
1380
|
+
function RestElement$1(node, scope, options) {
|
|
1372
1381
|
if (options === void 0) { options = {}; }
|
|
1373
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;
|
|
1374
1383
|
var arg = node.argument;
|
|
@@ -1378,7 +1387,7 @@
|
|
|
1378
1387
|
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1379
1388
|
}
|
|
1380
1389
|
else {
|
|
1381
|
-
pattern
|
|
1390
|
+
pattern(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1382
1391
|
}
|
|
1383
1392
|
}
|
|
1384
1393
|
}
|
|
@@ -1387,17 +1396,17 @@
|
|
|
1387
1396
|
scope[kind](arg.name, feed);
|
|
1388
1397
|
}
|
|
1389
1398
|
else {
|
|
1390
|
-
var variable = Identifier(arg, scope, { getVar: true });
|
|
1399
|
+
var variable = Identifier$1(arg, scope, { getVar: true });
|
|
1391
1400
|
variable.set(feed);
|
|
1392
1401
|
}
|
|
1393
1402
|
}
|
|
1394
1403
|
else {
|
|
1395
|
-
pattern
|
|
1404
|
+
pattern(arg, scope, { kind: kind, feed: feed });
|
|
1396
1405
|
}
|
|
1397
1406
|
}
|
|
1398
|
-
function AssignmentPattern(node, scope, options) {
|
|
1407
|
+
function AssignmentPattern$1(node, scope, options) {
|
|
1399
1408
|
if (options === void 0) { options = {}; }
|
|
1400
|
-
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;
|
|
1401
1410
|
var left = node.left;
|
|
1402
1411
|
if (hoist) {
|
|
1403
1412
|
if (onlyBlock || kind === 'var') {
|
|
@@ -1405,7 +1414,7 @@
|
|
|
1405
1414
|
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1406
1415
|
}
|
|
1407
1416
|
else {
|
|
1408
|
-
pattern
|
|
1417
|
+
pattern(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1409
1418
|
}
|
|
1410
1419
|
}
|
|
1411
1420
|
}
|
|
@@ -1413,21 +1422,21 @@
|
|
|
1413
1422
|
scope[kind](left.name, feed);
|
|
1414
1423
|
}
|
|
1415
1424
|
else {
|
|
1416
|
-
pattern
|
|
1425
|
+
pattern(left, scope, { kind: kind, feed: feed });
|
|
1417
1426
|
}
|
|
1418
1427
|
}
|
|
1419
1428
|
|
|
1420
|
-
var pattern = /*#__PURE__*/Object.freeze({
|
|
1429
|
+
var pattern$3 = /*#__PURE__*/Object.freeze({
|
|
1421
1430
|
__proto__: null,
|
|
1422
|
-
ObjectPattern: ObjectPattern,
|
|
1423
|
-
ArrayPattern: ArrayPattern,
|
|
1424
|
-
RestElement: RestElement,
|
|
1425
|
-
AssignmentPattern: AssignmentPattern
|
|
1431
|
+
ObjectPattern: ObjectPattern$1,
|
|
1432
|
+
ArrayPattern: ArrayPattern$1,
|
|
1433
|
+
RestElement: RestElement$1,
|
|
1434
|
+
AssignmentPattern: AssignmentPattern$1
|
|
1426
1435
|
});
|
|
1427
1436
|
|
|
1428
1437
|
function Program(program, scope) {
|
|
1429
1438
|
for (var i = 0; i < program.body.length; i++) {
|
|
1430
|
-
evaluate(program.body[i], scope);
|
|
1439
|
+
evaluate$1(program.body[i], scope);
|
|
1431
1440
|
}
|
|
1432
1441
|
}
|
|
1433
1442
|
|
|
@@ -1436,14 +1445,14 @@
|
|
|
1436
1445
|
Program: Program
|
|
1437
1446
|
});
|
|
1438
1447
|
|
|
1439
|
-
var evaluateOps;
|
|
1440
|
-
function evaluate(node, scope) {
|
|
1448
|
+
var evaluateOps$1;
|
|
1449
|
+
function evaluate$1(node, scope) {
|
|
1441
1450
|
if (!node)
|
|
1442
1451
|
return;
|
|
1443
|
-
if (!evaluateOps) {
|
|
1444
|
-
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);
|
|
1445
1454
|
}
|
|
1446
|
-
var handler = evaluateOps[node.type];
|
|
1455
|
+
var handler = evaluateOps$1[node.type];
|
|
1447
1456
|
if (handler) {
|
|
1448
1457
|
return handler(node, scope);
|
|
1449
1458
|
}
|
|
@@ -1452,58 +1461,58 @@
|
|
|
1452
1461
|
}
|
|
1453
1462
|
}
|
|
1454
1463
|
|
|
1455
|
-
function ExpressionStatement(node, scope) {
|
|
1456
|
-
evaluate(node.expression, scope);
|
|
1464
|
+
function ExpressionStatement$1(node, scope) {
|
|
1465
|
+
evaluate$1(node.expression, scope);
|
|
1457
1466
|
}
|
|
1458
|
-
function BlockStatement(block, scope, options) {
|
|
1467
|
+
function BlockStatement$1(block, scope, options) {
|
|
1459
1468
|
if (options === void 0) { options = {}; }
|
|
1460
1469
|
var _a = options.invasived, invasived = _a === void 0 ? false : _a, _b = options.hoisted, hoisted = _b === void 0 ? false : _b;
|
|
1461
1470
|
var subScope = invasived ? scope : new Scope(scope);
|
|
1462
1471
|
if (!hoisted) {
|
|
1463
|
-
hoist
|
|
1472
|
+
hoist(block, subScope, { onlyBlock: true });
|
|
1464
1473
|
}
|
|
1465
1474
|
for (var i = 0; i < block.body.length; i++) {
|
|
1466
|
-
var result = evaluate(block.body[i], subScope);
|
|
1475
|
+
var result = evaluate$1(block.body[i], subScope);
|
|
1467
1476
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
1468
1477
|
return result;
|
|
1469
1478
|
}
|
|
1470
1479
|
}
|
|
1471
1480
|
}
|
|
1472
|
-
function EmptyStatement() {
|
|
1481
|
+
function EmptyStatement$1() {
|
|
1473
1482
|
}
|
|
1474
|
-
function DebuggerStatement() {
|
|
1483
|
+
function DebuggerStatement$1() {
|
|
1475
1484
|
debugger;
|
|
1476
1485
|
}
|
|
1477
|
-
function ReturnStatement(node, scope) {
|
|
1478
|
-
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;
|
|
1479
1488
|
return RETURN;
|
|
1480
1489
|
}
|
|
1481
|
-
function BreakStatement() {
|
|
1490
|
+
function BreakStatement$1() {
|
|
1482
1491
|
return BREAK;
|
|
1483
1492
|
}
|
|
1484
|
-
function ContinueStatement() {
|
|
1493
|
+
function ContinueStatement$1() {
|
|
1485
1494
|
return CONTINUE;
|
|
1486
1495
|
}
|
|
1487
|
-
function IfStatement(node, scope) {
|
|
1488
|
-
if (evaluate(node.test, scope)) {
|
|
1489
|
-
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);
|
|
1490
1499
|
}
|
|
1491
1500
|
else {
|
|
1492
|
-
return evaluate(node.alternate, scope);
|
|
1501
|
+
return evaluate$1(node.alternate, scope);
|
|
1493
1502
|
}
|
|
1494
1503
|
}
|
|
1495
|
-
function SwitchStatement(node, scope) {
|
|
1496
|
-
var discriminant = evaluate(node.discriminant, scope);
|
|
1504
|
+
function SwitchStatement$1(node, scope) {
|
|
1505
|
+
var discriminant = evaluate$1(node.discriminant, scope);
|
|
1497
1506
|
var matched = false;
|
|
1498
1507
|
for (var i = 0; i < node.cases.length; i++) {
|
|
1499
1508
|
var eachCase = node.cases[i];
|
|
1500
1509
|
if (!matched
|
|
1501
1510
|
&& (!eachCase.test
|
|
1502
|
-
|| (evaluate(eachCase.test, scope)) === discriminant)) {
|
|
1511
|
+
|| (evaluate$1(eachCase.test, scope)) === discriminant)) {
|
|
1503
1512
|
matched = true;
|
|
1504
1513
|
}
|
|
1505
1514
|
if (matched) {
|
|
1506
|
-
var result = SwitchCase(eachCase, scope);
|
|
1515
|
+
var result = SwitchCase$1(eachCase, scope);
|
|
1507
1516
|
if (result === BREAK) {
|
|
1508
1517
|
break;
|
|
1509
1518
|
}
|
|
@@ -1513,20 +1522,20 @@
|
|
|
1513
1522
|
}
|
|
1514
1523
|
}
|
|
1515
1524
|
}
|
|
1516
|
-
function SwitchCase(node, scope) {
|
|
1525
|
+
function SwitchCase$1(node, scope) {
|
|
1517
1526
|
for (var i = 0; i < node.consequent.length; i++) {
|
|
1518
|
-
var result = evaluate(node.consequent[i], scope);
|
|
1527
|
+
var result = evaluate$1(node.consequent[i], scope);
|
|
1519
1528
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
1520
1529
|
return result;
|
|
1521
1530
|
}
|
|
1522
1531
|
}
|
|
1523
1532
|
}
|
|
1524
|
-
function ThrowStatement(node, scope) {
|
|
1525
|
-
throw evaluate(node.argument, scope);
|
|
1533
|
+
function ThrowStatement$1(node, scope) {
|
|
1534
|
+
throw evaluate$1(node.argument, scope);
|
|
1526
1535
|
}
|
|
1527
|
-
function TryStatement(node, scope) {
|
|
1536
|
+
function TryStatement$1(node, scope) {
|
|
1528
1537
|
try {
|
|
1529
|
-
return BlockStatement(node.block, scope);
|
|
1538
|
+
return BlockStatement$1(node.block, scope);
|
|
1530
1539
|
}
|
|
1531
1540
|
catch (err) {
|
|
1532
1541
|
if (node.handler) {
|
|
@@ -1538,10 +1547,10 @@
|
|
|
1538
1547
|
subScope.var(name_1, err);
|
|
1539
1548
|
}
|
|
1540
1549
|
else {
|
|
1541
|
-
pattern
|
|
1550
|
+
pattern(param, scope, { feed: err });
|
|
1542
1551
|
}
|
|
1543
1552
|
}
|
|
1544
|
-
return CatchClause(node.handler, subScope);
|
|
1553
|
+
return CatchClause$1(node.handler, subScope);
|
|
1545
1554
|
}
|
|
1546
1555
|
else {
|
|
1547
1556
|
throw err;
|
|
@@ -1549,19 +1558,19 @@
|
|
|
1549
1558
|
}
|
|
1550
1559
|
finally {
|
|
1551
1560
|
if (node.finalizer) {
|
|
1552
|
-
var result = BlockStatement(node.finalizer, scope);
|
|
1561
|
+
var result = BlockStatement$1(node.finalizer, scope);
|
|
1553
1562
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
1554
1563
|
return result;
|
|
1555
1564
|
}
|
|
1556
1565
|
}
|
|
1557
1566
|
}
|
|
1558
1567
|
}
|
|
1559
|
-
function CatchClause(node, scope) {
|
|
1560
|
-
return BlockStatement(node.body, scope, { invasived: true });
|
|
1568
|
+
function CatchClause$1(node, scope) {
|
|
1569
|
+
return BlockStatement$1(node.body, scope, { invasived: true });
|
|
1561
1570
|
}
|
|
1562
|
-
function WhileStatement(node, scope) {
|
|
1563
|
-
while (evaluate(node.test, scope)) {
|
|
1564
|
-
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);
|
|
1565
1574
|
if (result === BREAK) {
|
|
1566
1575
|
break;
|
|
1567
1576
|
}
|
|
@@ -1573,9 +1582,9 @@
|
|
|
1573
1582
|
}
|
|
1574
1583
|
}
|
|
1575
1584
|
}
|
|
1576
|
-
function DoWhileStatement(node, scope) {
|
|
1585
|
+
function DoWhileStatement$1(node, scope) {
|
|
1577
1586
|
do {
|
|
1578
|
-
var result = evaluate(node.body, scope);
|
|
1587
|
+
var result = evaluate$1(node.body, scope);
|
|
1579
1588
|
if (result === BREAK) {
|
|
1580
1589
|
break;
|
|
1581
1590
|
}
|
|
@@ -1585,18 +1594,18 @@
|
|
|
1585
1594
|
else if (result === RETURN) {
|
|
1586
1595
|
return result;
|
|
1587
1596
|
}
|
|
1588
|
-
} while (evaluate(node.test, scope));
|
|
1597
|
+
} while (evaluate$1(node.test, scope));
|
|
1589
1598
|
}
|
|
1590
|
-
function ForStatement(node, scope) {
|
|
1599
|
+
function ForStatement$1(node, scope) {
|
|
1591
1600
|
var forScope = new Scope(scope);
|
|
1592
|
-
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)) {
|
|
1593
1602
|
var subScope = new Scope(forScope);
|
|
1594
1603
|
var result = void 0;
|
|
1595
1604
|
if (node.body.type === 'BlockStatement') {
|
|
1596
|
-
result = BlockStatement(node.body, subScope, { invasived: true });
|
|
1605
|
+
result = BlockStatement$1(node.body, subScope, { invasived: true });
|
|
1597
1606
|
}
|
|
1598
1607
|
else {
|
|
1599
|
-
result = evaluate(node.body, subScope);
|
|
1608
|
+
result = evaluate$1(node.body, subScope);
|
|
1600
1609
|
}
|
|
1601
1610
|
if (result === BREAK) {
|
|
1602
1611
|
break;
|
|
@@ -1609,9 +1618,9 @@
|
|
|
1609
1618
|
}
|
|
1610
1619
|
}
|
|
1611
1620
|
}
|
|
1612
|
-
function ForInStatement(node, scope) {
|
|
1613
|
-
for (var value in evaluate(node.right, scope)) {
|
|
1614
|
-
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 });
|
|
1615
1624
|
if (result === BREAK) {
|
|
1616
1625
|
break;
|
|
1617
1626
|
}
|
|
@@ -1623,13 +1632,13 @@
|
|
|
1623
1632
|
}
|
|
1624
1633
|
}
|
|
1625
1634
|
}
|
|
1626
|
-
function ForOfStatement(node, scope) {
|
|
1635
|
+
function ForOfStatement$1(node, scope) {
|
|
1627
1636
|
var e_1, _a;
|
|
1628
|
-
var right = evaluate(node.right, scope);
|
|
1637
|
+
var right = evaluate$1(node.right, scope);
|
|
1629
1638
|
try {
|
|
1630
1639
|
for (var right_1 = __values(right), right_1_1 = right_1.next(); !right_1_1.done; right_1_1 = right_1.next()) {
|
|
1631
1640
|
var value = right_1_1.value;
|
|
1632
|
-
var result = ForXHandler
|
|
1641
|
+
var result = ForXHandler(node, scope, { value: value });
|
|
1633
1642
|
if (result === BREAK) {
|
|
1634
1643
|
break;
|
|
1635
1644
|
}
|
|
@@ -1650,16 +1659,16 @@
|
|
|
1650
1659
|
}
|
|
1651
1660
|
}
|
|
1652
1661
|
|
|
1653
|
-
function FunctionDeclaration(node, scope) {
|
|
1654
|
-
scope.func(node.id.name, createFunc
|
|
1662
|
+
function FunctionDeclaration$1(node, scope) {
|
|
1663
|
+
scope.func(node.id.name, createFunc(node, scope));
|
|
1655
1664
|
}
|
|
1656
|
-
function VariableDeclaration(node, scope, options) {
|
|
1665
|
+
function VariableDeclaration$1(node, scope, options) {
|
|
1657
1666
|
if (options === void 0) { options = {}; }
|
|
1658
1667
|
for (var i = 0; i < node.declarations.length; i++) {
|
|
1659
|
-
VariableDeclarator(node.declarations[i], scope, assign({ kind: node.kind }, options));
|
|
1668
|
+
VariableDeclarator$1(node.declarations[i], scope, assign({ kind: node.kind }, options));
|
|
1660
1669
|
}
|
|
1661
1670
|
}
|
|
1662
|
-
function VariableDeclarator(node, scope, options) {
|
|
1671
|
+
function VariableDeclarator$1(node, scope, options) {
|
|
1663
1672
|
if (options === void 0) { options = {}; }
|
|
1664
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;
|
|
1665
1674
|
if (hoist) {
|
|
@@ -1668,13 +1677,13 @@
|
|
|
1668
1677
|
scope[kind](node.id.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
1669
1678
|
}
|
|
1670
1679
|
else {
|
|
1671
|
-
pattern
|
|
1680
|
+
pattern(node.id, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock });
|
|
1672
1681
|
}
|
|
1673
1682
|
}
|
|
1674
1683
|
}
|
|
1675
1684
|
else {
|
|
1676
1685
|
var hasFeed = 'feed' in options;
|
|
1677
|
-
var value = hasFeed ? feed : evaluate(node.init, scope);
|
|
1686
|
+
var value = hasFeed ? feed : evaluate$1(node.init, scope);
|
|
1678
1687
|
if (node.id.type === 'Identifier') {
|
|
1679
1688
|
var name_1 = node.id.name;
|
|
1680
1689
|
if (kind === 'var' && !node.init && !hasFeed) {
|
|
@@ -1694,36 +1703,36 @@
|
|
|
1694
1703
|
}
|
|
1695
1704
|
}
|
|
1696
1705
|
else {
|
|
1697
|
-
pattern
|
|
1706
|
+
pattern(node.id, scope, { kind: kind, feed: value });
|
|
1698
1707
|
}
|
|
1699
1708
|
}
|
|
1700
1709
|
}
|
|
1701
|
-
function ClassDeclaration(node, scope) {
|
|
1702
|
-
scope.func(node.id.name, createClass
|
|
1710
|
+
function ClassDeclaration$1(node, scope) {
|
|
1711
|
+
scope.func(node.id.name, createClass(node, scope));
|
|
1703
1712
|
}
|
|
1704
|
-
function ClassBody(node, scope, options) {
|
|
1713
|
+
function ClassBody$1(node, scope, options) {
|
|
1705
1714
|
if (options === void 0) { options = {}; }
|
|
1706
1715
|
var klass = options.klass, superClass = options.superClass;
|
|
1707
1716
|
for (var i = 0; i < node.body.length; i++) {
|
|
1708
1717
|
var def = node.body[i];
|
|
1709
1718
|
if (def.type === 'MethodDefinition') {
|
|
1710
|
-
MethodDefinition(def, scope, { klass: klass, superClass: superClass });
|
|
1719
|
+
MethodDefinition$1(def, scope, { klass: klass, superClass: superClass });
|
|
1711
1720
|
}
|
|
1712
1721
|
else if (def.type === 'PropertyDefinition' && def.static) {
|
|
1713
|
-
PropertyDefinition(def, scope, { klass: klass, superClass: superClass });
|
|
1722
|
+
PropertyDefinition$1(def, scope, { klass: klass, superClass: superClass });
|
|
1714
1723
|
}
|
|
1715
1724
|
else if (def.type === 'StaticBlock') {
|
|
1716
|
-
StaticBlock(def, scope, { klass: klass, superClass: superClass });
|
|
1725
|
+
StaticBlock$1(def, scope, { klass: klass, superClass: superClass });
|
|
1717
1726
|
}
|
|
1718
1727
|
}
|
|
1719
1728
|
}
|
|
1720
|
-
function MethodDefinition(node, scope, options) {
|
|
1729
|
+
function MethodDefinition$1(node, scope, options) {
|
|
1721
1730
|
if (options === void 0) { options = {}; }
|
|
1722
1731
|
var klass = options.klass, superClass = options.superClass;
|
|
1723
1732
|
var key;
|
|
1724
1733
|
var priv = false;
|
|
1725
1734
|
if (node.computed) {
|
|
1726
|
-
key = evaluate(node.key, scope);
|
|
1735
|
+
key = evaluate$1(node.key, scope);
|
|
1727
1736
|
}
|
|
1728
1737
|
else if (node.key.type === 'Identifier') {
|
|
1729
1738
|
key = node.key.name;
|
|
@@ -1742,7 +1751,7 @@
|
|
|
1742
1751
|
}
|
|
1743
1752
|
obj = obj[PRIVATE];
|
|
1744
1753
|
}
|
|
1745
|
-
var value = createFunc
|
|
1754
|
+
var value = createFunc(node.value, scope, { superClass: superClass });
|
|
1746
1755
|
switch (node.kind) {
|
|
1747
1756
|
case 'constructor':
|
|
1748
1757
|
break;
|
|
@@ -1775,13 +1784,13 @@
|
|
|
1775
1784
|
throw new SyntaxError('Unexpected token');
|
|
1776
1785
|
}
|
|
1777
1786
|
}
|
|
1778
|
-
function PropertyDefinition(node, scope, options) {
|
|
1787
|
+
function PropertyDefinition$1(node, scope, options) {
|
|
1779
1788
|
if (options === void 0) { options = {}; }
|
|
1780
1789
|
var klass = options.klass, superClass = options.superClass;
|
|
1781
1790
|
var key;
|
|
1782
1791
|
var priv = false;
|
|
1783
1792
|
if (node.computed) {
|
|
1784
|
-
key = evaluate(node.key, scope);
|
|
1793
|
+
key = evaluate$1(node.key, scope);
|
|
1785
1794
|
}
|
|
1786
1795
|
else if (node.key.type === 'Identifier') {
|
|
1787
1796
|
key = node.key.name;
|
|
@@ -1803,20 +1812,20 @@
|
|
|
1803
1812
|
obj = obj[PRIVATE];
|
|
1804
1813
|
}
|
|
1805
1814
|
if (node.value.type === 'FunctionExpression' || node.value.type === 'ArrowFunctionExpression') {
|
|
1806
|
-
obj[key] = createFunc
|
|
1815
|
+
obj[key] = createFunc(node.value, subScope, { superClass: superClass });
|
|
1807
1816
|
}
|
|
1808
1817
|
else {
|
|
1809
|
-
obj[key] = evaluate(node.value, subScope);
|
|
1818
|
+
obj[key] = evaluate$1(node.value, subScope);
|
|
1810
1819
|
}
|
|
1811
1820
|
}
|
|
1812
|
-
function StaticBlock(node, scope, options) {
|
|
1821
|
+
function StaticBlock$1(node, scope, options) {
|
|
1813
1822
|
if (options === void 0) { options = {}; }
|
|
1814
1823
|
var klass = options.klass;
|
|
1815
1824
|
var subScope = new Scope(scope, true);
|
|
1816
1825
|
subScope.const('this', klass);
|
|
1817
|
-
return BlockStatement(node, subScope, { invasived: true });
|
|
1826
|
+
return BlockStatement$1(node, subScope, { invasived: true });
|
|
1818
1827
|
}
|
|
1819
|
-
function ImportDeclaration(node, scope) {
|
|
1828
|
+
function ImportDeclaration$1(node, scope) {
|
|
1820
1829
|
var globalScope = scope.global();
|
|
1821
1830
|
var module = globalScope.find(IMPORT + node.source.value);
|
|
1822
1831
|
var value;
|
|
@@ -1853,19 +1862,19 @@
|
|
|
1853
1862
|
scope.var(spec.local.name, name_2 === '*' ? assign({}, value) : value[name_2]);
|
|
1854
1863
|
}
|
|
1855
1864
|
}
|
|
1856
|
-
function ExportDefaultDeclaration(node, scope) {
|
|
1865
|
+
function ExportDefaultDeclaration$1(node, scope) {
|
|
1857
1866
|
var globalScope = scope.global();
|
|
1858
1867
|
var value;
|
|
1859
1868
|
if (node.declaration.type === 'FunctionDeclaration') {
|
|
1860
|
-
value = createFunc
|
|
1869
|
+
value = createFunc(node.declaration, scope);
|
|
1861
1870
|
scope.func(node.declaration.id.name, value);
|
|
1862
1871
|
}
|
|
1863
1872
|
else if (node.declaration.type === 'ClassDeclaration') {
|
|
1864
|
-
value = createClass
|
|
1873
|
+
value = createClass(node.declaration, scope);
|
|
1865
1874
|
scope.func(node.declaration.id.name, value);
|
|
1866
1875
|
}
|
|
1867
1876
|
else {
|
|
1868
|
-
value = evaluate(node.declaration, scope);
|
|
1877
|
+
value = evaluate$1(node.declaration, scope);
|
|
1869
1878
|
}
|
|
1870
1879
|
var variable = globalScope.find(EXPORTS);
|
|
1871
1880
|
if (variable) {
|
|
@@ -1875,11 +1884,11 @@
|
|
|
1875
1884
|
}
|
|
1876
1885
|
}
|
|
1877
1886
|
}
|
|
1878
|
-
function ExportNamedDeclaration(node, scope) {
|
|
1887
|
+
function ExportNamedDeclaration$1(node, scope) {
|
|
1879
1888
|
var globalScope = scope.global();
|
|
1880
1889
|
if (node.declaration) {
|
|
1881
1890
|
if (node.declaration.type === 'FunctionDeclaration') {
|
|
1882
|
-
var value = createFunc
|
|
1891
|
+
var value = createFunc(node.declaration, scope);
|
|
1883
1892
|
scope.func(node.declaration.id.name, value);
|
|
1884
1893
|
var variable = globalScope.find(EXPORTS);
|
|
1885
1894
|
if (variable) {
|
|
@@ -1890,7 +1899,7 @@
|
|
|
1890
1899
|
}
|
|
1891
1900
|
}
|
|
1892
1901
|
else if (node.declaration.type === 'ClassDeclaration') {
|
|
1893
|
-
var value = createClass
|
|
1902
|
+
var value = createClass(node.declaration, scope);
|
|
1894
1903
|
scope.func(node.declaration.id.name, value);
|
|
1895
1904
|
var variable = globalScope.find(EXPORTS);
|
|
1896
1905
|
if (variable) {
|
|
@@ -1901,7 +1910,7 @@
|
|
|
1901
1910
|
}
|
|
1902
1911
|
}
|
|
1903
1912
|
else if (node.declaration.type === 'VariableDeclaration') {
|
|
1904
|
-
VariableDeclaration(node.declaration, scope);
|
|
1913
|
+
VariableDeclaration$1(node.declaration, scope);
|
|
1905
1914
|
var variable = globalScope.find(EXPORTS);
|
|
1906
1915
|
if (variable) {
|
|
1907
1916
|
var exports_4 = variable.get();
|
|
@@ -1936,7 +1945,7 @@
|
|
|
1936
1945
|
}
|
|
1937
1946
|
}
|
|
1938
1947
|
}
|
|
1939
|
-
function ExportAllDeclaration(node, scope) {
|
|
1948
|
+
function ExportAllDeclaration$1(node, scope) {
|
|
1940
1949
|
var globalScope = scope.global();
|
|
1941
1950
|
var module = globalScope.find(IMPORT + node.source.value);
|
|
1942
1951
|
var value;
|
|
@@ -1963,7 +1972,7 @@
|
|
|
1963
1972
|
}
|
|
1964
1973
|
}
|
|
1965
1974
|
|
|
1966
|
-
function Identifier
|
|
1975
|
+
function Identifier(node, scope, options) {
|
|
1967
1976
|
var _a, getVar, _b, throwErr, variable, value;
|
|
1968
1977
|
if (options === void 0) { options = {}; }
|
|
1969
1978
|
return __generator(this, function (_c) {
|
|
@@ -1995,23 +2004,23 @@
|
|
|
1995
2004
|
});
|
|
1996
2005
|
}
|
|
1997
2006
|
|
|
1998
|
-
var identifier
|
|
2007
|
+
var identifier = /*#__PURE__*/Object.freeze({
|
|
1999
2008
|
__proto__: null,
|
|
2000
|
-
Identifier: Identifier
|
|
2009
|
+
Identifier: Identifier
|
|
2001
2010
|
});
|
|
2002
2011
|
|
|
2003
|
-
function Literal
|
|
2012
|
+
function Literal(node, scope) {
|
|
2004
2013
|
return __generator(this, function (_a) {
|
|
2005
2014
|
return [2, node.value];
|
|
2006
2015
|
});
|
|
2007
2016
|
}
|
|
2008
2017
|
|
|
2009
|
-
var literal
|
|
2018
|
+
var literal = /*#__PURE__*/Object.freeze({
|
|
2010
2019
|
__proto__: null,
|
|
2011
|
-
Literal: Literal
|
|
2020
|
+
Literal: Literal
|
|
2012
2021
|
});
|
|
2013
2022
|
|
|
2014
|
-
function ThisExpression
|
|
2023
|
+
function ThisExpression(node, scope) {
|
|
2015
2024
|
var superCall;
|
|
2016
2025
|
return __generator(this, function (_a) {
|
|
2017
2026
|
superCall = scope.find(SUPERCALL);
|
|
@@ -2024,7 +2033,7 @@
|
|
|
2024
2033
|
}
|
|
2025
2034
|
});
|
|
2026
2035
|
}
|
|
2027
|
-
function ArrayExpression
|
|
2036
|
+
function ArrayExpression(node, scope) {
|
|
2028
2037
|
var results, i, item, _a, _b, _c, _d;
|
|
2029
2038
|
return __generator(this, function (_e) {
|
|
2030
2039
|
switch (_e.label) {
|
|
@@ -2037,13 +2046,13 @@
|
|
|
2037
2046
|
item = node.elements[i];
|
|
2038
2047
|
if (!(item.type === 'SpreadElement')) return [3, 3];
|
|
2039
2048
|
_b = (_a = results).concat;
|
|
2040
|
-
return [5, __values(SpreadElement
|
|
2049
|
+
return [5, __values(SpreadElement(item, scope))];
|
|
2041
2050
|
case 2:
|
|
2042
2051
|
results = _b.apply(_a, [_e.sent()]);
|
|
2043
2052
|
return [3, 5];
|
|
2044
2053
|
case 3:
|
|
2045
2054
|
_d = (_c = results).push;
|
|
2046
|
-
return [5, __values(evaluate
|
|
2055
|
+
return [5, __values(evaluate(item, scope))];
|
|
2047
2056
|
case 4:
|
|
2048
2057
|
_d.apply(_c, [_e.sent()]);
|
|
2049
2058
|
_e.label = 5;
|
|
@@ -2054,7 +2063,7 @@
|
|
|
2054
2063
|
}
|
|
2055
2064
|
});
|
|
2056
2065
|
}
|
|
2057
|
-
function ObjectExpression
|
|
2066
|
+
function ObjectExpression(node, scope) {
|
|
2058
2067
|
var object, i, property, _a, _b, key, propKey, _c, value, propKind, oriDptor, oriDptor;
|
|
2059
2068
|
return __generator(this, function (_d) {
|
|
2060
2069
|
switch (_d.label) {
|
|
@@ -2068,7 +2077,7 @@
|
|
|
2068
2077
|
if (!(property.type === 'SpreadElement')) return [3, 3];
|
|
2069
2078
|
_a = assign;
|
|
2070
2079
|
_b = [object];
|
|
2071
|
-
return [5, __values(SpreadElement
|
|
2080
|
+
return [5, __values(SpreadElement(property, scope))];
|
|
2072
2081
|
case 2:
|
|
2073
2082
|
_a.apply(void 0, _b.concat([_d.sent()]));
|
|
2074
2083
|
return [3, 10];
|
|
@@ -2076,7 +2085,7 @@
|
|
|
2076
2085
|
key = void 0;
|
|
2077
2086
|
propKey = property.key;
|
|
2078
2087
|
if (!property.computed) return [3, 5];
|
|
2079
|
-
return [5, __values(evaluate
|
|
2088
|
+
return [5, __values(evaluate(propKey, scope))];
|
|
2080
2089
|
case 4:
|
|
2081
2090
|
key = _d.sent();
|
|
2082
2091
|
return [3, 8];
|
|
@@ -2086,11 +2095,11 @@
|
|
|
2086
2095
|
return [3, 8];
|
|
2087
2096
|
case 6:
|
|
2088
2097
|
_c = '';
|
|
2089
|
-
return [5, __values(Literal
|
|
2098
|
+
return [5, __values(Literal(propKey))];
|
|
2090
2099
|
case 7:
|
|
2091
2100
|
key = _c + (_d.sent());
|
|
2092
2101
|
_d.label = 8;
|
|
2093
|
-
case 8: return [5, __values(evaluate
|
|
2102
|
+
case 8: return [5, __values(evaluate(property.value, scope))];
|
|
2094
2103
|
case 9:
|
|
2095
2104
|
value = _d.sent();
|
|
2096
2105
|
propKind = property.kind;
|
|
@@ -2123,21 +2132,21 @@
|
|
|
2123
2132
|
}
|
|
2124
2133
|
});
|
|
2125
2134
|
}
|
|
2126
|
-
function FunctionExpression
|
|
2135
|
+
function FunctionExpression(node, scope) {
|
|
2127
2136
|
var tmpScope, func;
|
|
2128
2137
|
return __generator(this, function (_a) {
|
|
2129
2138
|
if (node.id && node.id.name) {
|
|
2130
2139
|
tmpScope = new Scope(scope);
|
|
2131
|
-
func = createFunc(node, tmpScope);
|
|
2140
|
+
func = createFunc$1(node, tmpScope);
|
|
2132
2141
|
tmpScope.const(node.id.name, func);
|
|
2133
2142
|
return [2, func];
|
|
2134
2143
|
}
|
|
2135
2144
|
else {
|
|
2136
|
-
return [2, createFunc(node, scope)];
|
|
2145
|
+
return [2, createFunc$1(node, scope)];
|
|
2137
2146
|
}
|
|
2138
2147
|
});
|
|
2139
2148
|
}
|
|
2140
|
-
function UnaryExpression
|
|
2149
|
+
function UnaryExpression(node, scope) {
|
|
2141
2150
|
var arg, _a, variable;
|
|
2142
2151
|
return __generator(this, function (_b) {
|
|
2143
2152
|
switch (_b.label) {
|
|
@@ -2154,32 +2163,32 @@
|
|
|
2154
2163
|
case 'delete': return [3, 15];
|
|
2155
2164
|
}
|
|
2156
2165
|
return [3, 20];
|
|
2157
|
-
case 1: return [5, __values(evaluate
|
|
2166
|
+
case 1: return [5, __values(evaluate(arg, scope))];
|
|
2158
2167
|
case 2: return [2, +(_b.sent())];
|
|
2159
|
-
case 3: return [5, __values(evaluate
|
|
2168
|
+
case 3: return [5, __values(evaluate(arg, scope))];
|
|
2160
2169
|
case 4: return [2, -(_b.sent())];
|
|
2161
|
-
case 5: return [5, __values(evaluate
|
|
2170
|
+
case 5: return [5, __values(evaluate(arg, scope))];
|
|
2162
2171
|
case 6: return [2, !(_b.sent())];
|
|
2163
|
-
case 7: return [5, __values(evaluate
|
|
2172
|
+
case 7: return [5, __values(evaluate(arg, scope))];
|
|
2164
2173
|
case 8: return [2, ~(_b.sent())];
|
|
2165
|
-
case 9: return [5, __values(evaluate
|
|
2174
|
+
case 9: return [5, __values(evaluate(arg, scope))];
|
|
2166
2175
|
case 10: return [2, void (_b.sent())];
|
|
2167
2176
|
case 11:
|
|
2168
2177
|
if (!(arg.type === 'Identifier')) return [3, 13];
|
|
2169
|
-
return [5, __values(Identifier
|
|
2178
|
+
return [5, __values(Identifier(arg, scope, { throwErr: false }))];
|
|
2170
2179
|
case 12: return [2, typeof (_b.sent())];
|
|
2171
|
-
case 13: return [5, __values(evaluate
|
|
2180
|
+
case 13: return [5, __values(evaluate(arg, scope))];
|
|
2172
2181
|
case 14: return [2, typeof (_b.sent())];
|
|
2173
2182
|
case 15:
|
|
2174
2183
|
if (!(arg.type === 'MemberExpression')) return [3, 17];
|
|
2175
|
-
return [5, __values(MemberExpression
|
|
2184
|
+
return [5, __values(MemberExpression(arg, scope, { getVar: true }))];
|
|
2176
2185
|
case 16:
|
|
2177
2186
|
variable = _b.sent();
|
|
2178
2187
|
return [2, variable.del()];
|
|
2179
2188
|
case 17:
|
|
2180
2189
|
if (!(arg.type === 'Identifier')) return [3, 18];
|
|
2181
2190
|
throw new SyntaxError('Delete of an unqualified identifier in strict mode');
|
|
2182
|
-
case 18: return [5, __values(evaluate
|
|
2191
|
+
case 18: return [5, __values(evaluate(arg, scope))];
|
|
2183
2192
|
case 19:
|
|
2184
2193
|
_b.sent();
|
|
2185
2194
|
return [2, true];
|
|
@@ -2187,20 +2196,20 @@
|
|
|
2187
2196
|
}
|
|
2188
2197
|
});
|
|
2189
2198
|
}
|
|
2190
|
-
function UpdateExpression
|
|
2199
|
+
function UpdateExpression(node, scope) {
|
|
2191
2200
|
var arg, variable, value;
|
|
2192
2201
|
return __generator(this, function (_a) {
|
|
2193
2202
|
switch (_a.label) {
|
|
2194
2203
|
case 0:
|
|
2195
2204
|
arg = node.argument;
|
|
2196
2205
|
if (!(arg.type === 'Identifier')) return [3, 2];
|
|
2197
|
-
return [5, __values(Identifier
|
|
2206
|
+
return [5, __values(Identifier(arg, scope, { getVar: true }))];
|
|
2198
2207
|
case 1:
|
|
2199
2208
|
variable = _a.sent();
|
|
2200
2209
|
return [3, 5];
|
|
2201
2210
|
case 2:
|
|
2202
2211
|
if (!(arg.type === 'MemberExpression')) return [3, 4];
|
|
2203
|
-
return [5, __values(MemberExpression
|
|
2212
|
+
return [5, __values(MemberExpression(arg, scope, { getVar: true }))];
|
|
2204
2213
|
case 3:
|
|
2205
2214
|
variable = _a.sent();
|
|
2206
2215
|
return [3, 5];
|
|
@@ -2221,22 +2230,22 @@
|
|
|
2221
2230
|
}
|
|
2222
2231
|
});
|
|
2223
2232
|
}
|
|
2224
|
-
function BinaryExpression
|
|
2233
|
+
function BinaryExpression(node, scope) {
|
|
2225
2234
|
var left, right;
|
|
2226
2235
|
return __generator(this, function (_a) {
|
|
2227
2236
|
switch (_a.label) {
|
|
2228
2237
|
case 0:
|
|
2229
2238
|
if (!(node.left.type === 'PrivateIdentifier')) return [3, 2];
|
|
2230
2239
|
left = node.left.name;
|
|
2231
|
-
return [5, __values(evaluate
|
|
2240
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2232
2241
|
case 1:
|
|
2233
2242
|
right = _a.sent();
|
|
2234
2243
|
right = right[PRIVATE];
|
|
2235
2244
|
return [3, 5];
|
|
2236
|
-
case 2: return [5, __values(evaluate
|
|
2245
|
+
case 2: return [5, __values(evaluate(node.left, scope))];
|
|
2237
2246
|
case 3:
|
|
2238
2247
|
left = _a.sent();
|
|
2239
|
-
return [5, __values(evaluate
|
|
2248
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2240
2249
|
case 4:
|
|
2241
2250
|
right = _a.sent();
|
|
2242
2251
|
_a.label = 5;
|
|
@@ -2269,7 +2278,7 @@
|
|
|
2269
2278
|
}
|
|
2270
2279
|
});
|
|
2271
2280
|
}
|
|
2272
|
-
function AssignmentExpression
|
|
2281
|
+
function AssignmentExpression(node, scope) {
|
|
2273
2282
|
var left, variable, win, value_1, value;
|
|
2274
2283
|
var _a;
|
|
2275
2284
|
return __generator(this, function (_b) {
|
|
@@ -2277,7 +2286,7 @@
|
|
|
2277
2286
|
case 0:
|
|
2278
2287
|
left = node.left;
|
|
2279
2288
|
if (!(left.type === 'Identifier')) return [3, 2];
|
|
2280
|
-
return [5, __values(Identifier
|
|
2289
|
+
return [5, __values(Identifier(left, scope, { getVar: true, throwErr: false }))];
|
|
2281
2290
|
case 1:
|
|
2282
2291
|
variable = _b.sent();
|
|
2283
2292
|
if (!variable) {
|
|
@@ -2287,16 +2296,16 @@
|
|
|
2287
2296
|
return [3, 7];
|
|
2288
2297
|
case 2:
|
|
2289
2298
|
if (!(left.type === 'MemberExpression')) return [3, 4];
|
|
2290
|
-
return [5, __values(MemberExpression
|
|
2299
|
+
return [5, __values(MemberExpression(left, scope, { getVar: true }))];
|
|
2291
2300
|
case 3:
|
|
2292
2301
|
variable = _b.sent();
|
|
2293
2302
|
return [3, 7];
|
|
2294
|
-
case 4: return [5, __values(evaluate
|
|
2303
|
+
case 4: return [5, __values(evaluate(node.right, scope))];
|
|
2295
2304
|
case 5:
|
|
2296
2305
|
value_1 = _b.sent();
|
|
2297
|
-
return [5, __values(pattern$
|
|
2306
|
+
return [5, __values(pattern$1(left, scope, { feed: value_1 }))];
|
|
2298
2307
|
case 6: return [2, _b.sent()];
|
|
2299
|
-
case 7: return [5, __values(evaluate
|
|
2308
|
+
case 7: return [5, __values(evaluate(node.right, scope))];
|
|
2300
2309
|
case 8:
|
|
2301
2310
|
value = _b.sent();
|
|
2302
2311
|
switch (node.operator) {
|
|
@@ -2353,7 +2362,7 @@
|
|
|
2353
2362
|
}
|
|
2354
2363
|
});
|
|
2355
2364
|
}
|
|
2356
|
-
function LogicalExpression
|
|
2365
|
+
function LogicalExpression(node, scope) {
|
|
2357
2366
|
var _a, _b, _c, _d;
|
|
2358
2367
|
var _e;
|
|
2359
2368
|
return __generator(this, function (_f) {
|
|
@@ -2366,30 +2375,30 @@
|
|
|
2366
2375
|
case '??': return [3, 9];
|
|
2367
2376
|
}
|
|
2368
2377
|
return [3, 14];
|
|
2369
|
-
case 1: return [5, __values(evaluate
|
|
2378
|
+
case 1: return [5, __values(evaluate(node.left, scope))];
|
|
2370
2379
|
case 2:
|
|
2371
2380
|
_b = (_f.sent());
|
|
2372
2381
|
if (_b) return [3, 4];
|
|
2373
|
-
return [5, __values(evaluate
|
|
2382
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2374
2383
|
case 3:
|
|
2375
2384
|
_b = (_f.sent());
|
|
2376
2385
|
_f.label = 4;
|
|
2377
2386
|
case 4: return [2, _b];
|
|
2378
|
-
case 5: return [5, __values(evaluate
|
|
2387
|
+
case 5: return [5, __values(evaluate(node.left, scope))];
|
|
2379
2388
|
case 6:
|
|
2380
2389
|
_c = (_f.sent());
|
|
2381
2390
|
if (!_c) return [3, 8];
|
|
2382
|
-
return [5, __values(evaluate
|
|
2391
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
2383
2392
|
case 7:
|
|
2384
2393
|
_c = (_f.sent());
|
|
2385
2394
|
_f.label = 8;
|
|
2386
2395
|
case 8: return [2, _c];
|
|
2387
|
-
case 9: return [5, __values(evaluate
|
|
2396
|
+
case 9: return [5, __values(evaluate(node.left, scope))];
|
|
2388
2397
|
case 10:
|
|
2389
2398
|
if (!((_e = (_f.sent())) !== null && _e !== void 0)) return [3, 11];
|
|
2390
2399
|
_d = _e;
|
|
2391
2400
|
return [3, 13];
|
|
2392
|
-
case 11: return [5, __values(evaluate
|
|
2401
|
+
case 11: return [5, __values(evaluate(node.right, scope))];
|
|
2393
2402
|
case 12:
|
|
2394
2403
|
_d = (_f.sent());
|
|
2395
2404
|
_f.label = 13;
|
|
@@ -2398,7 +2407,7 @@
|
|
|
2398
2407
|
}
|
|
2399
2408
|
});
|
|
2400
2409
|
}
|
|
2401
|
-
function MemberExpression
|
|
2410
|
+
function MemberExpression(node, scope, options) {
|
|
2402
2411
|
var _a, getObj, _b, getVar, object, key, priv, setter, thisObject, privateKey, getter, thisObject;
|
|
2403
2412
|
if (options === void 0) { options = {}; }
|
|
2404
2413
|
return __generator(this, function (_c) {
|
|
@@ -2406,11 +2415,11 @@
|
|
|
2406
2415
|
case 0:
|
|
2407
2416
|
_a = options.getObj, getObj = _a === void 0 ? false : _a, _b = options.getVar, getVar = _b === void 0 ? false : _b;
|
|
2408
2417
|
if (!(node.object.type === 'Super')) return [3, 2];
|
|
2409
|
-
return [5, __values(Super
|
|
2418
|
+
return [5, __values(Super(node.object, scope, { getProto: true }))];
|
|
2410
2419
|
case 1:
|
|
2411
2420
|
object = _c.sent();
|
|
2412
2421
|
return [3, 4];
|
|
2413
|
-
case 2: return [5, __values(evaluate
|
|
2422
|
+
case 2: return [5, __values(evaluate(node.object, scope))];
|
|
2414
2423
|
case 3:
|
|
2415
2424
|
object = _c.sent();
|
|
2416
2425
|
_c.label = 4;
|
|
@@ -2419,7 +2428,7 @@
|
|
|
2419
2428
|
return [2, object];
|
|
2420
2429
|
priv = false;
|
|
2421
2430
|
if (!node.computed) return [3, 6];
|
|
2422
|
-
return [5, __values(evaluate
|
|
2431
|
+
return [5, __values(evaluate(node.property, scope))];
|
|
2423
2432
|
case 5:
|
|
2424
2433
|
key = _c.sent();
|
|
2425
2434
|
return [3, 7];
|
|
@@ -2467,18 +2476,18 @@
|
|
|
2467
2476
|
}
|
|
2468
2477
|
});
|
|
2469
2478
|
}
|
|
2470
|
-
function ConditionalExpression
|
|
2479
|
+
function ConditionalExpression(node, scope) {
|
|
2471
2480
|
var _a;
|
|
2472
2481
|
return __generator(this, function (_b) {
|
|
2473
2482
|
switch (_b.label) {
|
|
2474
|
-
case 0: return [5, __values(evaluate
|
|
2483
|
+
case 0: return [5, __values(evaluate(node.test, scope))];
|
|
2475
2484
|
case 1:
|
|
2476
2485
|
if (!(_b.sent())) return [3, 3];
|
|
2477
|
-
return [5, __values(evaluate
|
|
2486
|
+
return [5, __values(evaluate(node.consequent, scope))];
|
|
2478
2487
|
case 2:
|
|
2479
2488
|
_a = (_b.sent());
|
|
2480
2489
|
return [3, 5];
|
|
2481
|
-
case 3: return [5, __values(evaluate
|
|
2490
|
+
case 3: return [5, __values(evaluate(node.alternate, scope))];
|
|
2482
2491
|
case 4:
|
|
2483
2492
|
_a = (_b.sent());
|
|
2484
2493
|
_b.label = 5;
|
|
@@ -2486,13 +2495,13 @@
|
|
|
2486
2495
|
}
|
|
2487
2496
|
});
|
|
2488
2497
|
}
|
|
2489
|
-
function CallExpression
|
|
2490
|
-
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;
|
|
2491
2500
|
return __generator(this, function (_e) {
|
|
2492
2501
|
switch (_e.label) {
|
|
2493
2502
|
case 0:
|
|
2494
2503
|
if (!(node.callee.type === 'MemberExpression')) return [3, 5];
|
|
2495
|
-
return [5, __values(MemberExpression
|
|
2504
|
+
return [5, __values(MemberExpression(node.callee, scope, { getObj: true }))];
|
|
2496
2505
|
case 1:
|
|
2497
2506
|
object = _e.sent();
|
|
2498
2507
|
if (node.callee.optional && object == null) {
|
|
@@ -2501,7 +2510,7 @@
|
|
|
2501
2510
|
key = void 0;
|
|
2502
2511
|
priv = false;
|
|
2503
2512
|
if (!node.callee.computed) return [3, 3];
|
|
2504
|
-
return [5, __values(evaluate
|
|
2513
|
+
return [5, __values(evaluate(node.callee.property, scope))];
|
|
2505
2514
|
case 2:
|
|
2506
2515
|
key = _e.sent();
|
|
2507
2516
|
return [3, 4];
|
|
@@ -2538,7 +2547,7 @@
|
|
|
2538
2547
|
return [3, 7];
|
|
2539
2548
|
case 5:
|
|
2540
2549
|
object = scope.find('this').get();
|
|
2541
|
-
return [5, __values(evaluate
|
|
2550
|
+
return [5, __values(evaluate(node.callee, scope))];
|
|
2542
2551
|
case 6:
|
|
2543
2552
|
func = _e.sent();
|
|
2544
2553
|
if (node.optional && func == null) {
|
|
@@ -2573,13 +2582,13 @@
|
|
|
2573
2582
|
arg = node.arguments[i];
|
|
2574
2583
|
if (!(arg.type === 'SpreadElement')) return [3, 10];
|
|
2575
2584
|
_b = (_a = args).concat;
|
|
2576
|
-
return [5, __values(SpreadElement
|
|
2585
|
+
return [5, __values(SpreadElement(arg, scope))];
|
|
2577
2586
|
case 9:
|
|
2578
2587
|
args = _b.apply(_a, [_e.sent()]);
|
|
2579
2588
|
return [3, 12];
|
|
2580
2589
|
case 10:
|
|
2581
2590
|
_d = (_c = args).push;
|
|
2582
|
-
return [5, __values(evaluate
|
|
2591
|
+
return [5, __values(evaluate(arg, scope))];
|
|
2583
2592
|
case 11:
|
|
2584
2593
|
_d.apply(_c, [_e.sent()]);
|
|
2585
2594
|
_e.label = 12;
|
|
@@ -2596,18 +2605,28 @@
|
|
|
2596
2605
|
scope.find(SUPERCALL).set(true);
|
|
2597
2606
|
}
|
|
2598
2607
|
}
|
|
2599
|
-
|
|
2600
|
-
return [2, func.apply(object
|
|
2608
|
+
try {
|
|
2609
|
+
return [2, func.apply(object, args)];
|
|
2601
2610
|
}
|
|
2602
|
-
|
|
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;
|
|
2620
|
+
}
|
|
2621
|
+
return [2];
|
|
2603
2622
|
}
|
|
2604
2623
|
});
|
|
2605
2624
|
}
|
|
2606
|
-
function NewExpression
|
|
2625
|
+
function NewExpression(node, scope) {
|
|
2607
2626
|
var constructor, name_2, args, i, arg, _a, _b, _c, _d;
|
|
2608
2627
|
return __generator(this, function (_e) {
|
|
2609
2628
|
switch (_e.label) {
|
|
2610
|
-
case 0: return [5, __values(evaluate
|
|
2629
|
+
case 0: return [5, __values(evaluate(node.callee, scope))];
|
|
2611
2630
|
case 1:
|
|
2612
2631
|
constructor = _e.sent();
|
|
2613
2632
|
if (typeof constructor !== 'function') {
|
|
@@ -2635,13 +2654,13 @@
|
|
|
2635
2654
|
arg = node.arguments[i];
|
|
2636
2655
|
if (!(arg.type === 'SpreadElement')) return [3, 4];
|
|
2637
2656
|
_b = (_a = args).concat;
|
|
2638
|
-
return [5, __values(SpreadElement
|
|
2657
|
+
return [5, __values(SpreadElement(arg, scope))];
|
|
2639
2658
|
case 3:
|
|
2640
2659
|
args = _b.apply(_a, [_e.sent()]);
|
|
2641
2660
|
return [3, 6];
|
|
2642
2661
|
case 4:
|
|
2643
2662
|
_d = (_c = args).push;
|
|
2644
|
-
return [5, __values(evaluate
|
|
2663
|
+
return [5, __values(evaluate(arg, scope))];
|
|
2645
2664
|
case 5:
|
|
2646
2665
|
_d.apply(_c, [_e.sent()]);
|
|
2647
2666
|
_e.label = 6;
|
|
@@ -2652,7 +2671,7 @@
|
|
|
2652
2671
|
}
|
|
2653
2672
|
});
|
|
2654
2673
|
}
|
|
2655
|
-
function MetaProperty
|
|
2674
|
+
function MetaProperty(node, scope) {
|
|
2656
2675
|
return __generator(this, function (_a) {
|
|
2657
2676
|
if (node.meta.name === 'new' && node.property.name === 'target') {
|
|
2658
2677
|
return [2, scope.find(NEWTARGET).get()];
|
|
@@ -2663,7 +2682,7 @@
|
|
|
2663
2682
|
return [2];
|
|
2664
2683
|
});
|
|
2665
2684
|
}
|
|
2666
|
-
function SequenceExpression
|
|
2685
|
+
function SequenceExpression(node, scope) {
|
|
2667
2686
|
var result, i;
|
|
2668
2687
|
return __generator(this, function (_a) {
|
|
2669
2688
|
switch (_a.label) {
|
|
@@ -2672,7 +2691,7 @@
|
|
|
2672
2691
|
_a.label = 1;
|
|
2673
2692
|
case 1:
|
|
2674
2693
|
if (!(i < node.expressions.length)) return [3, 4];
|
|
2675
|
-
return [5, __values(evaluate
|
|
2694
|
+
return [5, __values(evaluate(node.expressions[i], scope))];
|
|
2676
2695
|
case 2:
|
|
2677
2696
|
result = _a.sent();
|
|
2678
2697
|
_a.label = 3;
|
|
@@ -2683,12 +2702,12 @@
|
|
|
2683
2702
|
}
|
|
2684
2703
|
});
|
|
2685
2704
|
}
|
|
2686
|
-
function ArrowFunctionExpression
|
|
2705
|
+
function ArrowFunctionExpression(node, scope) {
|
|
2687
2706
|
return __generator(this, function (_a) {
|
|
2688
|
-
return [2, createFunc(node, scope)];
|
|
2707
|
+
return [2, createFunc$1(node, scope)];
|
|
2689
2708
|
});
|
|
2690
2709
|
}
|
|
2691
|
-
function TemplateLiteral
|
|
2710
|
+
function TemplateLiteral(node, scope) {
|
|
2692
2711
|
var quasis, expressions, result, temEl, expr, _a, _b;
|
|
2693
2712
|
return __generator(this, function (_c) {
|
|
2694
2713
|
switch (_c.label) {
|
|
@@ -2700,13 +2719,13 @@
|
|
|
2700
2719
|
case 1:
|
|
2701
2720
|
if (!(temEl = quasis.shift())) return [3, 5];
|
|
2702
2721
|
_a = result;
|
|
2703
|
-
return [5, __values(TemplateElement
|
|
2722
|
+
return [5, __values(TemplateElement(temEl))];
|
|
2704
2723
|
case 2:
|
|
2705
2724
|
result = _a + _c.sent();
|
|
2706
2725
|
expr = expressions.shift();
|
|
2707
2726
|
if (!expr) return [3, 4];
|
|
2708
2727
|
_b = result;
|
|
2709
|
-
return [5, __values(evaluate
|
|
2728
|
+
return [5, __values(evaluate(expr, scope))];
|
|
2710
2729
|
case 3:
|
|
2711
2730
|
result = _b + _c.sent();
|
|
2712
2731
|
_c.label = 4;
|
|
@@ -2715,11 +2734,11 @@
|
|
|
2715
2734
|
}
|
|
2716
2735
|
});
|
|
2717
2736
|
}
|
|
2718
|
-
function TaggedTemplateExpression
|
|
2737
|
+
function TaggedTemplateExpression(node, scope) {
|
|
2719
2738
|
var tagFunc, quasis, str, raw, expressions, args, i, _a, _b;
|
|
2720
2739
|
return __generator(this, function (_c) {
|
|
2721
2740
|
switch (_c.label) {
|
|
2722
|
-
case 0: return [5, __values(evaluate
|
|
2741
|
+
case 0: return [5, __values(evaluate(node.tag, scope))];
|
|
2723
2742
|
case 1:
|
|
2724
2743
|
tagFunc = _c.sent();
|
|
2725
2744
|
quasis = node.quasi.quasis;
|
|
@@ -2736,7 +2755,7 @@
|
|
|
2736
2755
|
case 2:
|
|
2737
2756
|
if (!(i < expressions.length)) return [3, 5];
|
|
2738
2757
|
_b = (_a = args).push;
|
|
2739
|
-
return [5, __values(evaluate
|
|
2758
|
+
return [5, __values(evaluate(expressions[i], scope))];
|
|
2740
2759
|
case 3:
|
|
2741
2760
|
_b.apply(_a, [_c.sent()]);
|
|
2742
2761
|
_c.label = 4;
|
|
@@ -2747,29 +2766,29 @@
|
|
|
2747
2766
|
}
|
|
2748
2767
|
});
|
|
2749
2768
|
}
|
|
2750
|
-
function TemplateElement
|
|
2769
|
+
function TemplateElement(node, scope) {
|
|
2751
2770
|
return __generator(this, function (_a) {
|
|
2752
2771
|
return [2, node.value.raw];
|
|
2753
2772
|
});
|
|
2754
2773
|
}
|
|
2755
|
-
function ClassExpression
|
|
2774
|
+
function ClassExpression(node, scope) {
|
|
2756
2775
|
var tmpScope, klass;
|
|
2757
2776
|
return __generator(this, function (_a) {
|
|
2758
2777
|
switch (_a.label) {
|
|
2759
2778
|
case 0:
|
|
2760
2779
|
if (!(node.id && node.id.name)) return [3, 2];
|
|
2761
2780
|
tmpScope = new Scope(scope);
|
|
2762
|
-
return [5, __values(createClass(node, tmpScope))];
|
|
2781
|
+
return [5, __values(createClass$1(node, tmpScope))];
|
|
2763
2782
|
case 1:
|
|
2764
2783
|
klass = _a.sent();
|
|
2765
2784
|
tmpScope.const(node.id.name, klass);
|
|
2766
2785
|
return [2, klass];
|
|
2767
|
-
case 2: return [5, __values(createClass(node, scope))];
|
|
2786
|
+
case 2: return [5, __values(createClass$1(node, scope))];
|
|
2768
2787
|
case 3: return [2, _a.sent()];
|
|
2769
2788
|
}
|
|
2770
2789
|
});
|
|
2771
2790
|
}
|
|
2772
|
-
function Super
|
|
2791
|
+
function Super(node, scope, options) {
|
|
2773
2792
|
var _a, getProto, superClass;
|
|
2774
2793
|
if (options === void 0) { options = {}; }
|
|
2775
2794
|
return __generator(this, function (_b) {
|
|
@@ -2778,32 +2797,32 @@
|
|
|
2778
2797
|
return [2, getProto ? superClass.prototype : superClass];
|
|
2779
2798
|
});
|
|
2780
2799
|
}
|
|
2781
|
-
function SpreadElement
|
|
2800
|
+
function SpreadElement(node, scope) {
|
|
2782
2801
|
var result;
|
|
2783
2802
|
return __generator(this, function (_a) {
|
|
2784
2803
|
switch (_a.label) {
|
|
2785
|
-
case 0: return [5, __values(evaluate
|
|
2804
|
+
case 0: return [5, __values(evaluate(node.argument, scope))];
|
|
2786
2805
|
case 1:
|
|
2787
2806
|
result = _a.sent();
|
|
2788
2807
|
return [2, typeof result === 'string' ? __spread(result) : result];
|
|
2789
2808
|
}
|
|
2790
2809
|
});
|
|
2791
2810
|
}
|
|
2792
|
-
function ChainExpression
|
|
2811
|
+
function ChainExpression(node, scope) {
|
|
2793
2812
|
return __generator(this, function (_a) {
|
|
2794
2813
|
switch (_a.label) {
|
|
2795
|
-
case 0: return [5, __values(evaluate
|
|
2814
|
+
case 0: return [5, __values(evaluate(node.expression, scope))];
|
|
2796
2815
|
case 1: return [2, _a.sent()];
|
|
2797
2816
|
}
|
|
2798
2817
|
});
|
|
2799
2818
|
}
|
|
2800
|
-
function ImportExpression
|
|
2819
|
+
function ImportExpression(node, scope) {
|
|
2801
2820
|
var globalScope, source, module, value, result;
|
|
2802
2821
|
return __generator(this, function (_a) {
|
|
2803
2822
|
switch (_a.label) {
|
|
2804
2823
|
case 0:
|
|
2805
2824
|
globalScope = scope.global();
|
|
2806
|
-
return [5, __values(evaluate
|
|
2825
|
+
return [5, __values(evaluate(node.source, scope))];
|
|
2807
2826
|
case 1:
|
|
2808
2827
|
source = _a.sent();
|
|
2809
2828
|
module = globalScope.find(IMPORT + source);
|
|
@@ -2829,7 +2848,7 @@
|
|
|
2829
2848
|
var res, _a;
|
|
2830
2849
|
return __generator(this, function (_b) {
|
|
2831
2850
|
switch (_b.label) {
|
|
2832
|
-
case 0: return [5, __values(evaluate
|
|
2851
|
+
case 0: return [5, __values(evaluate(node.argument, scope))];
|
|
2833
2852
|
case 1:
|
|
2834
2853
|
res = _b.sent();
|
|
2835
2854
|
if (!node.delegate) return [3, 3];
|
|
@@ -2851,7 +2870,7 @@
|
|
|
2851
2870
|
switch (_b.label) {
|
|
2852
2871
|
case 0:
|
|
2853
2872
|
_a = AWAIT;
|
|
2854
|
-
return [5, __values(evaluate
|
|
2873
|
+
return [5, __values(evaluate(node.argument, scope))];
|
|
2855
2874
|
case 1:
|
|
2856
2875
|
_a.RES = _b.sent();
|
|
2857
2876
|
return [4, AWAIT];
|
|
@@ -2860,37 +2879,37 @@
|
|
|
2860
2879
|
});
|
|
2861
2880
|
}
|
|
2862
2881
|
|
|
2863
|
-
var expression
|
|
2882
|
+
var expression = /*#__PURE__*/Object.freeze({
|
|
2864
2883
|
__proto__: null,
|
|
2865
|
-
ThisExpression: ThisExpression
|
|
2866
|
-
ArrayExpression: ArrayExpression
|
|
2867
|
-
ObjectExpression: ObjectExpression
|
|
2868
|
-
FunctionExpression: FunctionExpression
|
|
2869
|
-
UnaryExpression: UnaryExpression
|
|
2870
|
-
UpdateExpression: UpdateExpression
|
|
2871
|
-
BinaryExpression: BinaryExpression
|
|
2872
|
-
AssignmentExpression: AssignmentExpression
|
|
2873
|
-
LogicalExpression: LogicalExpression
|
|
2874
|
-
MemberExpression: MemberExpression
|
|
2875
|
-
ConditionalExpression: ConditionalExpression
|
|
2876
|
-
CallExpression: CallExpression
|
|
2877
|
-
NewExpression: NewExpression
|
|
2878
|
-
MetaProperty: MetaProperty
|
|
2879
|
-
SequenceExpression: SequenceExpression
|
|
2880
|
-
ArrowFunctionExpression: ArrowFunctionExpression
|
|
2881
|
-
TemplateLiteral: TemplateLiteral
|
|
2882
|
-
TaggedTemplateExpression: TaggedTemplateExpression
|
|
2883
|
-
TemplateElement: TemplateElement
|
|
2884
|
-
ClassExpression: ClassExpression
|
|
2885
|
-
Super: Super
|
|
2886
|
-
SpreadElement: SpreadElement
|
|
2887
|
-
ChainExpression: ChainExpression
|
|
2888
|
-
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,
|
|
2889
2908
|
YieldExpression: YieldExpression,
|
|
2890
2909
|
AwaitExpression: AwaitExpression
|
|
2891
2910
|
});
|
|
2892
2911
|
|
|
2893
|
-
function ObjectPattern
|
|
2912
|
+
function ObjectPattern(node, scope, options) {
|
|
2894
2913
|
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, fedKeys, i, property, value, key, value, rest, i_1;
|
|
2895
2914
|
if (options === void 0) { options = {}; }
|
|
2896
2915
|
return __generator(this, function (_e) {
|
|
@@ -2910,12 +2929,12 @@
|
|
|
2910
2929
|
if (!(value.type === 'Identifier')) return [3, 2];
|
|
2911
2930
|
scope[kind](value.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2912
2931
|
return [3, 4];
|
|
2913
|
-
case 2: return [5, __values(pattern$
|
|
2932
|
+
case 2: return [5, __values(pattern$1(value, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2914
2933
|
case 3:
|
|
2915
2934
|
_e.sent();
|
|
2916
2935
|
_e.label = 4;
|
|
2917
2936
|
case 4: return [3, 7];
|
|
2918
|
-
case 5: return [5, __values(RestElement
|
|
2937
|
+
case 5: return [5, __values(RestElement(property, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2919
2938
|
case 6:
|
|
2920
2939
|
_e.sent();
|
|
2921
2940
|
_e.label = 7;
|
|
@@ -2924,7 +2943,7 @@
|
|
|
2924
2943
|
if (!(property.type === 'Property')) return [3, 15];
|
|
2925
2944
|
key = void 0;
|
|
2926
2945
|
if (!property.computed) return [3, 10];
|
|
2927
|
-
return [5, __values(evaluate
|
|
2946
|
+
return [5, __values(evaluate(property.key, scope))];
|
|
2928
2947
|
case 9:
|
|
2929
2948
|
key = _e.sent();
|
|
2930
2949
|
return [3, 11];
|
|
@@ -2937,7 +2956,7 @@
|
|
|
2937
2956
|
if (!(value.type === 'Identifier')) return [3, 12];
|
|
2938
2957
|
scope[kind](value.name, feed[key]);
|
|
2939
2958
|
return [3, 14];
|
|
2940
|
-
case 12: return [5, __values(pattern$
|
|
2959
|
+
case 12: return [5, __values(pattern$1(value, scope, { kind: kind, feed: feed[key] }))];
|
|
2941
2960
|
case 13:
|
|
2942
2961
|
_e.sent();
|
|
2943
2962
|
_e.label = 14;
|
|
@@ -2946,7 +2965,7 @@
|
|
|
2946
2965
|
rest = assign({}, feed);
|
|
2947
2966
|
for (i_1 = 0; i_1 < fedKeys.length; i_1++)
|
|
2948
2967
|
delete rest[fedKeys[i_1]];
|
|
2949
|
-
return [5, __values(RestElement
|
|
2968
|
+
return [5, __values(RestElement(property, scope, { kind: kind, feed: rest }))];
|
|
2950
2969
|
case 16:
|
|
2951
2970
|
_e.sent();
|
|
2952
2971
|
_e.label = 17;
|
|
@@ -2957,7 +2976,7 @@
|
|
|
2957
2976
|
}
|
|
2958
2977
|
});
|
|
2959
2978
|
}
|
|
2960
|
-
function ArrayPattern
|
|
2979
|
+
function ArrayPattern(node, scope, options) {
|
|
2961
2980
|
var kind, _a, hoist, _b, onlyBlock, _c, feed, result, i, element, variable;
|
|
2962
2981
|
if (options === void 0) { options = {}; }
|
|
2963
2982
|
return __generator(this, function (_d) {
|
|
@@ -2977,7 +2996,7 @@
|
|
|
2977
2996
|
if (!(element.type === 'Identifier')) return [3, 2];
|
|
2978
2997
|
scope[kind](element.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
2979
2998
|
return [3, 4];
|
|
2980
|
-
case 2: return [5, __values(pattern$
|
|
2999
|
+
case 2: return [5, __values(pattern$1(element, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
2981
3000
|
case 3:
|
|
2982
3001
|
_d.sent();
|
|
2983
3002
|
_d.label = 4;
|
|
@@ -2987,7 +3006,7 @@
|
|
|
2987
3006
|
if (!kind) return [3, 6];
|
|
2988
3007
|
scope[kind](element.name, feed[i]);
|
|
2989
3008
|
return [3, 8];
|
|
2990
|
-
case 6: return [5, __values(Identifier
|
|
3009
|
+
case 6: return [5, __values(Identifier(element, scope, { getVar: true }))];
|
|
2991
3010
|
case 7:
|
|
2992
3011
|
variable = _d.sent();
|
|
2993
3012
|
variable.set(feed[i]);
|
|
@@ -2996,11 +3015,11 @@
|
|
|
2996
3015
|
case 8: return [3, 13];
|
|
2997
3016
|
case 9:
|
|
2998
3017
|
if (!(element.type === 'RestElement')) return [3, 11];
|
|
2999
|
-
return [5, __values(RestElement
|
|
3018
|
+
return [5, __values(RestElement(element, scope, { kind: kind, feed: feed.slice(i) }))];
|
|
3000
3019
|
case 10:
|
|
3001
3020
|
_d.sent();
|
|
3002
3021
|
return [3, 13];
|
|
3003
|
-
case 11: return [5, __values(pattern$
|
|
3022
|
+
case 11: return [5, __values(pattern$1(element, scope, { kind: kind, feed: feed[i] }))];
|
|
3004
3023
|
case 12:
|
|
3005
3024
|
_d.sent();
|
|
3006
3025
|
_d.label = 13;
|
|
@@ -3015,7 +3034,7 @@
|
|
|
3015
3034
|
}
|
|
3016
3035
|
});
|
|
3017
3036
|
}
|
|
3018
|
-
function RestElement
|
|
3037
|
+
function RestElement(node, scope, options) {
|
|
3019
3038
|
var kind, _a, hoist, _b, onlyBlock, _c, feed, arg, variable;
|
|
3020
3039
|
if (options === void 0) { options = {}; }
|
|
3021
3040
|
return __generator(this, function (_d) {
|
|
@@ -3028,7 +3047,7 @@
|
|
|
3028
3047
|
if (!(arg.type === 'Identifier')) return [3, 1];
|
|
3029
3048
|
scope[kind](arg.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3030
3049
|
return [3, 3];
|
|
3031
|
-
case 1: return [5, __values(pattern$
|
|
3050
|
+
case 1: return [5, __values(pattern$1(arg, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3032
3051
|
case 2:
|
|
3033
3052
|
_d.sent();
|
|
3034
3053
|
_d.label = 3;
|
|
@@ -3038,13 +3057,13 @@
|
|
|
3038
3057
|
if (!kind) return [3, 5];
|
|
3039
3058
|
scope[kind](arg.name, feed);
|
|
3040
3059
|
return [3, 7];
|
|
3041
|
-
case 5: return [5, __values(Identifier
|
|
3060
|
+
case 5: return [5, __values(Identifier(arg, scope, { getVar: true }))];
|
|
3042
3061
|
case 6:
|
|
3043
3062
|
variable = _d.sent();
|
|
3044
3063
|
variable.set(feed);
|
|
3045
3064
|
_d.label = 7;
|
|
3046
3065
|
case 7: return [3, 10];
|
|
3047
|
-
case 8: return [5, __values(pattern$
|
|
3066
|
+
case 8: return [5, __values(pattern$1(arg, scope, { kind: kind, feed: feed }))];
|
|
3048
3067
|
case 9:
|
|
3049
3068
|
_d.sent();
|
|
3050
3069
|
_d.label = 10;
|
|
@@ -3052,7 +3071,7 @@
|
|
|
3052
3071
|
}
|
|
3053
3072
|
});
|
|
3054
3073
|
}
|
|
3055
|
-
function AssignmentPattern
|
|
3074
|
+
function AssignmentPattern(node, scope, options) {
|
|
3056
3075
|
var _a, kind, _b, hoist, _c, onlyBlock, _d, feed, _e, left;
|
|
3057
3076
|
if (options === void 0) { options = {}; }
|
|
3058
3077
|
return __generator(this, function (_f) {
|
|
@@ -3060,7 +3079,7 @@
|
|
|
3060
3079
|
case 0:
|
|
3061
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;
|
|
3062
3081
|
if (!(_d === void 0)) return [3, 2];
|
|
3063
|
-
return [5, __values(evaluate
|
|
3082
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
3064
3083
|
case 1:
|
|
3065
3084
|
_e = _f.sent();
|
|
3066
3085
|
return [3, 3];
|
|
@@ -3075,7 +3094,7 @@
|
|
|
3075
3094
|
if (!(left.type === 'Identifier')) return [3, 4];
|
|
3076
3095
|
scope[kind](left.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3077
3096
|
return [3, 6];
|
|
3078
|
-
case 4: return [5, __values(pattern$
|
|
3097
|
+
case 4: return [5, __values(pattern$1(left, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3079
3098
|
case 5:
|
|
3080
3099
|
_f.sent();
|
|
3081
3100
|
_f.label = 6;
|
|
@@ -3084,7 +3103,7 @@
|
|
|
3084
3103
|
if (!(left.type === 'Identifier')) return [3, 8];
|
|
3085
3104
|
scope[kind](left.name, feed);
|
|
3086
3105
|
return [3, 10];
|
|
3087
|
-
case 8: return [5, __values(pattern$
|
|
3106
|
+
case 8: return [5, __values(pattern$1(left, scope, { kind: kind, feed: feed }))];
|
|
3088
3107
|
case 9:
|
|
3089
3108
|
_f.sent();
|
|
3090
3109
|
_f.label = 10;
|
|
@@ -3093,26 +3112,26 @@
|
|
|
3093
3112
|
});
|
|
3094
3113
|
}
|
|
3095
3114
|
|
|
3096
|
-
var pattern$
|
|
3115
|
+
var pattern$2 = /*#__PURE__*/Object.freeze({
|
|
3097
3116
|
__proto__: null,
|
|
3098
|
-
ObjectPattern: ObjectPattern
|
|
3099
|
-
ArrayPattern: ArrayPattern
|
|
3100
|
-
RestElement: RestElement
|
|
3101
|
-
AssignmentPattern: AssignmentPattern
|
|
3117
|
+
ObjectPattern: ObjectPattern,
|
|
3118
|
+
ArrayPattern: ArrayPattern,
|
|
3119
|
+
RestElement: RestElement,
|
|
3120
|
+
AssignmentPattern: AssignmentPattern
|
|
3102
3121
|
});
|
|
3103
3122
|
|
|
3104
|
-
var evaluateOps
|
|
3105
|
-
function evaluate
|
|
3123
|
+
var evaluateOps;
|
|
3124
|
+
function evaluate(node, scope) {
|
|
3106
3125
|
var handler;
|
|
3107
3126
|
return __generator(this, function (_a) {
|
|
3108
3127
|
switch (_a.label) {
|
|
3109
3128
|
case 0:
|
|
3110
3129
|
if (!node)
|
|
3111
3130
|
return [2];
|
|
3112
|
-
if (!evaluateOps
|
|
3113
|
-
evaluateOps
|
|
3131
|
+
if (!evaluateOps) {
|
|
3132
|
+
evaluateOps = assign({}, declaration, expression, identifier, statement, literal, pattern$2);
|
|
3114
3133
|
}
|
|
3115
|
-
handler = evaluateOps
|
|
3134
|
+
handler = evaluateOps[node.type];
|
|
3116
3135
|
if (!handler) return [3, 2];
|
|
3117
3136
|
return [5, __values(handler(node, scope))];
|
|
3118
3137
|
case 1: return [2, _a.sent()];
|
|
@@ -3121,17 +3140,17 @@
|
|
|
3121
3140
|
});
|
|
3122
3141
|
}
|
|
3123
3142
|
|
|
3124
|
-
function ExpressionStatement
|
|
3143
|
+
function ExpressionStatement(node, scope) {
|
|
3125
3144
|
return __generator(this, function (_a) {
|
|
3126
3145
|
switch (_a.label) {
|
|
3127
|
-
case 0: return [5, __values(evaluate
|
|
3146
|
+
case 0: return [5, __values(evaluate(node.expression, scope))];
|
|
3128
3147
|
case 1:
|
|
3129
3148
|
_a.sent();
|
|
3130
3149
|
return [2];
|
|
3131
3150
|
}
|
|
3132
3151
|
});
|
|
3133
3152
|
}
|
|
3134
|
-
function BlockStatement
|
|
3153
|
+
function BlockStatement(block, scope, options) {
|
|
3135
3154
|
var _a, invasived, _b, hoisted, subScope, i, result;
|
|
3136
3155
|
if (options === void 0) { options = {}; }
|
|
3137
3156
|
return __generator(this, function (_c) {
|
|
@@ -3140,7 +3159,7 @@
|
|
|
3140
3159
|
_a = options.invasived, invasived = _a === void 0 ? false : _a, _b = options.hoisted, hoisted = _b === void 0 ? false : _b;
|
|
3141
3160
|
subScope = invasived ? scope : new Scope(scope);
|
|
3142
3161
|
if (!!hoisted) return [3, 2];
|
|
3143
|
-
return [5, __values(hoist(block, subScope, { onlyBlock: true }))];
|
|
3162
|
+
return [5, __values(hoist$1(block, subScope, { onlyBlock: true }))];
|
|
3144
3163
|
case 1:
|
|
3145
3164
|
_c.sent();
|
|
3146
3165
|
_c.label = 2;
|
|
@@ -3149,7 +3168,7 @@
|
|
|
3149
3168
|
_c.label = 3;
|
|
3150
3169
|
case 3:
|
|
3151
3170
|
if (!(i < block.body.length)) return [3, 6];
|
|
3152
|
-
return [5, __values(evaluate
|
|
3171
|
+
return [5, __values(evaluate(block.body[i], subScope))];
|
|
3153
3172
|
case 4:
|
|
3154
3173
|
result = _c.sent();
|
|
3155
3174
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
@@ -3163,25 +3182,25 @@
|
|
|
3163
3182
|
}
|
|
3164
3183
|
});
|
|
3165
3184
|
}
|
|
3166
|
-
function EmptyStatement
|
|
3185
|
+
function EmptyStatement() {
|
|
3167
3186
|
return __generator(this, function (_a) {
|
|
3168
3187
|
return [2];
|
|
3169
3188
|
});
|
|
3170
3189
|
}
|
|
3171
|
-
function DebuggerStatement
|
|
3190
|
+
function DebuggerStatement() {
|
|
3172
3191
|
return __generator(this, function (_a) {
|
|
3173
3192
|
debugger;
|
|
3174
3193
|
return [2];
|
|
3175
3194
|
});
|
|
3176
3195
|
}
|
|
3177
|
-
function ReturnStatement
|
|
3196
|
+
function ReturnStatement(node, scope) {
|
|
3178
3197
|
var _a, _b;
|
|
3179
3198
|
return __generator(this, function (_c) {
|
|
3180
3199
|
switch (_c.label) {
|
|
3181
3200
|
case 0:
|
|
3182
3201
|
_a = RETURN;
|
|
3183
3202
|
if (!node.argument) return [3, 2];
|
|
3184
|
-
return [5, __values(evaluate
|
|
3203
|
+
return [5, __values(evaluate(node.argument, scope))];
|
|
3185
3204
|
case 1:
|
|
3186
3205
|
_b = (_c.sent());
|
|
3187
3206
|
return [3, 3];
|
|
@@ -3194,34 +3213,34 @@
|
|
|
3194
3213
|
}
|
|
3195
3214
|
});
|
|
3196
3215
|
}
|
|
3197
|
-
function BreakStatement
|
|
3216
|
+
function BreakStatement() {
|
|
3198
3217
|
return __generator(this, function (_a) {
|
|
3199
3218
|
return [2, BREAK];
|
|
3200
3219
|
});
|
|
3201
3220
|
}
|
|
3202
|
-
function ContinueStatement
|
|
3221
|
+
function ContinueStatement() {
|
|
3203
3222
|
return __generator(this, function (_a) {
|
|
3204
3223
|
return [2, CONTINUE];
|
|
3205
3224
|
});
|
|
3206
3225
|
}
|
|
3207
|
-
function IfStatement
|
|
3226
|
+
function IfStatement(node, scope) {
|
|
3208
3227
|
return __generator(this, function (_a) {
|
|
3209
3228
|
switch (_a.label) {
|
|
3210
|
-
case 0: return [5, __values(evaluate
|
|
3229
|
+
case 0: return [5, __values(evaluate(node.test, scope))];
|
|
3211
3230
|
case 1:
|
|
3212
3231
|
if (!_a.sent()) return [3, 3];
|
|
3213
|
-
return [5, __values(evaluate
|
|
3232
|
+
return [5, __values(evaluate(node.consequent, scope))];
|
|
3214
3233
|
case 2: return [2, _a.sent()];
|
|
3215
|
-
case 3: return [5, __values(evaluate
|
|
3234
|
+
case 3: return [5, __values(evaluate(node.alternate, scope))];
|
|
3216
3235
|
case 4: return [2, _a.sent()];
|
|
3217
3236
|
}
|
|
3218
3237
|
});
|
|
3219
3238
|
}
|
|
3220
|
-
function SwitchStatement
|
|
3239
|
+
function SwitchStatement(node, scope) {
|
|
3221
3240
|
var discriminant, matched, i, eachCase, _a, _b, result;
|
|
3222
3241
|
return __generator(this, function (_c) {
|
|
3223
3242
|
switch (_c.label) {
|
|
3224
|
-
case 0: return [5, __values(evaluate
|
|
3243
|
+
case 0: return [5, __values(evaluate(node.discriminant, scope))];
|
|
3225
3244
|
case 1:
|
|
3226
3245
|
discriminant = _c.sent();
|
|
3227
3246
|
matched = false;
|
|
@@ -3234,7 +3253,7 @@
|
|
|
3234
3253
|
if (!_a) return [3, 5];
|
|
3235
3254
|
_b = !eachCase.test;
|
|
3236
3255
|
if (_b) return [3, 4];
|
|
3237
|
-
return [5, __values(evaluate
|
|
3256
|
+
return [5, __values(evaluate(eachCase.test, scope))];
|
|
3238
3257
|
case 3:
|
|
3239
3258
|
_b = (_c.sent()) === discriminant;
|
|
3240
3259
|
_c.label = 4;
|
|
@@ -3246,7 +3265,7 @@
|
|
|
3246
3265
|
matched = true;
|
|
3247
3266
|
}
|
|
3248
3267
|
if (!matched) return [3, 7];
|
|
3249
|
-
return [5, __values(SwitchCase
|
|
3268
|
+
return [5, __values(SwitchCase(eachCase, scope))];
|
|
3250
3269
|
case 6:
|
|
3251
3270
|
result = _c.sent();
|
|
3252
3271
|
if (result === BREAK) {
|
|
@@ -3263,7 +3282,7 @@
|
|
|
3263
3282
|
}
|
|
3264
3283
|
});
|
|
3265
3284
|
}
|
|
3266
|
-
function SwitchCase
|
|
3285
|
+
function SwitchCase(node, scope) {
|
|
3267
3286
|
var i, result;
|
|
3268
3287
|
return __generator(this, function (_a) {
|
|
3269
3288
|
switch (_a.label) {
|
|
@@ -3272,7 +3291,7 @@
|
|
|
3272
3291
|
_a.label = 1;
|
|
3273
3292
|
case 1:
|
|
3274
3293
|
if (!(i < node.consequent.length)) return [3, 4];
|
|
3275
|
-
return [5, __values(evaluate
|
|
3294
|
+
return [5, __values(evaluate(node.consequent[i], scope))];
|
|
3276
3295
|
case 2:
|
|
3277
3296
|
result = _a.sent();
|
|
3278
3297
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
@@ -3286,21 +3305,21 @@
|
|
|
3286
3305
|
}
|
|
3287
3306
|
});
|
|
3288
3307
|
}
|
|
3289
|
-
function ThrowStatement
|
|
3308
|
+
function ThrowStatement(node, scope) {
|
|
3290
3309
|
return __generator(this, function (_a) {
|
|
3291
3310
|
switch (_a.label) {
|
|
3292
|
-
case 0: return [5, __values(evaluate
|
|
3311
|
+
case 0: return [5, __values(evaluate(node.argument, scope))];
|
|
3293
3312
|
case 1: throw _a.sent();
|
|
3294
3313
|
}
|
|
3295
3314
|
});
|
|
3296
3315
|
}
|
|
3297
|
-
function TryStatement
|
|
3316
|
+
function TryStatement(node, scope) {
|
|
3298
3317
|
var err_1, subScope, param, name_1, result;
|
|
3299
3318
|
return __generator(this, function (_a) {
|
|
3300
3319
|
switch (_a.label) {
|
|
3301
3320
|
case 0:
|
|
3302
3321
|
_a.trys.push([0, 2, 9, 12]);
|
|
3303
|
-
return [5, __values(BlockStatement
|
|
3322
|
+
return [5, __values(BlockStatement(node.block, scope))];
|
|
3304
3323
|
case 1: return [2, _a.sent()];
|
|
3305
3324
|
case 2:
|
|
3306
3325
|
err_1 = _a.sent();
|
|
@@ -3312,17 +3331,17 @@
|
|
|
3312
3331
|
name_1 = param.name;
|
|
3313
3332
|
subScope.var(name_1, err_1);
|
|
3314
3333
|
return [3, 5];
|
|
3315
|
-
case 3: return [5, __values(pattern$
|
|
3334
|
+
case 3: return [5, __values(pattern$1(param, scope, { feed: err_1 }))];
|
|
3316
3335
|
case 4:
|
|
3317
3336
|
_a.sent();
|
|
3318
3337
|
_a.label = 5;
|
|
3319
|
-
case 5: return [5, __values(CatchClause
|
|
3338
|
+
case 5: return [5, __values(CatchClause(node.handler, subScope))];
|
|
3320
3339
|
case 6: return [2, _a.sent()];
|
|
3321
3340
|
case 7: throw err_1;
|
|
3322
3341
|
case 8: return [3, 12];
|
|
3323
3342
|
case 9:
|
|
3324
3343
|
if (!node.finalizer) return [3, 11];
|
|
3325
|
-
return [5, __values(BlockStatement
|
|
3344
|
+
return [5, __values(BlockStatement(node.finalizer, scope))];
|
|
3326
3345
|
case 10:
|
|
3327
3346
|
result = _a.sent();
|
|
3328
3347
|
if (result === BREAK || result === CONTINUE || result === RETURN) {
|
|
@@ -3334,22 +3353,22 @@
|
|
|
3334
3353
|
}
|
|
3335
3354
|
});
|
|
3336
3355
|
}
|
|
3337
|
-
function CatchClause
|
|
3356
|
+
function CatchClause(node, scope) {
|
|
3338
3357
|
return __generator(this, function (_a) {
|
|
3339
3358
|
switch (_a.label) {
|
|
3340
|
-
case 0: return [5, __values(BlockStatement
|
|
3359
|
+
case 0: return [5, __values(BlockStatement(node.body, scope, { invasived: true }))];
|
|
3341
3360
|
case 1: return [2, _a.sent()];
|
|
3342
3361
|
}
|
|
3343
3362
|
});
|
|
3344
3363
|
}
|
|
3345
|
-
function WhileStatement
|
|
3364
|
+
function WhileStatement(node, scope) {
|
|
3346
3365
|
var result;
|
|
3347
3366
|
return __generator(this, function (_a) {
|
|
3348
3367
|
switch (_a.label) {
|
|
3349
|
-
case 0: return [5, __values(evaluate
|
|
3368
|
+
case 0: return [5, __values(evaluate(node.test, scope))];
|
|
3350
3369
|
case 1:
|
|
3351
3370
|
if (!_a.sent()) return [3, 3];
|
|
3352
|
-
return [5, __values(evaluate
|
|
3371
|
+
return [5, __values(evaluate(node.body, scope))];
|
|
3353
3372
|
case 2:
|
|
3354
3373
|
result = _a.sent();
|
|
3355
3374
|
if (result === BREAK) {
|
|
@@ -3366,11 +3385,11 @@
|
|
|
3366
3385
|
}
|
|
3367
3386
|
});
|
|
3368
3387
|
}
|
|
3369
|
-
function DoWhileStatement
|
|
3388
|
+
function DoWhileStatement(node, scope) {
|
|
3370
3389
|
var result;
|
|
3371
3390
|
return __generator(this, function (_a) {
|
|
3372
3391
|
switch (_a.label) {
|
|
3373
|
-
case 0: return [5, __values(evaluate
|
|
3392
|
+
case 0: return [5, __values(evaluate(node.body, scope))];
|
|
3374
3393
|
case 1:
|
|
3375
3394
|
result = _a.sent();
|
|
3376
3395
|
if (result === BREAK) {
|
|
@@ -3383,7 +3402,7 @@
|
|
|
3383
3402
|
return [2, result];
|
|
3384
3403
|
}
|
|
3385
3404
|
_a.label = 2;
|
|
3386
|
-
case 2: return [5, __values(evaluate
|
|
3405
|
+
case 2: return [5, __values(evaluate(node.test, scope))];
|
|
3387
3406
|
case 3:
|
|
3388
3407
|
if (_a.sent()) return [3, 0];
|
|
3389
3408
|
_a.label = 4;
|
|
@@ -3391,19 +3410,19 @@
|
|
|
3391
3410
|
}
|
|
3392
3411
|
});
|
|
3393
3412
|
}
|
|
3394
|
-
function ForStatement
|
|
3413
|
+
function ForStatement(node, scope) {
|
|
3395
3414
|
var forScope, _a, subScope, result;
|
|
3396
3415
|
return __generator(this, function (_b) {
|
|
3397
3416
|
switch (_b.label) {
|
|
3398
3417
|
case 0:
|
|
3399
3418
|
forScope = new Scope(scope);
|
|
3400
|
-
return [5, __values(evaluate
|
|
3419
|
+
return [5, __values(evaluate(node.init, forScope))];
|
|
3401
3420
|
case 1:
|
|
3402
3421
|
_b.sent();
|
|
3403
3422
|
_b.label = 2;
|
|
3404
3423
|
case 2:
|
|
3405
3424
|
if (!node.test) return [3, 4];
|
|
3406
|
-
return [5, __values(evaluate
|
|
3425
|
+
return [5, __values(evaluate(node.test, forScope))];
|
|
3407
3426
|
case 3:
|
|
3408
3427
|
_a = (_b.sent());
|
|
3409
3428
|
return [3, 5];
|
|
@@ -3415,11 +3434,11 @@
|
|
|
3415
3434
|
subScope = new Scope(forScope);
|
|
3416
3435
|
result = void 0;
|
|
3417
3436
|
if (!(node.body.type === 'BlockStatement')) return [3, 7];
|
|
3418
|
-
return [5, __values(BlockStatement
|
|
3437
|
+
return [5, __values(BlockStatement(node.body, subScope, { invasived: true }))];
|
|
3419
3438
|
case 6:
|
|
3420
3439
|
result = _b.sent();
|
|
3421
3440
|
return [3, 9];
|
|
3422
|
-
case 7: return [5, __values(evaluate
|
|
3441
|
+
case 7: return [5, __values(evaluate(node.body, subScope))];
|
|
3423
3442
|
case 8:
|
|
3424
3443
|
result = _b.sent();
|
|
3425
3444
|
_b.label = 9;
|
|
@@ -3434,7 +3453,7 @@
|
|
|
3434
3453
|
return [2, result];
|
|
3435
3454
|
}
|
|
3436
3455
|
_b.label = 10;
|
|
3437
|
-
case 10: return [5, __values(evaluate
|
|
3456
|
+
case 10: return [5, __values(evaluate(node.update, forScope))];
|
|
3438
3457
|
case 11:
|
|
3439
3458
|
_b.sent();
|
|
3440
3459
|
return [3, 2];
|
|
@@ -3442,13 +3461,13 @@
|
|
|
3442
3461
|
}
|
|
3443
3462
|
});
|
|
3444
3463
|
}
|
|
3445
|
-
function ForInStatement
|
|
3464
|
+
function ForInStatement(node, scope) {
|
|
3446
3465
|
var _a, _b, _i, value, result;
|
|
3447
3466
|
return __generator(this, function (_c) {
|
|
3448
3467
|
switch (_c.label) {
|
|
3449
3468
|
case 0:
|
|
3450
3469
|
_a = [];
|
|
3451
|
-
return [5, __values(evaluate
|
|
3470
|
+
return [5, __values(evaluate(node.right, scope))];
|
|
3452
3471
|
case 1:
|
|
3453
3472
|
for (_b in _c.sent())
|
|
3454
3473
|
_a.push(_b);
|
|
@@ -3457,7 +3476,7 @@
|
|
|
3457
3476
|
case 2:
|
|
3458
3477
|
if (!(_i < _a.length)) return [3, 5];
|
|
3459
3478
|
value = _a[_i];
|
|
3460
|
-
return [5, __values(ForXHandler(node, scope, { value: value }))];
|
|
3479
|
+
return [5, __values(ForXHandler$1(node, scope, { value: value }))];
|
|
3461
3480
|
case 3:
|
|
3462
3481
|
result = _c.sent();
|
|
3463
3482
|
if (result === BREAK) {
|
|
@@ -3477,12 +3496,12 @@
|
|
|
3477
3496
|
}
|
|
3478
3497
|
});
|
|
3479
3498
|
}
|
|
3480
|
-
function ForOfStatement
|
|
3499
|
+
function ForOfStatement(node, scope) {
|
|
3481
3500
|
var right, iterator, ret, result, right_1, right_1_1, value, result, e_1_1;
|
|
3482
3501
|
var e_1, _a;
|
|
3483
3502
|
return __generator(this, function (_b) {
|
|
3484
3503
|
switch (_b.label) {
|
|
3485
|
-
case 0: return [5, __values(evaluate
|
|
3504
|
+
case 0: return [5, __values(evaluate(node.right, scope))];
|
|
3486
3505
|
case 1:
|
|
3487
3506
|
right = _b.sent();
|
|
3488
3507
|
if (!node.await) return [3, 8];
|
|
@@ -3495,7 +3514,7 @@
|
|
|
3495
3514
|
_b.label = 3;
|
|
3496
3515
|
case 3:
|
|
3497
3516
|
if (!!ret.done) return [3, 7];
|
|
3498
|
-
return [5, __values(ForXHandler(node, scope, { value: ret.value }))];
|
|
3517
|
+
return [5, __values(ForXHandler$1(node, scope, { value: ret.value }))];
|
|
3499
3518
|
case 4:
|
|
3500
3519
|
result = _b.sent();
|
|
3501
3520
|
if (result === BREAK) {
|
|
@@ -3522,7 +3541,7 @@
|
|
|
3522
3541
|
case 9:
|
|
3523
3542
|
if (!!right_1_1.done) return [3, 12];
|
|
3524
3543
|
value = right_1_1.value;
|
|
3525
|
-
return [5, __values(ForXHandler(node, scope, { value: value }))];
|
|
3544
|
+
return [5, __values(ForXHandler$1(node, scope, { value: value }))];
|
|
3526
3545
|
case 10:
|
|
3527
3546
|
result = _b.sent();
|
|
3528
3547
|
if (result === BREAK) {
|
|
@@ -3554,13 +3573,13 @@
|
|
|
3554
3573
|
});
|
|
3555
3574
|
}
|
|
3556
3575
|
|
|
3557
|
-
function FunctionDeclaration
|
|
3576
|
+
function FunctionDeclaration(node, scope) {
|
|
3558
3577
|
return __generator(this, function (_a) {
|
|
3559
|
-
scope.func(node.id.name, createFunc(node, scope));
|
|
3578
|
+
scope.func(node.id.name, createFunc$1(node, scope));
|
|
3560
3579
|
return [2];
|
|
3561
3580
|
});
|
|
3562
3581
|
}
|
|
3563
|
-
function VariableDeclaration
|
|
3582
|
+
function VariableDeclaration(node, scope, options) {
|
|
3564
3583
|
var i;
|
|
3565
3584
|
if (options === void 0) { options = {}; }
|
|
3566
3585
|
return __generator(this, function (_a) {
|
|
@@ -3570,7 +3589,7 @@
|
|
|
3570
3589
|
_a.label = 1;
|
|
3571
3590
|
case 1:
|
|
3572
3591
|
if (!(i < node.declarations.length)) return [3, 4];
|
|
3573
|
-
return [5, __values(VariableDeclarator
|
|
3592
|
+
return [5, __values(VariableDeclarator(node.declarations[i], scope, assign({ kind: node.kind }, options)))];
|
|
3574
3593
|
case 2:
|
|
3575
3594
|
_a.sent();
|
|
3576
3595
|
_a.label = 3;
|
|
@@ -3581,7 +3600,7 @@
|
|
|
3581
3600
|
}
|
|
3582
3601
|
});
|
|
3583
3602
|
}
|
|
3584
|
-
function VariableDeclarator
|
|
3603
|
+
function VariableDeclarator(node, scope, options) {
|
|
3585
3604
|
var _a, kind, _b, hoist, _c, onlyBlock, feed, hasFeed, value, _d, name_1;
|
|
3586
3605
|
if (options === void 0) { options = {}; }
|
|
3587
3606
|
return __generator(this, function (_e) {
|
|
@@ -3593,7 +3612,7 @@
|
|
|
3593
3612
|
if (!(node.id.type === 'Identifier')) return [3, 1];
|
|
3594
3613
|
scope[kind](node.id.name, onlyBlock ? DEADZONE : kind === 'var' ? NOINIT : undefined);
|
|
3595
3614
|
return [3, 3];
|
|
3596
|
-
case 1: return [5, __values(pattern$
|
|
3615
|
+
case 1: return [5, __values(pattern$1(node.id, scope, { kind: kind, hoist: hoist, onlyBlock: onlyBlock }))];
|
|
3597
3616
|
case 2:
|
|
3598
3617
|
_e.sent();
|
|
3599
3618
|
_e.label = 3;
|
|
@@ -3603,7 +3622,7 @@
|
|
|
3603
3622
|
if (!hasFeed) return [3, 5];
|
|
3604
3623
|
_d = feed;
|
|
3605
3624
|
return [3, 7];
|
|
3606
|
-
case 5: return [5, __values(evaluate
|
|
3625
|
+
case 5: return [5, __values(evaluate(node.init, scope))];
|
|
3607
3626
|
case 6:
|
|
3608
3627
|
_d = _e.sent();
|
|
3609
3628
|
_e.label = 7;
|
|
@@ -3627,7 +3646,7 @@
|
|
|
3627
3646
|
});
|
|
3628
3647
|
}
|
|
3629
3648
|
return [3, 10];
|
|
3630
|
-
case 8: return [5, __values(pattern$
|
|
3649
|
+
case 8: return [5, __values(pattern$1(node.id, scope, { kind: kind, feed: value }))];
|
|
3631
3650
|
case 9:
|
|
3632
3651
|
_e.sent();
|
|
3633
3652
|
_e.label = 10;
|
|
@@ -3635,21 +3654,21 @@
|
|
|
3635
3654
|
}
|
|
3636
3655
|
});
|
|
3637
3656
|
}
|
|
3638
|
-
function ClassDeclaration
|
|
3657
|
+
function ClassDeclaration(node, scope) {
|
|
3639
3658
|
var _a, _b, _c;
|
|
3640
3659
|
return __generator(this, function (_d) {
|
|
3641
3660
|
switch (_d.label) {
|
|
3642
3661
|
case 0:
|
|
3643
3662
|
_b = (_a = scope).func;
|
|
3644
3663
|
_c = [node.id.name];
|
|
3645
|
-
return [5, __values(createClass(node, scope))];
|
|
3664
|
+
return [5, __values(createClass$1(node, scope))];
|
|
3646
3665
|
case 1:
|
|
3647
3666
|
_b.apply(_a, _c.concat([_d.sent()]));
|
|
3648
3667
|
return [2];
|
|
3649
3668
|
}
|
|
3650
3669
|
});
|
|
3651
3670
|
}
|
|
3652
|
-
function ClassBody
|
|
3671
|
+
function ClassBody(node, scope, options) {
|
|
3653
3672
|
var klass, superClass, i, def;
|
|
3654
3673
|
if (options === void 0) { options = {}; }
|
|
3655
3674
|
return __generator(this, function (_a) {
|
|
@@ -3662,19 +3681,19 @@
|
|
|
3662
3681
|
if (!(i < node.body.length)) return [3, 8];
|
|
3663
3682
|
def = node.body[i];
|
|
3664
3683
|
if (!(def.type === 'MethodDefinition')) return [3, 3];
|
|
3665
|
-
return [5, __values(MethodDefinition
|
|
3684
|
+
return [5, __values(MethodDefinition(def, scope, { klass: klass, superClass: superClass }))];
|
|
3666
3685
|
case 2:
|
|
3667
3686
|
_a.sent();
|
|
3668
3687
|
return [3, 7];
|
|
3669
3688
|
case 3:
|
|
3670
3689
|
if (!(def.type === 'PropertyDefinition' && def.static)) return [3, 5];
|
|
3671
|
-
return [5, __values(PropertyDefinition
|
|
3690
|
+
return [5, __values(PropertyDefinition(def, scope, { klass: klass, superClass: superClass }))];
|
|
3672
3691
|
case 4:
|
|
3673
3692
|
_a.sent();
|
|
3674
3693
|
return [3, 7];
|
|
3675
3694
|
case 5:
|
|
3676
3695
|
if (!(def.type === 'StaticBlock')) return [3, 7];
|
|
3677
|
-
return [5, __values(StaticBlock
|
|
3696
|
+
return [5, __values(StaticBlock(def, scope, { klass: klass, superClass: superClass }))];
|
|
3678
3697
|
case 6:
|
|
3679
3698
|
_a.sent();
|
|
3680
3699
|
_a.label = 7;
|
|
@@ -3685,7 +3704,7 @@
|
|
|
3685
3704
|
}
|
|
3686
3705
|
});
|
|
3687
3706
|
}
|
|
3688
|
-
function MethodDefinition
|
|
3707
|
+
function MethodDefinition(node, scope, options) {
|
|
3689
3708
|
var klass, superClass, key, priv, obj, value, oriDptor, oriDptor;
|
|
3690
3709
|
if (options === void 0) { options = {}; }
|
|
3691
3710
|
return __generator(this, function (_a) {
|
|
@@ -3694,7 +3713,7 @@
|
|
|
3694
3713
|
klass = options.klass, superClass = options.superClass;
|
|
3695
3714
|
priv = false;
|
|
3696
3715
|
if (!node.computed) return [3, 2];
|
|
3697
|
-
return [5, __values(evaluate
|
|
3716
|
+
return [5, __values(evaluate(node.key, scope))];
|
|
3698
3717
|
case 1:
|
|
3699
3718
|
key = _a.sent();
|
|
3700
3719
|
return [3, 3];
|
|
@@ -3718,7 +3737,7 @@
|
|
|
3718
3737
|
}
|
|
3719
3738
|
obj = obj[PRIVATE];
|
|
3720
3739
|
}
|
|
3721
|
-
value = createFunc(node.value, scope, { superClass: superClass });
|
|
3740
|
+
value = createFunc$1(node.value, scope, { superClass: superClass });
|
|
3722
3741
|
switch (node.kind) {
|
|
3723
3742
|
case 'constructor':
|
|
3724
3743
|
break;
|
|
@@ -3754,7 +3773,7 @@
|
|
|
3754
3773
|
}
|
|
3755
3774
|
});
|
|
3756
3775
|
}
|
|
3757
|
-
function PropertyDefinition
|
|
3776
|
+
function PropertyDefinition(node, scope, options) {
|
|
3758
3777
|
var klass, superClass, key, priv, subScope, obj, _a, _b;
|
|
3759
3778
|
if (options === void 0) { options = {}; }
|
|
3760
3779
|
return __generator(this, function (_c) {
|
|
@@ -3763,7 +3782,7 @@
|
|
|
3763
3782
|
klass = options.klass, superClass = options.superClass;
|
|
3764
3783
|
priv = false;
|
|
3765
3784
|
if (!node.computed) return [3, 2];
|
|
3766
|
-
return [5, __values(evaluate
|
|
3785
|
+
return [5, __values(evaluate(node.key, scope))];
|
|
3767
3786
|
case 1:
|
|
3768
3787
|
key = _c.sent();
|
|
3769
3788
|
return [3, 3];
|
|
@@ -3790,12 +3809,12 @@
|
|
|
3790
3809
|
obj = obj[PRIVATE];
|
|
3791
3810
|
}
|
|
3792
3811
|
if (!(node.value.type === 'FunctionExpression' || node.value.type === 'ArrowFunctionExpression')) return [3, 4];
|
|
3793
|
-
obj[key] = createFunc(node.value, subScope, { superClass: superClass });
|
|
3812
|
+
obj[key] = createFunc$1(node.value, subScope, { superClass: superClass });
|
|
3794
3813
|
return [3, 6];
|
|
3795
3814
|
case 4:
|
|
3796
3815
|
_a = obj;
|
|
3797
3816
|
_b = key;
|
|
3798
|
-
return [5, __values(evaluate
|
|
3817
|
+
return [5, __values(evaluate(node.value, subScope))];
|
|
3799
3818
|
case 5:
|
|
3800
3819
|
_a[_b] = _c.sent();
|
|
3801
3820
|
_c.label = 6;
|
|
@@ -3803,7 +3822,7 @@
|
|
|
3803
3822
|
}
|
|
3804
3823
|
});
|
|
3805
3824
|
}
|
|
3806
|
-
function StaticBlock
|
|
3825
|
+
function StaticBlock(node, scope, options) {
|
|
3807
3826
|
var klass, subScope;
|
|
3808
3827
|
if (options === void 0) { options = {}; }
|
|
3809
3828
|
return __generator(this, function (_a) {
|
|
@@ -3812,12 +3831,12 @@
|
|
|
3812
3831
|
klass = options.klass;
|
|
3813
3832
|
subScope = new Scope(scope, true);
|
|
3814
3833
|
subScope.const('this', klass);
|
|
3815
|
-
return [5, __values(BlockStatement
|
|
3834
|
+
return [5, __values(BlockStatement(node, subScope, { invasived: true }))];
|
|
3816
3835
|
case 1: return [2, _a.sent()];
|
|
3817
3836
|
}
|
|
3818
3837
|
});
|
|
3819
3838
|
}
|
|
3820
|
-
function ImportDeclaration
|
|
3839
|
+
function ImportDeclaration(node, scope) {
|
|
3821
3840
|
var globalScope, module, value, result, i, spec, name_2;
|
|
3822
3841
|
return __generator(this, function (_a) {
|
|
3823
3842
|
globalScope = scope.global();
|
|
@@ -3857,24 +3876,24 @@
|
|
|
3857
3876
|
return [2];
|
|
3858
3877
|
});
|
|
3859
3878
|
}
|
|
3860
|
-
function ExportDefaultDeclaration
|
|
3879
|
+
function ExportDefaultDeclaration(node, scope) {
|
|
3861
3880
|
var globalScope, value, variable, exports_1;
|
|
3862
3881
|
return __generator(this, function (_a) {
|
|
3863
3882
|
switch (_a.label) {
|
|
3864
3883
|
case 0:
|
|
3865
3884
|
globalScope = scope.global();
|
|
3866
3885
|
if (!(node.declaration.type === 'FunctionDeclaration')) return [3, 1];
|
|
3867
|
-
value = createFunc(node.declaration, scope);
|
|
3886
|
+
value = createFunc$1(node.declaration, scope);
|
|
3868
3887
|
scope.func(node.declaration.id.name, value);
|
|
3869
3888
|
return [3, 5];
|
|
3870
3889
|
case 1:
|
|
3871
3890
|
if (!(node.declaration.type === 'ClassDeclaration')) return [3, 3];
|
|
3872
|
-
return [5, __values(createClass(node.declaration, scope))];
|
|
3891
|
+
return [5, __values(createClass$1(node.declaration, scope))];
|
|
3873
3892
|
case 2:
|
|
3874
3893
|
value = _a.sent();
|
|
3875
3894
|
scope.func(node.declaration.id.name, value);
|
|
3876
3895
|
return [3, 5];
|
|
3877
|
-
case 3: return [5, __values(evaluate
|
|
3896
|
+
case 3: return [5, __values(evaluate(node.declaration, scope))];
|
|
3878
3897
|
case 4:
|
|
3879
3898
|
value = _a.sent();
|
|
3880
3899
|
_a.label = 5;
|
|
@@ -3890,7 +3909,7 @@
|
|
|
3890
3909
|
}
|
|
3891
3910
|
});
|
|
3892
3911
|
}
|
|
3893
|
-
function ExportNamedDeclaration
|
|
3912
|
+
function ExportNamedDeclaration(node, scope) {
|
|
3894
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;
|
|
3895
3914
|
return __generator(this, function (_a) {
|
|
3896
3915
|
switch (_a.label) {
|
|
@@ -3898,7 +3917,7 @@
|
|
|
3898
3917
|
globalScope = scope.global();
|
|
3899
3918
|
if (!node.declaration) return [3, 6];
|
|
3900
3919
|
if (!(node.declaration.type === 'FunctionDeclaration')) return [3, 1];
|
|
3901
|
-
value = createFunc(node.declaration, scope);
|
|
3920
|
+
value = createFunc$1(node.declaration, scope);
|
|
3902
3921
|
scope.func(node.declaration.id.name, value);
|
|
3903
3922
|
variable = globalScope.find(EXPORTS);
|
|
3904
3923
|
if (variable) {
|
|
@@ -3910,7 +3929,7 @@
|
|
|
3910
3929
|
return [3, 5];
|
|
3911
3930
|
case 1:
|
|
3912
3931
|
if (!(node.declaration.type === 'ClassDeclaration')) return [3, 3];
|
|
3913
|
-
return [5, __values(createClass(node.declaration, scope))];
|
|
3932
|
+
return [5, __values(createClass$1(node.declaration, scope))];
|
|
3914
3933
|
case 2:
|
|
3915
3934
|
value = _a.sent();
|
|
3916
3935
|
scope.func(node.declaration.id.name, value);
|
|
@@ -3924,7 +3943,7 @@
|
|
|
3924
3943
|
return [3, 5];
|
|
3925
3944
|
case 3:
|
|
3926
3945
|
if (!(node.declaration.type === 'VariableDeclaration')) return [3, 5];
|
|
3927
|
-
return [5, __values(VariableDeclaration
|
|
3946
|
+
return [5, __values(VariableDeclaration(node.declaration, scope))];
|
|
3928
3947
|
case 4:
|
|
3929
3948
|
_a.sent();
|
|
3930
3949
|
variable = globalScope.find(EXPORTS);
|
|
@@ -3966,7 +3985,7 @@
|
|
|
3966
3985
|
}
|
|
3967
3986
|
});
|
|
3968
3987
|
}
|
|
3969
|
-
function ExportAllDeclaration
|
|
3988
|
+
function ExportAllDeclaration(node, scope) {
|
|
3970
3989
|
var globalScope, module, value, result, variable, exports_6;
|
|
3971
3990
|
return __generator(this, function (_a) {
|
|
3972
3991
|
globalScope = scope.global();
|
|
@@ -4043,7 +4062,7 @@
|
|
|
4043
4062
|
});
|
|
4044
4063
|
}
|
|
4045
4064
|
|
|
4046
|
-
function hoist(block, scope, options) {
|
|
4065
|
+
function hoist$1(block, scope, options) {
|
|
4047
4066
|
var _a, onlyBlock, funcDclrList, funcDclrIdxs, i, statement, i;
|
|
4048
4067
|
if (options === void 0) { options = {}; }
|
|
4049
4068
|
return __generator(this, function (_b) {
|
|
@@ -4064,13 +4083,13 @@
|
|
|
4064
4083
|
case 2:
|
|
4065
4084
|
if (!(statement.type === 'VariableDeclaration'
|
|
4066
4085
|
&& ['const', 'let'].indexOf(statement.kind) !== -1)) return [3, 4];
|
|
4067
|
-
return [5, __values(VariableDeclaration
|
|
4086
|
+
return [5, __values(VariableDeclaration(statement, scope, { hoist: true, onlyBlock: true }))];
|
|
4068
4087
|
case 3:
|
|
4069
4088
|
_b.sent();
|
|
4070
4089
|
return [3, 6];
|
|
4071
4090
|
case 4:
|
|
4072
4091
|
if (!!onlyBlock) return [3, 6];
|
|
4073
|
-
return [5, __values(hoistVarRecursion(statement, scope))];
|
|
4092
|
+
return [5, __values(hoistVarRecursion$1(statement, scope))];
|
|
4074
4093
|
case 5:
|
|
4075
4094
|
_b.sent();
|
|
4076
4095
|
_b.label = 6;
|
|
@@ -4088,7 +4107,7 @@
|
|
|
4088
4107
|
}
|
|
4089
4108
|
});
|
|
4090
4109
|
}
|
|
4091
|
-
function hoistVarRecursion(statement, scope) {
|
|
4110
|
+
function hoistVarRecursion$1(statement, scope) {
|
|
4092
4111
|
var _a, i, i, j, tryBlock, i, catchBlock, i, finalBlock, i;
|
|
4093
4112
|
return __generator(this, function (_b) {
|
|
4094
4113
|
switch (_b.label) {
|
|
@@ -4107,31 +4126,31 @@
|
|
|
4107
4126
|
case 'TryStatement': return [3, 25];
|
|
4108
4127
|
}
|
|
4109
4128
|
return [3, 38];
|
|
4110
|
-
case 1: return [5, __values(VariableDeclaration
|
|
4129
|
+
case 1: return [5, __values(VariableDeclaration(statement, scope, { hoist: true }))];
|
|
4111
4130
|
case 2:
|
|
4112
4131
|
_b.sent();
|
|
4113
4132
|
return [3, 38];
|
|
4114
4133
|
case 3:
|
|
4115
4134
|
if (!(statement.left.type === 'VariableDeclaration')) return [3, 5];
|
|
4116
|
-
return [5, __values(VariableDeclaration
|
|
4135
|
+
return [5, __values(VariableDeclaration(statement.left, scope, { hoist: true }))];
|
|
4117
4136
|
case 4:
|
|
4118
4137
|
_b.sent();
|
|
4119
4138
|
_b.label = 5;
|
|
4120
4139
|
case 5:
|
|
4121
4140
|
if (!(statement.type === 'ForStatement' && statement.init.type === 'VariableDeclaration')) return [3, 7];
|
|
4122
|
-
return [5, __values(VariableDeclaration
|
|
4141
|
+
return [5, __values(VariableDeclaration(statement.init, scope, { hoist: true }))];
|
|
4123
4142
|
case 6:
|
|
4124
4143
|
_b.sent();
|
|
4125
4144
|
_b.label = 7;
|
|
4126
|
-
case 7: return [5, __values(hoistVarRecursion(statement.body, scope))];
|
|
4145
|
+
case 7: return [5, __values(hoistVarRecursion$1(statement.body, scope))];
|
|
4127
4146
|
case 8:
|
|
4128
4147
|
_b.sent();
|
|
4129
4148
|
return [3, 38];
|
|
4130
|
-
case 9: return [5, __values(hoistVarRecursion(statement.consequent, scope))];
|
|
4149
|
+
case 9: return [5, __values(hoistVarRecursion$1(statement.consequent, scope))];
|
|
4131
4150
|
case 10:
|
|
4132
4151
|
_b.sent();
|
|
4133
4152
|
if (!statement.alternate) return [3, 12];
|
|
4134
|
-
return [5, __values(hoistVarRecursion(statement.alternate, scope))];
|
|
4153
|
+
return [5, __values(hoistVarRecursion$1(statement.alternate, scope))];
|
|
4135
4154
|
case 11:
|
|
4136
4155
|
_b.sent();
|
|
4137
4156
|
_b.label = 12;
|
|
@@ -4141,7 +4160,7 @@
|
|
|
4141
4160
|
_b.label = 14;
|
|
4142
4161
|
case 14:
|
|
4143
4162
|
if (!(i < statement.body.length)) return [3, 17];
|
|
4144
|
-
return [5, __values(hoistVarRecursion(statement.body[i], scope))];
|
|
4163
|
+
return [5, __values(hoistVarRecursion$1(statement.body[i], scope))];
|
|
4145
4164
|
case 15:
|
|
4146
4165
|
_b.sent();
|
|
4147
4166
|
_b.label = 16;
|
|
@@ -4158,7 +4177,7 @@
|
|
|
4158
4177
|
_b.label = 20;
|
|
4159
4178
|
case 20:
|
|
4160
4179
|
if (!(j < statement.cases[i].consequent.length)) return [3, 23];
|
|
4161
|
-
return [5, __values(hoistVarRecursion(statement.cases[i].consequent[j], scope))];
|
|
4180
|
+
return [5, __values(hoistVarRecursion$1(statement.cases[i].consequent[j], scope))];
|
|
4162
4181
|
case 21:
|
|
4163
4182
|
_b.sent();
|
|
4164
4183
|
_b.label = 22;
|
|
@@ -4175,7 +4194,7 @@
|
|
|
4175
4194
|
_b.label = 26;
|
|
4176
4195
|
case 26:
|
|
4177
4196
|
if (!(i < tryBlock.length)) return [3, 29];
|
|
4178
|
-
return [5, __values(hoistVarRecursion(tryBlock[i], scope))];
|
|
4197
|
+
return [5, __values(hoistVarRecursion$1(tryBlock[i], scope))];
|
|
4179
4198
|
case 27:
|
|
4180
4199
|
_b.sent();
|
|
4181
4200
|
_b.label = 28;
|
|
@@ -4189,7 +4208,7 @@
|
|
|
4189
4208
|
_b.label = 30;
|
|
4190
4209
|
case 30:
|
|
4191
4210
|
if (!(i < catchBlock.length)) return [3, 33];
|
|
4192
|
-
return [5, __values(hoistVarRecursion(catchBlock[i], scope))];
|
|
4211
|
+
return [5, __values(hoistVarRecursion$1(catchBlock[i], scope))];
|
|
4193
4212
|
case 31:
|
|
4194
4213
|
_b.sent();
|
|
4195
4214
|
_b.label = 32;
|
|
@@ -4203,7 +4222,7 @@
|
|
|
4203
4222
|
_b.label = 34;
|
|
4204
4223
|
case 34:
|
|
4205
4224
|
if (!(i < finalBlock.length)) return [3, 37];
|
|
4206
|
-
return [5, __values(hoistVarRecursion(finalBlock[i], scope))];
|
|
4225
|
+
return [5, __values(hoistVarRecursion$1(finalBlock[i], scope))];
|
|
4207
4226
|
case 35:
|
|
4208
4227
|
_b.sent();
|
|
4209
4228
|
_b.label = 36;
|
|
@@ -4215,7 +4234,7 @@
|
|
|
4215
4234
|
}
|
|
4216
4235
|
});
|
|
4217
4236
|
}
|
|
4218
|
-
function pattern$
|
|
4237
|
+
function pattern$1(node, scope, options) {
|
|
4219
4238
|
var _a;
|
|
4220
4239
|
if (options === void 0) { options = {}; }
|
|
4221
4240
|
return __generator(this, function (_b) {
|
|
@@ -4229,22 +4248,22 @@
|
|
|
4229
4248
|
case 'AssignmentPattern': return [3, 7];
|
|
4230
4249
|
}
|
|
4231
4250
|
return [3, 9];
|
|
4232
|
-
case 1: return [5, __values(ObjectPattern
|
|
4251
|
+
case 1: return [5, __values(ObjectPattern(node, scope, options))];
|
|
4233
4252
|
case 2: return [2, _b.sent()];
|
|
4234
|
-
case 3: return [5, __values(ArrayPattern
|
|
4253
|
+
case 3: return [5, __values(ArrayPattern(node, scope, options))];
|
|
4235
4254
|
case 4: return [2, _b.sent()];
|
|
4236
|
-
case 5: return [5, __values(RestElement
|
|
4255
|
+
case 5: return [5, __values(RestElement(node, scope, options))];
|
|
4237
4256
|
case 6: return [2, _b.sent()];
|
|
4238
|
-
case 7: return [5, __values(AssignmentPattern
|
|
4257
|
+
case 7: return [5, __values(AssignmentPattern(node, scope, options))];
|
|
4239
4258
|
case 8: return [2, _b.sent()];
|
|
4240
4259
|
case 9: throw new SyntaxError('Unexpected token');
|
|
4241
4260
|
}
|
|
4242
4261
|
});
|
|
4243
4262
|
}
|
|
4244
|
-
function createFunc(node, scope, options) {
|
|
4263
|
+
function createFunc$1(node, scope, options) {
|
|
4245
4264
|
if (options === void 0) { options = {}; }
|
|
4246
4265
|
if (!node.generator && !node.async) {
|
|
4247
|
-
return createFunc
|
|
4266
|
+
return createFunc(node, scope, options);
|
|
4248
4267
|
}
|
|
4249
4268
|
var superClass = options.superClass, construct = options.construct;
|
|
4250
4269
|
var params = node.params;
|
|
@@ -4286,11 +4305,11 @@
|
|
|
4286
4305
|
return [3, 9];
|
|
4287
4306
|
case 5:
|
|
4288
4307
|
if (!(param.type === 'RestElement')) return [3, 7];
|
|
4289
|
-
return [5, __values(RestElement
|
|
4308
|
+
return [5, __values(RestElement(param, subScope, { kind: 'var', feed: args.slice(i) }))];
|
|
4290
4309
|
case 6:
|
|
4291
4310
|
_a.sent();
|
|
4292
4311
|
return [3, 9];
|
|
4293
|
-
case 7: return [5, __values(pattern$
|
|
4312
|
+
case 7: return [5, __values(pattern$1(param, subScope, { kind: 'var', feed: args[i] }))];
|
|
4294
4313
|
case 8:
|
|
4295
4314
|
_a.sent();
|
|
4296
4315
|
_a.label = 9;
|
|
@@ -4299,17 +4318,17 @@
|
|
|
4299
4318
|
return [3, 4];
|
|
4300
4319
|
case 10:
|
|
4301
4320
|
if (!(node.body.type === 'BlockStatement')) return [3, 13];
|
|
4302
|
-
return [5, __values(hoist(node.body, subScope))];
|
|
4321
|
+
return [5, __values(hoist$1(node.body, subScope))];
|
|
4303
4322
|
case 11:
|
|
4304
4323
|
_a.sent();
|
|
4305
|
-
return [5, __values(BlockStatement
|
|
4324
|
+
return [5, __values(BlockStatement(node.body, subScope, {
|
|
4306
4325
|
invasived: true,
|
|
4307
4326
|
hoisted: true
|
|
4308
4327
|
}))];
|
|
4309
4328
|
case 12:
|
|
4310
4329
|
result = _a.sent();
|
|
4311
4330
|
return [3, 15];
|
|
4312
|
-
case 13: return [5, __values(evaluate
|
|
4331
|
+
case 13: return [5, __values(evaluate(node.body, subScope))];
|
|
4313
4332
|
case 14:
|
|
4314
4333
|
result = _a.sent();
|
|
4315
4334
|
if (node.type === 'ArrowFunctionExpression') {
|
|
@@ -4371,11 +4390,11 @@
|
|
|
4371
4390
|
});
|
|
4372
4391
|
return func;
|
|
4373
4392
|
}
|
|
4374
|
-
function createClass(node, scope) {
|
|
4393
|
+
function createClass$1(node, scope) {
|
|
4375
4394
|
var superClass, methodBody, construct, klass, i, method;
|
|
4376
4395
|
return __generator(this, function (_a) {
|
|
4377
4396
|
switch (_a.label) {
|
|
4378
|
-
case 0: return [5, __values(evaluate
|
|
4397
|
+
case 0: return [5, __values(evaluate(node.superClass, scope))];
|
|
4379
4398
|
case 1:
|
|
4380
4399
|
superClass = _a.sent();
|
|
4381
4400
|
methodBody = node.body.body;
|
|
@@ -4390,7 +4409,7 @@
|
|
|
4390
4409
|
if (!(i < methodBody.length)) return [3, 4];
|
|
4391
4410
|
def = methodBody[i];
|
|
4392
4411
|
if (!(def.type === 'PropertyDefinition' && !def.static)) return [3, 3];
|
|
4393
|
-
return [5, __values(PropertyDefinition
|
|
4412
|
+
return [5, __values(PropertyDefinition(def, scope, { klass: object, superClass: superClass }))];
|
|
4394
4413
|
case 2:
|
|
4395
4414
|
_a.sent();
|
|
4396
4415
|
_a.label = 3;
|
|
@@ -4417,14 +4436,14 @@
|
|
|
4417
4436
|
for (i = 0; i < methodBody.length; i++) {
|
|
4418
4437
|
method = methodBody[i];
|
|
4419
4438
|
if (method.type === 'MethodDefinition' && method.kind === 'constructor') {
|
|
4420
|
-
klass = createFunc(method.value, scope, { superClass: superClass, construct: construct });
|
|
4439
|
+
klass = createFunc$1(method.value, scope, { superClass: superClass, construct: construct });
|
|
4421
4440
|
break;
|
|
4422
4441
|
}
|
|
4423
4442
|
}
|
|
4424
4443
|
if (superClass) {
|
|
4425
4444
|
inherits(klass, superClass);
|
|
4426
4445
|
}
|
|
4427
|
-
return [5, __values(ClassBody
|
|
4446
|
+
return [5, __values(ClassBody(node.body, scope, { klass: klass, superClass: superClass }))];
|
|
4428
4447
|
case 2:
|
|
4429
4448
|
_a.sent();
|
|
4430
4449
|
define(klass, CLSCTOR, { value: true });
|
|
@@ -4436,7 +4455,7 @@
|
|
|
4436
4455
|
}
|
|
4437
4456
|
});
|
|
4438
4457
|
}
|
|
4439
|
-
function ForXHandler(node, scope, options) {
|
|
4458
|
+
function ForXHandler$1(node, scope, options) {
|
|
4440
4459
|
var value, left, subScope, variable, result;
|
|
4441
4460
|
return __generator(this, function (_a) {
|
|
4442
4461
|
switch (_a.label) {
|
|
@@ -4445,28 +4464,28 @@
|
|
|
4445
4464
|
left = node.left;
|
|
4446
4465
|
subScope = new Scope(scope);
|
|
4447
4466
|
if (!(left.type === 'VariableDeclaration')) return [3, 2];
|
|
4448
|
-
return [5, __values(VariableDeclaration
|
|
4467
|
+
return [5, __values(VariableDeclaration(left, subScope, { feed: value }))];
|
|
4449
4468
|
case 1:
|
|
4450
4469
|
_a.sent();
|
|
4451
4470
|
return [3, 6];
|
|
4452
4471
|
case 2:
|
|
4453
4472
|
if (!(left.type === 'Identifier')) return [3, 4];
|
|
4454
|
-
return [5, __values(Identifier(left, scope, { getVar: true }))];
|
|
4473
|
+
return [5, __values(Identifier$1(left, scope, { getVar: true }))];
|
|
4455
4474
|
case 3:
|
|
4456
4475
|
variable = _a.sent();
|
|
4457
4476
|
variable.set(value);
|
|
4458
4477
|
return [3, 6];
|
|
4459
|
-
case 4: return [5, __values(pattern$
|
|
4478
|
+
case 4: return [5, __values(pattern$1(left, scope, { feed: value }))];
|
|
4460
4479
|
case 5:
|
|
4461
4480
|
_a.sent();
|
|
4462
4481
|
_a.label = 6;
|
|
4463
4482
|
case 6:
|
|
4464
4483
|
if (!(node.body.type === 'BlockStatement')) return [3, 8];
|
|
4465
|
-
return [5, __values(BlockStatement
|
|
4484
|
+
return [5, __values(BlockStatement(node.body, subScope, { invasived: true }))];
|
|
4466
4485
|
case 7:
|
|
4467
4486
|
result = _a.sent();
|
|
4468
4487
|
return [3, 10];
|
|
4469
|
-
case 8: return [5, __values(evaluate
|
|
4488
|
+
case 8: return [5, __values(evaluate(node.body, subScope))];
|
|
4470
4489
|
case 9:
|
|
4471
4490
|
result = _a.sent();
|
|
4472
4491
|
_a.label = 10;
|
|
@@ -4475,7 +4494,7 @@
|
|
|
4475
4494
|
});
|
|
4476
4495
|
}
|
|
4477
4496
|
|
|
4478
|
-
function hoist
|
|
4497
|
+
function hoist(block, scope, options) {
|
|
4479
4498
|
if (options === void 0) { options = {}; }
|
|
4480
4499
|
var _a = options.onlyBlock, onlyBlock = _a === void 0 ? false : _a;
|
|
4481
4500
|
var funcDclrList = [];
|
|
@@ -4488,10 +4507,10 @@
|
|
|
4488
4507
|
}
|
|
4489
4508
|
else if (statement.type === 'VariableDeclaration'
|
|
4490
4509
|
&& ['const', 'let'].indexOf(statement.kind) !== -1) {
|
|
4491
|
-
VariableDeclaration(statement, scope, { hoist: true, onlyBlock: true });
|
|
4510
|
+
VariableDeclaration$1(statement, scope, { hoist: true, onlyBlock: true });
|
|
4492
4511
|
}
|
|
4493
4512
|
else if (!onlyBlock) {
|
|
4494
|
-
hoistVarRecursion
|
|
4513
|
+
hoistVarRecursion(statement, scope);
|
|
4495
4514
|
}
|
|
4496
4515
|
}
|
|
4497
4516
|
if (funcDclrIdxs.length) {
|
|
@@ -4501,82 +4520,82 @@
|
|
|
4501
4520
|
block.body = funcDclrList.concat(block.body);
|
|
4502
4521
|
}
|
|
4503
4522
|
}
|
|
4504
|
-
function hoistVarRecursion
|
|
4523
|
+
function hoistVarRecursion(statement, scope) {
|
|
4505
4524
|
switch (statement.type) {
|
|
4506
4525
|
case 'VariableDeclaration':
|
|
4507
|
-
VariableDeclaration(statement, scope, { hoist: true });
|
|
4526
|
+
VariableDeclaration$1(statement, scope, { hoist: true });
|
|
4508
4527
|
break;
|
|
4509
4528
|
case 'ForInStatement':
|
|
4510
4529
|
case 'ForOfStatement':
|
|
4511
4530
|
if (statement.left.type === 'VariableDeclaration') {
|
|
4512
|
-
VariableDeclaration(statement.left, scope, { hoist: true });
|
|
4531
|
+
VariableDeclaration$1(statement.left, scope, { hoist: true });
|
|
4513
4532
|
}
|
|
4514
4533
|
case 'ForStatement':
|
|
4515
4534
|
if (statement.type === 'ForStatement' && statement.init.type === 'VariableDeclaration') {
|
|
4516
|
-
VariableDeclaration(statement.init, scope, { hoist: true });
|
|
4535
|
+
VariableDeclaration$1(statement.init, scope, { hoist: true });
|
|
4517
4536
|
}
|
|
4518
4537
|
case 'WhileStatement':
|
|
4519
4538
|
case 'DoWhileStatement':
|
|
4520
|
-
hoistVarRecursion
|
|
4539
|
+
hoistVarRecursion(statement.body, scope);
|
|
4521
4540
|
break;
|
|
4522
4541
|
case 'IfStatement':
|
|
4523
|
-
hoistVarRecursion
|
|
4542
|
+
hoistVarRecursion(statement.consequent, scope);
|
|
4524
4543
|
if (statement.alternate) {
|
|
4525
|
-
hoistVarRecursion
|
|
4544
|
+
hoistVarRecursion(statement.alternate, scope);
|
|
4526
4545
|
}
|
|
4527
4546
|
break;
|
|
4528
4547
|
case 'BlockStatement':
|
|
4529
4548
|
for (var i = 0; i < statement.body.length; i++) {
|
|
4530
|
-
hoistVarRecursion
|
|
4549
|
+
hoistVarRecursion(statement.body[i], scope);
|
|
4531
4550
|
}
|
|
4532
4551
|
break;
|
|
4533
4552
|
case 'SwitchStatement':
|
|
4534
4553
|
for (var i = 0; i < statement.cases.length; i++) {
|
|
4535
4554
|
for (var j = 0; j < statement.cases[i].consequent.length; j++) {
|
|
4536
|
-
hoistVarRecursion
|
|
4555
|
+
hoistVarRecursion(statement.cases[i].consequent[j], scope);
|
|
4537
4556
|
}
|
|
4538
4557
|
}
|
|
4539
4558
|
break;
|
|
4540
4559
|
case 'TryStatement': {
|
|
4541
4560
|
var tryBlock = statement.block.body;
|
|
4542
4561
|
for (var i = 0; i < tryBlock.length; i++) {
|
|
4543
|
-
hoistVarRecursion
|
|
4562
|
+
hoistVarRecursion(tryBlock[i], scope);
|
|
4544
4563
|
}
|
|
4545
4564
|
var catchBlock = statement.handler && statement.handler.body.body;
|
|
4546
4565
|
if (catchBlock) {
|
|
4547
4566
|
for (var i = 0; i < catchBlock.length; i++) {
|
|
4548
|
-
hoistVarRecursion
|
|
4567
|
+
hoistVarRecursion(catchBlock[i], scope);
|
|
4549
4568
|
}
|
|
4550
4569
|
}
|
|
4551
4570
|
var finalBlock = statement.finalizer && statement.finalizer.body;
|
|
4552
4571
|
if (finalBlock) {
|
|
4553
4572
|
for (var i = 0; i < finalBlock.length; i++) {
|
|
4554
|
-
hoistVarRecursion
|
|
4573
|
+
hoistVarRecursion(finalBlock[i], scope);
|
|
4555
4574
|
}
|
|
4556
4575
|
}
|
|
4557
4576
|
break;
|
|
4558
4577
|
}
|
|
4559
4578
|
}
|
|
4560
4579
|
}
|
|
4561
|
-
function pattern
|
|
4580
|
+
function pattern(node, scope, options) {
|
|
4562
4581
|
if (options === void 0) { options = {}; }
|
|
4563
4582
|
switch (node.type) {
|
|
4564
4583
|
case 'ObjectPattern':
|
|
4565
|
-
return ObjectPattern(node, scope, options);
|
|
4584
|
+
return ObjectPattern$1(node, scope, options);
|
|
4566
4585
|
case 'ArrayPattern':
|
|
4567
|
-
return ArrayPattern(node, scope, options);
|
|
4586
|
+
return ArrayPattern$1(node, scope, options);
|
|
4568
4587
|
case 'RestElement':
|
|
4569
|
-
return RestElement(node, scope, options);
|
|
4588
|
+
return RestElement$1(node, scope, options);
|
|
4570
4589
|
case 'AssignmentPattern':
|
|
4571
|
-
return AssignmentPattern(node, scope, options);
|
|
4590
|
+
return AssignmentPattern$1(node, scope, options);
|
|
4572
4591
|
default:
|
|
4573
4592
|
throw new SyntaxError('Unexpected token');
|
|
4574
4593
|
}
|
|
4575
4594
|
}
|
|
4576
|
-
function createFunc
|
|
4595
|
+
function createFunc(node, scope, options) {
|
|
4577
4596
|
if (options === void 0) { options = {}; }
|
|
4578
4597
|
if (node.generator || node.async) {
|
|
4579
|
-
return createFunc(node, scope, options);
|
|
4598
|
+
return createFunc$1(node, scope, options);
|
|
4580
4599
|
}
|
|
4581
4600
|
var superClass = options.superClass, construct = options.construct;
|
|
4582
4601
|
var params = node.params;
|
|
@@ -4606,22 +4625,22 @@
|
|
|
4606
4625
|
subScope.var(param.name, args[i]);
|
|
4607
4626
|
}
|
|
4608
4627
|
else if (param.type === 'RestElement') {
|
|
4609
|
-
RestElement(param, subScope, { kind: 'var', feed: args.slice(i) });
|
|
4628
|
+
RestElement$1(param, subScope, { kind: 'var', feed: args.slice(i) });
|
|
4610
4629
|
}
|
|
4611
4630
|
else {
|
|
4612
|
-
pattern
|
|
4631
|
+
pattern(param, subScope, { kind: 'var', feed: args[i] });
|
|
4613
4632
|
}
|
|
4614
4633
|
}
|
|
4615
4634
|
var result;
|
|
4616
4635
|
if (node.body.type === 'BlockStatement') {
|
|
4617
|
-
hoist
|
|
4618
|
-
result = BlockStatement(node.body, subScope, {
|
|
4636
|
+
hoist(node.body, subScope);
|
|
4637
|
+
result = BlockStatement$1(node.body, subScope, {
|
|
4619
4638
|
invasived: true,
|
|
4620
4639
|
hoisted: true
|
|
4621
4640
|
});
|
|
4622
4641
|
}
|
|
4623
4642
|
else {
|
|
4624
|
-
result = evaluate(node.body, subScope);
|
|
4643
|
+
result = evaluate$1(node.body, subScope);
|
|
4625
4644
|
if (node.type === 'ArrowFunctionExpression') {
|
|
4626
4645
|
RETURN.RES = result;
|
|
4627
4646
|
result = RETURN;
|
|
@@ -4647,14 +4666,14 @@
|
|
|
4647
4666
|
});
|
|
4648
4667
|
return func;
|
|
4649
4668
|
}
|
|
4650
|
-
function createClass
|
|
4651
|
-
var superClass = evaluate(node.superClass, scope);
|
|
4669
|
+
function createClass(node, scope) {
|
|
4670
|
+
var superClass = evaluate$1(node.superClass, scope);
|
|
4652
4671
|
var methodBody = node.body.body;
|
|
4653
4672
|
var construct = function (object) {
|
|
4654
4673
|
for (var i = 0; i < methodBody.length; i++) {
|
|
4655
4674
|
var def = methodBody[i];
|
|
4656
4675
|
if (def.type === 'PropertyDefinition' && !def.static) {
|
|
4657
|
-
PropertyDefinition(def, scope, { klass: object, superClass: superClass });
|
|
4676
|
+
PropertyDefinition$1(def, scope, { klass: object, superClass: superClass });
|
|
4658
4677
|
}
|
|
4659
4678
|
}
|
|
4660
4679
|
};
|
|
@@ -4667,14 +4686,14 @@
|
|
|
4667
4686
|
for (var i = 0; i < methodBody.length; i++) {
|
|
4668
4687
|
var method = methodBody[i];
|
|
4669
4688
|
if (method.type === 'MethodDefinition' && method.kind === 'constructor') {
|
|
4670
|
-
klass = createFunc
|
|
4689
|
+
klass = createFunc(method.value, scope, { superClass: superClass, construct: construct });
|
|
4671
4690
|
break;
|
|
4672
4691
|
}
|
|
4673
4692
|
}
|
|
4674
4693
|
if (superClass) {
|
|
4675
4694
|
inherits(klass, superClass);
|
|
4676
4695
|
}
|
|
4677
|
-
ClassBody(node.body, scope, { klass: klass, superClass: superClass });
|
|
4696
|
+
ClassBody$1(node.body, scope, { klass: klass, superClass: superClass });
|
|
4678
4697
|
define(klass, CLSCTOR, { value: true });
|
|
4679
4698
|
define(klass, 'name', {
|
|
4680
4699
|
value: node.id && node.id.name || '',
|
|
@@ -4682,26 +4701,26 @@
|
|
|
4682
4701
|
});
|
|
4683
4702
|
return klass;
|
|
4684
4703
|
}
|
|
4685
|
-
function ForXHandler
|
|
4704
|
+
function ForXHandler(node, scope, options) {
|
|
4686
4705
|
var value = options.value;
|
|
4687
4706
|
var left = node.left;
|
|
4688
4707
|
var subScope = new Scope(scope);
|
|
4689
4708
|
if (left.type === 'VariableDeclaration') {
|
|
4690
|
-
VariableDeclaration(left, subScope, { feed: value });
|
|
4709
|
+
VariableDeclaration$1(left, subScope, { feed: value });
|
|
4691
4710
|
}
|
|
4692
4711
|
else if (left.type === 'Identifier') {
|
|
4693
|
-
var variable = Identifier(left, scope, { getVar: true });
|
|
4712
|
+
var variable = Identifier$1(left, scope, { getVar: true });
|
|
4694
4713
|
variable.set(value);
|
|
4695
4714
|
}
|
|
4696
4715
|
else {
|
|
4697
|
-
pattern
|
|
4716
|
+
pattern(left, scope, { feed: value });
|
|
4698
4717
|
}
|
|
4699
4718
|
var result;
|
|
4700
4719
|
if (node.body.type === 'BlockStatement') {
|
|
4701
|
-
result = BlockStatement(node.body, subScope, { invasived: true });
|
|
4720
|
+
result = BlockStatement$1(node.body, subScope, { invasived: true });
|
|
4702
4721
|
}
|
|
4703
4722
|
else {
|
|
4704
|
-
result = evaluate(node.body, subScope);
|
|
4723
|
+
result = evaluate$1(node.body, subScope);
|
|
4705
4724
|
}
|
|
4706
4725
|
return result;
|
|
4707
4726
|
}
|
|
@@ -4757,8 +4776,8 @@
|
|
|
4757
4776
|
};
|
|
4758
4777
|
Sval.prototype.run = function (code) {
|
|
4759
4778
|
var ast = typeof code === 'string' ? acorn.parse(code, this.options) : code;
|
|
4760
|
-
hoist
|
|
4761
|
-
evaluate(ast, this.scope);
|
|
4779
|
+
hoist(ast, this.scope);
|
|
4780
|
+
evaluate$1(ast, this.scope);
|
|
4762
4781
|
};
|
|
4763
4782
|
Sval.version = version;
|
|
4764
4783
|
return Sval;
|
|
@@ -4766,4 +4785,4 @@
|
|
|
4766
4785
|
|
|
4767
4786
|
return Sval;
|
|
4768
4787
|
|
|
4769
|
-
}))
|
|
4788
|
+
}));
|