Changeset e29cc2e for trip-planner-front/node_modules/acorn/dist/acorn.js
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/acorn/dist/acorn.js
r59329aa re29cc2e 2 2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 3 3 typeof define === 'function' && define.amd ? define(['exports'], factory) : 4 (global = global || self, factory(global.acorn = {}));5 } (this, (function (exports) { 'use strict';4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.acorn = {})); 5 })(this, (function (exports) { 'use strict'; 6 6 7 7 // Reserved word lists for various dialects of the language … … 19 19 var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; 20 20 21 var keywords = {21 var keywords$1 = { 22 22 5: ecma5AndLessKeywords, 23 23 "5module": ecma5AndLessKeywords + " export import", … … 138 138 // Map keyword names to token types. 139 139 140 var keywords $1= {};140 var keywords = {}; 141 141 142 142 // Succinct definitions of keyword token types … … 145 145 146 146 options.keyword = name; 147 return keywords $1[name] = new TokenType(name, options)147 return keywords[name] = new TokenType(name, options) 148 148 } 149 149 150 var types = {150 var types$1 = { 151 151 num: new TokenType("num", startsExpr), 152 152 regexp: new TokenType("regexp", startsExpr), … … 490 490 this.options = options = getOptions(options); 491 491 this.sourceFile = options.sourceFile; 492 this.keywords = wordsRegexp(keywords [options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);492 this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); 493 493 var reserved = ""; 494 494 if (options.allowReserved !== true) { … … 521 521 // Properties of the current token: 522 522 // Its type 523 this.type = types .eof;523 this.type = types$1.eof; 524 524 // For tokens that include more information than their type, the value 525 525 this.value = null; … … 581 581 582 582 prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 }; 583 583 584 prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit }; 585 584 586 prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit }; 587 585 588 prototypeAccessors.canAwait.get = function () { 586 589 for (var i = this.scopeStack.length - 1; i >= 0; i--) { … … 591 594 return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction 592 595 }; 596 593 597 prototypeAccessors.allowSuper.get = function () { 594 598 var ref = this.currentThisScope(); … … 597 601 return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod 598 602 }; 603 599 604 prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 }; 605 600 606 prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) }; 607 601 608 prototypeAccessors.allowNewDotTarget.get = function () { 602 609 var ref = this.currentThisScope(); … … 605 612 return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit 606 613 }; 614 607 615 prototypeAccessors.inClassStaticBlock.get = function () { 608 616 return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0 … … 634 642 Object.defineProperties( Parser.prototype, prototypeAccessors ); 635 643 636 var pp = Parser.prototype;644 var pp$9 = Parser.prototype; 637 645 638 646 // ## Parser utilities 639 647 640 648 var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; 641 pp .strictDirective = function(start) {649 pp$9.strictDirective = function(start) { 642 650 for (;;) { 643 651 // Try to find string literal. … … 667 675 // type, and if yes, consumes it as a side effect. 668 676 669 pp .eat = function(type) {677 pp$9.eat = function(type) { 670 678 if (this.type === type) { 671 679 this.next(); … … 678 686 // Tests whether parsed token is a contextual keyword. 679 687 680 pp .isContextual = function(name) {681 return this.type === types .name && this.value === name && !this.containsEsc688 pp$9.isContextual = function(name) { 689 return this.type === types$1.name && this.value === name && !this.containsEsc 682 690 }; 683 691 684 692 // Consumes contextual keyword if possible. 685 693 686 pp .eatContextual = function(name) {694 pp$9.eatContextual = function(name) { 687 695 if (!this.isContextual(name)) { return false } 688 696 this.next(); … … 692 700 // Asserts that following token is given contextual keyword. 693 701 694 pp .expectContextual = function(name) {702 pp$9.expectContextual = function(name) { 695 703 if (!this.eatContextual(name)) { this.unexpected(); } 696 704 }; … … 698 706 // Test whether a semicolon can be inserted at the current position. 699 707 700 pp .canInsertSemicolon = function() {701 return this.type === types .eof ||702 this.type === types .braceR ||708 pp$9.canInsertSemicolon = function() { 709 return this.type === types$1.eof || 710 this.type === types$1.braceR || 703 711 lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) 704 712 }; 705 713 706 pp .insertSemicolon = function() {714 pp$9.insertSemicolon = function() { 707 715 if (this.canInsertSemicolon()) { 708 716 if (this.options.onInsertedSemicolon) … … 715 723 // pretend that there is a semicolon at this position. 716 724 717 pp .semicolon = function() {718 if (!this.eat(types .semi) && !this.insertSemicolon()) { this.unexpected(); }719 }; 720 721 pp .afterTrailingComma = function(tokType, notNext) {725 pp$9.semicolon = function() { 726 if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); } 727 }; 728 729 pp$9.afterTrailingComma = function(tokType, notNext) { 722 730 if (this.type === tokType) { 723 731 if (this.options.onTrailingComma) … … 732 740 // raise an unexpected token error. 733 741 734 pp .expect = function(type) {742 pp$9.expect = function(type) { 735 743 this.eat(type) || this.unexpected(); 736 744 }; … … 738 746 // Raise an unexpected token error. 739 747 740 pp .unexpected = function(pos) {748 pp$9.unexpected = function(pos) { 741 749 this.raise(pos != null ? pos : this.start, "Unexpected token"); 742 750 }; … … 751 759 } 752 760 753 pp .checkPatternErrors = function(refDestructuringErrors, isAssign) {761 pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) { 754 762 if (!refDestructuringErrors) { return } 755 763 if (refDestructuringErrors.trailingComma > -1) … … 759 767 }; 760 768 761 pp .checkExpressionErrors = function(refDestructuringErrors, andThrow) {769 pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) { 762 770 if (!refDestructuringErrors) { return false } 763 771 var shorthandAssign = refDestructuringErrors.shorthandAssign; … … 770 778 }; 771 779 772 pp .checkYieldAwaitInDefaultParams = function() {780 pp$9.checkYieldAwaitInDefaultParams = function() { 773 781 if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) 774 782 { this.raise(this.yieldPos, "Yield expression cannot be a default value"); } … … 777 785 }; 778 786 779 pp .isSimpleAssignTarget = function(expr) {787 pp$9.isSimpleAssignTarget = function(expr) { 780 788 if (expr.type === "ParenthesizedExpression") 781 789 { return this.isSimpleAssignTarget(expr.expression) } … … 783 791 }; 784 792 785 var pp$ 1= Parser.prototype;793 var pp$8 = Parser.prototype; 786 794 787 795 // ### Statement parsing … … 792 800 // to its body instead of creating a new node. 793 801 794 pp$ 1.parseTopLevel = function(node) {802 pp$8.parseTopLevel = function(node) { 795 803 var exports = Object.create(null); 796 804 if (!node.body) { node.body = []; } 797 while (this.type !== types .eof) {805 while (this.type !== types$1.eof) { 798 806 var stmt = this.parseStatement(null, true, exports); 799 807 node.body.push(stmt); … … 814 822 var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}; 815 823 816 pp$ 1.isLet = function(context) {824 pp$8.isLet = function(context) { 817 825 if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false } 818 826 skipWhiteSpace.lastIndex = this.pos; … … 840 848 // - 'async /*foo*/ function' is OK. 841 849 // - 'async /*\n*/ function' is invalid. 842 pp$ 1.isAsyncFunction = function() {850 pp$8.isAsyncFunction = function() { 843 851 if (this.options.ecmaVersion < 8 || !this.isContextual("async")) 844 852 { return false } … … 860 868 // does not help. 861 869 862 pp$ 1.parseStatement = function(context, topLevel, exports) {870 pp$8.parseStatement = function(context, topLevel, exports) { 863 871 var starttype = this.type, node = this.startNode(), kind; 864 872 865 873 if (this.isLet(context)) { 866 starttype = types ._var;874 starttype = types$1._var; 867 875 kind = "let"; 868 876 } … … 873 881 874 882 switch (starttype) { 875 case types ._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)876 case types ._debugger: return this.parseDebuggerStatement(node)877 case types ._do: return this.parseDoStatement(node)878 case types ._for: return this.parseForStatement(node)879 case types ._function:883 case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword) 884 case types$1._debugger: return this.parseDebuggerStatement(node) 885 case types$1._do: return this.parseDoStatement(node) 886 case types$1._for: return this.parseForStatement(node) 887 case types$1._function: 880 888 // Function as sole body of either an if statement or a labeled statement 881 889 // works, but not when it is part of a labeled statement that is the sole … … 883 891 if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); } 884 892 return this.parseFunctionStatement(node, false, !context) 885 case types ._class:893 case types$1._class: 886 894 if (context) { this.unexpected(); } 887 895 return this.parseClass(node, true) 888 case types ._if: return this.parseIfStatement(node)889 case types ._return: return this.parseReturnStatement(node)890 case types ._switch: return this.parseSwitchStatement(node)891 case types ._throw: return this.parseThrowStatement(node)892 case types ._try: return this.parseTryStatement(node)893 case types ._const: case types._var:896 case types$1._if: return this.parseIfStatement(node) 897 case types$1._return: return this.parseReturnStatement(node) 898 case types$1._switch: return this.parseSwitchStatement(node) 899 case types$1._throw: return this.parseThrowStatement(node) 900 case types$1._try: return this.parseTryStatement(node) 901 case types$1._const: case types$1._var: 894 902 kind = kind || this.value; 895 903 if (context && kind !== "var") { this.unexpected(); } 896 904 return this.parseVarStatement(node, kind) 897 case types ._while: return this.parseWhileStatement(node)898 case types ._with: return this.parseWithStatement(node)899 case types .braceL: return this.parseBlock(true, node)900 case types .semi: return this.parseEmptyStatement(node)901 case types ._export:902 case types ._import:903 if (this.options.ecmaVersion > 10 && starttype === types ._import) {905 case types$1._while: return this.parseWhileStatement(node) 906 case types$1._with: return this.parseWithStatement(node) 907 case types$1.braceL: return this.parseBlock(true, node) 908 case types$1.semi: return this.parseEmptyStatement(node) 909 case types$1._export: 910 case types$1._import: 911 if (this.options.ecmaVersion > 10 && starttype === types$1._import) { 904 912 skipWhiteSpace.lastIndex = this.pos; 905 913 var skip = skipWhiteSpace.exec(this.input); … … 915 923 { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); } 916 924 } 917 return starttype === types ._import ? this.parseImport(node) : this.parseExport(node, exports)925 return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports) 918 926 919 927 // If the statement does not start with a statement keyword or a … … 930 938 931 939 var maybeName = this.value, expr = this.parseExpression(); 932 if (starttype === types .name && expr.type === "Identifier" && this.eat(types.colon))940 if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) 933 941 { return this.parseLabeledStatement(node, maybeName, expr, context) } 934 942 else { return this.parseExpressionStatement(node, expr) } … … 936 944 }; 937 945 938 pp$ 1.parseBreakContinueStatement = function(node, keyword) {946 pp$8.parseBreakContinueStatement = function(node, keyword) { 939 947 var isBreak = keyword === "break"; 940 948 this.next(); 941 if (this.eat(types .semi) || this.insertSemicolon()) { node.label = null; }942 else if (this.type !== types .name) { this.unexpected(); }949 if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; } 950 else if (this.type !== types$1.name) { this.unexpected(); } 943 951 else { 944 952 node.label = this.parseIdent(); … … 960 968 }; 961 969 962 pp$ 1.parseDebuggerStatement = function(node) {970 pp$8.parseDebuggerStatement = function(node) { 963 971 this.next(); 964 972 this.semicolon(); … … 966 974 }; 967 975 968 pp$ 1.parseDoStatement = function(node) {976 pp$8.parseDoStatement = function(node) { 969 977 this.next(); 970 978 this.labels.push(loopLabel); 971 979 node.body = this.parseStatement("do"); 972 980 this.labels.pop(); 973 this.expect(types ._while);981 this.expect(types$1._while); 974 982 node.test = this.parseParenExpression(); 975 983 if (this.options.ecmaVersion >= 6) 976 { this.eat(types .semi); }984 { this.eat(types$1.semi); } 977 985 else 978 986 { this.semicolon(); } … … 988 996 // is a regular `for` loop. 989 997 990 pp$ 1.parseForStatement = function(node) {998 pp$8.parseForStatement = function(node) { 991 999 this.next(); 992 1000 var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1; 993 1001 this.labels.push(loopLabel); 994 1002 this.enterScope(0); 995 this.expect(types .parenL);996 if (this.type === types .semi) {1003 this.expect(types$1.parenL); 1004 if (this.type === types$1.semi) { 997 1005 if (awaitAt > -1) { this.unexpected(awaitAt); } 998 1006 return this.parseFor(node, null) 999 1007 } 1000 1008 var isLet = this.isLet(); 1001 if (this.type === types ._var || this.type === types._const || isLet) {1009 if (this.type === types$1._var || this.type === types$1._const || isLet) { 1002 1010 var init$1 = this.startNode(), kind = isLet ? "let" : this.value; 1003 1011 this.next(); 1004 1012 this.parseVar(init$1, true, kind); 1005 1013 this.finishNode(init$1, "VariableDeclaration"); 1006 if ((this.type === types ._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {1014 if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) { 1007 1015 if (this.options.ecmaVersion >= 9) { 1008 if (this.type === types ._in) {1016 if (this.type === types$1._in) { 1009 1017 if (awaitAt > -1) { this.unexpected(awaitAt); } 1010 1018 } else { node.await = awaitAt > -1; } … … 1018 1026 var refDestructuringErrors = new DestructuringErrors; 1019 1027 var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); 1020 if (this.type === types ._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {1028 if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { 1021 1029 if (this.options.ecmaVersion >= 9) { 1022 if (this.type === types ._in) {1030 if (this.type === types$1._in) { 1023 1031 if (awaitAt > -1) { this.unexpected(awaitAt); } 1024 1032 } else { node.await = awaitAt > -1; } … … 1035 1043 }; 1036 1044 1037 pp$ 1.parseFunctionStatement = function(node, isAsync, declarationPosition) {1045 pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) { 1038 1046 this.next(); 1039 1047 return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync) 1040 1048 }; 1041 1049 1042 pp$ 1.parseIfStatement = function(node) {1050 pp$8.parseIfStatement = function(node) { 1043 1051 this.next(); 1044 1052 node.test = this.parseParenExpression(); 1045 1053 // allow function declarations in branches, but only in non-strict mode 1046 1054 node.consequent = this.parseStatement("if"); 1047 node.alternate = this.eat(types ._else) ? this.parseStatement("if") : null;1055 node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; 1048 1056 return this.finishNode(node, "IfStatement") 1049 1057 }; 1050 1058 1051 pp$ 1.parseReturnStatement = function(node) {1059 pp$8.parseReturnStatement = function(node) { 1052 1060 if (!this.inFunction && !this.options.allowReturnOutsideFunction) 1053 1061 { this.raise(this.start, "'return' outside of function"); } … … 1058 1066 // possibility to insert one. 1059 1067 1060 if (this.eat(types .semi) || this.insertSemicolon()) { node.argument = null; }1068 if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; } 1061 1069 else { node.argument = this.parseExpression(); this.semicolon(); } 1062 1070 return this.finishNode(node, "ReturnStatement") 1063 1071 }; 1064 1072 1065 pp$ 1.parseSwitchStatement = function(node) {1073 pp$8.parseSwitchStatement = function(node) { 1066 1074 this.next(); 1067 1075 node.discriminant = this.parseParenExpression(); 1068 1076 node.cases = []; 1069 this.expect(types .braceL);1077 this.expect(types$1.braceL); 1070 1078 this.labels.push(switchLabel); 1071 1079 this.enterScope(0); … … 1076 1084 1077 1085 var cur; 1078 for (var sawDefault = false; this.type !== types .braceR;) {1079 if (this.type === types ._case || this.type === types._default) {1080 var isCase = this.type === types ._case;1086 for (var sawDefault = false; this.type !== types$1.braceR;) { 1087 if (this.type === types$1._case || this.type === types$1._default) { 1088 var isCase = this.type === types$1._case; 1081 1089 if (cur) { this.finishNode(cur, "SwitchCase"); } 1082 1090 node.cases.push(cur = this.startNode()); … … 1090 1098 cur.test = null; 1091 1099 } 1092 this.expect(types .colon);1100 this.expect(types$1.colon); 1093 1101 } else { 1094 1102 if (!cur) { this.unexpected(); } … … 1103 1111 }; 1104 1112 1105 pp$ 1.parseThrowStatement = function(node) {1113 pp$8.parseThrowStatement = function(node) { 1106 1114 this.next(); 1107 1115 if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) … … 1114 1122 // Reused empty array added for node fields that are always empty. 1115 1123 1116 var empty = [];1117 1118 pp$ 1.parseTryStatement = function(node) {1124 var empty$1 = []; 1125 1126 pp$8.parseTryStatement = function(node) { 1119 1127 this.next(); 1120 1128 node.block = this.parseBlock(); 1121 1129 node.handler = null; 1122 if (this.type === types ._catch) {1130 if (this.type === types$1._catch) { 1123 1131 var clause = this.startNode(); 1124 1132 this.next(); 1125 if (this.eat(types .parenL)) {1133 if (this.eat(types$1.parenL)) { 1126 1134 clause.param = this.parseBindingAtom(); 1127 1135 var simple = clause.param.type === "Identifier"; 1128 1136 this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); 1129 1137 this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); 1130 this.expect(types .parenR);1138 this.expect(types$1.parenR); 1131 1139 } else { 1132 1140 if (this.options.ecmaVersion < 10) { this.unexpected(); } … … 1138 1146 node.handler = this.finishNode(clause, "CatchClause"); 1139 1147 } 1140 node.finalizer = this.eat(types ._finally) ? this.parseBlock() : null;1148 node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; 1141 1149 if (!node.handler && !node.finalizer) 1142 1150 { this.raise(node.start, "Missing catch or finally clause"); } … … 1144 1152 }; 1145 1153 1146 pp$ 1.parseVarStatement = function(node, kind) {1154 pp$8.parseVarStatement = function(node, kind) { 1147 1155 this.next(); 1148 1156 this.parseVar(node, false, kind); … … 1151 1159 }; 1152 1160 1153 pp$ 1.parseWhileStatement = function(node) {1161 pp$8.parseWhileStatement = function(node) { 1154 1162 this.next(); 1155 1163 node.test = this.parseParenExpression(); … … 1160 1168 }; 1161 1169 1162 pp$ 1.parseWithStatement = function(node) {1170 pp$8.parseWithStatement = function(node) { 1163 1171 if (this.strict) { this.raise(this.start, "'with' in strict mode"); } 1164 1172 this.next(); … … 1168 1176 }; 1169 1177 1170 pp$ 1.parseEmptyStatement = function(node) {1178 pp$8.parseEmptyStatement = function(node) { 1171 1179 this.next(); 1172 1180 return this.finishNode(node, "EmptyStatement") 1173 1181 }; 1174 1182 1175 pp$ 1.parseLabeledStatement = function(node, maybeName, expr, context) {1183 pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { 1176 1184 for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) 1177 1185 { … … 1181 1189 { this.raise(expr.start, "Label '" + maybeName + "' is already declared"); 1182 1190 } } 1183 var kind = this.type.isLoop ? "loop" : this.type === types ._switch ? "switch" : null;1191 var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; 1184 1192 for (var i = this.labels.length - 1; i >= 0; i--) { 1185 1193 var label$1 = this.labels[i]; … … 1197 1205 }; 1198 1206 1199 pp$ 1.parseExpressionStatement = function(node, expr) {1207 pp$8.parseExpressionStatement = function(node, expr) { 1200 1208 node.expression = expr; 1201 1209 this.semicolon(); … … 1207 1215 // function bodies). 1208 1216 1209 pp$ 1.parseBlock = function(createNewLexicalScope, node, exitStrict) {1217 pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { 1210 1218 if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true; 1211 1219 if ( node === void 0 ) node = this.startNode(); 1212 1220 1213 1221 node.body = []; 1214 this.expect(types .braceL);1222 this.expect(types$1.braceL); 1215 1223 if (createNewLexicalScope) { this.enterScope(0); } 1216 while (this.type !== types .braceR) {1224 while (this.type !== types$1.braceR) { 1217 1225 var stmt = this.parseStatement(null); 1218 1226 node.body.push(stmt); … … 1228 1236 // expression. 1229 1237 1230 pp$ 1.parseFor = function(node, init) {1238 pp$8.parseFor = function(node, init) { 1231 1239 node.init = init; 1232 this.expect(types .semi);1233 node.test = this.type === types .semi ? null : this.parseExpression();1234 this.expect(types .semi);1235 node.update = this.type === types .parenR ? null : this.parseExpression();1236 this.expect(types .parenR);1240 this.expect(types$1.semi); 1241 node.test = this.type === types$1.semi ? null : this.parseExpression(); 1242 this.expect(types$1.semi); 1243 node.update = this.type === types$1.parenR ? null : this.parseExpression(); 1244 this.expect(types$1.parenR); 1237 1245 node.body = this.parseStatement("for"); 1238 1246 this.exitScope(); … … 1244 1252 // same from parser's perspective. 1245 1253 1246 pp$ 1.parseForIn = function(node, init) {1247 var isForIn = this.type === types ._in;1254 pp$8.parseForIn = function(node, init) { 1255 var isForIn = this.type === types$1._in; 1248 1256 this.next(); 1249 1257 … … 1266 1274 node.left = init; 1267 1275 node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); 1268 this.expect(types .parenR);1276 this.expect(types$1.parenR); 1269 1277 node.body = this.parseStatement("for"); 1270 1278 this.exitScope(); … … 1275 1283 // Parse a list of variable declarations. 1276 1284 1277 pp$ 1.parseVar = function(node, isFor, kind) {1285 pp$8.parseVar = function(node, isFor, kind) { 1278 1286 node.declarations = []; 1279 1287 node.kind = kind; … … 1281 1289 var decl = this.startNode(); 1282 1290 this.parseVarId(decl, kind); 1283 if (this.eat(types .eq)) {1291 if (this.eat(types$1.eq)) { 1284 1292 decl.init = this.parseMaybeAssign(isFor); 1285 } else if (kind === "const" && !(this.type === types ._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {1293 } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) { 1286 1294 this.unexpected(); 1287 } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types ._in || this.isContextual("of")))) {1295 } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { 1288 1296 this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); 1289 1297 } else { … … 1291 1299 } 1292 1300 node.declarations.push(this.finishNode(decl, "VariableDeclarator")); 1293 if (!this.eat(types .comma)) { break }1301 if (!this.eat(types$1.comma)) { break } 1294 1302 } 1295 1303 return node 1296 1304 }; 1297 1305 1298 pp$ 1.parseVarId = function(decl, kind) {1306 pp$8.parseVarId = function(decl, kind) { 1299 1307 decl.id = this.parseBindingAtom(); 1300 1308 this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); … … 1307 1315 1308 1316 // Remove `allowExpressionBody` for 7.0.0, as it is only called with false 1309 pp$ 1.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {1317 pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { 1310 1318 this.initFunction(node); 1311 1319 if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { 1312 if (this.type === types .star && (statement & FUNC_HANGING_STATEMENT))1320 if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT)) 1313 1321 { this.unexpected(); } 1314 node.generator = this.eat(types .star);1322 node.generator = this.eat(types$1.star); 1315 1323 } 1316 1324 if (this.options.ecmaVersion >= 8) … … 1318 1326 1319 1327 if (statement & FUNC_STATEMENT) { 1320 node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types .name ? null : this.parseIdent();1328 node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent(); 1321 1329 if (node.id && !(statement & FUNC_HANGING_STATEMENT)) 1322 1330 // If it is a regular function declaration in sloppy mode, then it is … … 1334 1342 1335 1343 if (!(statement & FUNC_STATEMENT)) 1336 { node.id = this.type === types .name ? this.parseIdent() : null; }1344 { node.id = this.type === types$1.name ? this.parseIdent() : null; } 1337 1345 1338 1346 this.parseFunctionParams(node); … … 1345 1353 }; 1346 1354 1347 pp$ 1.parseFunctionParams = function(node) {1348 this.expect(types .parenL);1349 node.params = this.parseBindingList(types .parenR, false, this.options.ecmaVersion >= 8);1355 pp$8.parseFunctionParams = function(node) { 1356 this.expect(types$1.parenL); 1357 node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); 1350 1358 this.checkYieldAwaitInDefaultParams(); 1351 1359 }; … … 1354 1362 // `isStatement` parameter). 1355 1363 1356 pp$ 1.parseClass = function(node, isStatement) {1364 pp$8.parseClass = function(node, isStatement) { 1357 1365 this.next(); 1358 1366 … … 1368 1376 var hadConstructor = false; 1369 1377 classBody.body = []; 1370 this.expect(types .braceL);1371 while (this.type !== types .braceR) {1378 this.expect(types$1.braceL); 1379 while (this.type !== types$1.braceR) { 1372 1380 var element = this.parseClassElement(node.superClass !== null); 1373 1381 if (element) { … … 1388 1396 }; 1389 1397 1390 pp$ 1.parseClassElement = function(constructorAllowsSuper) {1391 if (this.eat(types .semi)) { return null }1398 pp$8.parseClassElement = function(constructorAllowsSuper) { 1399 if (this.eat(types$1.semi)) { return null } 1392 1400 1393 1401 var ecmaVersion = this.options.ecmaVersion; … … 1401 1409 if (this.eatContextual("static")) { 1402 1410 // Parse static init block 1403 if (ecmaVersion >= 13 && this.eat(types .braceL)) {1411 if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { 1404 1412 this.parseClassStaticBlock(node); 1405 1413 return node 1406 1414 } 1407 if (this.isClassElementNameStart() || this.type === types .star) {1415 if (this.isClassElementNameStart() || this.type === types$1.star) { 1408 1416 isStatic = true; 1409 1417 } else { … … 1413 1421 node.static = isStatic; 1414 1422 if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { 1415 if ((this.isClassElementNameStart() || this.type === types .star) && !this.canInsertSemicolon()) {1423 if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { 1416 1424 isAsync = true; 1417 1425 } else { … … 1419 1427 } 1420 1428 } 1421 if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types .star)) {1429 if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { 1422 1430 isGenerator = true; 1423 1431 } … … 1446 1454 1447 1455 // Parse element value 1448 if (ecmaVersion < 13 || this.type === types .parenL || kind !== "method" || isGenerator || isAsync) {1456 if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { 1449 1457 var isConstructor = !node.static && checkKeyName(node, "constructor"); 1450 1458 var allowsDirectSuper = isConstructor && constructorAllowsSuper; … … 1460 1468 }; 1461 1469 1462 pp$ 1.isClassElementNameStart = function() {1470 pp$8.isClassElementNameStart = function() { 1463 1471 return ( 1464 this.type === types .name ||1465 this.type === types .privateId ||1466 this.type === types .num ||1467 this.type === types .string ||1468 this.type === types .bracketL ||1472 this.type === types$1.name || 1473 this.type === types$1.privateId || 1474 this.type === types$1.num || 1475 this.type === types$1.string || 1476 this.type === types$1.bracketL || 1469 1477 this.type.keyword 1470 1478 ) 1471 1479 }; 1472 1480 1473 pp$ 1.parseClassElementName = function(element) {1474 if (this.type === types .privateId) {1481 pp$8.parseClassElementName = function(element) { 1482 if (this.type === types$1.privateId) { 1475 1483 if (this.value === "constructor") { 1476 1484 this.raise(this.start, "Classes can't have an element named '#constructor'"); … … 1483 1491 }; 1484 1492 1485 pp$ 1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {1493 pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { 1486 1494 // Check key and flags 1487 1495 var key = method.key; … … 1507 1515 }; 1508 1516 1509 pp$ 1.parseClassField = function(field) {1517 pp$8.parseClassField = function(field) { 1510 1518 if (checkKeyName(field, "constructor")) { 1511 1519 this.raise(field.key.start, "Classes can't have a field named 'constructor'"); … … 1514 1522 } 1515 1523 1516 if (this.eat(types .eq)) {1524 if (this.eat(types$1.eq)) { 1517 1525 // To raise SyntaxError if 'arguments' exists in the initializer. 1518 1526 var scope = this.currentThisScope(); … … 1529 1537 }; 1530 1538 1531 pp$ 1.parseClassStaticBlock = function(node) {1539 pp$8.parseClassStaticBlock = function(node) { 1532 1540 node.body = []; 1533 1541 … … 1535 1543 this.labels = []; 1536 1544 this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); 1537 while (this.type !== types .braceR) {1545 while (this.type !== types$1.braceR) { 1538 1546 var stmt = this.parseStatement(null); 1539 1547 node.body.push(stmt); … … 1546 1554 }; 1547 1555 1548 pp$ 1.parseClassId = function(node, isStatement) {1549 if (this.type === types .name) {1556 pp$8.parseClassId = function(node, isStatement) { 1557 if (this.type === types$1.name) { 1550 1558 node.id = this.parseIdent(); 1551 1559 if (isStatement) … … 1558 1566 }; 1559 1567 1560 pp$ 1.parseClassSuper = function(node) {1561 node.superClass = this.eat(types ._extends) ? this.parseExprSubscripts(false) : null;1562 }; 1563 1564 pp$ 1.enterClassBody = function() {1568 pp$8.parseClassSuper = function(node) { 1569 node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null; 1570 }; 1571 1572 pp$8.enterClassBody = function() { 1565 1573 var element = {declared: Object.create(null), used: []}; 1566 1574 this.privateNameStack.push(element); … … 1568 1576 }; 1569 1577 1570 pp$ 1.exitClassBody = function() {1578 pp$8.exitClassBody = function() { 1571 1579 var ref = this.privateNameStack.pop(); 1572 1580 var declared = ref.declared; … … 1623 1631 // Parses module export declaration. 1624 1632 1625 pp$ 1.parseExport = function(node, exports) {1633 pp$8.parseExport = function(node, exports) { 1626 1634 this.next(); 1627 1635 // export * from '...' 1628 if (this.eat(types .star)) {1636 if (this.eat(types$1.star)) { 1629 1637 if (this.options.ecmaVersion >= 11) { 1630 1638 if (this.eatContextual("as")) { … … 1636 1644 } 1637 1645 this.expectContextual("from"); 1638 if (this.type !== types .string) { this.unexpected(); }1646 if (this.type !== types$1.string) { this.unexpected(); } 1639 1647 node.source = this.parseExprAtom(); 1640 1648 this.semicolon(); 1641 1649 return this.finishNode(node, "ExportAllDeclaration") 1642 1650 } 1643 if (this.eat(types ._default)) { // export default ...1651 if (this.eat(types$1._default)) { // export default ... 1644 1652 this.checkExport(exports, "default", this.lastTokStart); 1645 1653 var isAsync; 1646 if (this.type === types ._function || (isAsync = this.isAsyncFunction())) {1654 if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { 1647 1655 var fNode = this.startNode(); 1648 1656 this.next(); 1649 1657 if (isAsync) { this.next(); } 1650 1658 node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); 1651 } else if (this.type === types ._class) {1659 } else if (this.type === types$1._class) { 1652 1660 var cNode = this.startNode(); 1653 1661 node.declaration = this.parseClass(cNode, "nullableID"); … … 1671 1679 node.specifiers = this.parseExportSpecifiers(exports); 1672 1680 if (this.eatContextual("from")) { 1673 if (this.type !== types .string) { this.unexpected(); }1681 if (this.type !== types$1.string) { this.unexpected(); } 1674 1682 node.source = this.parseExprAtom(); 1675 1683 } else { … … 1690 1698 }; 1691 1699 1692 pp$ 1.checkExport = function(exports, name, pos) {1700 pp$8.checkExport = function(exports, name, pos) { 1693 1701 if (!exports) { return } 1694 1702 if (has(exports, name)) … … 1697 1705 }; 1698 1706 1699 pp$ 1.checkPatternExport = function(exports, pat) {1707 pp$8.checkPatternExport = function(exports, pat) { 1700 1708 var type = pat.type; 1701 1709 if (type === "Identifier") … … 1724 1732 }; 1725 1733 1726 pp$ 1.checkVariableExport = function(exports, decls) {1734 pp$8.checkVariableExport = function(exports, decls) { 1727 1735 if (!exports) { return } 1728 1736 for (var i = 0, list = decls; i < list.length; i += 1) … … 1734 1742 }; 1735 1743 1736 pp$ 1.shouldParseExportStatement = function() {1744 pp$8.shouldParseExportStatement = function() { 1737 1745 return this.type.keyword === "var" || 1738 1746 this.type.keyword === "const" || … … 1745 1753 // Parses a comma-separated list of module exports. 1746 1754 1747 pp$ 1.parseExportSpecifiers = function(exports) {1755 pp$8.parseExportSpecifiers = function(exports) { 1748 1756 var nodes = [], first = true; 1749 1757 // export { x, y as z } [from '...'] 1750 this.expect(types .braceL);1751 while (!this.eat(types .braceR)) {1758 this.expect(types$1.braceL); 1759 while (!this.eat(types$1.braceR)) { 1752 1760 if (!first) { 1753 this.expect(types .comma);1754 if (this.afterTrailingComma(types .braceR)) { break }1761 this.expect(types$1.comma); 1762 if (this.afterTrailingComma(types$1.braceR)) { break } 1755 1763 } else { first = false; } 1756 1764 … … 1766 1774 // Parses import declaration. 1767 1775 1768 pp$ 1.parseImport = function(node) {1776 pp$8.parseImport = function(node) { 1769 1777 this.next(); 1770 1778 // import '...' 1771 if (this.type === types .string) {1772 node.specifiers = empty ;1779 if (this.type === types$1.string) { 1780 node.specifiers = empty$1; 1773 1781 node.source = this.parseExprAtom(); 1774 1782 } else { 1775 1783 node.specifiers = this.parseImportSpecifiers(); 1776 1784 this.expectContextual("from"); 1777 node.source = this.type === types .string ? this.parseExprAtom() : this.unexpected();1785 node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); 1778 1786 } 1779 1787 this.semicolon(); … … 1783 1791 // Parses a comma-separated list of module imports. 1784 1792 1785 pp$ 1.parseImportSpecifiers = function() {1793 pp$8.parseImportSpecifiers = function() { 1786 1794 var nodes = [], first = true; 1787 if (this.type === types .name) {1795 if (this.type === types$1.name) { 1788 1796 // import defaultObj, { x, y as z } from '...' 1789 1797 var node = this.startNode(); … … 1791 1799 this.checkLValSimple(node.local, BIND_LEXICAL); 1792 1800 nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); 1793 if (!this.eat(types .comma)) { return nodes }1794 } 1795 if (this.type === types .star) {1801 if (!this.eat(types$1.comma)) { return nodes } 1802 } 1803 if (this.type === types$1.star) { 1796 1804 var node$1 = this.startNode(); 1797 1805 this.next(); … … 1802 1810 return nodes 1803 1811 } 1804 this.expect(types .braceL);1805 while (!this.eat(types .braceR)) {1812 this.expect(types$1.braceL); 1813 while (!this.eat(types$1.braceR)) { 1806 1814 if (!first) { 1807 this.expect(types .comma);1808 if (this.afterTrailingComma(types .braceR)) { break }1815 this.expect(types$1.comma); 1816 if (this.afterTrailingComma(types$1.braceR)) { break } 1809 1817 } else { first = false; } 1810 1818 … … 1824 1832 1825 1833 // Set `ExpressionStatement#directive` property for directive prologues. 1826 pp$ 1.adaptDirectivePrologue = function(statements) {1834 pp$8.adaptDirectivePrologue = function(statements) { 1827 1835 for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { 1828 1836 statements[i].directive = statements[i].expression.raw.slice(1, -1); 1829 1837 } 1830 1838 }; 1831 pp$ 1.isDirectiveCandidate = function(statement) {1839 pp$8.isDirectiveCandidate = function(statement) { 1832 1840 return ( 1833 1841 statement.type === "ExpressionStatement" && … … 1839 1847 }; 1840 1848 1841 var pp$ 2= Parser.prototype;1849 var pp$7 = Parser.prototype; 1842 1850 1843 1851 // Convert existing expression atom to assignable pattern 1844 1852 // if possible. 1845 1853 1846 pp$ 2.toAssignable = function(node, isBinding, refDestructuringErrors) {1854 pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { 1847 1855 if (this.options.ecmaVersion >= 6 && node) { 1848 1856 switch (node.type) { … … 1925 1933 // Convert list of expression atoms to binding list. 1926 1934 1927 pp$ 2.toAssignableList = function(exprList, isBinding) {1935 pp$7.toAssignableList = function(exprList, isBinding) { 1928 1936 var end = exprList.length; 1929 1937 for (var i = 0; i < end; i++) { … … 1941 1949 // Parses spread element. 1942 1950 1943 pp$ 2.parseSpread = function(refDestructuringErrors) {1951 pp$7.parseSpread = function(refDestructuringErrors) { 1944 1952 var node = this.startNode(); 1945 1953 this.next(); … … 1948 1956 }; 1949 1957 1950 pp$ 2.parseRestBinding = function() {1958 pp$7.parseRestBinding = function() { 1951 1959 var node = this.startNode(); 1952 1960 this.next(); 1953 1961 1954 1962 // RestElement inside of a function parameter must be an identifier 1955 if (this.options.ecmaVersion === 6 && this.type !== types .name)1963 if (this.options.ecmaVersion === 6 && this.type !== types$1.name) 1956 1964 { this.unexpected(); } 1957 1965 … … 1963 1971 // Parses lvalue (assignable) atom. 1964 1972 1965 pp$ 2.parseBindingAtom = function() {1973 pp$7.parseBindingAtom = function() { 1966 1974 if (this.options.ecmaVersion >= 6) { 1967 1975 switch (this.type) { 1968 case types .bracketL:1976 case types$1.bracketL: 1969 1977 var node = this.startNode(); 1970 1978 this.next(); 1971 node.elements = this.parseBindingList(types .bracketR, true, true);1979 node.elements = this.parseBindingList(types$1.bracketR, true, true); 1972 1980 return this.finishNode(node, "ArrayPattern") 1973 1981 1974 case types .braceL:1982 case types$1.braceL: 1975 1983 return this.parseObj(true) 1976 1984 } … … 1979 1987 }; 1980 1988 1981 pp$ 2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {1989 pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) { 1982 1990 var elts = [], first = true; 1983 1991 while (!this.eat(close)) { 1984 1992 if (first) { first = false; } 1985 else { this.expect(types .comma); }1986 if (allowEmpty && this.type === types .comma) {1993 else { this.expect(types$1.comma); } 1994 if (allowEmpty && this.type === types$1.comma) { 1987 1995 elts.push(null); 1988 1996 } else if (allowTrailingComma && this.afterTrailingComma(close)) { 1989 1997 break 1990 } else if (this.type === types .ellipsis) {1998 } else if (this.type === types$1.ellipsis) { 1991 1999 var rest = this.parseRestBinding(); 1992 2000 this.parseBindingListItem(rest); 1993 2001 elts.push(rest); 1994 if (this.type === types .comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }2002 if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } 1995 2003 this.expect(close); 1996 2004 break … … 2004 2012 }; 2005 2013 2006 pp$ 2.parseBindingListItem = function(param) {2014 pp$7.parseBindingListItem = function(param) { 2007 2015 return param 2008 2016 }; … … 2010 2018 // Parses assignment pattern around given atom if possible. 2011 2019 2012 pp$ 2.parseMaybeDefault = function(startPos, startLoc, left) {2020 pp$7.parseMaybeDefault = function(startPos, startLoc, left) { 2013 2021 left = left || this.parseBindingAtom(); 2014 if (this.options.ecmaVersion < 6 || !this.eat(types .eq)) { return left }2022 if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left } 2015 2023 var node = this.startNodeAt(startPos, startLoc); 2016 2024 node.left = left; … … 2083 2091 // is an assignment (i.e., bindingType is BIND_NONE). 2084 2092 2085 pp$ 2.checkLValSimple = function(expr, bindingType, checkClashes) {2093 pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { 2086 2094 if ( bindingType === void 0 ) bindingType = BIND_NONE; 2087 2095 … … 2121 2129 }; 2122 2130 2123 pp$ 2.checkLValPattern = function(expr, bindingType, checkClashes) {2131 pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { 2124 2132 if ( bindingType === void 0 ) bindingType = BIND_NONE; 2125 2133 … … 2146 2154 }; 2147 2155 2148 pp$ 2.checkLValInnerPattern = function(expr, bindingType, checkClashes) {2156 pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) { 2149 2157 if ( bindingType === void 0 ) bindingType = BIND_NONE; 2150 2158 … … 2178 2186 }; 2179 2187 2180 var types $1= {2188 var types = { 2181 2189 b_stat: new TokContext("{", false), 2182 2190 b_expr: new TokContext("{", true), … … 2191 2199 }; 2192 2200 2193 var pp$ 3= Parser.prototype;2194 2195 pp$ 3.initialContext = function() {2196 return [types $1.b_stat]2197 }; 2198 2199 pp$ 3.curContext = function() {2201 var pp$6 = Parser.prototype; 2202 2203 pp$6.initialContext = function() { 2204 return [types.b_stat] 2205 }; 2206 2207 pp$6.curContext = function() { 2200 2208 return this.context[this.context.length - 1] 2201 2209 }; 2202 2210 2203 pp$ 3.braceIsBlock = function(prevType) {2211 pp$6.braceIsBlock = function(prevType) { 2204 2212 var parent = this.curContext(); 2205 if (parent === types $1.f_expr || parent === types$1.f_stat)2213 if (parent === types.f_expr || parent === types.f_stat) 2206 2214 { return true } 2207 if (prevType === types .colon && (parent === types$1.b_stat || parent === types$1.b_expr))2215 if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) 2208 2216 { return !parent.isExpr } 2209 2217 … … 2211 2219 // after a `yield` or `of` construct. See the `updateContext` for 2212 2220 // `tt.name`. 2213 if (prevType === types ._return || prevType === types.name && this.exprAllowed)2221 if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) 2214 2222 { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) } 2215 if (prevType === types ._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)2223 if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) 2216 2224 { return true } 2217 if (prevType === types .braceL)2218 { return parent === types $1.b_stat }2219 if (prevType === types ._var || prevType === types._const || prevType === types.name)2225 if (prevType === types$1.braceL) 2226 { return parent === types.b_stat } 2227 if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) 2220 2228 { return false } 2221 2229 return !this.exprAllowed 2222 2230 }; 2223 2231 2224 pp$ 3.inGeneratorContext = function() {2232 pp$6.inGeneratorContext = function() { 2225 2233 for (var i = this.context.length - 1; i >= 1; i--) { 2226 2234 var context = this.context[i]; … … 2231 2239 }; 2232 2240 2233 pp$ 3.updateContext = function(prevType) {2241 pp$6.updateContext = function(prevType) { 2234 2242 var update, type = this.type; 2235 if (type.keyword && prevType === types .dot)2243 if (type.keyword && prevType === types$1.dot) 2236 2244 { this.exprAllowed = false; } 2237 2245 else if (update = type.updateContext) … … 2242 2250 2243 2251 // Used to handle egde case when token context could not be inferred correctly in tokenize phase 2244 pp$ 3.overrideContext = function(tokenCtx) {2252 pp$6.overrideContext = function(tokenCtx) { 2245 2253 if (this.curContext() !== tokenCtx) { 2246 2254 this.context[this.context.length - 1] = tokenCtx; … … 2250 2258 // Token-specific context update code 2251 2259 2252 types .parenR.updateContext = types.braceR.updateContext = function() {2260 types$1.parenR.updateContext = types$1.braceR.updateContext = function() { 2253 2261 if (this.context.length === 1) { 2254 2262 this.exprAllowed = true; … … 2256 2264 } 2257 2265 var out = this.context.pop(); 2258 if (out === types $1.b_stat && this.curContext().token === "function") {2266 if (out === types.b_stat && this.curContext().token === "function") { 2259 2267 out = this.context.pop(); 2260 2268 } … … 2262 2270 }; 2263 2271 2264 types .braceL.updateContext = function(prevType) {2265 this.context.push(this.braceIsBlock(prevType) ? types $1.b_stat : types$1.b_expr);2272 types$1.braceL.updateContext = function(prevType) { 2273 this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); 2266 2274 this.exprAllowed = true; 2267 2275 }; 2268 2276 2269 types .dollarBraceL.updateContext = function() {2270 this.context.push(types $1.b_tmpl);2277 types$1.dollarBraceL.updateContext = function() { 2278 this.context.push(types.b_tmpl); 2271 2279 this.exprAllowed = true; 2272 2280 }; 2273 2281 2274 types .parenL.updateContext = function(prevType) {2275 var statementParens = prevType === types ._if || prevType === types._for || prevType === types._with || prevType === types._while;2276 this.context.push(statementParens ? types $1.p_stat : types$1.p_expr);2282 types$1.parenL.updateContext = function(prevType) { 2283 var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; 2284 this.context.push(statementParens ? types.p_stat : types.p_expr); 2277 2285 this.exprAllowed = true; 2278 2286 }; 2279 2287 2280 types .incDec.updateContext = function() {2288 types$1.incDec.updateContext = function() { 2281 2289 // tokExprAllowed stays unchanged 2282 2290 }; 2283 2291 2284 types ._function.updateContext = types._class.updateContext = function(prevType) {2285 if (prevType.beforeExpr && prevType !== types ._else &&2286 !(prevType === types .semi && this.curContext() !== types$1.p_stat) &&2287 !(prevType === types ._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&2288 !((prevType === types .colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))2289 { this.context.push(types $1.f_expr); }2292 types$1._function.updateContext = types$1._class.updateContext = function(prevType) { 2293 if (prevType.beforeExpr && prevType !== types$1._else && 2294 !(prevType === types$1.semi && this.curContext() !== types.p_stat) && 2295 !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && 2296 !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) 2297 { this.context.push(types.f_expr); } 2290 2298 else 2291 { this.context.push(types $1.f_stat); }2299 { this.context.push(types.f_stat); } 2292 2300 this.exprAllowed = false; 2293 2301 }; 2294 2302 2295 types .backQuote.updateContext = function() {2296 if (this.curContext() === types $1.q_tmpl)2303 types$1.backQuote.updateContext = function() { 2304 if (this.curContext() === types.q_tmpl) 2297 2305 { this.context.pop(); } 2298 2306 else 2299 { this.context.push(types $1.q_tmpl); }2307 { this.context.push(types.q_tmpl); } 2300 2308 this.exprAllowed = false; 2301 2309 }; 2302 2310 2303 types .star.updateContext = function(prevType) {2304 if (prevType === types ._function) {2311 types$1.star.updateContext = function(prevType) { 2312 if (prevType === types$1._function) { 2305 2313 var index = this.context.length - 1; 2306 if (this.context[index] === types $1.f_expr)2307 { this.context[index] = types $1.f_expr_gen; }2314 if (this.context[index] === types.f_expr) 2315 { this.context[index] = types.f_expr_gen; } 2308 2316 else 2309 { this.context[index] = types $1.f_gen; }2317 { this.context[index] = types.f_gen; } 2310 2318 } 2311 2319 this.exprAllowed = true; 2312 2320 }; 2313 2321 2314 types .name.updateContext = function(prevType) {2322 types$1.name.updateContext = function(prevType) { 2315 2323 var allowed = false; 2316 if (this.options.ecmaVersion >= 6 && prevType !== types .dot) {2324 if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { 2317 2325 if (this.value === "of" && !this.exprAllowed || 2318 2326 this.value === "yield" && this.inGeneratorContext()) … … 2324 2332 // A recursive descent parser operates by defining functions for all 2325 2333 2326 var pp$ 4= Parser.prototype;2334 var pp$5 = Parser.prototype; 2327 2335 2328 2336 // Check if property name clashes with already added. … … 2331 2339 // strict mode, init properties are also not allowed to be repeated. 2332 2340 2333 pp$ 4.checkPropClash = function(prop, propHash, refDestructuringErrors) {2341 pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { 2334 2342 if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") 2335 2343 { return } … … 2348 2356 if (propHash.proto) { 2349 2357 if (refDestructuringErrors) { 2350 if (refDestructuringErrors.doubleProto < 0) 2351 { refDestructuringErrors.doubleProto = key.start; } 2352 // Backwards-compat kludge. Can be removed in version 6.0 2353 } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } 2358 if (refDestructuringErrors.doubleProto < 0) { 2359 refDestructuringErrors.doubleProto = key.start; 2360 } 2361 } else { 2362 this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); 2363 } 2354 2364 } 2355 2365 propHash.proto = true; … … 2393 2403 // delayed syntax error at correct position). 2394 2404 2395 pp$ 4.parseExpression = function(forInit, refDestructuringErrors) {2405 pp$5.parseExpression = function(forInit, refDestructuringErrors) { 2396 2406 var startPos = this.start, startLoc = this.startLoc; 2397 2407 var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); 2398 if (this.type === types .comma) {2408 if (this.type === types$1.comma) { 2399 2409 var node = this.startNodeAt(startPos, startLoc); 2400 2410 node.expressions = [expr]; 2401 while (this.eat(types .comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }2411 while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); } 2402 2412 return this.finishNode(node, "SequenceExpression") 2403 2413 } … … 2408 2418 // operators like `+=`. 2409 2419 2410 pp$ 4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {2420 pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) { 2411 2421 if (this.isContextual("yield")) { 2412 2422 if (this.inGenerator) { return this.parseYield(forInit) } … … 2416 2426 } 2417 2427 2418 var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1 ;2428 var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; 2419 2429 if (refDestructuringErrors) { 2420 2430 oldParenAssign = refDestructuringErrors.parenthesizedAssign; 2421 2431 oldTrailingComma = refDestructuringErrors.trailingComma; 2432 oldDoubleProto = refDestructuringErrors.doubleProto; 2422 2433 refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; 2423 2434 } else { … … 2427 2438 2428 2439 var startPos = this.start, startLoc = this.startLoc; 2429 if (this.type === types .parenL || this.type === types.name) {2440 if (this.type === types$1.parenL || this.type === types$1.name) { 2430 2441 this.potentialArrowAt = this.start; 2431 2442 this.potentialArrowInForAwait = forInit === "await"; … … 2436 2447 var node = this.startNodeAt(startPos, startLoc); 2437 2448 node.operator = this.value; 2438 if (this.type === types .eq)2449 if (this.type === types$1.eq) 2439 2450 { left = this.toAssignable(left, false, refDestructuringErrors); } 2440 2451 if (!ownDestructuringErrors) { … … 2443 2454 if (refDestructuringErrors.shorthandAssign >= left.start) 2444 2455 { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly 2445 if (this.type === types .eq)2456 if (this.type === types$1.eq) 2446 2457 { this.checkLValPattern(left); } 2447 2458 else … … 2450 2461 this.next(); 2451 2462 node.right = this.parseMaybeAssign(forInit); 2463 if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; } 2452 2464 return this.finishNode(node, "AssignmentExpression") 2453 2465 } else { … … 2461 2473 // Parse a ternary conditional (`?:`) operator. 2462 2474 2463 pp$ 4.parseMaybeConditional = function(forInit, refDestructuringErrors) {2475 pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { 2464 2476 var startPos = this.start, startLoc = this.startLoc; 2465 2477 var expr = this.parseExprOps(forInit, refDestructuringErrors); 2466 2478 if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } 2467 if (this.eat(types .question)) {2479 if (this.eat(types$1.question)) { 2468 2480 var node = this.startNodeAt(startPos, startLoc); 2469 2481 node.test = expr; 2470 2482 node.consequent = this.parseMaybeAssign(); 2471 this.expect(types .colon);2483 this.expect(types$1.colon); 2472 2484 node.alternate = this.parseMaybeAssign(forInit); 2473 2485 return this.finishNode(node, "ConditionalExpression") … … 2478 2490 // Start the precedence parser. 2479 2491 2480 pp$ 4.parseExprOps = function(forInit, refDestructuringErrors) {2492 pp$5.parseExprOps = function(forInit, refDestructuringErrors) { 2481 2493 var startPos = this.start, startLoc = this.startLoc; 2482 2494 var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); … … 2491 2503 // operator that has a lower precedence than the set it is parsing. 2492 2504 2493 pp$ 4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {2505 pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) { 2494 2506 var prec = this.type.binop; 2495 if (prec != null && (!forInit || this.type !== types ._in)) {2507 if (prec != null && (!forInit || this.type !== types$1._in)) { 2496 2508 if (prec > minPrec) { 2497 var logical = this.type === types .logicalOR || this.type === types.logicalAND;2498 var coalesce = this.type === types .coalesce;2509 var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; 2510 var coalesce = this.type === types$1.coalesce; 2499 2511 if (coalesce) { 2500 2512 // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. 2501 2513 // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. 2502 prec = types .logicalAND.binop;2514 prec = types$1.logicalAND.binop; 2503 2515 } 2504 2516 var op = this.value; … … 2507 2519 var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); 2508 2520 var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); 2509 if ((logical && this.type === types .coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {2521 if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) { 2510 2522 this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); 2511 2523 } … … 2516 2528 }; 2517 2529 2518 pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) { 2530 pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { 2531 if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); } 2519 2532 var node = this.startNodeAt(startPos, startLoc); 2520 2533 node.left = left; … … 2526 2539 // Parse unary operators, both prefix and postfix. 2527 2540 2528 pp$ 4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {2541 pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { 2529 2542 var startPos = this.start, startLoc = this.startLoc, expr; 2530 2543 if (this.isContextual("await") && this.canAwait) { … … 2532 2545 sawUnary = true; 2533 2546 } else if (this.type.prefix) { 2534 var node = this.startNode(), update = this.type === types .incDec;2547 var node = this.startNode(), update = this.type === types$1.incDec; 2535 2548 node.operator = this.value; 2536 2549 node.prefix = true; … … 2546 2559 else { sawUnary = true; } 2547 2560 expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); 2561 } else if (!sawUnary && this.type === types$1.privateId) { 2562 if (forInit || this.privateNameStack.length === 0) { this.unexpected(); } 2563 expr = this.parsePrivateIdent(); 2564 // only could be private fields in 'in', such as #x in obj 2565 if (this.type !== types$1._in) { this.unexpected(); } 2548 2566 } else { 2549 2567 expr = this.parseExprSubscripts(refDestructuringErrors, forInit); … … 2560 2578 } 2561 2579 2562 if (!incDec && this.eat(types .starstar)) {2580 if (!incDec && this.eat(types$1.starstar)) { 2563 2581 if (sawUnary) 2564 2582 { this.unexpected(this.lastTokStart); } … … 2579 2597 // Parse call, dot, and `[]`-subscript expressions. 2580 2598 2581 pp$ 4.parseExprSubscripts = function(refDestructuringErrors, forInit) {2599 pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { 2582 2600 var startPos = this.start, startLoc = this.startLoc; 2583 2601 var expr = this.parseExprAtom(refDestructuringErrors, forInit); … … 2593 2611 }; 2594 2612 2595 pp$ 4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {2613 pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) { 2596 2614 var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && 2597 2615 this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && … … 2616 2634 }; 2617 2635 2618 pp$ 4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {2636 pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { 2619 2637 var optionalSupported = this.options.ecmaVersion >= 11; 2620 var optional = optionalSupported && this.eat(types .questionDot);2638 var optional = optionalSupported && this.eat(types$1.questionDot); 2621 2639 if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); } 2622 2640 2623 var computed = this.eat(types .bracketL);2624 if (computed || (optional && this.type !== types .parenL && this.type !== types.backQuote) || this.eat(types.dot)) {2641 var computed = this.eat(types$1.bracketL); 2642 if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) { 2625 2643 var node = this.startNodeAt(startPos, startLoc); 2626 2644 node.object = base; 2627 2645 if (computed) { 2628 2646 node.property = this.parseExpression(); 2629 this.expect(types .bracketR);2630 } else if (this.type === types .privateId && base.type !== "Super") {2647 this.expect(types$1.bracketR); 2648 } else if (this.type === types$1.privateId && base.type !== "Super") { 2631 2649 node.property = this.parsePrivateIdent(); 2632 2650 } else { … … 2638 2656 } 2639 2657 base = this.finishNode(node, "MemberExpression"); 2640 } else if (!noCalls && this.eat(types .parenL)) {2658 } else if (!noCalls && this.eat(types$1.parenL)) { 2641 2659 var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; 2642 2660 this.yieldPos = 0; 2643 2661 this.awaitPos = 0; 2644 2662 this.awaitIdentPos = 0; 2645 var exprList = this.parseExprList(types .parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);2646 if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types .arrow)) {2663 var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); 2664 if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { 2647 2665 this.checkPatternErrors(refDestructuringErrors, false); 2648 2666 this.checkYieldAwaitInDefaultParams(); … … 2665 2683 } 2666 2684 base = this.finishNode(node$1, "CallExpression"); 2667 } else if (this.type === types .backQuote) {2685 } else if (this.type === types$1.backQuote) { 2668 2686 if (optional || optionalChained) { 2669 2687 this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); … … 2682 2700 // or `{}`. 2683 2701 2684 pp$ 4.parseExprAtom = function(refDestructuringErrors, forInit) {2702 pp$5.parseExprAtom = function(refDestructuringErrors, forInit) { 2685 2703 // If a division operator appears in an expression position, the 2686 2704 // tokenizer got confused, and we force it to read a regexp instead. 2687 if (this.type === types .slash) { this.readRegexp(); }2705 if (this.type === types$1.slash) { this.readRegexp(); } 2688 2706 2689 2707 var node, canBeArrow = this.potentialArrowAt === this.start; 2690 2708 switch (this.type) { 2691 case types ._super:2709 case types$1._super: 2692 2710 if (!this.allowSuper) 2693 2711 { this.raise(this.start, "'super' keyword outside a method"); } 2694 2712 node = this.startNode(); 2695 2713 this.next(); 2696 if (this.type === types .parenL && !this.allowDirectSuper)2714 if (this.type === types$1.parenL && !this.allowDirectSuper) 2697 2715 { this.raise(node.start, "super() call outside constructor of a subclass"); } 2698 2716 // The `super` keyword can appear at below: … … 2702 2720 // SuperCall: 2703 2721 // super ( Arguments ) 2704 if (this.type !== types .dot && this.type !== types.bracketL && this.type !== types.parenL)2722 if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) 2705 2723 { this.unexpected(); } 2706 2724 return this.finishNode(node, "Super") 2707 2725 2708 case types ._this:2726 case types$1._this: 2709 2727 node = this.startNode(); 2710 2728 this.next(); 2711 2729 return this.finishNode(node, "ThisExpression") 2712 2730 2713 case types .name:2731 case types$1.name: 2714 2732 var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; 2715 2733 var id = this.parseIdent(false); 2716 if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types ._function)) {2717 this.overrideContext(types $1.f_expr);2734 if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { 2735 this.overrideContext(types.f_expr); 2718 2736 return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit) 2719 2737 } 2720 2738 if (canBeArrow && !this.canInsertSemicolon()) { 2721 if (this.eat(types .arrow))2739 if (this.eat(types$1.arrow)) 2722 2740 { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) } 2723 if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types .name && !containsEsc &&2741 if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && 2724 2742 (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { 2725 2743 id = this.parseIdent(false); 2726 if (this.canInsertSemicolon() || !this.eat(types .arrow))2744 if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) 2727 2745 { this.unexpected(); } 2728 2746 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit) … … 2731 2749 return id 2732 2750 2733 case types .regexp:2751 case types$1.regexp: 2734 2752 var value = this.value; 2735 2753 node = this.parseLiteral(value.value); … … 2737 2755 return node 2738 2756 2739 case types .num: case types.string:2757 case types$1.num: case types$1.string: 2740 2758 return this.parseLiteral(this.value) 2741 2759 2742 case types ._null: case types._true: case types._false:2760 case types$1._null: case types$1._true: case types$1._false: 2743 2761 node = this.startNode(); 2744 node.value = this.type === types ._null ? null : this.type === types._true;2762 node.value = this.type === types$1._null ? null : this.type === types$1._true; 2745 2763 node.raw = this.type.keyword; 2746 2764 this.next(); 2747 2765 return this.finishNode(node, "Literal") 2748 2766 2749 case types .parenL:2767 case types$1.parenL: 2750 2768 var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); 2751 2769 if (refDestructuringErrors) { … … 2757 2775 return expr 2758 2776 2759 case types .bracketL:2777 case types$1.bracketL: 2760 2778 node = this.startNode(); 2761 2779 this.next(); 2762 node.elements = this.parseExprList(types .bracketR, true, true, refDestructuringErrors);2780 node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); 2763 2781 return this.finishNode(node, "ArrayExpression") 2764 2782 2765 case types .braceL:2766 this.overrideContext(types $1.b_expr);2783 case types$1.braceL: 2784 this.overrideContext(types.b_expr); 2767 2785 return this.parseObj(false, refDestructuringErrors) 2768 2786 2769 case types ._function:2787 case types$1._function: 2770 2788 node = this.startNode(); 2771 2789 this.next(); 2772 2790 return this.parseFunction(node, 0) 2773 2791 2774 case types ._class:2792 case types$1._class: 2775 2793 return this.parseClass(this.startNode(), false) 2776 2794 2777 case types ._new:2795 case types$1._new: 2778 2796 return this.parseNew() 2779 2797 2780 case types .backQuote:2798 case types$1.backQuote: 2781 2799 return this.parseTemplate() 2782 2800 2783 case types ._import:2801 case types$1._import: 2784 2802 if (this.options.ecmaVersion >= 11) { 2785 2803 return this.parseExprImport() … … 2793 2811 }; 2794 2812 2795 pp$ 4.parseExprImport = function() {2813 pp$5.parseExprImport = function() { 2796 2814 var node = this.startNode(); 2797 2815 … … 2802 2820 2803 2821 switch (this.type) { 2804 case types .parenL:2822 case types$1.parenL: 2805 2823 return this.parseDynamicImport(node) 2806 case types .dot:2824 case types$1.dot: 2807 2825 node.meta = meta; 2808 2826 return this.parseImportMeta(node) … … 2812 2830 }; 2813 2831 2814 pp$ 4.parseDynamicImport = function(node) {2832 pp$5.parseDynamicImport = function(node) { 2815 2833 this.next(); // skip `(` 2816 2834 … … 2819 2837 2820 2838 // Verify ending. 2821 if (!this.eat(types .parenR)) {2839 if (!this.eat(types$1.parenR)) { 2822 2840 var errorPos = this.start; 2823 if (this.eat(types .comma) && this.eat(types.parenR)) {2841 if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { 2824 2842 this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); 2825 2843 } else { … … 2831 2849 }; 2832 2850 2833 pp$ 4.parseImportMeta = function(node) {2851 pp$5.parseImportMeta = function(node) { 2834 2852 this.next(); // skip `.` 2835 2853 … … 2847 2865 }; 2848 2866 2849 pp$ 4.parseLiteral = function(value) {2867 pp$5.parseLiteral = function(value) { 2850 2868 var node = this.startNode(); 2851 2869 node.value = value; … … 2856 2874 }; 2857 2875 2858 pp$ 4.parseParenExpression = function() {2859 this.expect(types .parenL);2876 pp$5.parseParenExpression = function() { 2877 this.expect(types$1.parenL); 2860 2878 var val = this.parseExpression(); 2861 this.expect(types .parenR);2879 this.expect(types$1.parenR); 2862 2880 return val 2863 2881 }; 2864 2882 2865 pp$ 4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {2883 pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { 2866 2884 var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; 2867 2885 if (this.options.ecmaVersion >= 6) { … … 2874 2892 this.awaitPos = 0; 2875 2893 // Do not save awaitIdentPos to allow checking awaits nested in parameters 2876 while (this.type !== types .parenR) {2877 first ? first = false : this.expect(types .comma);2878 if (allowTrailingComma && this.afterTrailingComma(types .parenR, true)) {2894 while (this.type !== types$1.parenR) { 2895 first ? first = false : this.expect(types$1.comma); 2896 if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { 2879 2897 lastIsComma = true; 2880 2898 break 2881 } else if (this.type === types .ellipsis) {2899 } else if (this.type === types$1.ellipsis) { 2882 2900 spreadStart = this.start; 2883 2901 exprList.push(this.parseParenItem(this.parseRestBinding())); 2884 if (this.type === types .comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }2902 if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } 2885 2903 break 2886 2904 } else { … … 2889 2907 } 2890 2908 var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; 2891 this.expect(types .parenR);2892 2893 if (canBeArrow && !this.canInsertSemicolon() && this.eat(types .arrow)) {2909 this.expect(types$1.parenR); 2910 2911 if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { 2894 2912 this.checkPatternErrors(refDestructuringErrors, false); 2895 2913 this.checkYieldAwaitInDefaultParams(); … … 2925 2943 }; 2926 2944 2927 pp$ 4.parseParenItem = function(item) {2945 pp$5.parseParenItem = function(item) { 2928 2946 return item 2929 2947 }; 2930 2948 2931 pp$ 4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {2932 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, f orInit)2949 pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { 2950 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit) 2933 2951 }; 2934 2952 … … 2939 2957 // argument list. 2940 2958 2941 var empty $1= [];2942 2943 pp$ 4.parseNew = function() {2959 var empty = []; 2960 2961 pp$5.parseNew = function() { 2944 2962 if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } 2945 2963 var node = this.startNode(); 2946 2964 var meta = this.parseIdent(true); 2947 if (this.options.ecmaVersion >= 6 && this.eat(types .dot)) {2965 if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { 2948 2966 node.meta = meta; 2949 2967 var containsEsc = this.containsEsc; … … 2957 2975 return this.finishNode(node, "MetaProperty") 2958 2976 } 2959 var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types ._import;2977 var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import; 2960 2978 node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); 2961 2979 if (isImport && node.callee.type === "ImportExpression") { 2962 2980 this.raise(startPos, "Cannot use new with import()"); 2963 2981 } 2964 if (this.eat(types .parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }2965 else { node.arguments = empty $1; }2982 if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); } 2983 else { node.arguments = empty; } 2966 2984 return this.finishNode(node, "NewExpression") 2967 2985 }; … … 2969 2987 // Parse template expression. 2970 2988 2971 pp$ 4.parseTemplateElement = function(ref) {2989 pp$5.parseTemplateElement = function(ref) { 2972 2990 var isTagged = ref.isTagged; 2973 2991 2974 2992 var elem = this.startNode(); 2975 if (this.type === types .invalidTemplate) {2993 if (this.type === types$1.invalidTemplate) { 2976 2994 if (!isTagged) { 2977 2995 this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); … … 2988 3006 } 2989 3007 this.next(); 2990 elem.tail = this.type === types .backQuote;3008 elem.tail = this.type === types$1.backQuote; 2991 3009 return this.finishNode(elem, "TemplateElement") 2992 3010 }; 2993 3011 2994 pp$ 4.parseTemplate = function(ref) {3012 pp$5.parseTemplate = function(ref) { 2995 3013 if ( ref === void 0 ) ref = {}; 2996 3014 var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false; … … 3002 3020 node.quasis = [curElt]; 3003 3021 while (!curElt.tail) { 3004 if (this.type === types .eof) { this.raise(this.pos, "Unterminated template literal"); }3005 this.expect(types .dollarBraceL);3022 if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); } 3023 this.expect(types$1.dollarBraceL); 3006 3024 node.expressions.push(this.parseExpression()); 3007 this.expect(types .braceR);3025 this.expect(types$1.braceR); 3008 3026 node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged})); 3009 3027 } … … 3012 3030 }; 3013 3031 3014 pp$ 4.isAsyncProp = function(prop) {3032 pp$5.isAsyncProp = function(prop) { 3015 3033 return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && 3016 (this.type === types .name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&3034 (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) && 3017 3035 !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) 3018 3036 }; … … 3020 3038 // Parse an object literal or binding pattern. 3021 3039 3022 pp$ 4.parseObj = function(isPattern, refDestructuringErrors) {3040 pp$5.parseObj = function(isPattern, refDestructuringErrors) { 3023 3041 var node = this.startNode(), first = true, propHash = {}; 3024 3042 node.properties = []; 3025 3043 this.next(); 3026 while (!this.eat(types .braceR)) {3044 while (!this.eat(types$1.braceR)) { 3027 3045 if (!first) { 3028 this.expect(types .comma);3029 if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types .braceR)) { break }3046 this.expect(types$1.comma); 3047 if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break } 3030 3048 } else { first = false; } 3031 3049 … … 3037 3055 }; 3038 3056 3039 pp$ 4.parseProperty = function(isPattern, refDestructuringErrors) {3057 pp$5.parseProperty = function(isPattern, refDestructuringErrors) { 3040 3058 var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; 3041 if (this.options.ecmaVersion >= 9 && this.eat(types .ellipsis)) {3059 if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { 3042 3060 if (isPattern) { 3043 3061 prop.argument = this.parseIdent(false); 3044 if (this.type === types .comma) {3062 if (this.type === types$1.comma) { 3045 3063 this.raise(this.start, "Comma is not permitted after the rest element"); 3046 3064 } … … 3048 3066 } 3049 3067 // To disallow parenthesized identifier via `this.toAssignable()`. 3050 if (this.type === types .parenL && refDestructuringErrors) {3068 if (this.type === types$1.parenL && refDestructuringErrors) { 3051 3069 if (refDestructuringErrors.parenthesizedAssign < 0) { 3052 3070 refDestructuringErrors.parenthesizedAssign = this.start; … … 3059 3077 prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); 3060 3078 // To disallow trailing comma via `this.toAssignable()`. 3061 if (this.type === types .comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {3079 if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { 3062 3080 refDestructuringErrors.trailingComma = this.start; 3063 3081 } … … 3073 3091 } 3074 3092 if (!isPattern) 3075 { isGenerator = this.eat(types .star); }3093 { isGenerator = this.eat(types$1.star); } 3076 3094 } 3077 3095 var containsEsc = this.containsEsc; … … 3079 3097 if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { 3080 3098 isAsync = true; 3081 isGenerator = this.options.ecmaVersion >= 9 && this.eat(types .star);3099 isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); 3082 3100 this.parsePropertyName(prop, refDestructuringErrors); 3083 3101 } else { … … 3088 3106 }; 3089 3107 3090 pp$ 4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {3091 if ((isGenerator || isAsync) && this.type === types .colon)3108 pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { 3109 if ((isGenerator || isAsync) && this.type === types$1.colon) 3092 3110 { this.unexpected(); } 3093 3111 3094 if (this.eat(types .colon)) {3112 if (this.eat(types$1.colon)) { 3095 3113 prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); 3096 3114 prop.kind = "init"; 3097 } else if (this.options.ecmaVersion >= 6 && this.type === types .parenL) {3115 } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { 3098 3116 if (isPattern) { this.unexpected(); } 3099 3117 prop.kind = "init"; … … 3103 3121 this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && 3104 3122 (prop.key.name === "get" || prop.key.name === "set") && 3105 (this.type !== types .comma && this.type !== types.braceR && this.type !== types.eq)) {3123 (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) { 3106 3124 if (isGenerator || isAsync) { this.unexpected(); } 3107 3125 prop.kind = prop.key.name; … … 3127 3145 if (isPattern) { 3128 3146 prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); 3129 } else if (this.type === types .eq && refDestructuringErrors) {3147 } else if (this.type === types$1.eq && refDestructuringErrors) { 3130 3148 if (refDestructuringErrors.shorthandAssign < 0) 3131 3149 { refDestructuringErrors.shorthandAssign = this.start; } … … 3138 3156 }; 3139 3157 3140 pp$ 4.parsePropertyName = function(prop) {3158 pp$5.parsePropertyName = function(prop) { 3141 3159 if (this.options.ecmaVersion >= 6) { 3142 if (this.eat(types .bracketL)) {3160 if (this.eat(types$1.bracketL)) { 3143 3161 prop.computed = true; 3144 3162 prop.key = this.parseMaybeAssign(); 3145 this.expect(types .bracketR);3163 this.expect(types$1.bracketR); 3146 3164 return prop.key 3147 3165 } else { … … 3149 3167 } 3150 3168 } 3151 return prop.key = this.type === types .num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")3169 return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never") 3152 3170 }; 3153 3171 3154 3172 // Initialize empty function node. 3155 3173 3156 pp$ 4.initFunction = function(node) {3174 pp$5.initFunction = function(node) { 3157 3175 node.id = null; 3158 3176 if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; } … … 3162 3180 // Parse object or class method. 3163 3181 3164 pp$ 4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {3182 pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { 3165 3183 var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; 3166 3184 … … 3176 3194 this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); 3177 3195 3178 this.expect(types .parenL);3179 node.params = this.parseBindingList(types .parenR, false, this.options.ecmaVersion >= 8);3196 this.expect(types$1.parenL); 3197 node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); 3180 3198 this.checkYieldAwaitInDefaultParams(); 3181 3199 this.parseFunctionBody(node, false, true, false); … … 3189 3207 // Parse arrow function expression with given parameters. 3190 3208 3191 pp$ 4.parseArrowExpression = function(node, params, isAsync, forInit) {3209 pp$5.parseArrowExpression = function(node, params, isAsync, forInit) { 3192 3210 var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; 3193 3211 … … 3211 3229 // Parse function body and check parameters. 3212 3230 3213 pp$ 4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {3214 var isExpression = isArrowFunction && this.type !== types .braceL;3231 pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { 3232 var isExpression = isArrowFunction && this.type !== types$1.braceL; 3215 3233 var oldStrict = this.strict, useStrict = false; 3216 3234 … … 3248 3266 }; 3249 3267 3250 pp$ 4.isSimpleParamList = function(params) {3268 pp$5.isSimpleParamList = function(params) { 3251 3269 for (var i = 0, list = params; i < list.length; i += 1) 3252 3270 { … … 3261 3279 // or "arguments" and duplicate parameters. 3262 3280 3263 pp$ 4.checkParams = function(node, allowDuplicates) {3281 pp$5.checkParams = function(node, allowDuplicates) { 3264 3282 var nameHash = Object.create(null); 3265 3283 for (var i = 0, list = node.params; i < list.length; i += 1) … … 3277 3295 // for array literals). 3278 3296 3279 pp$ 4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {3297 pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { 3280 3298 var elts = [], first = true; 3281 3299 while (!this.eat(close)) { 3282 3300 if (!first) { 3283 this.expect(types .comma);3301 this.expect(types$1.comma); 3284 3302 if (allowTrailingComma && this.afterTrailingComma(close)) { break } 3285 3303 } else { first = false; } 3286 3304 3287 3305 var elt = (void 0); 3288 if (allowEmpty && this.type === types .comma)3306 if (allowEmpty && this.type === types$1.comma) 3289 3307 { elt = null; } 3290 else if (this.type === types .ellipsis) {3308 else if (this.type === types$1.ellipsis) { 3291 3309 elt = this.parseSpread(refDestructuringErrors); 3292 if (refDestructuringErrors && this.type === types .comma && refDestructuringErrors.trailingComma < 0)3310 if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) 3293 3311 { refDestructuringErrors.trailingComma = this.start; } 3294 3312 } else { … … 3300 3318 }; 3301 3319 3302 pp$ 4.checkUnreserved = function(ref) {3320 pp$5.checkUnreserved = function(ref) { 3303 3321 var start = ref.start; 3304 3322 var end = ref.end; … … 3329 3347 // identifiers. 3330 3348 3331 pp$ 4.parseIdent = function(liberal, isBinding) {3349 pp$5.parseIdent = function(liberal, isBinding) { 3332 3350 var node = this.startNode(); 3333 if (this.type === types .name) {3351 if (this.type === types$1.name) { 3334 3352 node.name = this.value; 3335 3353 } else if (this.type.keyword) { … … 3357 3375 }; 3358 3376 3359 pp$ 4.parsePrivateIdent = function() {3377 pp$5.parsePrivateIdent = function() { 3360 3378 var node = this.startNode(); 3361 if (this.type === types .privateId) {3379 if (this.type === types$1.privateId) { 3362 3380 node.name = this.value; 3363 3381 } else { … … 3379 3397 // Parses yield expression inside generator. 3380 3398 3381 pp$ 4.parseYield = function(forInit) {3399 pp$5.parseYield = function(forInit) { 3382 3400 if (!this.yieldPos) { this.yieldPos = this.start; } 3383 3401 3384 3402 var node = this.startNode(); 3385 3403 this.next(); 3386 if (this.type === types .semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {3404 if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) { 3387 3405 node.delegate = false; 3388 3406 node.argument = null; 3389 3407 } else { 3390 node.delegate = this.eat(types .star);3408 node.delegate = this.eat(types$1.star); 3391 3409 node.argument = this.parseMaybeAssign(forInit); 3392 3410 } … … 3394 3412 }; 3395 3413 3396 pp$ 4.parseAwait = function(forInit) {3414 pp$5.parseAwait = function(forInit) { 3397 3415 if (!this.awaitPos) { this.awaitPos = this.start; } 3398 3416 … … 3403 3421 }; 3404 3422 3405 var pp$ 5= Parser.prototype;3423 var pp$4 = Parser.prototype; 3406 3424 3407 3425 // This function is used to raise exceptions on parse errors. It … … 3411 3429 // message. 3412 3430 3413 pp$ 5.raise = function(pos, message) {3431 pp$4.raise = function(pos, message) { 3414 3432 var loc = getLineInfo(this.input, pos); 3415 3433 message += " (" + loc.line + ":" + loc.column + ")"; … … 3419 3437 }; 3420 3438 3421 pp$ 5.raiseRecoverable = pp$5.raise;3422 3423 pp$ 5.curPosition = function() {3439 pp$4.raiseRecoverable = pp$4.raise; 3440 3441 pp$4.curPosition = function() { 3424 3442 if (this.options.locations) { 3425 3443 return new Position(this.curLine, this.pos - this.lineStart) … … 3427 3445 }; 3428 3446 3429 var pp$ 6= Parser.prototype;3447 var pp$3 = Parser.prototype; 3430 3448 3431 3449 var Scope = function Scope(flags) { … … 3443 3461 // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. 3444 3462 3445 pp$ 6.enterScope = function(flags) {3463 pp$3.enterScope = function(flags) { 3446 3464 this.scopeStack.push(new Scope(flags)); 3447 3465 }; 3448 3466 3449 pp$ 6.exitScope = function() {3467 pp$3.exitScope = function() { 3450 3468 this.scopeStack.pop(); 3451 3469 }; … … 3454 3472 // > At the top level of a function, or script, function declarations are 3455 3473 // > treated like var declarations rather than like lexical declarations. 3456 pp$ 6.treatFunctionsAsVarInScope = function(scope) {3474 pp$3.treatFunctionsAsVarInScope = function(scope) { 3457 3475 return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP) 3458 3476 }; 3459 3477 3460 pp$ 6.declareName = function(name, bindingType, pos) {3478 pp$3.declareName = function(name, bindingType, pos) { 3461 3479 var redeclared = false; 3462 3480 if (bindingType === BIND_LEXICAL) { … … 3493 3511 }; 3494 3512 3495 pp$ 6.checkLocalExport = function(id) {3513 pp$3.checkLocalExport = function(id) { 3496 3514 // scope.functions must be empty as Module code is always strict. 3497 3515 if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && … … 3501 3519 }; 3502 3520 3503 pp$ 6.currentScope = function() {3521 pp$3.currentScope = function() { 3504 3522 return this.scopeStack[this.scopeStack.length - 1] 3505 3523 }; 3506 3524 3507 pp$ 6.currentVarScope = function() {3525 pp$3.currentVarScope = function() { 3508 3526 for (var i = this.scopeStack.length - 1;; i--) { 3509 3527 var scope = this.scopeStack[i]; … … 3513 3531 3514 3532 // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. 3515 pp$ 6.currentThisScope = function() {3533 pp$3.currentThisScope = function() { 3516 3534 for (var i = this.scopeStack.length - 1;; i--) { 3517 3535 var scope = this.scopeStack[i]; … … 3534 3552 // Start an AST node, attaching a start offset. 3535 3553 3536 var pp$ 7= Parser.prototype;3537 3538 pp$ 7.startNode = function() {3554 var pp$2 = Parser.prototype; 3555 3556 pp$2.startNode = function() { 3539 3557 return new Node(this, this.start, this.startLoc) 3540 3558 }; 3541 3559 3542 pp$ 7.startNodeAt = function(pos, loc) {3560 pp$2.startNodeAt = function(pos, loc) { 3543 3561 return new Node(this, pos, loc) 3544 3562 }; … … 3556 3574 } 3557 3575 3558 pp$ 7.finishNode = function(node, type) {3576 pp$2.finishNode = function(node, type) { 3559 3577 return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc) 3560 3578 }; … … 3562 3580 // Finish node at given position 3563 3581 3564 pp$ 7.finishNodeAt = function(node, type, pos, loc) {3582 pp$2.finishNodeAt = function(node, type, pos, loc) { 3565 3583 return finishNodeAt.call(this, node, type, pos, loc) 3566 3584 }; 3567 3585 3568 pp$ 7.copyNode = function(node) {3586 pp$2.copyNode = function(node) { 3569 3587 var newNode = new Node(this, node.start, this.startLoc); 3570 3588 for (var prop in node) { newNode[prop] = node[prop]; } … … 3623 3641 buildUnicodeData(12); 3624 3642 3625 var pp$ 8= Parser.prototype;3643 var pp$1 = Parser.prototype; 3626 3644 3627 3645 var RegExpValidationState = function RegExpValidationState(parser) { … … 3719 3737 }; 3720 3738 3721 function codePointToString (ch) {3739 function codePointToString$1(ch) { 3722 3740 if (ch <= 0xFFFF) { return String.fromCharCode(ch) } 3723 3741 ch -= 0x10000; … … 3731 3749 * @returns {void} 3732 3750 */ 3733 pp$ 8.validateRegExpFlags = function(state) {3751 pp$1.validateRegExpFlags = function(state) { 3734 3752 var validFlags = state.validFlags; 3735 3753 var flags = state.flags; … … 3752 3770 * @returns {void} 3753 3771 */ 3754 pp$ 8.validateRegExpPattern = function(state) {3772 pp$1.validateRegExpPattern = function(state) { 3755 3773 this.regexp_pattern(state); 3756 3774 … … 3767 3785 3768 3786 // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern 3769 pp$ 8.regexp_pattern = function(state) {3787 pp$1.regexp_pattern = function(state) { 3770 3788 state.pos = 0; 3771 3789 state.lastIntValue = 0; … … 3801 3819 3802 3820 // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction 3803 pp$ 8.regexp_disjunction = function(state) {3821 pp$1.regexp_disjunction = function(state) { 3804 3822 this.regexp_alternative(state); 3805 3823 while (state.eat(0x7C /* | */)) { … … 3817 3835 3818 3836 // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative 3819 pp$ 8.regexp_alternative = function(state) {3837 pp$1.regexp_alternative = function(state) { 3820 3838 while (state.pos < state.source.length && this.regexp_eatTerm(state)) 3821 3839 { } … … 3823 3841 3824 3842 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term 3825 pp$ 8.regexp_eatTerm = function(state) {3843 pp$1.regexp_eatTerm = function(state) { 3826 3844 if (this.regexp_eatAssertion(state)) { 3827 3845 // Handle `QuantifiableAssertion Quantifier` alternative. … … 3846 3864 3847 3865 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion 3848 pp$ 8.regexp_eatAssertion = function(state) {3866 pp$1.regexp_eatAssertion = function(state) { 3849 3867 var start = state.pos; 3850 3868 state.lastAssertionIsQuantifiable = false; … … 3884 3902 3885 3903 // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier 3886 pp$ 8.regexp_eatQuantifier = function(state, noError) {3904 pp$1.regexp_eatQuantifier = function(state, noError) { 3887 3905 if ( noError === void 0 ) noError = false; 3888 3906 … … 3895 3913 3896 3914 // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix 3897 pp$ 8.regexp_eatQuantifierPrefix = function(state, noError) {3915 pp$1.regexp_eatQuantifierPrefix = function(state, noError) { 3898 3916 return ( 3899 3917 state.eat(0x2A /* * */) || … … 3903 3921 ) 3904 3922 }; 3905 pp$ 8.regexp_eatBracedQuantifier = function(state, noError) {3923 pp$1.regexp_eatBracedQuantifier = function(state, noError) { 3906 3924 var start = state.pos; 3907 3925 if (state.eat(0x7B /* { */)) { … … 3929 3947 3930 3948 // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom 3931 pp$ 8.regexp_eatAtom = function(state) {3949 pp$1.regexp_eatAtom = function(state) { 3932 3950 return ( 3933 3951 this.regexp_eatPatternCharacters(state) || … … 3939 3957 ) 3940 3958 }; 3941 pp$ 8.regexp_eatReverseSolidusAtomEscape = function(state) {3959 pp$1.regexp_eatReverseSolidusAtomEscape = function(state) { 3942 3960 var start = state.pos; 3943 3961 if (state.eat(0x5C /* \ */)) { … … 3949 3967 return false 3950 3968 }; 3951 pp$ 8.regexp_eatUncapturingGroup = function(state) {3969 pp$1.regexp_eatUncapturingGroup = function(state) { 3952 3970 var start = state.pos; 3953 3971 if (state.eat(0x28 /* ( */)) { … … 3963 3981 return false 3964 3982 }; 3965 pp$ 8.regexp_eatCapturingGroup = function(state) {3983 pp$1.regexp_eatCapturingGroup = function(state) { 3966 3984 if (state.eat(0x28 /* ( */)) { 3967 3985 if (this.options.ecmaVersion >= 9) { … … 3981 3999 3982 4000 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom 3983 pp$ 8.regexp_eatExtendedAtom = function(state) {4001 pp$1.regexp_eatExtendedAtom = function(state) { 3984 4002 return ( 3985 4003 state.eat(0x2E /* . */) || … … 3994 4012 3995 4013 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier 3996 pp$ 8.regexp_eatInvalidBracedQuantifier = function(state) {4014 pp$1.regexp_eatInvalidBracedQuantifier = function(state) { 3997 4015 if (this.regexp_eatBracedQuantifier(state, true)) { 3998 4016 state.raise("Nothing to repeat"); … … 4002 4020 4003 4021 // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter 4004 pp$ 8.regexp_eatSyntaxCharacter = function(state) {4022 pp$1.regexp_eatSyntaxCharacter = function(state) { 4005 4023 var ch = state.current(); 4006 4024 if (isSyntaxCharacter(ch)) { … … 4024 4042 // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter 4025 4043 // But eat eager. 4026 pp$ 8.regexp_eatPatternCharacters = function(state) {4044 pp$1.regexp_eatPatternCharacters = function(state) { 4027 4045 var start = state.pos; 4028 4046 var ch = 0; … … 4034 4052 4035 4053 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter 4036 pp$ 8.regexp_eatExtendedPatternCharacter = function(state) {4054 pp$1.regexp_eatExtendedPatternCharacter = function(state) { 4037 4055 var ch = state.current(); 4038 4056 if ( … … 4055 4073 // [empty] 4056 4074 // `?` GroupName 4057 pp$ 8.regexp_groupSpecifier = function(state) {4075 pp$1.regexp_groupSpecifier = function(state) { 4058 4076 if (state.eat(0x3F /* ? */)) { 4059 4077 if (this.regexp_eatGroupName(state)) { … … 4071 4089 // `<` RegExpIdentifierName `>` 4072 4090 // Note: this updates `state.lastStringValue` property with the eaten name. 4073 pp$ 8.regexp_eatGroupName = function(state) {4091 pp$1.regexp_eatGroupName = function(state) { 4074 4092 state.lastStringValue = ""; 4075 4093 if (state.eat(0x3C /* < */)) { … … 4086 4104 // RegExpIdentifierName RegExpIdentifierPart 4087 4105 // Note: this updates `state.lastStringValue` property with the eaten name. 4088 pp$ 8.regexp_eatRegExpIdentifierName = function(state) {4106 pp$1.regexp_eatRegExpIdentifierName = function(state) { 4089 4107 state.lastStringValue = ""; 4090 4108 if (this.regexp_eatRegExpIdentifierStart(state)) { 4091 state.lastStringValue += codePointToString (state.lastIntValue);4109 state.lastStringValue += codePointToString$1(state.lastIntValue); 4092 4110 while (this.regexp_eatRegExpIdentifierPart(state)) { 4093 state.lastStringValue += codePointToString (state.lastIntValue);4111 state.lastStringValue += codePointToString$1(state.lastIntValue); 4094 4112 } 4095 4113 return true … … 4103 4121 // `_` 4104 4122 // `\` RegExpUnicodeEscapeSequence[+U] 4105 pp$ 8.regexp_eatRegExpIdentifierStart = function(state) {4123 pp$1.regexp_eatRegExpIdentifierStart = function(state) { 4106 4124 var start = state.pos; 4107 4125 var forceU = this.options.ecmaVersion >= 11; … … 4131 4149 // <ZWNJ> 4132 4150 // <ZWJ> 4133 pp$ 8.regexp_eatRegExpIdentifierPart = function(state) {4151 pp$1.regexp_eatRegExpIdentifierPart = function(state) { 4134 4152 var start = state.pos; 4135 4153 var forceU = this.options.ecmaVersion >= 11; … … 4153 4171 4154 4172 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape 4155 pp$ 8.regexp_eatAtomEscape = function(state) {4173 pp$1.regexp_eatAtomEscape = function(state) { 4156 4174 if ( 4157 4175 this.regexp_eatBackReference(state) || … … 4171 4189 return false 4172 4190 }; 4173 pp$ 8.regexp_eatBackReference = function(state) {4191 pp$1.regexp_eatBackReference = function(state) { 4174 4192 var start = state.pos; 4175 4193 if (this.regexp_eatDecimalEscape(state)) { … … 4189 4207 return false 4190 4208 }; 4191 pp$ 8.regexp_eatKGroupName = function(state) {4209 pp$1.regexp_eatKGroupName = function(state) { 4192 4210 if (state.eat(0x6B /* k */)) { 4193 4211 if (this.regexp_eatGroupName(state)) { … … 4201 4219 4202 4220 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape 4203 pp$ 8.regexp_eatCharacterEscape = function(state) {4221 pp$1.regexp_eatCharacterEscape = function(state) { 4204 4222 return ( 4205 4223 this.regexp_eatControlEscape(state) || … … 4212 4230 ) 4213 4231 }; 4214 pp$ 8.regexp_eatCControlLetter = function(state) {4232 pp$1.regexp_eatCControlLetter = function(state) { 4215 4233 var start = state.pos; 4216 4234 if (state.eat(0x63 /* c */)) { … … 4222 4240 return false 4223 4241 }; 4224 pp$ 8.regexp_eatZero = function(state) {4242 pp$1.regexp_eatZero = function(state) { 4225 4243 if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) { 4226 4244 state.lastIntValue = 0; … … 4232 4250 4233 4251 // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape 4234 pp$ 8.regexp_eatControlEscape = function(state) {4252 pp$1.regexp_eatControlEscape = function(state) { 4235 4253 var ch = state.current(); 4236 4254 if (ch === 0x74 /* t */) { … … 4263 4281 4264 4282 // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter 4265 pp$ 8.regexp_eatControlLetter = function(state) {4283 pp$1.regexp_eatControlLetter = function(state) { 4266 4284 var ch = state.current(); 4267 4285 if (isControlLetter(ch)) { … … 4280 4298 4281 4299 // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence 4282 pp$ 8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {4300 pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { 4283 4301 if ( forceU === void 0 ) forceU = false; 4284 4302 … … 4325 4343 4326 4344 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape 4327 pp$ 8.regexp_eatIdentityEscape = function(state) {4345 pp$1.regexp_eatIdentityEscape = function(state) { 4328 4346 if (state.switchU) { 4329 4347 if (this.regexp_eatSyntaxCharacter(state)) { … … 4348 4366 4349 4367 // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape 4350 pp$ 8.regexp_eatDecimalEscape = function(state) {4368 pp$1.regexp_eatDecimalEscape = function(state) { 4351 4369 state.lastIntValue = 0; 4352 4370 var ch = state.current(); … … 4362 4380 4363 4381 // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape 4364 pp$ 8.regexp_eatCharacterClassEscape = function(state) {4382 pp$1.regexp_eatCharacterClassEscape = function(state) { 4365 4383 var ch = state.current(); 4366 4384 … … 4404 4422 // UnicodePropertyName `=` UnicodePropertyValue 4405 4423 // LoneUnicodePropertyNameOrValue 4406 pp$ 8.regexp_eatUnicodePropertyValueExpression = function(state) {4424 pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { 4407 4425 var start = state.pos; 4408 4426 … … 4426 4444 return false 4427 4445 }; 4428 pp$ 8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {4446 pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) { 4429 4447 if (!has(state.unicodeProperties.nonBinary, name)) 4430 4448 { state.raise("Invalid property name"); } … … 4432 4450 { state.raise("Invalid property value"); } 4433 4451 }; 4434 pp$ 8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {4452 pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { 4435 4453 if (!state.unicodeProperties.binary.test(nameOrValue)) 4436 4454 { state.raise("Invalid property name"); } … … 4439 4457 // UnicodePropertyName :: 4440 4458 // UnicodePropertyNameCharacters 4441 pp$ 8.regexp_eatUnicodePropertyName = function(state) {4459 pp$1.regexp_eatUnicodePropertyName = function(state) { 4442 4460 var ch = 0; 4443 4461 state.lastStringValue = ""; 4444 4462 while (isUnicodePropertyNameCharacter(ch = state.current())) { 4445 state.lastStringValue += codePointToString (ch);4463 state.lastStringValue += codePointToString$1(ch); 4446 4464 state.advance(); 4447 4465 } … … 4454 4472 // UnicodePropertyValue :: 4455 4473 // UnicodePropertyValueCharacters 4456 pp$ 8.regexp_eatUnicodePropertyValue = function(state) {4474 pp$1.regexp_eatUnicodePropertyValue = function(state) { 4457 4475 var ch = 0; 4458 4476 state.lastStringValue = ""; 4459 4477 while (isUnicodePropertyValueCharacter(ch = state.current())) { 4460 state.lastStringValue += codePointToString (ch);4478 state.lastStringValue += codePointToString$1(ch); 4461 4479 state.advance(); 4462 4480 } … … 4469 4487 // LoneUnicodePropertyNameOrValue :: 4470 4488 // UnicodePropertyValueCharacters 4471 pp$ 8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {4489 pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) { 4472 4490 return this.regexp_eatUnicodePropertyValue(state) 4473 4491 }; 4474 4492 4475 4493 // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass 4476 pp$ 8.regexp_eatCharacterClass = function(state) {4494 pp$1.regexp_eatCharacterClass = function(state) { 4477 4495 if (state.eat(0x5B /* [ */)) { 4478 4496 state.eat(0x5E /* ^ */); … … 4490 4508 // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges 4491 4509 // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash 4492 pp$ 8.regexp_classRanges = function(state) {4510 pp$1.regexp_classRanges = function(state) { 4493 4511 while (this.regexp_eatClassAtom(state)) { 4494 4512 var left = state.lastIntValue; … … 4507 4525 // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom 4508 4526 // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash 4509 pp$ 8.regexp_eatClassAtom = function(state) {4527 pp$1.regexp_eatClassAtom = function(state) { 4510 4528 var start = state.pos; 4511 4529 … … 4536 4554 4537 4555 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape 4538 pp$ 8.regexp_eatClassEscape = function(state) {4556 pp$1.regexp_eatClassEscape = function(state) { 4539 4557 var start = state.pos; 4540 4558 … … 4563 4581 4564 4582 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter 4565 pp$ 8.regexp_eatClassControlLetter = function(state) {4583 pp$1.regexp_eatClassControlLetter = function(state) { 4566 4584 var ch = state.current(); 4567 4585 if (isDecimalDigit(ch) || ch === 0x5F /* _ */) { … … 4574 4592 4575 4593 // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence 4576 pp$ 8.regexp_eatHexEscapeSequence = function(state) {4594 pp$1.regexp_eatHexEscapeSequence = function(state) { 4577 4595 var start = state.pos; 4578 4596 if (state.eat(0x78 /* x */)) { … … 4589 4607 4590 4608 // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits 4591 pp$ 8.regexp_eatDecimalDigits = function(state) {4609 pp$1.regexp_eatDecimalDigits = function(state) { 4592 4610 var start = state.pos; 4593 4611 var ch = 0; … … 4604 4622 4605 4623 // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits 4606 pp$ 8.regexp_eatHexDigits = function(state) {4624 pp$1.regexp_eatHexDigits = function(state) { 4607 4625 var start = state.pos; 4608 4626 var ch = 0; … … 4633 4651 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence 4634 4652 // Allows only 0-377(octal) i.e. 0-255(decimal). 4635 pp$ 8.regexp_eatLegacyOctalEscapeSequence = function(state) {4653 pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) { 4636 4654 if (this.regexp_eatOctalDigit(state)) { 4637 4655 var n1 = state.lastIntValue; … … 4652 4670 4653 4671 // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit 4654 pp$ 8.regexp_eatOctalDigit = function(state) {4672 pp$1.regexp_eatOctalDigit = function(state) { 4655 4673 var ch = state.current(); 4656 4674 if (isOctalDigit(ch)) { … … 4669 4687 // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit 4670 4688 // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence 4671 pp$ 8.regexp_eatFixedHexDigits = function(state, length) {4689 pp$1.regexp_eatFixedHexDigits = function(state, length) { 4672 4690 var start = state.pos; 4673 4691 state.lastIntValue = 0; … … 4701 4719 // ## Tokenizer 4702 4720 4703 var pp $9= Parser.prototype;4721 var pp = Parser.prototype; 4704 4722 4705 4723 // Move to the next token 4706 4724 4707 pp $9.next = function(ignoreEscapeSequenceInKeyword) {4725 pp.next = function(ignoreEscapeSequenceInKeyword) { 4708 4726 if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) 4709 4727 { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } … … 4718 4736 }; 4719 4737 4720 pp $9.getToken = function() {4738 pp.getToken = function() { 4721 4739 this.next(); 4722 4740 return new Token(this) … … 4725 4743 // If we're in an ES6 environment, make parsers iterable 4726 4744 if (typeof Symbol !== "undefined") 4727 { pp $9[Symbol.iterator] = function() {4728 var this$1 = this;4745 { pp[Symbol.iterator] = function() { 4746 var this$1$1 = this; 4729 4747 4730 4748 return { 4731 4749 next: function () { 4732 var token = this$1 .getToken();4750 var token = this$1$1.getToken(); 4733 4751 return { 4734 done: token.type === types .eof,4752 done: token.type === types$1.eof, 4735 4753 value: token 4736 4754 } … … 4745 4763 // properties. 4746 4764 4747 pp $9.nextToken = function() {4765 pp.nextToken = function() { 4748 4766 var curContext = this.curContext(); 4749 4767 if (!curContext || !curContext.preserveSpace) { this.skipSpace(); } … … 4751 4769 this.start = this.pos; 4752 4770 if (this.options.locations) { this.startLoc = this.curPosition(); } 4753 if (this.pos >= this.input.length) { return this.finishToken(types .eof) }4771 if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) } 4754 4772 4755 4773 if (curContext.override) { return curContext.override(this) } … … 4757 4775 }; 4758 4776 4759 pp $9.readToken = function(code) {4777 pp.readToken = function(code) { 4760 4778 // Identifier or keyword. '\uXXXX' sequences are allowed in 4761 4779 // identifiers, so '\' also dispatches to that. … … 4766 4784 }; 4767 4785 4768 pp $9.fullCharCodeAtPos = function() {4786 pp.fullCharCodeAtPos = function() { 4769 4787 var code = this.input.charCodeAt(this.pos); 4770 4788 if (code <= 0xd7ff || code >= 0xdc00) { return code } … … 4773 4791 }; 4774 4792 4775 pp $9.skipBlockComment = function() {4793 pp.skipBlockComment = function() { 4776 4794 var startLoc = this.options.onComment && this.curPosition(); 4777 4795 var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); … … 4791 4809 }; 4792 4810 4793 pp $9.skipLineComment = function(startSkip) {4811 pp.skipLineComment = function(startSkip) { 4794 4812 var start = this.pos; 4795 4813 var startLoc = this.options.onComment && this.curPosition(); … … 4806 4824 // whitespace and comments, and. 4807 4825 4808 pp $9.skipSpace = function() {4826 pp.skipSpace = function() { 4809 4827 loop: while (this.pos < this.input.length) { 4810 4828 var ch = this.input.charCodeAt(this.pos); … … 4851 4869 // right position. 4852 4870 4853 pp $9.finishToken = function(type, val) {4871 pp.finishToken = function(type, val) { 4854 4872 this.end = this.pos; 4855 4873 if (this.options.locations) { this.endLoc = this.curPosition(); } … … 4870 4888 // All in the name of speed. 4871 4889 // 4872 pp $9.readToken_dot = function() {4890 pp.readToken_dot = function() { 4873 4891 var next = this.input.charCodeAt(this.pos + 1); 4874 4892 if (next >= 48 && next <= 57) { return this.readNumber(true) } … … 4876 4894 if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.' 4877 4895 this.pos += 3; 4878 return this.finishToken(types .ellipsis)4896 return this.finishToken(types$1.ellipsis) 4879 4897 } else { 4880 4898 ++this.pos; 4881 return this.finishToken(types .dot)4882 } 4883 }; 4884 4885 pp $9.readToken_slash = function() { // '/'4899 return this.finishToken(types$1.dot) 4900 } 4901 }; 4902 4903 pp.readToken_slash = function() { // '/' 4886 4904 var next = this.input.charCodeAt(this.pos + 1); 4887 4905 if (this.exprAllowed) { ++this.pos; return this.readRegexp() } 4888 if (next === 61) { return this.finishOp(types .assign, 2) }4889 return this.finishOp(types .slash, 1)4890 }; 4891 4892 pp $9.readToken_mult_modulo_exp = function(code) { // '%*'4906 if (next === 61) { return this.finishOp(types$1.assign, 2) } 4907 return this.finishOp(types$1.slash, 1) 4908 }; 4909 4910 pp.readToken_mult_modulo_exp = function(code) { // '%*' 4893 4911 var next = this.input.charCodeAt(this.pos + 1); 4894 4912 var size = 1; 4895 var tokentype = code === 42 ? types .star : types.modulo;4913 var tokentype = code === 42 ? types$1.star : types$1.modulo; 4896 4914 4897 4915 // exponentiation operator ** and **= 4898 4916 if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) { 4899 4917 ++size; 4900 tokentype = types .starstar;4918 tokentype = types$1.starstar; 4901 4919 next = this.input.charCodeAt(this.pos + 2); 4902 4920 } 4903 4921 4904 if (next === 61) { return this.finishOp(types .assign, size + 1) }4922 if (next === 61) { return this.finishOp(types$1.assign, size + 1) } 4905 4923 return this.finishOp(tokentype, size) 4906 4924 }; 4907 4925 4908 pp $9.readToken_pipe_amp = function(code) { // '|&'4926 pp.readToken_pipe_amp = function(code) { // '|&' 4909 4927 var next = this.input.charCodeAt(this.pos + 1); 4910 4928 if (next === code) { 4911 4929 if (this.options.ecmaVersion >= 12) { 4912 4930 var next2 = this.input.charCodeAt(this.pos + 2); 4913 if (next2 === 61) { return this.finishOp(types .assign, 3) }4914 } 4915 return this.finishOp(code === 124 ? types .logicalOR : types.logicalAND, 2)4916 } 4917 if (next === 61) { return this.finishOp(types .assign, 2) }4918 return this.finishOp(code === 124 ? types .bitwiseOR : types.bitwiseAND, 1)4919 }; 4920 4921 pp $9.readToken_caret = function() { // '^'4931 if (next2 === 61) { return this.finishOp(types$1.assign, 3) } 4932 } 4933 return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2) 4934 } 4935 if (next === 61) { return this.finishOp(types$1.assign, 2) } 4936 return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1) 4937 }; 4938 4939 pp.readToken_caret = function() { // '^' 4922 4940 var next = this.input.charCodeAt(this.pos + 1); 4923 if (next === 61) { return this.finishOp(types .assign, 2) }4924 return this.finishOp(types .bitwiseXOR, 1)4925 }; 4926 4927 pp $9.readToken_plus_min = function(code) { // '+-'4941 if (next === 61) { return this.finishOp(types$1.assign, 2) } 4942 return this.finishOp(types$1.bitwiseXOR, 1) 4943 }; 4944 4945 pp.readToken_plus_min = function(code) { // '+-' 4928 4946 var next = this.input.charCodeAt(this.pos + 1); 4929 4947 if (next === code) { … … 4935 4953 return this.nextToken() 4936 4954 } 4937 return this.finishOp(types .incDec, 2)4938 } 4939 if (next === 61) { return this.finishOp(types .assign, 2) }4940 return this.finishOp(types .plusMin, 1)4941 }; 4942 4943 pp $9.readToken_lt_gt = function(code) { // '<>'4955 return this.finishOp(types$1.incDec, 2) 4956 } 4957 if (next === 61) { return this.finishOp(types$1.assign, 2) } 4958 return this.finishOp(types$1.plusMin, 1) 4959 }; 4960 4961 pp.readToken_lt_gt = function(code) { // '<>' 4944 4962 var next = this.input.charCodeAt(this.pos + 1); 4945 4963 var size = 1; 4946 4964 if (next === code) { 4947 4965 size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; 4948 if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types .assign, size + 1) }4949 return this.finishOp(types .bitShift, size)4966 if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) } 4967 return this.finishOp(types$1.bitShift, size) 4950 4968 } 4951 4969 if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && … … 4957 4975 } 4958 4976 if (next === 61) { size = 2; } 4959 return this.finishOp(types .relational, size)4960 }; 4961 4962 pp $9.readToken_eq_excl = function(code) { // '=!'4977 return this.finishOp(types$1.relational, size) 4978 }; 4979 4980 pp.readToken_eq_excl = function(code) { // '=!' 4963 4981 var next = this.input.charCodeAt(this.pos + 1); 4964 if (next === 61) { return this.finishOp(types .equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }4982 if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) } 4965 4983 if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>' 4966 4984 this.pos += 2; 4967 return this.finishToken(types .arrow)4968 } 4969 return this.finishOp(code === 61 ? types .eq : types.prefix, 1)4970 }; 4971 4972 pp $9.readToken_question = function() { // '?'4985 return this.finishToken(types$1.arrow) 4986 } 4987 return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1) 4988 }; 4989 4990 pp.readToken_question = function() { // '?' 4973 4991 var ecmaVersion = this.options.ecmaVersion; 4974 4992 if (ecmaVersion >= 11) { … … 4976 4994 if (next === 46) { 4977 4995 var next2 = this.input.charCodeAt(this.pos + 2); 4978 if (next2 < 48 || next2 > 57) { return this.finishOp(types .questionDot, 2) }4996 if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) } 4979 4997 } 4980 4998 if (next === 63) { 4981 4999 if (ecmaVersion >= 12) { 4982 5000 var next2$1 = this.input.charCodeAt(this.pos + 2); 4983 if (next2$1 === 61) { return this.finishOp(types .assign, 3) }5001 if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) } 4984 5002 } 4985 return this.finishOp(types .coalesce, 2)4986 } 4987 } 4988 return this.finishOp(types .question, 1)4989 }; 4990 4991 pp $9.readToken_numberSign = function() { // '#'5003 return this.finishOp(types$1.coalesce, 2) 5004 } 5005 } 5006 return this.finishOp(types$1.question, 1) 5007 }; 5008 5009 pp.readToken_numberSign = function() { // '#' 4992 5010 var ecmaVersion = this.options.ecmaVersion; 4993 5011 var code = 35; // '#' … … 4996 5014 code = this.fullCharCodeAtPos(); 4997 5015 if (isIdentifierStart(code, true) || code === 92 /* '\' */) { 4998 return this.finishToken(types .privateId, this.readWord1())4999 } 5000 } 5001 5002 this.raise(this.pos, "Unexpected character '" + codePointToString $1(code) + "'");5003 }; 5004 5005 pp $9.getTokenFromCode = function(code) {5016 return this.finishToken(types$1.privateId, this.readWord1()) 5017 } 5018 } 5019 5020 this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); 5021 }; 5022 5023 pp.getTokenFromCode = function(code) { 5006 5024 switch (code) { 5007 5025 // The interpretation of a dot depends on whether it is followed … … 5011 5029 5012 5030 // Punctuation tokens. 5013 case 40: ++this.pos; return this.finishToken(types .parenL)5014 case 41: ++this.pos; return this.finishToken(types .parenR)5015 case 59: ++this.pos; return this.finishToken(types .semi)5016 case 44: ++this.pos; return this.finishToken(types .comma)5017 case 91: ++this.pos; return this.finishToken(types .bracketL)5018 case 93: ++this.pos; return this.finishToken(types .bracketR)5019 case 123: ++this.pos; return this.finishToken(types .braceL)5020 case 125: ++this.pos; return this.finishToken(types .braceR)5021 case 58: ++this.pos; return this.finishToken(types .colon)5031 case 40: ++this.pos; return this.finishToken(types$1.parenL) 5032 case 41: ++this.pos; return this.finishToken(types$1.parenR) 5033 case 59: ++this.pos; return this.finishToken(types$1.semi) 5034 case 44: ++this.pos; return this.finishToken(types$1.comma) 5035 case 91: ++this.pos; return this.finishToken(types$1.bracketL) 5036 case 93: ++this.pos; return this.finishToken(types$1.bracketR) 5037 case 123: ++this.pos; return this.finishToken(types$1.braceL) 5038 case 125: ++this.pos; return this.finishToken(types$1.braceR) 5039 case 58: ++this.pos; return this.finishToken(types$1.colon) 5022 5040 5023 5041 case 96: // '`' 5024 5042 if (this.options.ecmaVersion < 6) { break } 5025 5043 ++this.pos; 5026 return this.finishToken(types .backQuote)5044 return this.finishToken(types$1.backQuote) 5027 5045 5028 5046 case 48: // '0' … … 5047 5065 // characters it is given as second argument, and returns a token 5048 5066 // of the type given by its first argument. 5049 5050 5067 case 47: // '/' 5051 5068 return this.readToken_slash() … … 5073 5090 5074 5091 case 126: // '~' 5075 return this.finishOp(types .prefix, 1)5092 return this.finishOp(types$1.prefix, 1) 5076 5093 5077 5094 case 35: // '#' … … 5079 5096 } 5080 5097 5081 this.raise(this.pos, "Unexpected character '" + codePointToString $1(code) + "'");5082 }; 5083 5084 pp $9.finishOp = function(type, size) {5098 this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); 5099 }; 5100 5101 pp.finishOp = function(type, size) { 5085 5102 var str = this.input.slice(this.pos, this.pos + size); 5086 5103 this.pos += size; … … 5088 5105 }; 5089 5106 5090 pp $9.readRegexp = function() {5107 pp.readRegexp = function() { 5091 5108 var escaped, inClass, start = this.pos; 5092 5109 for (;;) { … … 5123 5140 } 5124 5141 5125 return this.finishToken(types .regexp, {pattern: pattern, flags: flags, value: value})5142 return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value}) 5126 5143 }; 5127 5144 … … 5130 5147 // will return `null` unless the integer has exactly `len` digits. 5131 5148 5132 pp $9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {5149 pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { 5133 5150 // `len` is used for character escape sequences. In that case, disallow separators. 5134 5151 var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined; … … 5184 5201 } 5185 5202 5186 pp $9.readRadixNumber = function(radix) {5203 pp.readRadixNumber = function(radix) { 5187 5204 var start = this.pos; 5188 5205 this.pos += 2; // 0x … … 5193 5210 ++this.pos; 5194 5211 } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } 5195 return this.finishToken(types .num, val)5212 return this.finishToken(types$1.num, val) 5196 5213 }; 5197 5214 5198 5215 // Read an integer, octal integer, or floating-point number. 5199 5216 5200 pp $9.readNumber = function(startsWithDot) {5217 pp.readNumber = function(startsWithDot) { 5201 5218 var start = this.pos; 5202 5219 if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); } … … 5208 5225 ++this.pos; 5209 5226 if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } 5210 return this.finishToken(types .num, val$1)5227 return this.finishToken(types$1.num, val$1) 5211 5228 } 5212 5229 if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } … … 5224 5241 5225 5242 var val = stringToNumber(this.input.slice(start, this.pos), octal); 5226 return this.finishToken(types .num, val)5243 return this.finishToken(types$1.num, val) 5227 5244 }; 5228 5245 5229 5246 // Read a string value, interpreting backslash-escapes. 5230 5247 5231 pp $9.readCodePoint = function() {5248 pp.readCodePoint = function() { 5232 5249 var ch = this.input.charCodeAt(this.pos), code; 5233 5250 … … 5244 5261 }; 5245 5262 5246 function codePointToString $1(code) {5263 function codePointToString(code) { 5247 5264 // UTF-16 Decoding 5248 5265 if (code <= 0xFFFF) { return String.fromCharCode(code) } … … 5251 5268 } 5252 5269 5253 pp $9.readString = function(quote) {5270 pp.readString = function(quote) { 5254 5271 var out = "", chunkStart = ++this.pos; 5255 5272 for (;;) { … … 5274 5291 } 5275 5292 out += this.input.slice(chunkStart, this.pos++); 5276 return this.finishToken(types .string, out)5293 return this.finishToken(types$1.string, out) 5277 5294 }; 5278 5295 … … 5281 5298 var INVALID_TEMPLATE_ESCAPE_ERROR = {}; 5282 5299 5283 pp $9.tryReadTemplateToken = function() {5300 pp.tryReadTemplateToken = function() { 5284 5301 this.inTemplateElement = true; 5285 5302 try { … … 5296 5313 }; 5297 5314 5298 pp $9.invalidStringToken = function(position, message) {5315 pp.invalidStringToken = function(position, message) { 5299 5316 if (this.inTemplateElement && this.options.ecmaVersion >= 9) { 5300 5317 throw INVALID_TEMPLATE_ESCAPE_ERROR … … 5304 5321 }; 5305 5322 5306 pp $9.readTmplToken = function() {5323 pp.readTmplToken = function() { 5307 5324 var out = "", chunkStart = this.pos; 5308 5325 for (;;) { … … 5310 5327 var ch = this.input.charCodeAt(this.pos); 5311 5328 if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${' 5312 if (this.pos === this.start && (this.type === types .template || this.type === types.invalidTemplate)) {5329 if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) { 5313 5330 if (ch === 36) { 5314 5331 this.pos += 2; 5315 return this.finishToken(types .dollarBraceL)5332 return this.finishToken(types$1.dollarBraceL) 5316 5333 } else { 5317 5334 ++this.pos; 5318 return this.finishToken(types .backQuote)5335 return this.finishToken(types$1.backQuote) 5319 5336 } 5320 5337 } 5321 5338 out += this.input.slice(chunkStart, this.pos); 5322 return this.finishToken(types .template, out)5339 return this.finishToken(types$1.template, out) 5323 5340 } 5324 5341 if (ch === 92) { // '\' … … 5351 5368 5352 5369 // Reads a template token to search for the end, without validating any escape sequences 5353 pp $9.readInvalidTemplateToken = function() {5370 pp.readInvalidTemplateToken = function() { 5354 5371 for (; this.pos < this.input.length; this.pos++) { 5355 5372 switch (this.input[this.pos]) { … … 5362 5379 break 5363 5380 } 5381 5364 5382 // falls through 5365 5366 5383 case "`": 5367 return this.finishToken(types .invalidTemplate, this.input.slice(this.start, this.pos))5384 return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos)) 5368 5385 5369 5386 // no default … … 5375 5392 // Used to read escaped characters 5376 5393 5377 pp $9.readEscapedChar = function(inTemplate) {5394 pp.readEscapedChar = function(inTemplate) { 5378 5395 var ch = this.input.charCodeAt(++this.pos); 5379 5396 ++this.pos; … … 5382 5399 case 114: return "\r" // 'r' -> '\r' 5383 5400 case 120: return String.fromCharCode(this.readHexChar(2)) // 'x' 5384 case 117: return codePointToString $1(this.readCodePoint()) // 'u'5401 case 117: return codePointToString(this.readCodePoint()) // 'u' 5385 5402 case 116: return "\t" // 't' -> '\t' 5386 5403 case 98: return "\b" // 'b' -> '\b' … … 5440 5457 // Used to read character escape sequences ('\x', '\u', '\U'). 5441 5458 5442 pp $9.readHexChar = function(len) {5459 pp.readHexChar = function(len) { 5443 5460 var codePos = this.pos; 5444 5461 var n = this.readInt(16, len); … … 5453 5470 // as a micro-optimization. 5454 5471 5455 pp $9.readWord1 = function() {5472 pp.readWord1 = function() { 5456 5473 this.containsEsc = false; 5457 5474 var word = "", first = true, chunkStart = this.pos; … … 5471 5488 if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) 5472 5489 { this.invalidStringToken(escStart, "Invalid Unicode escape"); } 5473 word += codePointToString $1(esc);5490 word += codePointToString(esc); 5474 5491 chunkStart = this.pos; 5475 5492 } else { … … 5484 5501 // words when necessary. 5485 5502 5486 pp $9.readWord = function() {5503 pp.readWord = function() { 5487 5504 var word = this.readWord1(); 5488 var type = types .name;5505 var type = types$1.name; 5489 5506 if (this.keywords.test(word)) { 5490 type = keywords $1[word];5507 type = keywords[word]; 5491 5508 } 5492 5509 return this.finishToken(type, word) … … 5495 5512 // Acorn is a tiny, fast JavaScript parser written in JavaScript. 5496 5513 5497 var version = "8. 5.0";5514 var version = "8.6.0"; 5498 5515 5499 5516 Parser.acorn = { … … 5506 5523 Node: Node, 5507 5524 TokenType: TokenType, 5508 tokTypes: types ,5509 keywordTypes: keywords $1,5525 tokTypes: types$1, 5526 keywordTypes: keywords, 5510 5527 TokContext: TokContext, 5511 tokContexts: types $1,5528 tokContexts: types, 5512 5529 isIdentifierChar: isIdentifierChar, 5513 5530 isIdentifierStart: isIdentifierStart, … … 5557 5574 exports.isIdentifierStart = isIdentifierStart; 5558 5575 exports.isNewLine = isNewLine; 5559 exports.keywordTypes = keywords $1;5576 exports.keywordTypes = keywords; 5560 5577 exports.lineBreak = lineBreak; 5561 5578 exports.lineBreakG = lineBreakG; … … 5563 5580 exports.parse = parse; 5564 5581 exports.parseExpressionAt = parseExpressionAt; 5565 exports.tokContexts = types $1;5566 exports.tokTypes = types ;5582 exports.tokContexts = types; 5583 exports.tokTypes = types$1; 5567 5584 exports.tokenizer = tokenizer; 5568 5585 exports.version = version; … … 5570 5587 Object.defineProperty(exports, '__esModule', { value: true }); 5571 5588 5572 })) );5589 }));
Note:
See TracChangeset
for help on using the changeset viewer.