rollup 2.60.2 → 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/bin/rollup +3 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +591 -614
- package/dist/es/shared/watch.js +4 -6
- package/dist/loadConfigFile.js +3 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +3 -5
- package/dist/shared/loadConfigFile.js +96 -37
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +590 -615
- package/dist/shared/watch-cli.js +36 -13
- package/dist/shared/watch.js +2 -2
- package/package.json +21 -21
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.61.0
|
|
4
|
+
Thu, 09 Dec 2021 05:43:43 GMT - commit 49d41f78987a1dd13488df009fe2db1b5d1b6e7c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version$1 = "2.
|
|
16
|
+
var version$1 = "2.61.0";
|
|
17
17
|
|
|
18
18
|
var charToInteger = {};
|
|
19
19
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1798,21 +1798,6 @@ class ExternalModule {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
1800
|
|
|
1801
|
-
function getAugmentedNamespace(n) {
|
|
1802
|
-
if (n.__esModule) return n;
|
|
1803
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
1804
|
-
Object.keys(n).forEach(function (k) {
|
|
1805
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1806
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
1807
|
-
enumerable: true,
|
|
1808
|
-
get: function () {
|
|
1809
|
-
return n[k];
|
|
1810
|
-
}
|
|
1811
|
-
});
|
|
1812
|
-
});
|
|
1813
|
-
return a;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
1801
|
var utils$3 = {};
|
|
1817
1802
|
|
|
1818
1803
|
const path$1 = require$$0__default;
|
|
@@ -16018,7 +16003,7 @@ var reservedWords = {
|
|
|
16018
16003
|
|
|
16019
16004
|
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";
|
|
16020
16005
|
|
|
16021
|
-
var keywords = {
|
|
16006
|
+
var keywords$1 = {
|
|
16022
16007
|
5: ecma5AndLessKeywords,
|
|
16023
16008
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16024
16009
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16137,17 +16122,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16137
16122
|
|
|
16138
16123
|
// Map keyword names to token types.
|
|
16139
16124
|
|
|
16140
|
-
var keywords
|
|
16125
|
+
var keywords = {};
|
|
16141
16126
|
|
|
16142
16127
|
// Succinct definitions of keyword token types
|
|
16143
16128
|
function kw(name, options) {
|
|
16144
16129
|
if ( options === void 0 ) options = {};
|
|
16145
16130
|
|
|
16146
16131
|
options.keyword = name;
|
|
16147
|
-
return keywords
|
|
16132
|
+
return keywords[name] = new TokenType(name, options)
|
|
16148
16133
|
}
|
|
16149
16134
|
|
|
16150
|
-
var types = {
|
|
16135
|
+
var types$1 = {
|
|
16151
16136
|
num: new TokenType("num", startsExpr),
|
|
16152
16137
|
regexp: new TokenType("regexp", startsExpr),
|
|
16153
16138
|
string: new TokenType("string", startsExpr),
|
|
@@ -16489,7 +16474,7 @@ var
|
|
|
16489
16474
|
var Parser = function Parser(options, input, startPos) {
|
|
16490
16475
|
this.options = options = getOptions(options);
|
|
16491
16476
|
this.sourceFile = options.sourceFile;
|
|
16492
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16477
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16493
16478
|
var reserved = "";
|
|
16494
16479
|
if (options.allowReserved !== true) {
|
|
16495
16480
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16520,7 +16505,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16520
16505
|
|
|
16521
16506
|
// Properties of the current token:
|
|
16522
16507
|
// Its type
|
|
16523
|
-
this.type = types.eof;
|
|
16508
|
+
this.type = types$1.eof;
|
|
16524
16509
|
// For tokens that include more information than their type, the value
|
|
16525
16510
|
this.value = null;
|
|
16526
16511
|
// Its start and end offset
|
|
@@ -16580,8 +16565,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16580
16565
|
};
|
|
16581
16566
|
|
|
16582
16567
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16568
|
+
|
|
16583
16569
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16570
|
+
|
|
16584
16571
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16572
|
+
|
|
16585
16573
|
prototypeAccessors.canAwait.get = function () {
|
|
16586
16574
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16587
16575
|
var scope = this.scopeStack[i];
|
|
@@ -16590,20 +16578,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16590
16578
|
}
|
|
16591
16579
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16592
16580
|
};
|
|
16581
|
+
|
|
16593
16582
|
prototypeAccessors.allowSuper.get = function () {
|
|
16594
16583
|
var ref = this.currentThisScope();
|
|
16595
16584
|
var flags = ref.flags;
|
|
16596
16585
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16597
16586
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16598
16587
|
};
|
|
16588
|
+
|
|
16599
16589
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16590
|
+
|
|
16600
16591
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16592
|
+
|
|
16601
16593
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16602
16594
|
var ref = this.currentThisScope();
|
|
16603
16595
|
var flags = ref.flags;
|
|
16604
16596
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16605
16597
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16606
16598
|
};
|
|
16599
|
+
|
|
16607
16600
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16608
16601
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16609
16602
|
};
|
|
@@ -16633,12 +16626,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16633
16626
|
|
|
16634
16627
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16635
16628
|
|
|
16636
|
-
var pp = Parser.prototype;
|
|
16629
|
+
var pp$9 = Parser.prototype;
|
|
16637
16630
|
|
|
16638
16631
|
// ## Parser utilities
|
|
16639
16632
|
|
|
16640
16633
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16641
|
-
pp.strictDirective = function(start) {
|
|
16634
|
+
pp$9.strictDirective = function(start) {
|
|
16642
16635
|
for (;;) {
|
|
16643
16636
|
// Try to find string literal.
|
|
16644
16637
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16666,7 +16659,7 @@ pp.strictDirective = function(start) {
|
|
|
16666
16659
|
// Predicate that tests whether the next token is of the given
|
|
16667
16660
|
// type, and if yes, consumes it as a side effect.
|
|
16668
16661
|
|
|
16669
|
-
pp.eat = function(type) {
|
|
16662
|
+
pp$9.eat = function(type) {
|
|
16670
16663
|
if (this.type === type) {
|
|
16671
16664
|
this.next();
|
|
16672
16665
|
return true
|
|
@@ -16677,13 +16670,13 @@ pp.eat = function(type) {
|
|
|
16677
16670
|
|
|
16678
16671
|
// Tests whether parsed token is a contextual keyword.
|
|
16679
16672
|
|
|
16680
|
-
pp.isContextual = function(name) {
|
|
16681
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16673
|
+
pp$9.isContextual = function(name) {
|
|
16674
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16682
16675
|
};
|
|
16683
16676
|
|
|
16684
16677
|
// Consumes contextual keyword if possible.
|
|
16685
16678
|
|
|
16686
|
-
pp.eatContextual = function(name) {
|
|
16679
|
+
pp$9.eatContextual = function(name) {
|
|
16687
16680
|
if (!this.isContextual(name)) { return false }
|
|
16688
16681
|
this.next();
|
|
16689
16682
|
return true
|
|
@@ -16691,19 +16684,19 @@ pp.eatContextual = function(name) {
|
|
|
16691
16684
|
|
|
16692
16685
|
// Asserts that following token is given contextual keyword.
|
|
16693
16686
|
|
|
16694
|
-
pp.expectContextual = function(name) {
|
|
16687
|
+
pp$9.expectContextual = function(name) {
|
|
16695
16688
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16696
16689
|
};
|
|
16697
16690
|
|
|
16698
16691
|
// Test whether a semicolon can be inserted at the current position.
|
|
16699
16692
|
|
|
16700
|
-
pp.canInsertSemicolon = function() {
|
|
16701
|
-
return this.type === types.eof ||
|
|
16702
|
-
this.type === types.braceR ||
|
|
16693
|
+
pp$9.canInsertSemicolon = function() {
|
|
16694
|
+
return this.type === types$1.eof ||
|
|
16695
|
+
this.type === types$1.braceR ||
|
|
16703
16696
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16704
16697
|
};
|
|
16705
16698
|
|
|
16706
|
-
pp.insertSemicolon = function() {
|
|
16699
|
+
pp$9.insertSemicolon = function() {
|
|
16707
16700
|
if (this.canInsertSemicolon()) {
|
|
16708
16701
|
if (this.options.onInsertedSemicolon)
|
|
16709
16702
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16714,11 +16707,11 @@ pp.insertSemicolon = function() {
|
|
|
16714
16707
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16715
16708
|
// pretend that there is a semicolon at this position.
|
|
16716
16709
|
|
|
16717
|
-
pp.semicolon = function() {
|
|
16718
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16710
|
+
pp$9.semicolon = function() {
|
|
16711
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16719
16712
|
};
|
|
16720
16713
|
|
|
16721
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16714
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16722
16715
|
if (this.type === tokType) {
|
|
16723
16716
|
if (this.options.onTrailingComma)
|
|
16724
16717
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16731,13 +16724,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16731
16724
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16732
16725
|
// raise an unexpected token error.
|
|
16733
16726
|
|
|
16734
|
-
pp.expect = function(type) {
|
|
16727
|
+
pp$9.expect = function(type) {
|
|
16735
16728
|
this.eat(type) || this.unexpected();
|
|
16736
16729
|
};
|
|
16737
16730
|
|
|
16738
16731
|
// Raise an unexpected token error.
|
|
16739
16732
|
|
|
16740
|
-
pp.unexpected = function(pos) {
|
|
16733
|
+
pp$9.unexpected = function(pos) {
|
|
16741
16734
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16742
16735
|
};
|
|
16743
16736
|
|
|
@@ -16750,7 +16743,7 @@ function DestructuringErrors() {
|
|
|
16750
16743
|
-1;
|
|
16751
16744
|
}
|
|
16752
16745
|
|
|
16753
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16746
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16754
16747
|
if (!refDestructuringErrors) { return }
|
|
16755
16748
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16756
16749
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16758,7 +16751,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16758
16751
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16759
16752
|
};
|
|
16760
16753
|
|
|
16761
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16754
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16762
16755
|
if (!refDestructuringErrors) { return false }
|
|
16763
16756
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16764
16757
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16769,20 +16762,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16769
16762
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16770
16763
|
};
|
|
16771
16764
|
|
|
16772
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16765
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16773
16766
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16774
16767
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16775
16768
|
if (this.awaitPos)
|
|
16776
16769
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16777
16770
|
};
|
|
16778
16771
|
|
|
16779
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16772
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16780
16773
|
if (expr.type === "ParenthesizedExpression")
|
|
16781
16774
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16782
16775
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16783
16776
|
};
|
|
16784
16777
|
|
|
16785
|
-
var pp$
|
|
16778
|
+
var pp$8 = Parser.prototype;
|
|
16786
16779
|
|
|
16787
16780
|
// ### Statement parsing
|
|
16788
16781
|
|
|
@@ -16791,10 +16784,10 @@ var pp$1 = Parser.prototype;
|
|
|
16791
16784
|
// `program` argument. If present, the statements will be appended
|
|
16792
16785
|
// to its body instead of creating a new node.
|
|
16793
16786
|
|
|
16794
|
-
pp$
|
|
16787
|
+
pp$8.parseTopLevel = function(node) {
|
|
16795
16788
|
var exports = Object.create(null);
|
|
16796
16789
|
if (!node.body) { node.body = []; }
|
|
16797
|
-
while (this.type !== types.eof) {
|
|
16790
|
+
while (this.type !== types$1.eof) {
|
|
16798
16791
|
var stmt = this.parseStatement(null, true, exports);
|
|
16799
16792
|
node.body.push(stmt);
|
|
16800
16793
|
}
|
|
@@ -16813,7 +16806,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16813
16806
|
|
|
16814
16807
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16815
16808
|
|
|
16816
|
-
pp$
|
|
16809
|
+
pp$8.isLet = function(context) {
|
|
16817
16810
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16818
16811
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16819
16812
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16839,7 +16832,7 @@ pp$1.isLet = function(context) {
|
|
|
16839
16832
|
// check 'async [no LineTerminator here] function'
|
|
16840
16833
|
// - 'async /*foo*/ function' is OK.
|
|
16841
16834
|
// - 'async /*\n*/ function' is invalid.
|
|
16842
|
-
pp$
|
|
16835
|
+
pp$8.isAsyncFunction = function() {
|
|
16843
16836
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16844
16837
|
{ return false }
|
|
16845
16838
|
|
|
@@ -16859,11 +16852,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16859
16852
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16860
16853
|
// does not help.
|
|
16861
16854
|
|
|
16862
|
-
pp$
|
|
16855
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16863
16856
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16864
16857
|
|
|
16865
16858
|
if (this.isLet(context)) {
|
|
16866
|
-
starttype = types._var;
|
|
16859
|
+
starttype = types$1._var;
|
|
16867
16860
|
kind = "let";
|
|
16868
16861
|
}
|
|
16869
16862
|
|
|
@@ -16872,35 +16865,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16872
16865
|
// complexity.
|
|
16873
16866
|
|
|
16874
16867
|
switch (starttype) {
|
|
16875
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16876
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
16877
|
-
case types._do: return this.parseDoStatement(node)
|
|
16878
|
-
case types._for: return this.parseForStatement(node)
|
|
16879
|
-
case types._function:
|
|
16868
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16869
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
16870
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
16871
|
+
case types$1._for: return this.parseForStatement(node)
|
|
16872
|
+
case types$1._function:
|
|
16880
16873
|
// Function as sole body of either an if statement or a labeled statement
|
|
16881
16874
|
// works, but not when it is part of a labeled statement that is the sole
|
|
16882
16875
|
// body of an if statement.
|
|
16883
16876
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
16884
16877
|
return this.parseFunctionStatement(node, false, !context)
|
|
16885
|
-
case types._class:
|
|
16878
|
+
case types$1._class:
|
|
16886
16879
|
if (context) { this.unexpected(); }
|
|
16887
16880
|
return this.parseClass(node, true)
|
|
16888
|
-
case types._if: return this.parseIfStatement(node)
|
|
16889
|
-
case types._return: return this.parseReturnStatement(node)
|
|
16890
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
16891
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
16892
|
-
case types._try: return this.parseTryStatement(node)
|
|
16893
|
-
case types._const: case types._var:
|
|
16881
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
16882
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
16883
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
16884
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
16885
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
16886
|
+
case types$1._const: case types$1._var:
|
|
16894
16887
|
kind = kind || this.value;
|
|
16895
16888
|
if (context && kind !== "var") { this.unexpected(); }
|
|
16896
16889
|
return this.parseVarStatement(node, kind)
|
|
16897
|
-
case types._while: return this.parseWhileStatement(node)
|
|
16898
|
-
case types._with: return this.parseWithStatement(node)
|
|
16899
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
16900
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
16901
|
-
case types._export:
|
|
16902
|
-
case types._import:
|
|
16903
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
16890
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
16891
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
16892
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
16893
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
16894
|
+
case types$1._export:
|
|
16895
|
+
case types$1._import:
|
|
16896
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
16904
16897
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16905
16898
|
var skip = skipWhiteSpace.exec(this.input);
|
|
16906
16899
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -16914,7 +16907,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16914
16907
|
if (!this.inModule)
|
|
16915
16908
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
16916
16909
|
}
|
|
16917
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16910
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16918
16911
|
|
|
16919
16912
|
// If the statement does not start with a statement keyword or a
|
|
16920
16913
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -16929,17 +16922,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16929
16922
|
}
|
|
16930
16923
|
|
|
16931
16924
|
var maybeName = this.value, expr = this.parseExpression();
|
|
16932
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
16925
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
16933
16926
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
16934
16927
|
else { return this.parseExpressionStatement(node, expr) }
|
|
16935
16928
|
}
|
|
16936
16929
|
};
|
|
16937
16930
|
|
|
16938
|
-
pp$
|
|
16931
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
16939
16932
|
var isBreak = keyword === "break";
|
|
16940
16933
|
this.next();
|
|
16941
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16942
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
16934
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16935
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
16943
16936
|
else {
|
|
16944
16937
|
node.label = this.parseIdent();
|
|
16945
16938
|
this.semicolon();
|
|
@@ -16959,21 +16952,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
16959
16952
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
16960
16953
|
};
|
|
16961
16954
|
|
|
16962
|
-
pp$
|
|
16955
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
16963
16956
|
this.next();
|
|
16964
16957
|
this.semicolon();
|
|
16965
16958
|
return this.finishNode(node, "DebuggerStatement")
|
|
16966
16959
|
};
|
|
16967
16960
|
|
|
16968
|
-
pp$
|
|
16961
|
+
pp$8.parseDoStatement = function(node) {
|
|
16969
16962
|
this.next();
|
|
16970
16963
|
this.labels.push(loopLabel);
|
|
16971
16964
|
node.body = this.parseStatement("do");
|
|
16972
16965
|
this.labels.pop();
|
|
16973
|
-
this.expect(types._while);
|
|
16966
|
+
this.expect(types$1._while);
|
|
16974
16967
|
node.test = this.parseParenExpression();
|
|
16975
16968
|
if (this.options.ecmaVersion >= 6)
|
|
16976
|
-
{ this.eat(types.semi); }
|
|
16969
|
+
{ this.eat(types$1.semi); }
|
|
16977
16970
|
else
|
|
16978
16971
|
{ this.semicolon(); }
|
|
16979
16972
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -16987,25 +16980,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
16987
16980
|
// part (semicolon immediately after the opening parenthesis), it
|
|
16988
16981
|
// is a regular `for` loop.
|
|
16989
16982
|
|
|
16990
|
-
pp$
|
|
16983
|
+
pp$8.parseForStatement = function(node) {
|
|
16991
16984
|
this.next();
|
|
16992
16985
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
16993
16986
|
this.labels.push(loopLabel);
|
|
16994
16987
|
this.enterScope(0);
|
|
16995
|
-
this.expect(types.parenL);
|
|
16996
|
-
if (this.type === types.semi) {
|
|
16988
|
+
this.expect(types$1.parenL);
|
|
16989
|
+
if (this.type === types$1.semi) {
|
|
16997
16990
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
16998
16991
|
return this.parseFor(node, null)
|
|
16999
16992
|
}
|
|
17000
16993
|
var isLet = this.isLet();
|
|
17001
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
16994
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
17002
16995
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
17003
16996
|
this.next();
|
|
17004
16997
|
this.parseVar(init$1, true, kind);
|
|
17005
16998
|
this.finishNode(init$1, "VariableDeclaration");
|
|
17006
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
16999
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17007
17000
|
if (this.options.ecmaVersion >= 9) {
|
|
17008
|
-
if (this.type === types._in) {
|
|
17001
|
+
if (this.type === types$1._in) {
|
|
17009
17002
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17010
17003
|
} else { node.await = awaitAt > -1; }
|
|
17011
17004
|
}
|
|
@@ -17017,9 +17010,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17017
17010
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17018
17011
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17019
17012
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17020
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17013
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17021
17014
|
if (this.options.ecmaVersion >= 9) {
|
|
17022
|
-
if (this.type === types._in) {
|
|
17015
|
+
if (this.type === types$1._in) {
|
|
17023
17016
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17024
17017
|
} else { node.await = awaitAt > -1; }
|
|
17025
17018
|
}
|
|
@@ -17034,21 +17027,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17034
17027
|
return this.parseFor(node, init)
|
|
17035
17028
|
};
|
|
17036
17029
|
|
|
17037
|
-
pp$
|
|
17030
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17038
17031
|
this.next();
|
|
17039
17032
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17040
17033
|
};
|
|
17041
17034
|
|
|
17042
|
-
pp$
|
|
17035
|
+
pp$8.parseIfStatement = function(node) {
|
|
17043
17036
|
this.next();
|
|
17044
17037
|
node.test = this.parseParenExpression();
|
|
17045
17038
|
// allow function declarations in branches, but only in non-strict mode
|
|
17046
17039
|
node.consequent = this.parseStatement("if");
|
|
17047
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17040
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17048
17041
|
return this.finishNode(node, "IfStatement")
|
|
17049
17042
|
};
|
|
17050
17043
|
|
|
17051
|
-
pp$
|
|
17044
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17052
17045
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17053
17046
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17054
17047
|
this.next();
|
|
@@ -17057,16 +17050,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17057
17050
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17058
17051
|
// possibility to insert one.
|
|
17059
17052
|
|
|
17060
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17053
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17061
17054
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17062
17055
|
return this.finishNode(node, "ReturnStatement")
|
|
17063
17056
|
};
|
|
17064
17057
|
|
|
17065
|
-
pp$
|
|
17058
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17066
17059
|
this.next();
|
|
17067
17060
|
node.discriminant = this.parseParenExpression();
|
|
17068
17061
|
node.cases = [];
|
|
17069
|
-
this.expect(types.braceL);
|
|
17062
|
+
this.expect(types$1.braceL);
|
|
17070
17063
|
this.labels.push(switchLabel);
|
|
17071
17064
|
this.enterScope(0);
|
|
17072
17065
|
|
|
@@ -17075,9 +17068,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17075
17068
|
// adding statements to.
|
|
17076
17069
|
|
|
17077
17070
|
var cur;
|
|
17078
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
17079
|
-
if (this.type === types._case || this.type === types._default) {
|
|
17080
|
-
var isCase = this.type === types._case;
|
|
17071
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17072
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17073
|
+
var isCase = this.type === types$1._case;
|
|
17081
17074
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17082
17075
|
node.cases.push(cur = this.startNode());
|
|
17083
17076
|
cur.consequent = [];
|
|
@@ -17089,7 +17082,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17089
17082
|
sawDefault = true;
|
|
17090
17083
|
cur.test = null;
|
|
17091
17084
|
}
|
|
17092
|
-
this.expect(types.colon);
|
|
17085
|
+
this.expect(types$1.colon);
|
|
17093
17086
|
} else {
|
|
17094
17087
|
if (!cur) { this.unexpected(); }
|
|
17095
17088
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17102,7 +17095,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17102
17095
|
return this.finishNode(node, "SwitchStatement")
|
|
17103
17096
|
};
|
|
17104
17097
|
|
|
17105
|
-
pp$
|
|
17098
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17106
17099
|
this.next();
|
|
17107
17100
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17108
17101
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17113,21 +17106,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17113
17106
|
|
|
17114
17107
|
// Reused empty array added for node fields that are always empty.
|
|
17115
17108
|
|
|
17116
|
-
var empty = [];
|
|
17109
|
+
var empty$1 = [];
|
|
17117
17110
|
|
|
17118
|
-
pp$
|
|
17111
|
+
pp$8.parseTryStatement = function(node) {
|
|
17119
17112
|
this.next();
|
|
17120
17113
|
node.block = this.parseBlock();
|
|
17121
17114
|
node.handler = null;
|
|
17122
|
-
if (this.type === types._catch) {
|
|
17115
|
+
if (this.type === types$1._catch) {
|
|
17123
17116
|
var clause = this.startNode();
|
|
17124
17117
|
this.next();
|
|
17125
|
-
if (this.eat(types.parenL)) {
|
|
17118
|
+
if (this.eat(types$1.parenL)) {
|
|
17126
17119
|
clause.param = this.parseBindingAtom();
|
|
17127
17120
|
var simple = clause.param.type === "Identifier";
|
|
17128
17121
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17129
17122
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17130
|
-
this.expect(types.parenR);
|
|
17123
|
+
this.expect(types$1.parenR);
|
|
17131
17124
|
} else {
|
|
17132
17125
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17133
17126
|
clause.param = null;
|
|
@@ -17137,20 +17130,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17137
17130
|
this.exitScope();
|
|
17138
17131
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17139
17132
|
}
|
|
17140
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17133
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17141
17134
|
if (!node.handler && !node.finalizer)
|
|
17142
17135
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17143
17136
|
return this.finishNode(node, "TryStatement")
|
|
17144
17137
|
};
|
|
17145
17138
|
|
|
17146
|
-
pp$
|
|
17139
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17147
17140
|
this.next();
|
|
17148
17141
|
this.parseVar(node, false, kind);
|
|
17149
17142
|
this.semicolon();
|
|
17150
17143
|
return this.finishNode(node, "VariableDeclaration")
|
|
17151
17144
|
};
|
|
17152
17145
|
|
|
17153
|
-
pp$
|
|
17146
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17154
17147
|
this.next();
|
|
17155
17148
|
node.test = this.parseParenExpression();
|
|
17156
17149
|
this.labels.push(loopLabel);
|
|
@@ -17159,7 +17152,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17159
17152
|
return this.finishNode(node, "WhileStatement")
|
|
17160
17153
|
};
|
|
17161
17154
|
|
|
17162
|
-
pp$
|
|
17155
|
+
pp$8.parseWithStatement = function(node) {
|
|
17163
17156
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17164
17157
|
this.next();
|
|
17165
17158
|
node.object = this.parseParenExpression();
|
|
@@ -17167,12 +17160,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17167
17160
|
return this.finishNode(node, "WithStatement")
|
|
17168
17161
|
};
|
|
17169
17162
|
|
|
17170
|
-
pp$
|
|
17163
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17171
17164
|
this.next();
|
|
17172
17165
|
return this.finishNode(node, "EmptyStatement")
|
|
17173
17166
|
};
|
|
17174
17167
|
|
|
17175
|
-
pp$
|
|
17168
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17176
17169
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17177
17170
|
{
|
|
17178
17171
|
var label = list[i$1];
|
|
@@ -17180,7 +17173,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17180
17173
|
if (label.name === maybeName)
|
|
17181
17174
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17182
17175
|
} }
|
|
17183
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17176
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17184
17177
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17185
17178
|
var label$1 = this.labels[i];
|
|
17186
17179
|
if (label$1.statementStart === node.start) {
|
|
@@ -17196,7 +17189,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17196
17189
|
return this.finishNode(node, "LabeledStatement")
|
|
17197
17190
|
};
|
|
17198
17191
|
|
|
17199
|
-
pp$
|
|
17192
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17200
17193
|
node.expression = expr;
|
|
17201
17194
|
this.semicolon();
|
|
17202
17195
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17206,14 +17199,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17206
17199
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17207
17200
|
// function bodies).
|
|
17208
17201
|
|
|
17209
|
-
pp$
|
|
17202
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17210
17203
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17211
17204
|
if ( node === void 0 ) node = this.startNode();
|
|
17212
17205
|
|
|
17213
17206
|
node.body = [];
|
|
17214
|
-
this.expect(types.braceL);
|
|
17207
|
+
this.expect(types$1.braceL);
|
|
17215
17208
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17216
|
-
while (this.type !== types.braceR) {
|
|
17209
|
+
while (this.type !== types$1.braceR) {
|
|
17217
17210
|
var stmt = this.parseStatement(null);
|
|
17218
17211
|
node.body.push(stmt);
|
|
17219
17212
|
}
|
|
@@ -17227,13 +17220,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17227
17220
|
// `parseStatement` will already have parsed the init statement or
|
|
17228
17221
|
// expression.
|
|
17229
17222
|
|
|
17230
|
-
pp$
|
|
17223
|
+
pp$8.parseFor = function(node, init) {
|
|
17231
17224
|
node.init = init;
|
|
17232
|
-
this.expect(types.semi);
|
|
17233
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
17234
|
-
this.expect(types.semi);
|
|
17235
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
17236
|
-
this.expect(types.parenR);
|
|
17225
|
+
this.expect(types$1.semi);
|
|
17226
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17227
|
+
this.expect(types$1.semi);
|
|
17228
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17229
|
+
this.expect(types$1.parenR);
|
|
17237
17230
|
node.body = this.parseStatement("for");
|
|
17238
17231
|
this.exitScope();
|
|
17239
17232
|
this.labels.pop();
|
|
@@ -17243,8 +17236,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17243
17236
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17244
17237
|
// same from parser's perspective.
|
|
17245
17238
|
|
|
17246
|
-
pp$
|
|
17247
|
-
var isForIn = this.type === types._in;
|
|
17239
|
+
pp$8.parseForIn = function(node, init) {
|
|
17240
|
+
var isForIn = this.type === types$1._in;
|
|
17248
17241
|
this.next();
|
|
17249
17242
|
|
|
17250
17243
|
if (
|
|
@@ -17265,7 +17258,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17265
17258
|
}
|
|
17266
17259
|
node.left = init;
|
|
17267
17260
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17268
|
-
this.expect(types.parenR);
|
|
17261
|
+
this.expect(types$1.parenR);
|
|
17269
17262
|
node.body = this.parseStatement("for");
|
|
17270
17263
|
this.exitScope();
|
|
17271
17264
|
this.labels.pop();
|
|
@@ -17274,28 +17267,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17274
17267
|
|
|
17275
17268
|
// Parse a list of variable declarations.
|
|
17276
17269
|
|
|
17277
|
-
pp$
|
|
17270
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17278
17271
|
node.declarations = [];
|
|
17279
17272
|
node.kind = kind;
|
|
17280
17273
|
for (;;) {
|
|
17281
17274
|
var decl = this.startNode();
|
|
17282
17275
|
this.parseVarId(decl, kind);
|
|
17283
|
-
if (this.eat(types.eq)) {
|
|
17276
|
+
if (this.eat(types$1.eq)) {
|
|
17284
17277
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17285
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17278
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17286
17279
|
this.unexpected();
|
|
17287
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17280
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17288
17281
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17289
17282
|
} else {
|
|
17290
17283
|
decl.init = null;
|
|
17291
17284
|
}
|
|
17292
17285
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17293
|
-
if (!this.eat(types.comma)) { break }
|
|
17286
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17294
17287
|
}
|
|
17295
17288
|
return node
|
|
17296
17289
|
};
|
|
17297
17290
|
|
|
17298
|
-
pp$
|
|
17291
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17299
17292
|
decl.id = this.parseBindingAtom();
|
|
17300
17293
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17301
17294
|
};
|
|
@@ -17306,18 +17299,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17306
17299
|
// `statement & FUNC_STATEMENT`).
|
|
17307
17300
|
|
|
17308
17301
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17309
|
-
pp$
|
|
17302
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17310
17303
|
this.initFunction(node);
|
|
17311
17304
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17312
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17305
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17313
17306
|
{ this.unexpected(); }
|
|
17314
|
-
node.generator = this.eat(types.star);
|
|
17307
|
+
node.generator = this.eat(types$1.star);
|
|
17315
17308
|
}
|
|
17316
17309
|
if (this.options.ecmaVersion >= 8)
|
|
17317
17310
|
{ node.async = !!isAsync; }
|
|
17318
17311
|
|
|
17319
17312
|
if (statement & FUNC_STATEMENT) {
|
|
17320
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17313
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17321
17314
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17322
17315
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17323
17316
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17333,7 +17326,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17333
17326
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17334
17327
|
|
|
17335
17328
|
if (!(statement & FUNC_STATEMENT))
|
|
17336
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17329
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17337
17330
|
|
|
17338
17331
|
this.parseFunctionParams(node);
|
|
17339
17332
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17344,16 +17337,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17344
17337
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17345
17338
|
};
|
|
17346
17339
|
|
|
17347
|
-
pp$
|
|
17348
|
-
this.expect(types.parenL);
|
|
17349
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17340
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17341
|
+
this.expect(types$1.parenL);
|
|
17342
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17350
17343
|
this.checkYieldAwaitInDefaultParams();
|
|
17351
17344
|
};
|
|
17352
17345
|
|
|
17353
17346
|
// Parse a class declaration or literal (depending on the
|
|
17354
17347
|
// `isStatement` parameter).
|
|
17355
17348
|
|
|
17356
|
-
pp$
|
|
17349
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17357
17350
|
this.next();
|
|
17358
17351
|
|
|
17359
17352
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17367,8 +17360,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17367
17360
|
var classBody = this.startNode();
|
|
17368
17361
|
var hadConstructor = false;
|
|
17369
17362
|
classBody.body = [];
|
|
17370
|
-
this.expect(types.braceL);
|
|
17371
|
-
while (this.type !== types.braceR) {
|
|
17363
|
+
this.expect(types$1.braceL);
|
|
17364
|
+
while (this.type !== types$1.braceR) {
|
|
17372
17365
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17373
17366
|
if (element) {
|
|
17374
17367
|
classBody.body.push(element);
|
|
@@ -17387,8 +17380,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17387
17380
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17388
17381
|
};
|
|
17389
17382
|
|
|
17390
|
-
pp$
|
|
17391
|
-
if (this.eat(types.semi)) { return null }
|
|
17383
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17384
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17392
17385
|
|
|
17393
17386
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17394
17387
|
var node = this.startNode();
|
|
@@ -17400,11 +17393,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17400
17393
|
|
|
17401
17394
|
if (this.eatContextual("static")) {
|
|
17402
17395
|
// Parse static init block
|
|
17403
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17396
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17404
17397
|
this.parseClassStaticBlock(node);
|
|
17405
17398
|
return node
|
|
17406
17399
|
}
|
|
17407
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17400
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17408
17401
|
isStatic = true;
|
|
17409
17402
|
} else {
|
|
17410
17403
|
keyName = "static";
|
|
@@ -17412,13 +17405,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17412
17405
|
}
|
|
17413
17406
|
node.static = isStatic;
|
|
17414
17407
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17415
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17408
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17416
17409
|
isAsync = true;
|
|
17417
17410
|
} else {
|
|
17418
17411
|
keyName = "async";
|
|
17419
17412
|
}
|
|
17420
17413
|
}
|
|
17421
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17414
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17422
17415
|
isGenerator = true;
|
|
17423
17416
|
}
|
|
17424
17417
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17445,7 +17438,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17445
17438
|
}
|
|
17446
17439
|
|
|
17447
17440
|
// Parse element value
|
|
17448
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17441
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17449
17442
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17450
17443
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17451
17444
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17459,19 +17452,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17459
17452
|
return node
|
|
17460
17453
|
};
|
|
17461
17454
|
|
|
17462
|
-
pp$
|
|
17455
|
+
pp$8.isClassElementNameStart = function() {
|
|
17463
17456
|
return (
|
|
17464
|
-
this.type === types.name ||
|
|
17465
|
-
this.type === types.privateId ||
|
|
17466
|
-
this.type === types.num ||
|
|
17467
|
-
this.type === types.string ||
|
|
17468
|
-
this.type === types.bracketL ||
|
|
17457
|
+
this.type === types$1.name ||
|
|
17458
|
+
this.type === types$1.privateId ||
|
|
17459
|
+
this.type === types$1.num ||
|
|
17460
|
+
this.type === types$1.string ||
|
|
17461
|
+
this.type === types$1.bracketL ||
|
|
17469
17462
|
this.type.keyword
|
|
17470
17463
|
)
|
|
17471
17464
|
};
|
|
17472
17465
|
|
|
17473
|
-
pp$
|
|
17474
|
-
if (this.type === types.privateId) {
|
|
17466
|
+
pp$8.parseClassElementName = function(element) {
|
|
17467
|
+
if (this.type === types$1.privateId) {
|
|
17475
17468
|
if (this.value === "constructor") {
|
|
17476
17469
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17477
17470
|
}
|
|
@@ -17482,7 +17475,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17482
17475
|
}
|
|
17483
17476
|
};
|
|
17484
17477
|
|
|
17485
|
-
pp$
|
|
17478
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17486
17479
|
// Check key and flags
|
|
17487
17480
|
var key = method.key;
|
|
17488
17481
|
if (method.kind === "constructor") {
|
|
@@ -17506,14 +17499,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17506
17499
|
return this.finishNode(method, "MethodDefinition")
|
|
17507
17500
|
};
|
|
17508
17501
|
|
|
17509
|
-
pp$
|
|
17502
|
+
pp$8.parseClassField = function(field) {
|
|
17510
17503
|
if (checkKeyName(field, "constructor")) {
|
|
17511
17504
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17512
17505
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17513
17506
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17514
17507
|
}
|
|
17515
17508
|
|
|
17516
|
-
if (this.eat(types.eq)) {
|
|
17509
|
+
if (this.eat(types$1.eq)) {
|
|
17517
17510
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17518
17511
|
var scope = this.currentThisScope();
|
|
17519
17512
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17528,13 +17521,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17528
17521
|
return this.finishNode(field, "PropertyDefinition")
|
|
17529
17522
|
};
|
|
17530
17523
|
|
|
17531
|
-
pp$
|
|
17524
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17532
17525
|
node.body = [];
|
|
17533
17526
|
|
|
17534
17527
|
var oldLabels = this.labels;
|
|
17535
17528
|
this.labels = [];
|
|
17536
17529
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17537
|
-
while (this.type !== types.braceR) {
|
|
17530
|
+
while (this.type !== types$1.braceR) {
|
|
17538
17531
|
var stmt = this.parseStatement(null);
|
|
17539
17532
|
node.body.push(stmt);
|
|
17540
17533
|
}
|
|
@@ -17545,8 +17538,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17545
17538
|
return this.finishNode(node, "StaticBlock")
|
|
17546
17539
|
};
|
|
17547
17540
|
|
|
17548
|
-
pp$
|
|
17549
|
-
if (this.type === types.name) {
|
|
17541
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17542
|
+
if (this.type === types$1.name) {
|
|
17550
17543
|
node.id = this.parseIdent();
|
|
17551
17544
|
if (isStatement)
|
|
17552
17545
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17557,17 +17550,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17557
17550
|
}
|
|
17558
17551
|
};
|
|
17559
17552
|
|
|
17560
|
-
pp$
|
|
17561
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17553
|
+
pp$8.parseClassSuper = function(node) {
|
|
17554
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17562
17555
|
};
|
|
17563
17556
|
|
|
17564
|
-
pp$
|
|
17557
|
+
pp$8.enterClassBody = function() {
|
|
17565
17558
|
var element = {declared: Object.create(null), used: []};
|
|
17566
17559
|
this.privateNameStack.push(element);
|
|
17567
17560
|
return element.declared
|
|
17568
17561
|
};
|
|
17569
17562
|
|
|
17570
|
-
pp$
|
|
17563
|
+
pp$8.exitClassBody = function() {
|
|
17571
17564
|
var ref = this.privateNameStack.pop();
|
|
17572
17565
|
var declared = ref.declared;
|
|
17573
17566
|
var used = ref.used;
|
|
@@ -17622,10 +17615,10 @@ function checkKeyName(node, name) {
|
|
|
17622
17615
|
|
|
17623
17616
|
// Parses module export declaration.
|
|
17624
17617
|
|
|
17625
|
-
pp$
|
|
17618
|
+
pp$8.parseExport = function(node, exports) {
|
|
17626
17619
|
this.next();
|
|
17627
17620
|
// export * from '...'
|
|
17628
|
-
if (this.eat(types.star)) {
|
|
17621
|
+
if (this.eat(types$1.star)) {
|
|
17629
17622
|
if (this.options.ecmaVersion >= 11) {
|
|
17630
17623
|
if (this.eatContextual("as")) {
|
|
17631
17624
|
node.exported = this.parseIdent(true);
|
|
@@ -17635,20 +17628,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17635
17628
|
}
|
|
17636
17629
|
}
|
|
17637
17630
|
this.expectContextual("from");
|
|
17638
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17631
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17639
17632
|
node.source = this.parseExprAtom();
|
|
17640
17633
|
this.semicolon();
|
|
17641
17634
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17642
17635
|
}
|
|
17643
|
-
if (this.eat(types._default)) { // export default ...
|
|
17636
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17644
17637
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17645
17638
|
var isAsync;
|
|
17646
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17639
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17647
17640
|
var fNode = this.startNode();
|
|
17648
17641
|
this.next();
|
|
17649
17642
|
if (isAsync) { this.next(); }
|
|
17650
17643
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17651
|
-
} else if (this.type === types._class) {
|
|
17644
|
+
} else if (this.type === types$1._class) {
|
|
17652
17645
|
var cNode = this.startNode();
|
|
17653
17646
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17654
17647
|
} else {
|
|
@@ -17670,7 +17663,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17670
17663
|
node.declaration = null;
|
|
17671
17664
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17672
17665
|
if (this.eatContextual("from")) {
|
|
17673
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17666
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17674
17667
|
node.source = this.parseExprAtom();
|
|
17675
17668
|
} else {
|
|
17676
17669
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17689,14 +17682,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17689
17682
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17690
17683
|
};
|
|
17691
17684
|
|
|
17692
|
-
pp$
|
|
17685
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17693
17686
|
if (!exports) { return }
|
|
17694
17687
|
if (has(exports, name))
|
|
17695
17688
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17696
17689
|
exports[name] = true;
|
|
17697
17690
|
};
|
|
17698
17691
|
|
|
17699
|
-
pp$
|
|
17692
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17700
17693
|
var type = pat.type;
|
|
17701
17694
|
if (type === "Identifier")
|
|
17702
17695
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17723,7 +17716,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17723
17716
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17724
17717
|
};
|
|
17725
17718
|
|
|
17726
|
-
pp$
|
|
17719
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17727
17720
|
if (!exports) { return }
|
|
17728
17721
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17729
17722
|
{
|
|
@@ -17733,7 +17726,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17733
17726
|
}
|
|
17734
17727
|
};
|
|
17735
17728
|
|
|
17736
|
-
pp$
|
|
17729
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17737
17730
|
return this.type.keyword === "var" ||
|
|
17738
17731
|
this.type.keyword === "const" ||
|
|
17739
17732
|
this.type.keyword === "class" ||
|
|
@@ -17744,14 +17737,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17744
17737
|
|
|
17745
17738
|
// Parses a comma-separated list of module exports.
|
|
17746
17739
|
|
|
17747
|
-
pp$
|
|
17740
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17748
17741
|
var nodes = [], first = true;
|
|
17749
17742
|
// export { x, y as z } [from '...']
|
|
17750
|
-
this.expect(types.braceL);
|
|
17751
|
-
while (!this.eat(types.braceR)) {
|
|
17743
|
+
this.expect(types$1.braceL);
|
|
17744
|
+
while (!this.eat(types$1.braceR)) {
|
|
17752
17745
|
if (!first) {
|
|
17753
|
-
this.expect(types.comma);
|
|
17754
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17746
|
+
this.expect(types$1.comma);
|
|
17747
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17755
17748
|
} else { first = false; }
|
|
17756
17749
|
|
|
17757
17750
|
var node = this.startNode();
|
|
@@ -17765,16 +17758,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17765
17758
|
|
|
17766
17759
|
// Parses import declaration.
|
|
17767
17760
|
|
|
17768
|
-
pp$
|
|
17761
|
+
pp$8.parseImport = function(node) {
|
|
17769
17762
|
this.next();
|
|
17770
17763
|
// import '...'
|
|
17771
|
-
if (this.type === types.string) {
|
|
17772
|
-
node.specifiers = empty;
|
|
17764
|
+
if (this.type === types$1.string) {
|
|
17765
|
+
node.specifiers = empty$1;
|
|
17773
17766
|
node.source = this.parseExprAtom();
|
|
17774
17767
|
} else {
|
|
17775
17768
|
node.specifiers = this.parseImportSpecifiers();
|
|
17776
17769
|
this.expectContextual("from");
|
|
17777
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17770
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17778
17771
|
}
|
|
17779
17772
|
this.semicolon();
|
|
17780
17773
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17782,17 +17775,17 @@ pp$1.parseImport = function(node) {
|
|
|
17782
17775
|
|
|
17783
17776
|
// Parses a comma-separated list of module imports.
|
|
17784
17777
|
|
|
17785
|
-
pp$
|
|
17778
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17786
17779
|
var nodes = [], first = true;
|
|
17787
|
-
if (this.type === types.name) {
|
|
17780
|
+
if (this.type === types$1.name) {
|
|
17788
17781
|
// import defaultObj, { x, y as z } from '...'
|
|
17789
17782
|
var node = this.startNode();
|
|
17790
17783
|
node.local = this.parseIdent();
|
|
17791
17784
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17792
17785
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17793
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17786
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17794
17787
|
}
|
|
17795
|
-
if (this.type === types.star) {
|
|
17788
|
+
if (this.type === types$1.star) {
|
|
17796
17789
|
var node$1 = this.startNode();
|
|
17797
17790
|
this.next();
|
|
17798
17791
|
this.expectContextual("as");
|
|
@@ -17801,11 +17794,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17801
17794
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17802
17795
|
return nodes
|
|
17803
17796
|
}
|
|
17804
|
-
this.expect(types.braceL);
|
|
17805
|
-
while (!this.eat(types.braceR)) {
|
|
17797
|
+
this.expect(types$1.braceL);
|
|
17798
|
+
while (!this.eat(types$1.braceR)) {
|
|
17806
17799
|
if (!first) {
|
|
17807
|
-
this.expect(types.comma);
|
|
17808
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17800
|
+
this.expect(types$1.comma);
|
|
17801
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17809
17802
|
} else { first = false; }
|
|
17810
17803
|
|
|
17811
17804
|
var node$2 = this.startNode();
|
|
@@ -17823,12 +17816,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17823
17816
|
};
|
|
17824
17817
|
|
|
17825
17818
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17826
|
-
pp$
|
|
17819
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17827
17820
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17828
17821
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17829
17822
|
}
|
|
17830
17823
|
};
|
|
17831
|
-
pp$
|
|
17824
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17832
17825
|
return (
|
|
17833
17826
|
statement.type === "ExpressionStatement" &&
|
|
17834
17827
|
statement.expression.type === "Literal" &&
|
|
@@ -17838,12 +17831,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17838
17831
|
)
|
|
17839
17832
|
};
|
|
17840
17833
|
|
|
17841
|
-
var pp$
|
|
17834
|
+
var pp$7 = Parser.prototype;
|
|
17842
17835
|
|
|
17843
17836
|
// Convert existing expression atom to assignable pattern
|
|
17844
17837
|
// if possible.
|
|
17845
17838
|
|
|
17846
|
-
pp$
|
|
17839
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17847
17840
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17848
17841
|
switch (node.type) {
|
|
17849
17842
|
case "Identifier":
|
|
@@ -17924,7 +17917,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
17924
17917
|
|
|
17925
17918
|
// Convert list of expression atoms to binding list.
|
|
17926
17919
|
|
|
17927
|
-
pp$
|
|
17920
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
17928
17921
|
var end = exprList.length;
|
|
17929
17922
|
for (var i = 0; i < end; i++) {
|
|
17930
17923
|
var elt = exprList[i];
|
|
@@ -17940,19 +17933,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
17940
17933
|
|
|
17941
17934
|
// Parses spread element.
|
|
17942
17935
|
|
|
17943
|
-
pp$
|
|
17936
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
17944
17937
|
var node = this.startNode();
|
|
17945
17938
|
this.next();
|
|
17946
17939
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
17947
17940
|
return this.finishNode(node, "SpreadElement")
|
|
17948
17941
|
};
|
|
17949
17942
|
|
|
17950
|
-
pp$
|
|
17943
|
+
pp$7.parseRestBinding = function() {
|
|
17951
17944
|
var node = this.startNode();
|
|
17952
17945
|
this.next();
|
|
17953
17946
|
|
|
17954
17947
|
// RestElement inside of a function parameter must be an identifier
|
|
17955
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
17948
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
17956
17949
|
{ this.unexpected(); }
|
|
17957
17950
|
|
|
17958
17951
|
node.argument = this.parseBindingAtom();
|
|
@@ -17962,36 +17955,36 @@ pp$2.parseRestBinding = function() {
|
|
|
17962
17955
|
|
|
17963
17956
|
// Parses lvalue (assignable) atom.
|
|
17964
17957
|
|
|
17965
|
-
pp$
|
|
17958
|
+
pp$7.parseBindingAtom = function() {
|
|
17966
17959
|
if (this.options.ecmaVersion >= 6) {
|
|
17967
17960
|
switch (this.type) {
|
|
17968
|
-
case types.bracketL:
|
|
17961
|
+
case types$1.bracketL:
|
|
17969
17962
|
var node = this.startNode();
|
|
17970
17963
|
this.next();
|
|
17971
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
17964
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
17972
17965
|
return this.finishNode(node, "ArrayPattern")
|
|
17973
17966
|
|
|
17974
|
-
case types.braceL:
|
|
17967
|
+
case types$1.braceL:
|
|
17975
17968
|
return this.parseObj(true)
|
|
17976
17969
|
}
|
|
17977
17970
|
}
|
|
17978
17971
|
return this.parseIdent()
|
|
17979
17972
|
};
|
|
17980
17973
|
|
|
17981
|
-
pp$
|
|
17974
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
17982
17975
|
var elts = [], first = true;
|
|
17983
17976
|
while (!this.eat(close)) {
|
|
17984
17977
|
if (first) { first = false; }
|
|
17985
|
-
else { this.expect(types.comma); }
|
|
17986
|
-
if (allowEmpty && this.type === types.comma) {
|
|
17978
|
+
else { this.expect(types$1.comma); }
|
|
17979
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
17987
17980
|
elts.push(null);
|
|
17988
17981
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
17989
17982
|
break
|
|
17990
|
-
} else if (this.type === types.ellipsis) {
|
|
17983
|
+
} else if (this.type === types$1.ellipsis) {
|
|
17991
17984
|
var rest = this.parseRestBinding();
|
|
17992
17985
|
this.parseBindingListItem(rest);
|
|
17993
17986
|
elts.push(rest);
|
|
17994
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
17987
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
17995
17988
|
this.expect(close);
|
|
17996
17989
|
break
|
|
17997
17990
|
} else {
|
|
@@ -18003,15 +17996,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
18003
17996
|
return elts
|
|
18004
17997
|
};
|
|
18005
17998
|
|
|
18006
|
-
pp$
|
|
17999
|
+
pp$7.parseBindingListItem = function(param) {
|
|
18007
18000
|
return param
|
|
18008
18001
|
};
|
|
18009
18002
|
|
|
18010
18003
|
// Parses assignment pattern around given atom if possible.
|
|
18011
18004
|
|
|
18012
|
-
pp$
|
|
18005
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18013
18006
|
left = left || this.parseBindingAtom();
|
|
18014
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18007
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18015
18008
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18016
18009
|
node.left = left;
|
|
18017
18010
|
node.right = this.parseMaybeAssign();
|
|
@@ -18082,7 +18075,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18082
18075
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18083
18076
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18084
18077
|
|
|
18085
|
-
pp$
|
|
18078
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18086
18079
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18087
18080
|
|
|
18088
18081
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18120,7 +18113,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18120
18113
|
}
|
|
18121
18114
|
};
|
|
18122
18115
|
|
|
18123
|
-
pp$
|
|
18116
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18124
18117
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18125
18118
|
|
|
18126
18119
|
switch (expr.type) {
|
|
@@ -18145,7 +18138,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18145
18138
|
}
|
|
18146
18139
|
};
|
|
18147
18140
|
|
|
18148
|
-
pp$
|
|
18141
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18149
18142
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18150
18143
|
|
|
18151
18144
|
switch (expr.type) {
|
|
@@ -18177,7 +18170,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18177
18170
|
this.generator = !!generator;
|
|
18178
18171
|
};
|
|
18179
18172
|
|
|
18180
|
-
var types
|
|
18173
|
+
var types = {
|
|
18181
18174
|
b_stat: new TokContext("{", false),
|
|
18182
18175
|
b_expr: new TokContext("{", true),
|
|
18183
18176
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18190,38 +18183,38 @@ var types$1 = {
|
|
|
18190
18183
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18191
18184
|
};
|
|
18192
18185
|
|
|
18193
|
-
var pp$
|
|
18186
|
+
var pp$6 = Parser.prototype;
|
|
18194
18187
|
|
|
18195
|
-
pp$
|
|
18196
|
-
return [types
|
|
18188
|
+
pp$6.initialContext = function() {
|
|
18189
|
+
return [types.b_stat]
|
|
18197
18190
|
};
|
|
18198
18191
|
|
|
18199
|
-
pp$
|
|
18192
|
+
pp$6.curContext = function() {
|
|
18200
18193
|
return this.context[this.context.length - 1]
|
|
18201
18194
|
};
|
|
18202
18195
|
|
|
18203
|
-
pp$
|
|
18196
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18204
18197
|
var parent = this.curContext();
|
|
18205
|
-
if (parent === types
|
|
18198
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18206
18199
|
{ return true }
|
|
18207
|
-
if (prevType === types.colon && (parent === types
|
|
18200
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18208
18201
|
{ return !parent.isExpr }
|
|
18209
18202
|
|
|
18210
18203
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18211
18204
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18212
18205
|
// `tt.name`.
|
|
18213
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18206
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18214
18207
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
18215
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
18208
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18216
18209
|
{ return true }
|
|
18217
|
-
if (prevType === types.braceL)
|
|
18218
|
-
{ return parent === types
|
|
18219
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18210
|
+
if (prevType === types$1.braceL)
|
|
18211
|
+
{ return parent === types.b_stat }
|
|
18212
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18220
18213
|
{ return false }
|
|
18221
18214
|
return !this.exprAllowed
|
|
18222
18215
|
};
|
|
18223
18216
|
|
|
18224
|
-
pp$
|
|
18217
|
+
pp$6.inGeneratorContext = function() {
|
|
18225
18218
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18226
18219
|
var context = this.context[i];
|
|
18227
18220
|
if (context.token === "function")
|
|
@@ -18230,9 +18223,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18230
18223
|
return false
|
|
18231
18224
|
};
|
|
18232
18225
|
|
|
18233
|
-
pp$
|
|
18226
|
+
pp$6.updateContext = function(prevType) {
|
|
18234
18227
|
var update, type = this.type;
|
|
18235
|
-
if (type.keyword && prevType === types.dot)
|
|
18228
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18236
18229
|
{ this.exprAllowed = false; }
|
|
18237
18230
|
else if (update = type.updateContext)
|
|
18238
18231
|
{ update.call(this, prevType); }
|
|
@@ -18241,7 +18234,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18241
18234
|
};
|
|
18242
18235
|
|
|
18243
18236
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18244
|
-
pp$
|
|
18237
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18245
18238
|
if (this.curContext() !== tokenCtx) {
|
|
18246
18239
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18247
18240
|
}
|
|
@@ -18249,71 +18242,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18249
18242
|
|
|
18250
18243
|
// Token-specific context update code
|
|
18251
18244
|
|
|
18252
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18245
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18253
18246
|
if (this.context.length === 1) {
|
|
18254
18247
|
this.exprAllowed = true;
|
|
18255
18248
|
return
|
|
18256
18249
|
}
|
|
18257
18250
|
var out = this.context.pop();
|
|
18258
|
-
if (out === types
|
|
18251
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18259
18252
|
out = this.context.pop();
|
|
18260
18253
|
}
|
|
18261
18254
|
this.exprAllowed = !out.isExpr;
|
|
18262
18255
|
};
|
|
18263
18256
|
|
|
18264
|
-
types.braceL.updateContext = function(prevType) {
|
|
18265
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18257
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18258
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18266
18259
|
this.exprAllowed = true;
|
|
18267
18260
|
};
|
|
18268
18261
|
|
|
18269
|
-
types.dollarBraceL.updateContext = function() {
|
|
18270
|
-
this.context.push(types
|
|
18262
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18263
|
+
this.context.push(types.b_tmpl);
|
|
18271
18264
|
this.exprAllowed = true;
|
|
18272
18265
|
};
|
|
18273
18266
|
|
|
18274
|
-
types.parenL.updateContext = function(prevType) {
|
|
18275
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
18276
|
-
this.context.push(statementParens ? types
|
|
18267
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18268
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18269
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18277
18270
|
this.exprAllowed = true;
|
|
18278
18271
|
};
|
|
18279
18272
|
|
|
18280
|
-
types.incDec.updateContext = function() {
|
|
18273
|
+
types$1.incDec.updateContext = function() {
|
|
18281
18274
|
// tokExprAllowed stays unchanged
|
|
18282
18275
|
};
|
|
18283
18276
|
|
|
18284
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
18285
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
18286
|
-
!(prevType === types.semi && this.curContext() !== types
|
|
18287
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18288
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types
|
|
18289
|
-
{ this.context.push(types
|
|
18277
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18278
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18279
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18280
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18281
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18282
|
+
{ this.context.push(types.f_expr); }
|
|
18290
18283
|
else
|
|
18291
|
-
{ this.context.push(types
|
|
18284
|
+
{ this.context.push(types.f_stat); }
|
|
18292
18285
|
this.exprAllowed = false;
|
|
18293
18286
|
};
|
|
18294
18287
|
|
|
18295
|
-
types.backQuote.updateContext = function() {
|
|
18296
|
-
if (this.curContext() === types
|
|
18288
|
+
types$1.backQuote.updateContext = function() {
|
|
18289
|
+
if (this.curContext() === types.q_tmpl)
|
|
18297
18290
|
{ this.context.pop(); }
|
|
18298
18291
|
else
|
|
18299
|
-
{ this.context.push(types
|
|
18292
|
+
{ this.context.push(types.q_tmpl); }
|
|
18300
18293
|
this.exprAllowed = false;
|
|
18301
18294
|
};
|
|
18302
18295
|
|
|
18303
|
-
types.star.updateContext = function(prevType) {
|
|
18304
|
-
if (prevType === types._function) {
|
|
18296
|
+
types$1.star.updateContext = function(prevType) {
|
|
18297
|
+
if (prevType === types$1._function) {
|
|
18305
18298
|
var index = this.context.length - 1;
|
|
18306
|
-
if (this.context[index] === types
|
|
18307
|
-
{ this.context[index] = types
|
|
18299
|
+
if (this.context[index] === types.f_expr)
|
|
18300
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18308
18301
|
else
|
|
18309
|
-
{ this.context[index] = types
|
|
18302
|
+
{ this.context[index] = types.f_gen; }
|
|
18310
18303
|
}
|
|
18311
18304
|
this.exprAllowed = true;
|
|
18312
18305
|
};
|
|
18313
18306
|
|
|
18314
|
-
types.name.updateContext = function(prevType) {
|
|
18307
|
+
types$1.name.updateContext = function(prevType) {
|
|
18315
18308
|
var allowed = false;
|
|
18316
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18309
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18317
18310
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18318
18311
|
this.value === "yield" && this.inGeneratorContext())
|
|
18319
18312
|
{ allowed = true; }
|
|
@@ -18323,14 +18316,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18323
18316
|
|
|
18324
18317
|
// A recursive descent parser operates by defining functions for all
|
|
18325
18318
|
|
|
18326
|
-
var pp$
|
|
18319
|
+
var pp$5 = Parser.prototype;
|
|
18327
18320
|
|
|
18328
18321
|
// Check if property name clashes with already added.
|
|
18329
18322
|
// Object/class getters and setters are not allowed to clash —
|
|
18330
18323
|
// either with each other or with an init property — and in
|
|
18331
18324
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18332
18325
|
|
|
18333
|
-
pp$
|
|
18326
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18334
18327
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18335
18328
|
{ return }
|
|
18336
18329
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18347,10 +18340,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18347
18340
|
if (name === "__proto__" && kind === "init") {
|
|
18348
18341
|
if (propHash.proto) {
|
|
18349
18342
|
if (refDestructuringErrors) {
|
|
18350
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
} else {
|
|
18343
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18344
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18345
|
+
}
|
|
18346
|
+
} else {
|
|
18347
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18348
|
+
}
|
|
18354
18349
|
}
|
|
18355
18350
|
propHash.proto = true;
|
|
18356
18351
|
}
|
|
@@ -18392,13 +18387,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18392
18387
|
// and object pattern might appear (so it's possible to raise
|
|
18393
18388
|
// delayed syntax error at correct position).
|
|
18394
18389
|
|
|
18395
|
-
pp$
|
|
18390
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18396
18391
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18397
18392
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18398
|
-
if (this.type === types.comma) {
|
|
18393
|
+
if (this.type === types$1.comma) {
|
|
18399
18394
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18400
18395
|
node.expressions = [expr];
|
|
18401
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18396
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18402
18397
|
return this.finishNode(node, "SequenceExpression")
|
|
18403
18398
|
}
|
|
18404
18399
|
return expr
|
|
@@ -18407,7 +18402,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18407
18402
|
// Parse an assignment expression. This includes applications of
|
|
18408
18403
|
// operators like `+=`.
|
|
18409
18404
|
|
|
18410
|
-
pp$
|
|
18405
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18411
18406
|
if (this.isContextual("yield")) {
|
|
18412
18407
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18413
18408
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18415,10 +18410,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18415
18410
|
else { this.exprAllowed = false; }
|
|
18416
18411
|
}
|
|
18417
18412
|
|
|
18418
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18413
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18419
18414
|
if (refDestructuringErrors) {
|
|
18420
18415
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18421
18416
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18417
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18422
18418
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18423
18419
|
} else {
|
|
18424
18420
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18426,7 +18422,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18426
18422
|
}
|
|
18427
18423
|
|
|
18428
18424
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18429
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18425
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18430
18426
|
this.potentialArrowAt = this.start;
|
|
18431
18427
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18432
18428
|
}
|
|
@@ -18435,20 +18431,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18435
18431
|
if (this.type.isAssign) {
|
|
18436
18432
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18437
18433
|
node.operator = this.value;
|
|
18438
|
-
if (this.type === types.eq)
|
|
18434
|
+
if (this.type === types$1.eq)
|
|
18439
18435
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18440
18436
|
if (!ownDestructuringErrors) {
|
|
18441
18437
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18442
18438
|
}
|
|
18443
18439
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18444
18440
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18445
|
-
if (this.type === types.eq)
|
|
18441
|
+
if (this.type === types$1.eq)
|
|
18446
18442
|
{ this.checkLValPattern(left); }
|
|
18447
18443
|
else
|
|
18448
18444
|
{ this.checkLValSimple(left); }
|
|
18449
18445
|
node.left = left;
|
|
18450
18446
|
this.next();
|
|
18451
18447
|
node.right = this.parseMaybeAssign(forInit);
|
|
18448
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18452
18449
|
return this.finishNode(node, "AssignmentExpression")
|
|
18453
18450
|
} else {
|
|
18454
18451
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18460,15 +18457,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18460
18457
|
|
|
18461
18458
|
// Parse a ternary conditional (`?:`) operator.
|
|
18462
18459
|
|
|
18463
|
-
pp$
|
|
18460
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18464
18461
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18465
18462
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18466
18463
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18467
|
-
if (this.eat(types.question)) {
|
|
18464
|
+
if (this.eat(types$1.question)) {
|
|
18468
18465
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18469
18466
|
node.test = expr;
|
|
18470
18467
|
node.consequent = this.parseMaybeAssign();
|
|
18471
|
-
this.expect(types.colon);
|
|
18468
|
+
this.expect(types$1.colon);
|
|
18472
18469
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18473
18470
|
return this.finishNode(node, "ConditionalExpression")
|
|
18474
18471
|
}
|
|
@@ -18477,7 +18474,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18477
18474
|
|
|
18478
18475
|
// Start the precedence parser.
|
|
18479
18476
|
|
|
18480
|
-
pp$
|
|
18477
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18481
18478
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18482
18479
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18483
18480
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18490,23 +18487,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18490
18487
|
// defer further parser to one of its callers when it encounters an
|
|
18491
18488
|
// operator that has a lower precedence than the set it is parsing.
|
|
18492
18489
|
|
|
18493
|
-
pp$
|
|
18490
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18494
18491
|
var prec = this.type.binop;
|
|
18495
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18492
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18496
18493
|
if (prec > minPrec) {
|
|
18497
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18498
|
-
var coalesce = this.type === types.coalesce;
|
|
18494
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18495
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18499
18496
|
if (coalesce) {
|
|
18500
18497
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18501
18498
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18502
|
-
prec = types.logicalAND.binop;
|
|
18499
|
+
prec = types$1.logicalAND.binop;
|
|
18503
18500
|
}
|
|
18504
18501
|
var op = this.value;
|
|
18505
18502
|
this.next();
|
|
18506
18503
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18507
18504
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18508
18505
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
18509
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
18506
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18510
18507
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18511
18508
|
}
|
|
18512
18509
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18515,7 +18512,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18515
18512
|
return left
|
|
18516
18513
|
};
|
|
18517
18514
|
|
|
18518
|
-
pp$
|
|
18515
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18516
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18519
18517
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18520
18518
|
node.left = left;
|
|
18521
18519
|
node.operator = op;
|
|
@@ -18525,13 +18523,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18525
18523
|
|
|
18526
18524
|
// Parse unary operators, both prefix and postfix.
|
|
18527
18525
|
|
|
18528
|
-
pp$
|
|
18526
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18529
18527
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18530
18528
|
if (this.isContextual("await") && this.canAwait) {
|
|
18531
18529
|
expr = this.parseAwait(forInit);
|
|
18532
18530
|
sawUnary = true;
|
|
18533
18531
|
} else if (this.type.prefix) {
|
|
18534
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18532
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18535
18533
|
node.operator = this.value;
|
|
18536
18534
|
node.prefix = true;
|
|
18537
18535
|
this.next();
|
|
@@ -18545,6 +18543,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18545
18543
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18546
18544
|
else { sawUnary = true; }
|
|
18547
18545
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18546
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18547
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18548
|
+
expr = this.parsePrivateIdent();
|
|
18549
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18550
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18548
18551
|
} else {
|
|
18549
18552
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18550
18553
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18559,7 +18562,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18559
18562
|
}
|
|
18560
18563
|
}
|
|
18561
18564
|
|
|
18562
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18565
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18563
18566
|
if (sawUnary)
|
|
18564
18567
|
{ this.unexpected(this.lastTokStart); }
|
|
18565
18568
|
else
|
|
@@ -18578,7 +18581,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18578
18581
|
|
|
18579
18582
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18580
18583
|
|
|
18581
|
-
pp$
|
|
18584
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18582
18585
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18583
18586
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18584
18587
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18592,7 +18595,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18592
18595
|
return result
|
|
18593
18596
|
};
|
|
18594
18597
|
|
|
18595
|
-
pp$
|
|
18598
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18596
18599
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18597
18600
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18598
18601
|
this.potentialArrowAt === base.start;
|
|
@@ -18615,19 +18618,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18615
18618
|
}
|
|
18616
18619
|
};
|
|
18617
18620
|
|
|
18618
|
-
pp$
|
|
18621
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18619
18622
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18620
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18623
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18621
18624
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18622
18625
|
|
|
18623
|
-
var computed = this.eat(types.bracketL);
|
|
18624
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18626
|
+
var computed = this.eat(types$1.bracketL);
|
|
18627
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18625
18628
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18626
18629
|
node.object = base;
|
|
18627
18630
|
if (computed) {
|
|
18628
18631
|
node.property = this.parseExpression();
|
|
18629
|
-
this.expect(types.bracketR);
|
|
18630
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18632
|
+
this.expect(types$1.bracketR);
|
|
18633
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18631
18634
|
node.property = this.parsePrivateIdent();
|
|
18632
18635
|
} else {
|
|
18633
18636
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18637,13 +18640,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18637
18640
|
node.optional = optional;
|
|
18638
18641
|
}
|
|
18639
18642
|
base = this.finishNode(node, "MemberExpression");
|
|
18640
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18643
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18641
18644
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18642
18645
|
this.yieldPos = 0;
|
|
18643
18646
|
this.awaitPos = 0;
|
|
18644
18647
|
this.awaitIdentPos = 0;
|
|
18645
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18646
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18648
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18649
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18647
18650
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18648
18651
|
this.checkYieldAwaitInDefaultParams();
|
|
18649
18652
|
if (this.awaitIdentPos > 0)
|
|
@@ -18664,7 +18667,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18664
18667
|
node$1.optional = optional;
|
|
18665
18668
|
}
|
|
18666
18669
|
base = this.finishNode(node$1, "CallExpression");
|
|
18667
|
-
} else if (this.type === types.backQuote) {
|
|
18670
|
+
} else if (this.type === types$1.backQuote) {
|
|
18668
18671
|
if (optional || optionalChained) {
|
|
18669
18672
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18670
18673
|
}
|
|
@@ -18681,19 +18684,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18681
18684
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18682
18685
|
// or `{}`.
|
|
18683
18686
|
|
|
18684
|
-
pp$
|
|
18687
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18685
18688
|
// If a division operator appears in an expression position, the
|
|
18686
18689
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18687
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18690
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18688
18691
|
|
|
18689
18692
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18690
18693
|
switch (this.type) {
|
|
18691
|
-
case types._super:
|
|
18694
|
+
case types$1._super:
|
|
18692
18695
|
if (!this.allowSuper)
|
|
18693
18696
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18694
18697
|
node = this.startNode();
|
|
18695
18698
|
this.next();
|
|
18696
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18699
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18697
18700
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18698
18701
|
// The `super` keyword can appear at below:
|
|
18699
18702
|
// SuperProperty:
|
|
@@ -18701,52 +18704,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18701
18704
|
// super . IdentifierName
|
|
18702
18705
|
// SuperCall:
|
|
18703
18706
|
// super ( Arguments )
|
|
18704
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18707
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18705
18708
|
{ this.unexpected(); }
|
|
18706
18709
|
return this.finishNode(node, "Super")
|
|
18707
18710
|
|
|
18708
|
-
case types._this:
|
|
18711
|
+
case types$1._this:
|
|
18709
18712
|
node = this.startNode();
|
|
18710
18713
|
this.next();
|
|
18711
18714
|
return this.finishNode(node, "ThisExpression")
|
|
18712
18715
|
|
|
18713
|
-
case types.name:
|
|
18716
|
+
case types$1.name:
|
|
18714
18717
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18715
18718
|
var id = this.parseIdent(false);
|
|
18716
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
|
|
18717
|
-
this.overrideContext(types
|
|
18719
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18720
|
+
this.overrideContext(types.f_expr);
|
|
18718
18721
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18719
18722
|
}
|
|
18720
18723
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18721
|
-
if (this.eat(types.arrow))
|
|
18724
|
+
if (this.eat(types$1.arrow))
|
|
18722
18725
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18723
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18726
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18724
18727
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18725
18728
|
id = this.parseIdent(false);
|
|
18726
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18729
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18727
18730
|
{ this.unexpected(); }
|
|
18728
18731
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18729
18732
|
}
|
|
18730
18733
|
}
|
|
18731
18734
|
return id
|
|
18732
18735
|
|
|
18733
|
-
case types.regexp:
|
|
18736
|
+
case types$1.regexp:
|
|
18734
18737
|
var value = this.value;
|
|
18735
18738
|
node = this.parseLiteral(value.value);
|
|
18736
18739
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18737
18740
|
return node
|
|
18738
18741
|
|
|
18739
|
-
case types.num: case types.string:
|
|
18742
|
+
case types$1.num: case types$1.string:
|
|
18740
18743
|
return this.parseLiteral(this.value)
|
|
18741
18744
|
|
|
18742
|
-
case types._null: case types._true: case types._false:
|
|
18745
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18743
18746
|
node = this.startNode();
|
|
18744
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18747
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18745
18748
|
node.raw = this.type.keyword;
|
|
18746
18749
|
this.next();
|
|
18747
18750
|
return this.finishNode(node, "Literal")
|
|
18748
18751
|
|
|
18749
|
-
case types.parenL:
|
|
18752
|
+
case types$1.parenL:
|
|
18750
18753
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18751
18754
|
if (refDestructuringErrors) {
|
|
18752
18755
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18756,31 +18759,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18756
18759
|
}
|
|
18757
18760
|
return expr
|
|
18758
18761
|
|
|
18759
|
-
case types.bracketL:
|
|
18762
|
+
case types$1.bracketL:
|
|
18760
18763
|
node = this.startNode();
|
|
18761
18764
|
this.next();
|
|
18762
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18765
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18763
18766
|
return this.finishNode(node, "ArrayExpression")
|
|
18764
18767
|
|
|
18765
|
-
case types.braceL:
|
|
18766
|
-
this.overrideContext(types
|
|
18768
|
+
case types$1.braceL:
|
|
18769
|
+
this.overrideContext(types.b_expr);
|
|
18767
18770
|
return this.parseObj(false, refDestructuringErrors)
|
|
18768
18771
|
|
|
18769
|
-
case types._function:
|
|
18772
|
+
case types$1._function:
|
|
18770
18773
|
node = this.startNode();
|
|
18771
18774
|
this.next();
|
|
18772
18775
|
return this.parseFunction(node, 0)
|
|
18773
18776
|
|
|
18774
|
-
case types._class:
|
|
18777
|
+
case types$1._class:
|
|
18775
18778
|
return this.parseClass(this.startNode(), false)
|
|
18776
18779
|
|
|
18777
|
-
case types._new:
|
|
18780
|
+
case types$1._new:
|
|
18778
18781
|
return this.parseNew()
|
|
18779
18782
|
|
|
18780
|
-
case types.backQuote:
|
|
18783
|
+
case types$1.backQuote:
|
|
18781
18784
|
return this.parseTemplate()
|
|
18782
18785
|
|
|
18783
|
-
case types._import:
|
|
18786
|
+
case types$1._import:
|
|
18784
18787
|
if (this.options.ecmaVersion >= 11) {
|
|
18785
18788
|
return this.parseExprImport()
|
|
18786
18789
|
} else {
|
|
@@ -18792,7 +18795,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18792
18795
|
}
|
|
18793
18796
|
};
|
|
18794
18797
|
|
|
18795
|
-
pp$
|
|
18798
|
+
pp$5.parseExprImport = function() {
|
|
18796
18799
|
var node = this.startNode();
|
|
18797
18800
|
|
|
18798
18801
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18801,9 +18804,9 @@ pp$4.parseExprImport = function() {
|
|
|
18801
18804
|
var meta = this.parseIdent(true);
|
|
18802
18805
|
|
|
18803
18806
|
switch (this.type) {
|
|
18804
|
-
case types.parenL:
|
|
18807
|
+
case types$1.parenL:
|
|
18805
18808
|
return this.parseDynamicImport(node)
|
|
18806
|
-
case types.dot:
|
|
18809
|
+
case types$1.dot:
|
|
18807
18810
|
node.meta = meta;
|
|
18808
18811
|
return this.parseImportMeta(node)
|
|
18809
18812
|
default:
|
|
@@ -18811,16 +18814,16 @@ pp$4.parseExprImport = function() {
|
|
|
18811
18814
|
}
|
|
18812
18815
|
};
|
|
18813
18816
|
|
|
18814
|
-
pp$
|
|
18817
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18815
18818
|
this.next(); // skip `(`
|
|
18816
18819
|
|
|
18817
18820
|
// Parse node.source.
|
|
18818
18821
|
node.source = this.parseMaybeAssign();
|
|
18819
18822
|
|
|
18820
18823
|
// Verify ending.
|
|
18821
|
-
if (!this.eat(types.parenR)) {
|
|
18824
|
+
if (!this.eat(types$1.parenR)) {
|
|
18822
18825
|
var errorPos = this.start;
|
|
18823
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
18826
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18824
18827
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18825
18828
|
} else {
|
|
18826
18829
|
this.unexpected(errorPos);
|
|
@@ -18830,7 +18833,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18830
18833
|
return this.finishNode(node, "ImportExpression")
|
|
18831
18834
|
};
|
|
18832
18835
|
|
|
18833
|
-
pp$
|
|
18836
|
+
pp$5.parseImportMeta = function(node) {
|
|
18834
18837
|
this.next(); // skip `.`
|
|
18835
18838
|
|
|
18836
18839
|
var containsEsc = this.containsEsc;
|
|
@@ -18846,7 +18849,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18846
18849
|
return this.finishNode(node, "MetaProperty")
|
|
18847
18850
|
};
|
|
18848
18851
|
|
|
18849
|
-
pp$
|
|
18852
|
+
pp$5.parseLiteral = function(value) {
|
|
18850
18853
|
var node = this.startNode();
|
|
18851
18854
|
node.value = value;
|
|
18852
18855
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18855,14 +18858,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18855
18858
|
return this.finishNode(node, "Literal")
|
|
18856
18859
|
};
|
|
18857
18860
|
|
|
18858
|
-
pp$
|
|
18859
|
-
this.expect(types.parenL);
|
|
18861
|
+
pp$5.parseParenExpression = function() {
|
|
18862
|
+
this.expect(types$1.parenL);
|
|
18860
18863
|
var val = this.parseExpression();
|
|
18861
|
-
this.expect(types.parenR);
|
|
18864
|
+
this.expect(types$1.parenR);
|
|
18862
18865
|
return val
|
|
18863
18866
|
};
|
|
18864
18867
|
|
|
18865
|
-
pp$
|
|
18868
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18866
18869
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18867
18870
|
if (this.options.ecmaVersion >= 6) {
|
|
18868
18871
|
this.next();
|
|
@@ -18873,24 +18876,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18873
18876
|
this.yieldPos = 0;
|
|
18874
18877
|
this.awaitPos = 0;
|
|
18875
18878
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
18876
|
-
while (this.type !== types.parenR) {
|
|
18877
|
-
first ? first = false : this.expect(types.comma);
|
|
18878
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
18879
|
+
while (this.type !== types$1.parenR) {
|
|
18880
|
+
first ? first = false : this.expect(types$1.comma);
|
|
18881
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
18879
18882
|
lastIsComma = true;
|
|
18880
18883
|
break
|
|
18881
|
-
} else if (this.type === types.ellipsis) {
|
|
18884
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18882
18885
|
spreadStart = this.start;
|
|
18883
18886
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
18884
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18887
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18885
18888
|
break
|
|
18886
18889
|
} else {
|
|
18887
18890
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
18888
18891
|
}
|
|
18889
18892
|
}
|
|
18890
18893
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
18891
|
-
this.expect(types.parenR);
|
|
18894
|
+
this.expect(types$1.parenR);
|
|
18892
18895
|
|
|
18893
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18896
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18894
18897
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18895
18898
|
this.checkYieldAwaitInDefaultParams();
|
|
18896
18899
|
this.yieldPos = oldYieldPos;
|
|
@@ -18924,12 +18927,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18924
18927
|
}
|
|
18925
18928
|
};
|
|
18926
18929
|
|
|
18927
|
-
pp$
|
|
18930
|
+
pp$5.parseParenItem = function(item) {
|
|
18928
18931
|
return item
|
|
18929
18932
|
};
|
|
18930
18933
|
|
|
18931
|
-
pp$
|
|
18932
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
18934
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
18935
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
18933
18936
|
};
|
|
18934
18937
|
|
|
18935
18938
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -18938,13 +18941,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
18938
18941
|
// argument to parseSubscripts to prevent it from consuming the
|
|
18939
18942
|
// argument list.
|
|
18940
18943
|
|
|
18941
|
-
var empty
|
|
18944
|
+
var empty = [];
|
|
18942
18945
|
|
|
18943
|
-
pp$
|
|
18946
|
+
pp$5.parseNew = function() {
|
|
18944
18947
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
18945
18948
|
var node = this.startNode();
|
|
18946
18949
|
var meta = this.parseIdent(true);
|
|
18947
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
18950
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
18948
18951
|
node.meta = meta;
|
|
18949
18952
|
var containsEsc = this.containsEsc;
|
|
18950
18953
|
node.property = this.parseIdent(true);
|
|
@@ -18956,23 +18959,23 @@ pp$4.parseNew = function() {
|
|
|
18956
18959
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
18957
18960
|
return this.finishNode(node, "MetaProperty")
|
|
18958
18961
|
}
|
|
18959
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
18962
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
18960
18963
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
18961
18964
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
18962
18965
|
this.raise(startPos, "Cannot use new with import()");
|
|
18963
18966
|
}
|
|
18964
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
18965
|
-
else { node.arguments = empty
|
|
18967
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
18968
|
+
else { node.arguments = empty; }
|
|
18966
18969
|
return this.finishNode(node, "NewExpression")
|
|
18967
18970
|
};
|
|
18968
18971
|
|
|
18969
18972
|
// Parse template expression.
|
|
18970
18973
|
|
|
18971
|
-
pp$
|
|
18974
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
18972
18975
|
var isTagged = ref.isTagged;
|
|
18973
18976
|
|
|
18974
18977
|
var elem = this.startNode();
|
|
18975
|
-
if (this.type === types.invalidTemplate) {
|
|
18978
|
+
if (this.type === types$1.invalidTemplate) {
|
|
18976
18979
|
if (!isTagged) {
|
|
18977
18980
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
18978
18981
|
}
|
|
@@ -18987,11 +18990,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
18987
18990
|
};
|
|
18988
18991
|
}
|
|
18989
18992
|
this.next();
|
|
18990
|
-
elem.tail = this.type === types.backQuote;
|
|
18993
|
+
elem.tail = this.type === types$1.backQuote;
|
|
18991
18994
|
return this.finishNode(elem, "TemplateElement")
|
|
18992
18995
|
};
|
|
18993
18996
|
|
|
18994
|
-
pp$
|
|
18997
|
+
pp$5.parseTemplate = function(ref) {
|
|
18995
18998
|
if ( ref === void 0 ) ref = {};
|
|
18996
18999
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
18997
19000
|
|
|
@@ -19001,32 +19004,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
19001
19004
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
19002
19005
|
node.quasis = [curElt];
|
|
19003
19006
|
while (!curElt.tail) {
|
|
19004
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19005
|
-
this.expect(types.dollarBraceL);
|
|
19007
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19008
|
+
this.expect(types$1.dollarBraceL);
|
|
19006
19009
|
node.expressions.push(this.parseExpression());
|
|
19007
|
-
this.expect(types.braceR);
|
|
19010
|
+
this.expect(types$1.braceR);
|
|
19008
19011
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19009
19012
|
}
|
|
19010
19013
|
this.next();
|
|
19011
19014
|
return this.finishNode(node, "TemplateLiteral")
|
|
19012
19015
|
};
|
|
19013
19016
|
|
|
19014
|
-
pp$
|
|
19017
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19015
19018
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
19016
|
-
(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)) &&
|
|
19019
|
+
(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)) &&
|
|
19017
19020
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19018
19021
|
};
|
|
19019
19022
|
|
|
19020
19023
|
// Parse an object literal or binding pattern.
|
|
19021
19024
|
|
|
19022
|
-
pp$
|
|
19025
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19023
19026
|
var node = this.startNode(), first = true, propHash = {};
|
|
19024
19027
|
node.properties = [];
|
|
19025
19028
|
this.next();
|
|
19026
|
-
while (!this.eat(types.braceR)) {
|
|
19029
|
+
while (!this.eat(types$1.braceR)) {
|
|
19027
19030
|
if (!first) {
|
|
19028
|
-
this.expect(types.comma);
|
|
19029
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19031
|
+
this.expect(types$1.comma);
|
|
19032
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19030
19033
|
} else { first = false; }
|
|
19031
19034
|
|
|
19032
19035
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19036,18 +19039,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19036
19039
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19037
19040
|
};
|
|
19038
19041
|
|
|
19039
|
-
pp$
|
|
19042
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19040
19043
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19041
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19044
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19042
19045
|
if (isPattern) {
|
|
19043
19046
|
prop.argument = this.parseIdent(false);
|
|
19044
|
-
if (this.type === types.comma) {
|
|
19047
|
+
if (this.type === types$1.comma) {
|
|
19045
19048
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19046
19049
|
}
|
|
19047
19050
|
return this.finishNode(prop, "RestElement")
|
|
19048
19051
|
}
|
|
19049
19052
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19050
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19053
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19051
19054
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19052
19055
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19053
19056
|
}
|
|
@@ -19058,7 +19061,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19058
19061
|
// Parse argument.
|
|
19059
19062
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19060
19063
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19061
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19064
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19062
19065
|
refDestructuringErrors.trailingComma = this.start;
|
|
19063
19066
|
}
|
|
19064
19067
|
// Finish
|
|
@@ -19072,13 +19075,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19072
19075
|
startLoc = this.startLoc;
|
|
19073
19076
|
}
|
|
19074
19077
|
if (!isPattern)
|
|
19075
|
-
{ isGenerator = this.eat(types.star); }
|
|
19078
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19076
19079
|
}
|
|
19077
19080
|
var containsEsc = this.containsEsc;
|
|
19078
19081
|
this.parsePropertyName(prop);
|
|
19079
19082
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19080
19083
|
isAsync = true;
|
|
19081
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19084
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19082
19085
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19083
19086
|
} else {
|
|
19084
19087
|
isAsync = false;
|
|
@@ -19087,14 +19090,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19087
19090
|
return this.finishNode(prop, "Property")
|
|
19088
19091
|
};
|
|
19089
19092
|
|
|
19090
|
-
pp$
|
|
19091
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19093
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19094
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19092
19095
|
{ this.unexpected(); }
|
|
19093
19096
|
|
|
19094
|
-
if (this.eat(types.colon)) {
|
|
19097
|
+
if (this.eat(types$1.colon)) {
|
|
19095
19098
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19096
19099
|
prop.kind = "init";
|
|
19097
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19100
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19098
19101
|
if (isPattern) { this.unexpected(); }
|
|
19099
19102
|
prop.kind = "init";
|
|
19100
19103
|
prop.method = true;
|
|
@@ -19102,7 +19105,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19102
19105
|
} else if (!isPattern && !containsEsc &&
|
|
19103
19106
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19104
19107
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19105
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19108
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19106
19109
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19107
19110
|
prop.kind = prop.key.name;
|
|
19108
19111
|
this.parsePropertyName(prop);
|
|
@@ -19126,7 +19129,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19126
19129
|
prop.kind = "init";
|
|
19127
19130
|
if (isPattern) {
|
|
19128
19131
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19129
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19132
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19130
19133
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19131
19134
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19132
19135
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19137,23 +19140,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19137
19140
|
} else { this.unexpected(); }
|
|
19138
19141
|
};
|
|
19139
19142
|
|
|
19140
|
-
pp$
|
|
19143
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19141
19144
|
if (this.options.ecmaVersion >= 6) {
|
|
19142
|
-
if (this.eat(types.bracketL)) {
|
|
19145
|
+
if (this.eat(types$1.bracketL)) {
|
|
19143
19146
|
prop.computed = true;
|
|
19144
19147
|
prop.key = this.parseMaybeAssign();
|
|
19145
|
-
this.expect(types.bracketR);
|
|
19148
|
+
this.expect(types$1.bracketR);
|
|
19146
19149
|
return prop.key
|
|
19147
19150
|
} else {
|
|
19148
19151
|
prop.computed = false;
|
|
19149
19152
|
}
|
|
19150
19153
|
}
|
|
19151
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19154
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19152
19155
|
};
|
|
19153
19156
|
|
|
19154
19157
|
// Initialize empty function node.
|
|
19155
19158
|
|
|
19156
|
-
pp$
|
|
19159
|
+
pp$5.initFunction = function(node) {
|
|
19157
19160
|
node.id = null;
|
|
19158
19161
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19159
19162
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19161,7 +19164,7 @@ pp$4.initFunction = function(node) {
|
|
|
19161
19164
|
|
|
19162
19165
|
// Parse object or class method.
|
|
19163
19166
|
|
|
19164
|
-
pp$
|
|
19167
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19165
19168
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19166
19169
|
|
|
19167
19170
|
this.initFunction(node);
|
|
@@ -19175,8 +19178,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19175
19178
|
this.awaitIdentPos = 0;
|
|
19176
19179
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19177
19180
|
|
|
19178
|
-
this.expect(types.parenL);
|
|
19179
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19181
|
+
this.expect(types$1.parenL);
|
|
19182
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19180
19183
|
this.checkYieldAwaitInDefaultParams();
|
|
19181
19184
|
this.parseFunctionBody(node, false, true, false);
|
|
19182
19185
|
|
|
@@ -19188,7 +19191,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19188
19191
|
|
|
19189
19192
|
// Parse arrow function expression with given parameters.
|
|
19190
19193
|
|
|
19191
|
-
pp$
|
|
19194
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19192
19195
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19193
19196
|
|
|
19194
19197
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19210,8 +19213,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19210
19213
|
|
|
19211
19214
|
// Parse function body and check parameters.
|
|
19212
19215
|
|
|
19213
|
-
pp$
|
|
19214
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19216
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19217
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19215
19218
|
var oldStrict = this.strict, useStrict = false;
|
|
19216
19219
|
|
|
19217
19220
|
if (isExpression) {
|
|
@@ -19247,7 +19250,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19247
19250
|
this.exitScope();
|
|
19248
19251
|
};
|
|
19249
19252
|
|
|
19250
|
-
pp$
|
|
19253
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19251
19254
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19252
19255
|
{
|
|
19253
19256
|
var param = list[i];
|
|
@@ -19260,7 +19263,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19260
19263
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19261
19264
|
// or "arguments" and duplicate parameters.
|
|
19262
19265
|
|
|
19263
|
-
pp$
|
|
19266
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19264
19267
|
var nameHash = Object.create(null);
|
|
19265
19268
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19266
19269
|
{
|
|
@@ -19276,20 +19279,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19276
19279
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19277
19280
|
// for array literals).
|
|
19278
19281
|
|
|
19279
|
-
pp$
|
|
19282
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19280
19283
|
var elts = [], first = true;
|
|
19281
19284
|
while (!this.eat(close)) {
|
|
19282
19285
|
if (!first) {
|
|
19283
|
-
this.expect(types.comma);
|
|
19286
|
+
this.expect(types$1.comma);
|
|
19284
19287
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19285
19288
|
} else { first = false; }
|
|
19286
19289
|
|
|
19287
19290
|
var elt = (void 0);
|
|
19288
|
-
if (allowEmpty && this.type === types.comma)
|
|
19291
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19289
19292
|
{ elt = null; }
|
|
19290
|
-
else if (this.type === types.ellipsis) {
|
|
19293
|
+
else if (this.type === types$1.ellipsis) {
|
|
19291
19294
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19292
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19295
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19293
19296
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19294
19297
|
} else {
|
|
19295
19298
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19299,7 +19302,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19299
19302
|
return elts
|
|
19300
19303
|
};
|
|
19301
19304
|
|
|
19302
|
-
pp$
|
|
19305
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19303
19306
|
var start = ref.start;
|
|
19304
19307
|
var end = ref.end;
|
|
19305
19308
|
var name = ref.name;
|
|
@@ -19328,9 +19331,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19328
19331
|
// when parsing properties), it will also convert keywords into
|
|
19329
19332
|
// identifiers.
|
|
19330
19333
|
|
|
19331
|
-
pp$
|
|
19334
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19332
19335
|
var node = this.startNode();
|
|
19333
|
-
if (this.type === types.name) {
|
|
19336
|
+
if (this.type === types$1.name) {
|
|
19334
19337
|
node.name = this.value;
|
|
19335
19338
|
} else if (this.type.keyword) {
|
|
19336
19339
|
node.name = this.type.keyword;
|
|
@@ -19356,9 +19359,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19356
19359
|
return node
|
|
19357
19360
|
};
|
|
19358
19361
|
|
|
19359
|
-
pp$
|
|
19362
|
+
pp$5.parsePrivateIdent = function() {
|
|
19360
19363
|
var node = this.startNode();
|
|
19361
|
-
if (this.type === types.privateId) {
|
|
19364
|
+
if (this.type === types$1.privateId) {
|
|
19362
19365
|
node.name = this.value;
|
|
19363
19366
|
} else {
|
|
19364
19367
|
this.unexpected();
|
|
@@ -19378,22 +19381,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19378
19381
|
|
|
19379
19382
|
// Parses yield expression inside generator.
|
|
19380
19383
|
|
|
19381
|
-
pp$
|
|
19384
|
+
pp$5.parseYield = function(forInit) {
|
|
19382
19385
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19383
19386
|
|
|
19384
19387
|
var node = this.startNode();
|
|
19385
19388
|
this.next();
|
|
19386
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19389
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19387
19390
|
node.delegate = false;
|
|
19388
19391
|
node.argument = null;
|
|
19389
19392
|
} else {
|
|
19390
|
-
node.delegate = this.eat(types.star);
|
|
19393
|
+
node.delegate = this.eat(types$1.star);
|
|
19391
19394
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19392
19395
|
}
|
|
19393
19396
|
return this.finishNode(node, "YieldExpression")
|
|
19394
19397
|
};
|
|
19395
19398
|
|
|
19396
|
-
pp$
|
|
19399
|
+
pp$5.parseAwait = function(forInit) {
|
|
19397
19400
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19398
19401
|
|
|
19399
19402
|
var node = this.startNode();
|
|
@@ -19402,7 +19405,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19402
19405
|
return this.finishNode(node, "AwaitExpression")
|
|
19403
19406
|
};
|
|
19404
19407
|
|
|
19405
|
-
var pp$
|
|
19408
|
+
var pp$4 = Parser.prototype;
|
|
19406
19409
|
|
|
19407
19410
|
// This function is used to raise exceptions on parse errors. It
|
|
19408
19411
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19410,7 +19413,7 @@ var pp$5 = Parser.prototype;
|
|
|
19410
19413
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19411
19414
|
// message.
|
|
19412
19415
|
|
|
19413
|
-
pp$
|
|
19416
|
+
pp$4.raise = function(pos, message) {
|
|
19414
19417
|
var loc = getLineInfo(this.input, pos);
|
|
19415
19418
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19416
19419
|
var err = new SyntaxError(message);
|
|
@@ -19418,15 +19421,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19418
19421
|
throw err
|
|
19419
19422
|
};
|
|
19420
19423
|
|
|
19421
|
-
pp$
|
|
19424
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19422
19425
|
|
|
19423
|
-
pp$
|
|
19426
|
+
pp$4.curPosition = function() {
|
|
19424
19427
|
if (this.options.locations) {
|
|
19425
19428
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19426
19429
|
}
|
|
19427
19430
|
};
|
|
19428
19431
|
|
|
19429
|
-
var pp$
|
|
19432
|
+
var pp$3 = Parser.prototype;
|
|
19430
19433
|
|
|
19431
19434
|
var Scope = function Scope(flags) {
|
|
19432
19435
|
this.flags = flags;
|
|
@@ -19442,22 +19445,22 @@ var Scope = function Scope(flags) {
|
|
|
19442
19445
|
|
|
19443
19446
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19444
19447
|
|
|
19445
|
-
pp$
|
|
19448
|
+
pp$3.enterScope = function(flags) {
|
|
19446
19449
|
this.scopeStack.push(new Scope(flags));
|
|
19447
19450
|
};
|
|
19448
19451
|
|
|
19449
|
-
pp$
|
|
19452
|
+
pp$3.exitScope = function() {
|
|
19450
19453
|
this.scopeStack.pop();
|
|
19451
19454
|
};
|
|
19452
19455
|
|
|
19453
19456
|
// The spec says:
|
|
19454
19457
|
// > At the top level of a function, or script, function declarations are
|
|
19455
19458
|
// > treated like var declarations rather than like lexical declarations.
|
|
19456
|
-
pp$
|
|
19459
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19457
19460
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19458
19461
|
};
|
|
19459
19462
|
|
|
19460
|
-
pp$
|
|
19463
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19461
19464
|
var redeclared = false;
|
|
19462
19465
|
if (bindingType === BIND_LEXICAL) {
|
|
19463
19466
|
var scope = this.currentScope();
|
|
@@ -19492,7 +19495,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19492
19495
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19493
19496
|
};
|
|
19494
19497
|
|
|
19495
|
-
pp$
|
|
19498
|
+
pp$3.checkLocalExport = function(id) {
|
|
19496
19499
|
// scope.functions must be empty as Module code is always strict.
|
|
19497
19500
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19498
19501
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19500,11 +19503,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19500
19503
|
}
|
|
19501
19504
|
};
|
|
19502
19505
|
|
|
19503
|
-
pp$
|
|
19506
|
+
pp$3.currentScope = function() {
|
|
19504
19507
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19505
19508
|
};
|
|
19506
19509
|
|
|
19507
|
-
pp$
|
|
19510
|
+
pp$3.currentVarScope = function() {
|
|
19508
19511
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19509
19512
|
var scope = this.scopeStack[i];
|
|
19510
19513
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19512,7 +19515,7 @@ pp$6.currentVarScope = function() {
|
|
|
19512
19515
|
};
|
|
19513
19516
|
|
|
19514
19517
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19515
|
-
pp$
|
|
19518
|
+
pp$3.currentThisScope = function() {
|
|
19516
19519
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19517
19520
|
var scope = this.scopeStack[i];
|
|
19518
19521
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19533,13 +19536,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19533
19536
|
|
|
19534
19537
|
// Start an AST node, attaching a start offset.
|
|
19535
19538
|
|
|
19536
|
-
var pp$
|
|
19539
|
+
var pp$2 = Parser.prototype;
|
|
19537
19540
|
|
|
19538
|
-
pp$
|
|
19541
|
+
pp$2.startNode = function() {
|
|
19539
19542
|
return new Node(this, this.start, this.startLoc)
|
|
19540
19543
|
};
|
|
19541
19544
|
|
|
19542
|
-
pp$
|
|
19545
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19543
19546
|
return new Node(this, pos, loc)
|
|
19544
19547
|
};
|
|
19545
19548
|
|
|
@@ -19555,17 +19558,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19555
19558
|
return node
|
|
19556
19559
|
}
|
|
19557
19560
|
|
|
19558
|
-
pp$
|
|
19561
|
+
pp$2.finishNode = function(node, type) {
|
|
19559
19562
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19560
19563
|
};
|
|
19561
19564
|
|
|
19562
19565
|
// Finish node at given position
|
|
19563
19566
|
|
|
19564
|
-
pp$
|
|
19567
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19565
19568
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19566
19569
|
};
|
|
19567
19570
|
|
|
19568
|
-
pp$
|
|
19571
|
+
pp$2.copyNode = function(node) {
|
|
19569
19572
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19570
19573
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19571
19574
|
return newNode
|
|
@@ -19622,7 +19625,7 @@ buildUnicodeData(10);
|
|
|
19622
19625
|
buildUnicodeData(11);
|
|
19623
19626
|
buildUnicodeData(12);
|
|
19624
19627
|
|
|
19625
|
-
var pp$
|
|
19628
|
+
var pp$1 = Parser.prototype;
|
|
19626
19629
|
|
|
19627
19630
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19628
19631
|
this.parser = parser;
|
|
@@ -19718,7 +19721,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19718
19721
|
return false
|
|
19719
19722
|
};
|
|
19720
19723
|
|
|
19721
|
-
function codePointToString(ch) {
|
|
19724
|
+
function codePointToString$1(ch) {
|
|
19722
19725
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19723
19726
|
ch -= 0x10000;
|
|
19724
19727
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19730,7 +19733,7 @@ function codePointToString(ch) {
|
|
|
19730
19733
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19731
19734
|
* @returns {void}
|
|
19732
19735
|
*/
|
|
19733
|
-
pp$
|
|
19736
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19734
19737
|
var validFlags = state.validFlags;
|
|
19735
19738
|
var flags = state.flags;
|
|
19736
19739
|
|
|
@@ -19751,7 +19754,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19751
19754
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19752
19755
|
* @returns {void}
|
|
19753
19756
|
*/
|
|
19754
|
-
pp$
|
|
19757
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19755
19758
|
this.regexp_pattern(state);
|
|
19756
19759
|
|
|
19757
19760
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19766,7 +19769,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19766
19769
|
};
|
|
19767
19770
|
|
|
19768
19771
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19769
|
-
pp$
|
|
19772
|
+
pp$1.regexp_pattern = function(state) {
|
|
19770
19773
|
state.pos = 0;
|
|
19771
19774
|
state.lastIntValue = 0;
|
|
19772
19775
|
state.lastStringValue = "";
|
|
@@ -19800,7 +19803,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19800
19803
|
};
|
|
19801
19804
|
|
|
19802
19805
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19803
|
-
pp$
|
|
19806
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19804
19807
|
this.regexp_alternative(state);
|
|
19805
19808
|
while (state.eat(0x7C /* | */)) {
|
|
19806
19809
|
this.regexp_alternative(state);
|
|
@@ -19816,13 +19819,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19816
19819
|
};
|
|
19817
19820
|
|
|
19818
19821
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19819
|
-
pp$
|
|
19822
|
+
pp$1.regexp_alternative = function(state) {
|
|
19820
19823
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19821
19824
|
{ }
|
|
19822
19825
|
};
|
|
19823
19826
|
|
|
19824
19827
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19825
|
-
pp$
|
|
19828
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19826
19829
|
if (this.regexp_eatAssertion(state)) {
|
|
19827
19830
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19828
19831
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19845,7 +19848,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19845
19848
|
};
|
|
19846
19849
|
|
|
19847
19850
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19848
|
-
pp$
|
|
19851
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19849
19852
|
var start = state.pos;
|
|
19850
19853
|
state.lastAssertionIsQuantifiable = false;
|
|
19851
19854
|
|
|
@@ -19883,7 +19886,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
19883
19886
|
};
|
|
19884
19887
|
|
|
19885
19888
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
19886
|
-
pp$
|
|
19889
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
19887
19890
|
if ( noError === void 0 ) noError = false;
|
|
19888
19891
|
|
|
19889
19892
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -19894,7 +19897,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
19894
19897
|
};
|
|
19895
19898
|
|
|
19896
19899
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
19897
|
-
pp$
|
|
19900
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
19898
19901
|
return (
|
|
19899
19902
|
state.eat(0x2A /* * */) ||
|
|
19900
19903
|
state.eat(0x2B /* + */) ||
|
|
@@ -19902,7 +19905,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
19902
19905
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
19903
19906
|
)
|
|
19904
19907
|
};
|
|
19905
|
-
pp$
|
|
19908
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
19906
19909
|
var start = state.pos;
|
|
19907
19910
|
if (state.eat(0x7B /* { */)) {
|
|
19908
19911
|
var min = 0, max = -1;
|
|
@@ -19928,7 +19931,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
19928
19931
|
};
|
|
19929
19932
|
|
|
19930
19933
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
19931
|
-
pp$
|
|
19934
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
19932
19935
|
return (
|
|
19933
19936
|
this.regexp_eatPatternCharacters(state) ||
|
|
19934
19937
|
state.eat(0x2E /* . */) ||
|
|
@@ -19938,7 +19941,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
19938
19941
|
this.regexp_eatCapturingGroup(state)
|
|
19939
19942
|
)
|
|
19940
19943
|
};
|
|
19941
|
-
pp$
|
|
19944
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
19942
19945
|
var start = state.pos;
|
|
19943
19946
|
if (state.eat(0x5C /* \ */)) {
|
|
19944
19947
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -19948,7 +19951,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
19948
19951
|
}
|
|
19949
19952
|
return false
|
|
19950
19953
|
};
|
|
19951
|
-
pp$
|
|
19954
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
19952
19955
|
var start = state.pos;
|
|
19953
19956
|
if (state.eat(0x28 /* ( */)) {
|
|
19954
19957
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -19962,7 +19965,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
19962
19965
|
}
|
|
19963
19966
|
return false
|
|
19964
19967
|
};
|
|
19965
|
-
pp$
|
|
19968
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
19966
19969
|
if (state.eat(0x28 /* ( */)) {
|
|
19967
19970
|
if (this.options.ecmaVersion >= 9) {
|
|
19968
19971
|
this.regexp_groupSpecifier(state);
|
|
@@ -19980,7 +19983,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
19980
19983
|
};
|
|
19981
19984
|
|
|
19982
19985
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
19983
|
-
pp$
|
|
19986
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
19984
19987
|
return (
|
|
19985
19988
|
state.eat(0x2E /* . */) ||
|
|
19986
19989
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -19993,7 +19996,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
19993
19996
|
};
|
|
19994
19997
|
|
|
19995
19998
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
19996
|
-
pp$
|
|
19999
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
19997
20000
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
19998
20001
|
state.raise("Nothing to repeat");
|
|
19999
20002
|
}
|
|
@@ -20001,7 +20004,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
20001
20004
|
};
|
|
20002
20005
|
|
|
20003
20006
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
20004
|
-
pp$
|
|
20007
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
20005
20008
|
var ch = state.current();
|
|
20006
20009
|
if (isSyntaxCharacter(ch)) {
|
|
20007
20010
|
state.lastIntValue = ch;
|
|
@@ -20023,7 +20026,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20023
20026
|
|
|
20024
20027
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20025
20028
|
// But eat eager.
|
|
20026
|
-
pp$
|
|
20029
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20027
20030
|
var start = state.pos;
|
|
20028
20031
|
var ch = 0;
|
|
20029
20032
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20033,7 +20036,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20033
20036
|
};
|
|
20034
20037
|
|
|
20035
20038
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20036
|
-
pp$
|
|
20039
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20037
20040
|
var ch = state.current();
|
|
20038
20041
|
if (
|
|
20039
20042
|
ch !== -1 &&
|
|
@@ -20054,7 +20057,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20054
20057
|
// GroupSpecifier ::
|
|
20055
20058
|
// [empty]
|
|
20056
20059
|
// `?` GroupName
|
|
20057
|
-
pp$
|
|
20060
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20058
20061
|
if (state.eat(0x3F /* ? */)) {
|
|
20059
20062
|
if (this.regexp_eatGroupName(state)) {
|
|
20060
20063
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20070,7 +20073,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20070
20073
|
// GroupName ::
|
|
20071
20074
|
// `<` RegExpIdentifierName `>`
|
|
20072
20075
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20073
|
-
pp$
|
|
20076
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20074
20077
|
state.lastStringValue = "";
|
|
20075
20078
|
if (state.eat(0x3C /* < */)) {
|
|
20076
20079
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20085,12 +20088,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20085
20088
|
// RegExpIdentifierStart
|
|
20086
20089
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20087
20090
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20088
|
-
pp$
|
|
20091
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20089
20092
|
state.lastStringValue = "";
|
|
20090
20093
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20091
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20094
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20092
20095
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20093
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20096
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20094
20097
|
}
|
|
20095
20098
|
return true
|
|
20096
20099
|
}
|
|
@@ -20102,7 +20105,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20102
20105
|
// `$`
|
|
20103
20106
|
// `_`
|
|
20104
20107
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20105
|
-
pp$
|
|
20108
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20106
20109
|
var start = state.pos;
|
|
20107
20110
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20108
20111
|
var ch = state.current(forceU);
|
|
@@ -20130,7 +20133,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20130
20133
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20131
20134
|
// <ZWNJ>
|
|
20132
20135
|
// <ZWJ>
|
|
20133
|
-
pp$
|
|
20136
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20134
20137
|
var start = state.pos;
|
|
20135
20138
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20136
20139
|
var ch = state.current(forceU);
|
|
@@ -20152,7 +20155,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20152
20155
|
}
|
|
20153
20156
|
|
|
20154
20157
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20155
|
-
pp$
|
|
20158
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20156
20159
|
if (
|
|
20157
20160
|
this.regexp_eatBackReference(state) ||
|
|
20158
20161
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20170,7 +20173,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20170
20173
|
}
|
|
20171
20174
|
return false
|
|
20172
20175
|
};
|
|
20173
|
-
pp$
|
|
20176
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20174
20177
|
var start = state.pos;
|
|
20175
20178
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20176
20179
|
var n = state.lastIntValue;
|
|
@@ -20188,7 +20191,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20188
20191
|
}
|
|
20189
20192
|
return false
|
|
20190
20193
|
};
|
|
20191
|
-
pp$
|
|
20194
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20192
20195
|
if (state.eat(0x6B /* k */)) {
|
|
20193
20196
|
if (this.regexp_eatGroupName(state)) {
|
|
20194
20197
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20200,7 +20203,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20200
20203
|
};
|
|
20201
20204
|
|
|
20202
20205
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20203
|
-
pp$
|
|
20206
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20204
20207
|
return (
|
|
20205
20208
|
this.regexp_eatControlEscape(state) ||
|
|
20206
20209
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20211,7 +20214,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20211
20214
|
this.regexp_eatIdentityEscape(state)
|
|
20212
20215
|
)
|
|
20213
20216
|
};
|
|
20214
|
-
pp$
|
|
20217
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20215
20218
|
var start = state.pos;
|
|
20216
20219
|
if (state.eat(0x63 /* c */)) {
|
|
20217
20220
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20221,7 +20224,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20221
20224
|
}
|
|
20222
20225
|
return false
|
|
20223
20226
|
};
|
|
20224
|
-
pp$
|
|
20227
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20225
20228
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20226
20229
|
state.lastIntValue = 0;
|
|
20227
20230
|
state.advance();
|
|
@@ -20231,7 +20234,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20231
20234
|
};
|
|
20232
20235
|
|
|
20233
20236
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20234
|
-
pp$
|
|
20237
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20235
20238
|
var ch = state.current();
|
|
20236
20239
|
if (ch === 0x74 /* t */) {
|
|
20237
20240
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20262,7 +20265,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20262
20265
|
};
|
|
20263
20266
|
|
|
20264
20267
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20265
|
-
pp$
|
|
20268
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20266
20269
|
var ch = state.current();
|
|
20267
20270
|
if (isControlLetter(ch)) {
|
|
20268
20271
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20279,7 +20282,7 @@ function isControlLetter(ch) {
|
|
|
20279
20282
|
}
|
|
20280
20283
|
|
|
20281
20284
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20282
|
-
pp$
|
|
20285
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20283
20286
|
if ( forceU === void 0 ) forceU = false;
|
|
20284
20287
|
|
|
20285
20288
|
var start = state.pos;
|
|
@@ -20324,7 +20327,7 @@ function isValidUnicode(ch) {
|
|
|
20324
20327
|
}
|
|
20325
20328
|
|
|
20326
20329
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20327
|
-
pp$
|
|
20330
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20328
20331
|
if (state.switchU) {
|
|
20329
20332
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20330
20333
|
return true
|
|
@@ -20347,7 +20350,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20347
20350
|
};
|
|
20348
20351
|
|
|
20349
20352
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20350
|
-
pp$
|
|
20353
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20351
20354
|
state.lastIntValue = 0;
|
|
20352
20355
|
var ch = state.current();
|
|
20353
20356
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20361,7 +20364,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20361
20364
|
};
|
|
20362
20365
|
|
|
20363
20366
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20364
|
-
pp$
|
|
20367
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20365
20368
|
var ch = state.current();
|
|
20366
20369
|
|
|
20367
20370
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20403,7 +20406,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20403
20406
|
// UnicodePropertyValueExpression ::
|
|
20404
20407
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20405
20408
|
// LoneUnicodePropertyNameOrValue
|
|
20406
|
-
pp$
|
|
20409
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20407
20410
|
var start = state.pos;
|
|
20408
20411
|
|
|
20409
20412
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20425,24 +20428,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20425
20428
|
}
|
|
20426
20429
|
return false
|
|
20427
20430
|
};
|
|
20428
|
-
pp$
|
|
20431
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20429
20432
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20430
20433
|
{ state.raise("Invalid property name"); }
|
|
20431
20434
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20432
20435
|
{ state.raise("Invalid property value"); }
|
|
20433
20436
|
};
|
|
20434
|
-
pp$
|
|
20437
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20435
20438
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20436
20439
|
{ state.raise("Invalid property name"); }
|
|
20437
20440
|
};
|
|
20438
20441
|
|
|
20439
20442
|
// UnicodePropertyName ::
|
|
20440
20443
|
// UnicodePropertyNameCharacters
|
|
20441
|
-
pp$
|
|
20444
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20442
20445
|
var ch = 0;
|
|
20443
20446
|
state.lastStringValue = "";
|
|
20444
20447
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20445
|
-
state.lastStringValue += codePointToString(ch);
|
|
20448
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20446
20449
|
state.advance();
|
|
20447
20450
|
}
|
|
20448
20451
|
return state.lastStringValue !== ""
|
|
@@ -20453,11 +20456,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20453
20456
|
|
|
20454
20457
|
// UnicodePropertyValue ::
|
|
20455
20458
|
// UnicodePropertyValueCharacters
|
|
20456
|
-
pp$
|
|
20459
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20457
20460
|
var ch = 0;
|
|
20458
20461
|
state.lastStringValue = "";
|
|
20459
20462
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20460
|
-
state.lastStringValue += codePointToString(ch);
|
|
20463
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20461
20464
|
state.advance();
|
|
20462
20465
|
}
|
|
20463
20466
|
return state.lastStringValue !== ""
|
|
@@ -20468,12 +20471,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20468
20471
|
|
|
20469
20472
|
// LoneUnicodePropertyNameOrValue ::
|
|
20470
20473
|
// UnicodePropertyValueCharacters
|
|
20471
|
-
pp$
|
|
20474
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20472
20475
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20473
20476
|
};
|
|
20474
20477
|
|
|
20475
20478
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20476
|
-
pp$
|
|
20479
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20477
20480
|
if (state.eat(0x5B /* [ */)) {
|
|
20478
20481
|
state.eat(0x5E /* ^ */);
|
|
20479
20482
|
this.regexp_classRanges(state);
|
|
@@ -20489,7 +20492,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20489
20492
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20490
20493
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20491
20494
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20492
|
-
pp$
|
|
20495
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20493
20496
|
while (this.regexp_eatClassAtom(state)) {
|
|
20494
20497
|
var left = state.lastIntValue;
|
|
20495
20498
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20506,7 +20509,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20506
20509
|
|
|
20507
20510
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20508
20511
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20509
|
-
pp$
|
|
20512
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20510
20513
|
var start = state.pos;
|
|
20511
20514
|
|
|
20512
20515
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20535,7 +20538,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20535
20538
|
};
|
|
20536
20539
|
|
|
20537
20540
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20538
|
-
pp$
|
|
20541
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20539
20542
|
var start = state.pos;
|
|
20540
20543
|
|
|
20541
20544
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20562,7 +20565,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20562
20565
|
};
|
|
20563
20566
|
|
|
20564
20567
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20565
|
-
pp$
|
|
20568
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20566
20569
|
var ch = state.current();
|
|
20567
20570
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20568
20571
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20573,7 +20576,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20573
20576
|
};
|
|
20574
20577
|
|
|
20575
20578
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20576
|
-
pp$
|
|
20579
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20577
20580
|
var start = state.pos;
|
|
20578
20581
|
if (state.eat(0x78 /* x */)) {
|
|
20579
20582
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20588,7 +20591,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20588
20591
|
};
|
|
20589
20592
|
|
|
20590
20593
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20591
|
-
pp$
|
|
20594
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20592
20595
|
var start = state.pos;
|
|
20593
20596
|
var ch = 0;
|
|
20594
20597
|
state.lastIntValue = 0;
|
|
@@ -20603,7 +20606,7 @@ function isDecimalDigit(ch) {
|
|
|
20603
20606
|
}
|
|
20604
20607
|
|
|
20605
20608
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20606
|
-
pp$
|
|
20609
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20607
20610
|
var start = state.pos;
|
|
20608
20611
|
var ch = 0;
|
|
20609
20612
|
state.lastIntValue = 0;
|
|
@@ -20632,7 +20635,7 @@ function hexToInt(ch) {
|
|
|
20632
20635
|
|
|
20633
20636
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20634
20637
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20635
|
-
pp$
|
|
20638
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20636
20639
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20637
20640
|
var n1 = state.lastIntValue;
|
|
20638
20641
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20651,7 +20654,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20651
20654
|
};
|
|
20652
20655
|
|
|
20653
20656
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20654
|
-
pp$
|
|
20657
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20655
20658
|
var ch = state.current();
|
|
20656
20659
|
if (isOctalDigit(ch)) {
|
|
20657
20660
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20668,7 +20671,7 @@ function isOctalDigit(ch) {
|
|
|
20668
20671
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20669
20672
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20670
20673
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20671
|
-
pp$
|
|
20674
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20672
20675
|
var start = state.pos;
|
|
20673
20676
|
state.lastIntValue = 0;
|
|
20674
20677
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20700,11 +20703,11 @@ var Token = function Token(p) {
|
|
|
20700
20703
|
|
|
20701
20704
|
// ## Tokenizer
|
|
20702
20705
|
|
|
20703
|
-
var pp
|
|
20706
|
+
var pp = Parser.prototype;
|
|
20704
20707
|
|
|
20705
20708
|
// Move to the next token
|
|
20706
20709
|
|
|
20707
|
-
pp
|
|
20710
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20708
20711
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20709
20712
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20710
20713
|
if (this.options.onToken)
|
|
@@ -20717,21 +20720,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20717
20720
|
this.nextToken();
|
|
20718
20721
|
};
|
|
20719
20722
|
|
|
20720
|
-
pp
|
|
20723
|
+
pp.getToken = function() {
|
|
20721
20724
|
this.next();
|
|
20722
20725
|
return new Token(this)
|
|
20723
20726
|
};
|
|
20724
20727
|
|
|
20725
20728
|
// If we're in an ES6 environment, make parsers iterable
|
|
20726
20729
|
if (typeof Symbol !== "undefined")
|
|
20727
|
-
{ pp
|
|
20730
|
+
{ pp[Symbol.iterator] = function() {
|
|
20728
20731
|
var this$1$1 = this;
|
|
20729
20732
|
|
|
20730
20733
|
return {
|
|
20731
20734
|
next: function () {
|
|
20732
20735
|
var token = this$1$1.getToken();
|
|
20733
20736
|
return {
|
|
20734
|
-
done: token.type === types.eof,
|
|
20737
|
+
done: token.type === types$1.eof,
|
|
20735
20738
|
value: token
|
|
20736
20739
|
}
|
|
20737
20740
|
}
|
|
@@ -20744,19 +20747,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20744
20747
|
// Read a single token, updating the parser object's token-related
|
|
20745
20748
|
// properties.
|
|
20746
20749
|
|
|
20747
|
-
pp
|
|
20750
|
+
pp.nextToken = function() {
|
|
20748
20751
|
var curContext = this.curContext();
|
|
20749
20752
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20750
20753
|
|
|
20751
20754
|
this.start = this.pos;
|
|
20752
20755
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20753
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20756
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20754
20757
|
|
|
20755
20758
|
if (curContext.override) { return curContext.override(this) }
|
|
20756
20759
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20757
20760
|
};
|
|
20758
20761
|
|
|
20759
|
-
pp
|
|
20762
|
+
pp.readToken = function(code) {
|
|
20760
20763
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20761
20764
|
// identifiers, so '\' also dispatches to that.
|
|
20762
20765
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20765,14 +20768,14 @@ pp$9.readToken = function(code) {
|
|
|
20765
20768
|
return this.getTokenFromCode(code)
|
|
20766
20769
|
};
|
|
20767
20770
|
|
|
20768
|
-
pp
|
|
20771
|
+
pp.fullCharCodeAtPos = function() {
|
|
20769
20772
|
var code = this.input.charCodeAt(this.pos);
|
|
20770
20773
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20771
20774
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20772
20775
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20773
20776
|
};
|
|
20774
20777
|
|
|
20775
|
-
pp
|
|
20778
|
+
pp.skipBlockComment = function() {
|
|
20776
20779
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20777
20780
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20778
20781
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20790,7 +20793,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20790
20793
|
startLoc, this.curPosition()); }
|
|
20791
20794
|
};
|
|
20792
20795
|
|
|
20793
|
-
pp
|
|
20796
|
+
pp.skipLineComment = function(startSkip) {
|
|
20794
20797
|
var start = this.pos;
|
|
20795
20798
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20796
20799
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20805,7 +20808,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20805
20808
|
// Called at the start of the parse and after every token. Skips
|
|
20806
20809
|
// whitespace and comments, and.
|
|
20807
20810
|
|
|
20808
|
-
pp
|
|
20811
|
+
pp.skipSpace = function() {
|
|
20809
20812
|
loop: while (this.pos < this.input.length) {
|
|
20810
20813
|
var ch = this.input.charCodeAt(this.pos);
|
|
20811
20814
|
switch (ch) {
|
|
@@ -20850,7 +20853,7 @@ pp$9.skipSpace = function() {
|
|
|
20850
20853
|
// the token, so that the next one's `start` will point at the
|
|
20851
20854
|
// right position.
|
|
20852
20855
|
|
|
20853
|
-
pp
|
|
20856
|
+
pp.finishToken = function(type, val) {
|
|
20854
20857
|
this.end = this.pos;
|
|
20855
20858
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20856
20859
|
var prevType = this.type;
|
|
@@ -20869,62 +20872,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
20869
20872
|
//
|
|
20870
20873
|
// All in the name of speed.
|
|
20871
20874
|
//
|
|
20872
|
-
pp
|
|
20875
|
+
pp.readToken_dot = function() {
|
|
20873
20876
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20874
20877
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
20875
20878
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20876
20879
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
20877
20880
|
this.pos += 3;
|
|
20878
|
-
return this.finishToken(types.ellipsis)
|
|
20881
|
+
return this.finishToken(types$1.ellipsis)
|
|
20879
20882
|
} else {
|
|
20880
20883
|
++this.pos;
|
|
20881
|
-
return this.finishToken(types.dot)
|
|
20884
|
+
return this.finishToken(types$1.dot)
|
|
20882
20885
|
}
|
|
20883
20886
|
};
|
|
20884
20887
|
|
|
20885
|
-
pp
|
|
20888
|
+
pp.readToken_slash = function() { // '/'
|
|
20886
20889
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20887
20890
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
20888
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20889
|
-
return this.finishOp(types.slash, 1)
|
|
20891
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20892
|
+
return this.finishOp(types$1.slash, 1)
|
|
20890
20893
|
};
|
|
20891
20894
|
|
|
20892
|
-
pp
|
|
20895
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
20893
20896
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20894
20897
|
var size = 1;
|
|
20895
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
20898
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
20896
20899
|
|
|
20897
20900
|
// exponentiation operator ** and **=
|
|
20898
20901
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
20899
20902
|
++size;
|
|
20900
|
-
tokentype = types.starstar;
|
|
20903
|
+
tokentype = types$1.starstar;
|
|
20901
20904
|
next = this.input.charCodeAt(this.pos + 2);
|
|
20902
20905
|
}
|
|
20903
20906
|
|
|
20904
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20907
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20905
20908
|
return this.finishOp(tokentype, size)
|
|
20906
20909
|
};
|
|
20907
20910
|
|
|
20908
|
-
pp
|
|
20911
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
20909
20912
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20910
20913
|
if (next === code) {
|
|
20911
20914
|
if (this.options.ecmaVersion >= 12) {
|
|
20912
20915
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20913
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
20916
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20914
20917
|
}
|
|
20915
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
20918
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
20916
20919
|
}
|
|
20917
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20918
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
20920
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20921
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
20919
20922
|
};
|
|
20920
20923
|
|
|
20921
|
-
pp
|
|
20924
|
+
pp.readToken_caret = function() { // '^'
|
|
20922
20925
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20923
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20924
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
20926
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20927
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
20925
20928
|
};
|
|
20926
20929
|
|
|
20927
|
-
pp
|
|
20930
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
20928
20931
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20929
20932
|
if (next === code) {
|
|
20930
20933
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -20934,19 +20937,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
20934
20937
|
this.skipSpace();
|
|
20935
20938
|
return this.nextToken()
|
|
20936
20939
|
}
|
|
20937
|
-
return this.finishOp(types.incDec, 2)
|
|
20940
|
+
return this.finishOp(types$1.incDec, 2)
|
|
20938
20941
|
}
|
|
20939
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20940
|
-
return this.finishOp(types.plusMin, 1)
|
|
20942
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20943
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
20941
20944
|
};
|
|
20942
20945
|
|
|
20943
|
-
pp
|
|
20946
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
20944
20947
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20945
20948
|
var size = 1;
|
|
20946
20949
|
if (next === code) {
|
|
20947
20950
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
20948
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20949
|
-
return this.finishOp(types.bitShift, size)
|
|
20951
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20952
|
+
return this.finishOp(types$1.bitShift, size)
|
|
20950
20953
|
}
|
|
20951
20954
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
20952
20955
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -20956,53 +20959,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
20956
20959
|
return this.nextToken()
|
|
20957
20960
|
}
|
|
20958
20961
|
if (next === 61) { size = 2; }
|
|
20959
|
-
return this.finishOp(types.relational, size)
|
|
20962
|
+
return this.finishOp(types$1.relational, size)
|
|
20960
20963
|
};
|
|
20961
20964
|
|
|
20962
|
-
pp
|
|
20965
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
20963
20966
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20964
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
20967
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
20965
20968
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
20966
20969
|
this.pos += 2;
|
|
20967
|
-
return this.finishToken(types.arrow)
|
|
20970
|
+
return this.finishToken(types$1.arrow)
|
|
20968
20971
|
}
|
|
20969
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
20972
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
20970
20973
|
};
|
|
20971
20974
|
|
|
20972
|
-
pp
|
|
20975
|
+
pp.readToken_question = function() { // '?'
|
|
20973
20976
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20974
20977
|
if (ecmaVersion >= 11) {
|
|
20975
20978
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20976
20979
|
if (next === 46) {
|
|
20977
20980
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20978
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
20981
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
20979
20982
|
}
|
|
20980
20983
|
if (next === 63) {
|
|
20981
20984
|
if (ecmaVersion >= 12) {
|
|
20982
20985
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
20983
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
20986
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20984
20987
|
}
|
|
20985
|
-
return this.finishOp(types.coalesce, 2)
|
|
20988
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
20986
20989
|
}
|
|
20987
20990
|
}
|
|
20988
|
-
return this.finishOp(types.question, 1)
|
|
20991
|
+
return this.finishOp(types$1.question, 1)
|
|
20989
20992
|
};
|
|
20990
20993
|
|
|
20991
|
-
pp
|
|
20994
|
+
pp.readToken_numberSign = function() { // '#'
|
|
20992
20995
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20993
20996
|
var code = 35; // '#'
|
|
20994
20997
|
if (ecmaVersion >= 13) {
|
|
20995
20998
|
++this.pos;
|
|
20996
20999
|
code = this.fullCharCodeAtPos();
|
|
20997
21000
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
20998
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21001
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
20999
21002
|
}
|
|
21000
21003
|
}
|
|
21001
21004
|
|
|
21002
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21005
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21003
21006
|
};
|
|
21004
21007
|
|
|
21005
|
-
pp
|
|
21008
|
+
pp.getTokenFromCode = function(code) {
|
|
21006
21009
|
switch (code) {
|
|
21007
21010
|
// The interpretation of a dot depends on whether it is followed
|
|
21008
21011
|
// by a digit or another two dots.
|
|
@@ -21010,20 +21013,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21010
21013
|
return this.readToken_dot()
|
|
21011
21014
|
|
|
21012
21015
|
// Punctuation tokens.
|
|
21013
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
21014
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
21015
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
21016
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
21017
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
21018
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
21019
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
21020
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
21021
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
21016
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21017
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21018
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21019
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21020
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21021
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21022
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21023
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21024
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21022
21025
|
|
|
21023
21026
|
case 96: // '`'
|
|
21024
21027
|
if (this.options.ecmaVersion < 6) { break }
|
|
21025
21028
|
++this.pos;
|
|
21026
|
-
return this.finishToken(types.backQuote)
|
|
21029
|
+
return this.finishToken(types$1.backQuote)
|
|
21027
21030
|
|
|
21028
21031
|
case 48: // '0'
|
|
21029
21032
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21046,7 +21049,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21046
21049
|
// often referred to. `finishOp` simply skips the amount of
|
|
21047
21050
|
// characters it is given as second argument, and returns a token
|
|
21048
21051
|
// of the type given by its first argument.
|
|
21049
|
-
|
|
21050
21052
|
case 47: // '/'
|
|
21051
21053
|
return this.readToken_slash()
|
|
21052
21054
|
|
|
@@ -21072,22 +21074,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21072
21074
|
return this.readToken_question()
|
|
21073
21075
|
|
|
21074
21076
|
case 126: // '~'
|
|
21075
|
-
return this.finishOp(types.prefix, 1)
|
|
21077
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21076
21078
|
|
|
21077
21079
|
case 35: // '#'
|
|
21078
21080
|
return this.readToken_numberSign()
|
|
21079
21081
|
}
|
|
21080
21082
|
|
|
21081
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21083
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21082
21084
|
};
|
|
21083
21085
|
|
|
21084
|
-
pp
|
|
21086
|
+
pp.finishOp = function(type, size) {
|
|
21085
21087
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21086
21088
|
this.pos += size;
|
|
21087
21089
|
return this.finishToken(type, str)
|
|
21088
21090
|
};
|
|
21089
21091
|
|
|
21090
|
-
pp
|
|
21092
|
+
pp.readRegexp = function() {
|
|
21091
21093
|
var escaped, inClass, start = this.pos;
|
|
21092
21094
|
for (;;) {
|
|
21093
21095
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21122,14 +21124,14 @@ pp$9.readRegexp = function() {
|
|
|
21122
21124
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21123
21125
|
}
|
|
21124
21126
|
|
|
21125
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21127
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21126
21128
|
};
|
|
21127
21129
|
|
|
21128
21130
|
// Read an integer in the given radix. Return null if zero digits
|
|
21129
21131
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21130
21132
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21131
21133
|
|
|
21132
|
-
pp
|
|
21134
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21133
21135
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21134
21136
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21135
21137
|
|
|
@@ -21183,7 +21185,7 @@ function stringToBigInt(str) {
|
|
|
21183
21185
|
return BigInt(str.replace(/_/g, ""))
|
|
21184
21186
|
}
|
|
21185
21187
|
|
|
21186
|
-
pp
|
|
21188
|
+
pp.readRadixNumber = function(radix) {
|
|
21187
21189
|
var start = this.pos;
|
|
21188
21190
|
this.pos += 2; // 0x
|
|
21189
21191
|
var val = this.readInt(radix);
|
|
@@ -21192,12 +21194,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21192
21194
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21193
21195
|
++this.pos;
|
|
21194
21196
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21195
|
-
return this.finishToken(types.num, val)
|
|
21197
|
+
return this.finishToken(types$1.num, val)
|
|
21196
21198
|
};
|
|
21197
21199
|
|
|
21198
21200
|
// Read an integer, octal integer, or floating-point number.
|
|
21199
21201
|
|
|
21200
|
-
pp
|
|
21202
|
+
pp.readNumber = function(startsWithDot) {
|
|
21201
21203
|
var start = this.pos;
|
|
21202
21204
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21203
21205
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21207,7 +21209,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21207
21209
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21208
21210
|
++this.pos;
|
|
21209
21211
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21210
|
-
return this.finishToken(types.num, val$1)
|
|
21212
|
+
return this.finishToken(types$1.num, val$1)
|
|
21211
21213
|
}
|
|
21212
21214
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21213
21215
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21223,12 +21225,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21223
21225
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21224
21226
|
|
|
21225
21227
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21226
|
-
return this.finishToken(types.num, val)
|
|
21228
|
+
return this.finishToken(types$1.num, val)
|
|
21227
21229
|
};
|
|
21228
21230
|
|
|
21229
21231
|
// Read a string value, interpreting backslash-escapes.
|
|
21230
21232
|
|
|
21231
|
-
pp
|
|
21233
|
+
pp.readCodePoint = function() {
|
|
21232
21234
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21233
21235
|
|
|
21234
21236
|
if (ch === 123) { // '{'
|
|
@@ -21243,14 +21245,14 @@ pp$9.readCodePoint = function() {
|
|
|
21243
21245
|
return code
|
|
21244
21246
|
};
|
|
21245
21247
|
|
|
21246
|
-
function codePointToString
|
|
21248
|
+
function codePointToString(code) {
|
|
21247
21249
|
// UTF-16 Decoding
|
|
21248
21250
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21249
21251
|
code -= 0x10000;
|
|
21250
21252
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21251
21253
|
}
|
|
21252
21254
|
|
|
21253
|
-
pp
|
|
21255
|
+
pp.readString = function(quote) {
|
|
21254
21256
|
var out = "", chunkStart = ++this.pos;
|
|
21255
21257
|
for (;;) {
|
|
21256
21258
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21273,14 +21275,14 @@ pp$9.readString = function(quote) {
|
|
|
21273
21275
|
}
|
|
21274
21276
|
}
|
|
21275
21277
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21276
|
-
return this.finishToken(types.string, out)
|
|
21278
|
+
return this.finishToken(types$1.string, out)
|
|
21277
21279
|
};
|
|
21278
21280
|
|
|
21279
21281
|
// Reads template string tokens.
|
|
21280
21282
|
|
|
21281
21283
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21282
21284
|
|
|
21283
|
-
pp
|
|
21285
|
+
pp.tryReadTemplateToken = function() {
|
|
21284
21286
|
this.inTemplateElement = true;
|
|
21285
21287
|
try {
|
|
21286
21288
|
this.readTmplToken();
|
|
@@ -21295,7 +21297,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21295
21297
|
this.inTemplateElement = false;
|
|
21296
21298
|
};
|
|
21297
21299
|
|
|
21298
|
-
pp
|
|
21300
|
+
pp.invalidStringToken = function(position, message) {
|
|
21299
21301
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21300
21302
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21301
21303
|
} else {
|
|
@@ -21303,23 +21305,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21303
21305
|
}
|
|
21304
21306
|
};
|
|
21305
21307
|
|
|
21306
|
-
pp
|
|
21308
|
+
pp.readTmplToken = function() {
|
|
21307
21309
|
var out = "", chunkStart = this.pos;
|
|
21308
21310
|
for (;;) {
|
|
21309
21311
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21310
21312
|
var ch = this.input.charCodeAt(this.pos);
|
|
21311
21313
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
21312
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
21314
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21313
21315
|
if (ch === 36) {
|
|
21314
21316
|
this.pos += 2;
|
|
21315
|
-
return this.finishToken(types.dollarBraceL)
|
|
21317
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21316
21318
|
} else {
|
|
21317
21319
|
++this.pos;
|
|
21318
|
-
return this.finishToken(types.backQuote)
|
|
21320
|
+
return this.finishToken(types$1.backQuote)
|
|
21319
21321
|
}
|
|
21320
21322
|
}
|
|
21321
21323
|
out += this.input.slice(chunkStart, this.pos);
|
|
21322
|
-
return this.finishToken(types.template, out)
|
|
21324
|
+
return this.finishToken(types$1.template, out)
|
|
21323
21325
|
}
|
|
21324
21326
|
if (ch === 92) { // '\'
|
|
21325
21327
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21350,7 +21352,7 @@ pp$9.readTmplToken = function() {
|
|
|
21350
21352
|
};
|
|
21351
21353
|
|
|
21352
21354
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21353
|
-
pp
|
|
21355
|
+
pp.readInvalidTemplateToken = function() {
|
|
21354
21356
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21355
21357
|
switch (this.input[this.pos]) {
|
|
21356
21358
|
case "\\":
|
|
@@ -21361,10 +21363,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21361
21363
|
if (this.input[this.pos + 1] !== "{") {
|
|
21362
21364
|
break
|
|
21363
21365
|
}
|
|
21364
|
-
// falls through
|
|
21365
21366
|
|
|
21367
|
+
// falls through
|
|
21366
21368
|
case "`":
|
|
21367
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21369
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21368
21370
|
|
|
21369
21371
|
// no default
|
|
21370
21372
|
}
|
|
@@ -21374,14 +21376,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21374
21376
|
|
|
21375
21377
|
// Used to read escaped characters
|
|
21376
21378
|
|
|
21377
|
-
pp
|
|
21379
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21378
21380
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21379
21381
|
++this.pos;
|
|
21380
21382
|
switch (ch) {
|
|
21381
21383
|
case 110: return "\n" // 'n' -> '\n'
|
|
21382
21384
|
case 114: return "\r" // 'r' -> '\r'
|
|
21383
21385
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21384
|
-
case 117: return codePointToString
|
|
21386
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21385
21387
|
case 116: return "\t" // 't' -> '\t'
|
|
21386
21388
|
case 98: return "\b" // 'b' -> '\b'
|
|
21387
21389
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21439,7 +21441,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21439
21441
|
|
|
21440
21442
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21441
21443
|
|
|
21442
|
-
pp
|
|
21444
|
+
pp.readHexChar = function(len) {
|
|
21443
21445
|
var codePos = this.pos;
|
|
21444
21446
|
var n = this.readInt(16, len);
|
|
21445
21447
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21452,7 +21454,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21452
21454
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21453
21455
|
// as a micro-optimization.
|
|
21454
21456
|
|
|
21455
|
-
pp
|
|
21457
|
+
pp.readWord1 = function() {
|
|
21456
21458
|
this.containsEsc = false;
|
|
21457
21459
|
var word = "", first = true, chunkStart = this.pos;
|
|
21458
21460
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21470,7 +21472,7 @@ pp$9.readWord1 = function() {
|
|
|
21470
21472
|
var esc = this.readCodePoint();
|
|
21471
21473
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21472
21474
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21473
|
-
word += codePointToString
|
|
21475
|
+
word += codePointToString(esc);
|
|
21474
21476
|
chunkStart = this.pos;
|
|
21475
21477
|
} else {
|
|
21476
21478
|
break
|
|
@@ -21483,18 +21485,18 @@ pp$9.readWord1 = function() {
|
|
|
21483
21485
|
// Read an identifier or keyword token. Will check for reserved
|
|
21484
21486
|
// words when necessary.
|
|
21485
21487
|
|
|
21486
|
-
pp
|
|
21488
|
+
pp.readWord = function() {
|
|
21487
21489
|
var word = this.readWord1();
|
|
21488
|
-
var type = types.name;
|
|
21490
|
+
var type = types$1.name;
|
|
21489
21491
|
if (this.keywords.test(word)) {
|
|
21490
|
-
type = keywords
|
|
21492
|
+
type = keywords[word];
|
|
21491
21493
|
}
|
|
21492
21494
|
return this.finishToken(type, word)
|
|
21493
21495
|
};
|
|
21494
21496
|
|
|
21495
21497
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21496
21498
|
|
|
21497
|
-
var version = "8.
|
|
21499
|
+
var version = "8.6.0";
|
|
21498
21500
|
|
|
21499
21501
|
Parser.acorn = {
|
|
21500
21502
|
Parser: Parser,
|
|
@@ -21505,10 +21507,10 @@ Parser.acorn = {
|
|
|
21505
21507
|
getLineInfo: getLineInfo,
|
|
21506
21508
|
Node: Node,
|
|
21507
21509
|
TokenType: TokenType,
|
|
21508
|
-
tokTypes: types,
|
|
21509
|
-
keywordTypes: keywords
|
|
21510
|
+
tokTypes: types$1,
|
|
21511
|
+
keywordTypes: keywords,
|
|
21510
21512
|
TokContext: TokContext,
|
|
21511
|
-
tokContexts: types
|
|
21513
|
+
tokContexts: types,
|
|
21512
21514
|
isIdentifierChar: isIdentifierChar,
|
|
21513
21515
|
isIdentifierStart: isIdentifierStart,
|
|
21514
21516
|
Token: Token,
|
|
@@ -21521,20 +21523,7 @@ Parser.acorn = {
|
|
|
21521
21523
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21522
21524
|
function mkdirpath(path) {
|
|
21523
21525
|
const dir = dirname(path);
|
|
21524
|
-
|
|
21525
|
-
fs.readdirSync(dir);
|
|
21526
|
-
}
|
|
21527
|
-
catch (_a) {
|
|
21528
|
-
mkdirpath(dir);
|
|
21529
|
-
try {
|
|
21530
|
-
fs.mkdirSync(dir);
|
|
21531
|
-
}
|
|
21532
|
-
catch (err) {
|
|
21533
|
-
if (err.code !== 'EEXIST') {
|
|
21534
|
-
throw err;
|
|
21535
|
-
}
|
|
21536
|
-
}
|
|
21537
|
-
}
|
|
21526
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21538
21527
|
}
|
|
21539
21528
|
function writeFile(dest, data) {
|
|
21540
21529
|
return new Promise((fulfil, reject) => {
|
|
@@ -23553,18 +23542,6 @@ function loadFsEvents() {
|
|
|
23553
23542
|
fsEventsImportError = err;
|
|
23554
23543
|
});
|
|
23555
23544
|
}
|
|
23556
|
-
// A call to this function will be injected into the chokidar code
|
|
23557
|
-
function getFsEvents() {
|
|
23558
|
-
if (fsEventsImportError)
|
|
23559
|
-
throw fsEventsImportError;
|
|
23560
|
-
return fsEvents;
|
|
23561
|
-
}
|
|
23562
|
-
|
|
23563
|
-
const fseventsImporter = {
|
|
23564
|
-
__proto__: null,
|
|
23565
|
-
loadFsEvents,
|
|
23566
|
-
getFsEvents
|
|
23567
|
-
};
|
|
23568
23545
|
|
|
23569
23546
|
class WatchEmitter extends EventEmitter {
|
|
23570
23547
|
constructor() {
|
|
@@ -23588,4 +23565,4 @@ function watch(configs) {
|
|
|
23588
23565
|
return emitter;
|
|
23589
23566
|
}
|
|
23590
23567
|
|
|
23591
|
-
export { createFilter, defaultOnWarn, defineConfig, ensureArray,
|
|
23568
|
+
export { createFilter, defaultOnWarn, defineConfig, ensureArray, generatedCodePresets, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|