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/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
|
|
@@ -26,7 +26,7 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
var version$1 = "2.
|
|
29
|
+
var version$1 = "2.61.0";
|
|
30
30
|
|
|
31
31
|
function ensureArray$1(items) {
|
|
32
32
|
if (Array.isArray(items)) {
|
|
@@ -592,36 +592,9 @@ function loadFsEvents() {
|
|
|
592
592
|
fsEventsImportError = err;
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
|
-
// A call to this function will be injected into the chokidar code
|
|
596
|
-
function getFsEvents() {
|
|
597
|
-
if (fsEventsImportError)
|
|
598
|
-
throw fsEventsImportError;
|
|
599
|
-
return fsEvents;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
const fseventsImporter = {
|
|
603
|
-
__proto__: null,
|
|
604
|
-
loadFsEvents,
|
|
605
|
-
getFsEvents
|
|
606
|
-
};
|
|
607
595
|
|
|
608
596
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
609
597
|
|
|
610
|
-
function getAugmentedNamespace(n) {
|
|
611
|
-
if (n.__esModule) return n;
|
|
612
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
613
|
-
Object.keys(n).forEach(function (k) {
|
|
614
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
615
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
616
|
-
enumerable: true,
|
|
617
|
-
get: function () {
|
|
618
|
-
return n[k];
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
});
|
|
622
|
-
return a;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
598
|
var charToInteger = {};
|
|
626
599
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
627
600
|
for (var i = 0; i < chars$1.length; i++) {
|
|
@@ -16149,7 +16122,7 @@ var reservedWords = {
|
|
|
16149
16122
|
|
|
16150
16123
|
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";
|
|
16151
16124
|
|
|
16152
|
-
var keywords = {
|
|
16125
|
+
var keywords$1 = {
|
|
16153
16126
|
5: ecma5AndLessKeywords,
|
|
16154
16127
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16155
16128
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16268,17 +16241,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16268
16241
|
|
|
16269
16242
|
// Map keyword names to token types.
|
|
16270
16243
|
|
|
16271
|
-
var keywords
|
|
16244
|
+
var keywords = {};
|
|
16272
16245
|
|
|
16273
16246
|
// Succinct definitions of keyword token types
|
|
16274
16247
|
function kw(name, options) {
|
|
16275
16248
|
if ( options === void 0 ) options = {};
|
|
16276
16249
|
|
|
16277
16250
|
options.keyword = name;
|
|
16278
|
-
return keywords
|
|
16251
|
+
return keywords[name] = new TokenType(name, options)
|
|
16279
16252
|
}
|
|
16280
16253
|
|
|
16281
|
-
var types = {
|
|
16254
|
+
var types$1 = {
|
|
16282
16255
|
num: new TokenType("num", startsExpr),
|
|
16283
16256
|
regexp: new TokenType("regexp", startsExpr),
|
|
16284
16257
|
string: new TokenType("string", startsExpr),
|
|
@@ -16620,7 +16593,7 @@ var
|
|
|
16620
16593
|
var Parser = function Parser(options, input, startPos) {
|
|
16621
16594
|
this.options = options = getOptions(options);
|
|
16622
16595
|
this.sourceFile = options.sourceFile;
|
|
16623
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16596
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16624
16597
|
var reserved = "";
|
|
16625
16598
|
if (options.allowReserved !== true) {
|
|
16626
16599
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16651,7 +16624,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16651
16624
|
|
|
16652
16625
|
// Properties of the current token:
|
|
16653
16626
|
// Its type
|
|
16654
|
-
this.type = types.eof;
|
|
16627
|
+
this.type = types$1.eof;
|
|
16655
16628
|
// For tokens that include more information than their type, the value
|
|
16656
16629
|
this.value = null;
|
|
16657
16630
|
// Its start and end offset
|
|
@@ -16711,8 +16684,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16711
16684
|
};
|
|
16712
16685
|
|
|
16713
16686
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16687
|
+
|
|
16714
16688
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16689
|
+
|
|
16715
16690
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16691
|
+
|
|
16716
16692
|
prototypeAccessors.canAwait.get = function () {
|
|
16717
16693
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16718
16694
|
var scope = this.scopeStack[i];
|
|
@@ -16721,20 +16697,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16721
16697
|
}
|
|
16722
16698
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16723
16699
|
};
|
|
16700
|
+
|
|
16724
16701
|
prototypeAccessors.allowSuper.get = function () {
|
|
16725
16702
|
var ref = this.currentThisScope();
|
|
16726
16703
|
var flags = ref.flags;
|
|
16727
16704
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16728
16705
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16729
16706
|
};
|
|
16707
|
+
|
|
16730
16708
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16709
|
+
|
|
16731
16710
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16711
|
+
|
|
16732
16712
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16733
16713
|
var ref = this.currentThisScope();
|
|
16734
16714
|
var flags = ref.flags;
|
|
16735
16715
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16736
16716
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16737
16717
|
};
|
|
16718
|
+
|
|
16738
16719
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16739
16720
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16740
16721
|
};
|
|
@@ -16764,12 +16745,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16764
16745
|
|
|
16765
16746
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16766
16747
|
|
|
16767
|
-
var pp = Parser.prototype;
|
|
16748
|
+
var pp$9 = Parser.prototype;
|
|
16768
16749
|
|
|
16769
16750
|
// ## Parser utilities
|
|
16770
16751
|
|
|
16771
16752
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16772
|
-
pp.strictDirective = function(start) {
|
|
16753
|
+
pp$9.strictDirective = function(start) {
|
|
16773
16754
|
for (;;) {
|
|
16774
16755
|
// Try to find string literal.
|
|
16775
16756
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16797,7 +16778,7 @@ pp.strictDirective = function(start) {
|
|
|
16797
16778
|
// Predicate that tests whether the next token is of the given
|
|
16798
16779
|
// type, and if yes, consumes it as a side effect.
|
|
16799
16780
|
|
|
16800
|
-
pp.eat = function(type) {
|
|
16781
|
+
pp$9.eat = function(type) {
|
|
16801
16782
|
if (this.type === type) {
|
|
16802
16783
|
this.next();
|
|
16803
16784
|
return true
|
|
@@ -16808,13 +16789,13 @@ pp.eat = function(type) {
|
|
|
16808
16789
|
|
|
16809
16790
|
// Tests whether parsed token is a contextual keyword.
|
|
16810
16791
|
|
|
16811
|
-
pp.isContextual = function(name) {
|
|
16812
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16792
|
+
pp$9.isContextual = function(name) {
|
|
16793
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16813
16794
|
};
|
|
16814
16795
|
|
|
16815
16796
|
// Consumes contextual keyword if possible.
|
|
16816
16797
|
|
|
16817
|
-
pp.eatContextual = function(name) {
|
|
16798
|
+
pp$9.eatContextual = function(name) {
|
|
16818
16799
|
if (!this.isContextual(name)) { return false }
|
|
16819
16800
|
this.next();
|
|
16820
16801
|
return true
|
|
@@ -16822,19 +16803,19 @@ pp.eatContextual = function(name) {
|
|
|
16822
16803
|
|
|
16823
16804
|
// Asserts that following token is given contextual keyword.
|
|
16824
16805
|
|
|
16825
|
-
pp.expectContextual = function(name) {
|
|
16806
|
+
pp$9.expectContextual = function(name) {
|
|
16826
16807
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16827
16808
|
};
|
|
16828
16809
|
|
|
16829
16810
|
// Test whether a semicolon can be inserted at the current position.
|
|
16830
16811
|
|
|
16831
|
-
pp.canInsertSemicolon = function() {
|
|
16832
|
-
return this.type === types.eof ||
|
|
16833
|
-
this.type === types.braceR ||
|
|
16812
|
+
pp$9.canInsertSemicolon = function() {
|
|
16813
|
+
return this.type === types$1.eof ||
|
|
16814
|
+
this.type === types$1.braceR ||
|
|
16834
16815
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16835
16816
|
};
|
|
16836
16817
|
|
|
16837
|
-
pp.insertSemicolon = function() {
|
|
16818
|
+
pp$9.insertSemicolon = function() {
|
|
16838
16819
|
if (this.canInsertSemicolon()) {
|
|
16839
16820
|
if (this.options.onInsertedSemicolon)
|
|
16840
16821
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16845,11 +16826,11 @@ pp.insertSemicolon = function() {
|
|
|
16845
16826
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16846
16827
|
// pretend that there is a semicolon at this position.
|
|
16847
16828
|
|
|
16848
|
-
pp.semicolon = function() {
|
|
16849
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16829
|
+
pp$9.semicolon = function() {
|
|
16830
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16850
16831
|
};
|
|
16851
16832
|
|
|
16852
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16833
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16853
16834
|
if (this.type === tokType) {
|
|
16854
16835
|
if (this.options.onTrailingComma)
|
|
16855
16836
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16862,13 +16843,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16862
16843
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16863
16844
|
// raise an unexpected token error.
|
|
16864
16845
|
|
|
16865
|
-
pp.expect = function(type) {
|
|
16846
|
+
pp$9.expect = function(type) {
|
|
16866
16847
|
this.eat(type) || this.unexpected();
|
|
16867
16848
|
};
|
|
16868
16849
|
|
|
16869
16850
|
// Raise an unexpected token error.
|
|
16870
16851
|
|
|
16871
|
-
pp.unexpected = function(pos) {
|
|
16852
|
+
pp$9.unexpected = function(pos) {
|
|
16872
16853
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16873
16854
|
};
|
|
16874
16855
|
|
|
@@ -16881,7 +16862,7 @@ function DestructuringErrors() {
|
|
|
16881
16862
|
-1;
|
|
16882
16863
|
}
|
|
16883
16864
|
|
|
16884
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16865
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16885
16866
|
if (!refDestructuringErrors) { return }
|
|
16886
16867
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16887
16868
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16889,7 +16870,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16889
16870
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16890
16871
|
};
|
|
16891
16872
|
|
|
16892
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16873
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16893
16874
|
if (!refDestructuringErrors) { return false }
|
|
16894
16875
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16895
16876
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16900,20 +16881,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16900
16881
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16901
16882
|
};
|
|
16902
16883
|
|
|
16903
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16884
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16904
16885
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16905
16886
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16906
16887
|
if (this.awaitPos)
|
|
16907
16888
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16908
16889
|
};
|
|
16909
16890
|
|
|
16910
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16891
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16911
16892
|
if (expr.type === "ParenthesizedExpression")
|
|
16912
16893
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16913
16894
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16914
16895
|
};
|
|
16915
16896
|
|
|
16916
|
-
var pp$
|
|
16897
|
+
var pp$8 = Parser.prototype;
|
|
16917
16898
|
|
|
16918
16899
|
// ### Statement parsing
|
|
16919
16900
|
|
|
@@ -16922,10 +16903,10 @@ var pp$1 = Parser.prototype;
|
|
|
16922
16903
|
// `program` argument. If present, the statements will be appended
|
|
16923
16904
|
// to its body instead of creating a new node.
|
|
16924
16905
|
|
|
16925
|
-
pp$
|
|
16906
|
+
pp$8.parseTopLevel = function(node) {
|
|
16926
16907
|
var exports = Object.create(null);
|
|
16927
16908
|
if (!node.body) { node.body = []; }
|
|
16928
|
-
while (this.type !== types.eof) {
|
|
16909
|
+
while (this.type !== types$1.eof) {
|
|
16929
16910
|
var stmt = this.parseStatement(null, true, exports);
|
|
16930
16911
|
node.body.push(stmt);
|
|
16931
16912
|
}
|
|
@@ -16944,7 +16925,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16944
16925
|
|
|
16945
16926
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16946
16927
|
|
|
16947
|
-
pp$
|
|
16928
|
+
pp$8.isLet = function(context) {
|
|
16948
16929
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16949
16930
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16950
16931
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16970,7 +16951,7 @@ pp$1.isLet = function(context) {
|
|
|
16970
16951
|
// check 'async [no LineTerminator here] function'
|
|
16971
16952
|
// - 'async /*foo*/ function' is OK.
|
|
16972
16953
|
// - 'async /*\n*/ function' is invalid.
|
|
16973
|
-
pp$
|
|
16954
|
+
pp$8.isAsyncFunction = function() {
|
|
16974
16955
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16975
16956
|
{ return false }
|
|
16976
16957
|
|
|
@@ -16990,11 +16971,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16990
16971
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16991
16972
|
// does not help.
|
|
16992
16973
|
|
|
16993
|
-
pp$
|
|
16974
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16994
16975
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16995
16976
|
|
|
16996
16977
|
if (this.isLet(context)) {
|
|
16997
|
-
starttype = types._var;
|
|
16978
|
+
starttype = types$1._var;
|
|
16998
16979
|
kind = "let";
|
|
16999
16980
|
}
|
|
17000
16981
|
|
|
@@ -17003,35 +16984,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17003
16984
|
// complexity.
|
|
17004
16985
|
|
|
17005
16986
|
switch (starttype) {
|
|
17006
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
17007
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
17008
|
-
case types._do: return this.parseDoStatement(node)
|
|
17009
|
-
case types._for: return this.parseForStatement(node)
|
|
17010
|
-
case types._function:
|
|
16987
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16988
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
16989
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
16990
|
+
case types$1._for: return this.parseForStatement(node)
|
|
16991
|
+
case types$1._function:
|
|
17011
16992
|
// Function as sole body of either an if statement or a labeled statement
|
|
17012
16993
|
// works, but not when it is part of a labeled statement that is the sole
|
|
17013
16994
|
// body of an if statement.
|
|
17014
16995
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
17015
16996
|
return this.parseFunctionStatement(node, false, !context)
|
|
17016
|
-
case types._class:
|
|
16997
|
+
case types$1._class:
|
|
17017
16998
|
if (context) { this.unexpected(); }
|
|
17018
16999
|
return this.parseClass(node, true)
|
|
17019
|
-
case types._if: return this.parseIfStatement(node)
|
|
17020
|
-
case types._return: return this.parseReturnStatement(node)
|
|
17021
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
17022
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
17023
|
-
case types._try: return this.parseTryStatement(node)
|
|
17024
|
-
case types._const: case types._var:
|
|
17000
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
17001
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
17002
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
17003
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
17004
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
17005
|
+
case types$1._const: case types$1._var:
|
|
17025
17006
|
kind = kind || this.value;
|
|
17026
17007
|
if (context && kind !== "var") { this.unexpected(); }
|
|
17027
17008
|
return this.parseVarStatement(node, kind)
|
|
17028
|
-
case types._while: return this.parseWhileStatement(node)
|
|
17029
|
-
case types._with: return this.parseWithStatement(node)
|
|
17030
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
17031
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
17032
|
-
case types._export:
|
|
17033
|
-
case types._import:
|
|
17034
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
17009
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
17010
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
17011
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
17012
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
17013
|
+
case types$1._export:
|
|
17014
|
+
case types$1._import:
|
|
17015
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
17035
17016
|
skipWhiteSpace.lastIndex = this.pos;
|
|
17036
17017
|
var skip = skipWhiteSpace.exec(this.input);
|
|
17037
17018
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -17045,7 +17026,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17045
17026
|
if (!this.inModule)
|
|
17046
17027
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
17047
17028
|
}
|
|
17048
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
17029
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
17049
17030
|
|
|
17050
17031
|
// If the statement does not start with a statement keyword or a
|
|
17051
17032
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -17060,17 +17041,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17060
17041
|
}
|
|
17061
17042
|
|
|
17062
17043
|
var maybeName = this.value, expr = this.parseExpression();
|
|
17063
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
17044
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
17064
17045
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
17065
17046
|
else { return this.parseExpressionStatement(node, expr) }
|
|
17066
17047
|
}
|
|
17067
17048
|
};
|
|
17068
17049
|
|
|
17069
|
-
pp$
|
|
17050
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
17070
17051
|
var isBreak = keyword === "break";
|
|
17071
17052
|
this.next();
|
|
17072
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
17073
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
17053
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
17054
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
17074
17055
|
else {
|
|
17075
17056
|
node.label = this.parseIdent();
|
|
17076
17057
|
this.semicolon();
|
|
@@ -17090,21 +17071,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
17090
17071
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
17091
17072
|
};
|
|
17092
17073
|
|
|
17093
|
-
pp$
|
|
17074
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
17094
17075
|
this.next();
|
|
17095
17076
|
this.semicolon();
|
|
17096
17077
|
return this.finishNode(node, "DebuggerStatement")
|
|
17097
17078
|
};
|
|
17098
17079
|
|
|
17099
|
-
pp$
|
|
17080
|
+
pp$8.parseDoStatement = function(node) {
|
|
17100
17081
|
this.next();
|
|
17101
17082
|
this.labels.push(loopLabel);
|
|
17102
17083
|
node.body = this.parseStatement("do");
|
|
17103
17084
|
this.labels.pop();
|
|
17104
|
-
this.expect(types._while);
|
|
17085
|
+
this.expect(types$1._while);
|
|
17105
17086
|
node.test = this.parseParenExpression();
|
|
17106
17087
|
if (this.options.ecmaVersion >= 6)
|
|
17107
|
-
{ this.eat(types.semi); }
|
|
17088
|
+
{ this.eat(types$1.semi); }
|
|
17108
17089
|
else
|
|
17109
17090
|
{ this.semicolon(); }
|
|
17110
17091
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -17118,25 +17099,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
17118
17099
|
// part (semicolon immediately after the opening parenthesis), it
|
|
17119
17100
|
// is a regular `for` loop.
|
|
17120
17101
|
|
|
17121
|
-
pp$
|
|
17102
|
+
pp$8.parseForStatement = function(node) {
|
|
17122
17103
|
this.next();
|
|
17123
17104
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
17124
17105
|
this.labels.push(loopLabel);
|
|
17125
17106
|
this.enterScope(0);
|
|
17126
|
-
this.expect(types.parenL);
|
|
17127
|
-
if (this.type === types.semi) {
|
|
17107
|
+
this.expect(types$1.parenL);
|
|
17108
|
+
if (this.type === types$1.semi) {
|
|
17128
17109
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17129
17110
|
return this.parseFor(node, null)
|
|
17130
17111
|
}
|
|
17131
17112
|
var isLet = this.isLet();
|
|
17132
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
17113
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
17133
17114
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
17134
17115
|
this.next();
|
|
17135
17116
|
this.parseVar(init$1, true, kind);
|
|
17136
17117
|
this.finishNode(init$1, "VariableDeclaration");
|
|
17137
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17118
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17138
17119
|
if (this.options.ecmaVersion >= 9) {
|
|
17139
|
-
if (this.type === types._in) {
|
|
17120
|
+
if (this.type === types$1._in) {
|
|
17140
17121
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17141
17122
|
} else { node.await = awaitAt > -1; }
|
|
17142
17123
|
}
|
|
@@ -17148,9 +17129,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17148
17129
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17149
17130
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17150
17131
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17151
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17132
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17152
17133
|
if (this.options.ecmaVersion >= 9) {
|
|
17153
|
-
if (this.type === types._in) {
|
|
17134
|
+
if (this.type === types$1._in) {
|
|
17154
17135
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17155
17136
|
} else { node.await = awaitAt > -1; }
|
|
17156
17137
|
}
|
|
@@ -17165,21 +17146,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17165
17146
|
return this.parseFor(node, init)
|
|
17166
17147
|
};
|
|
17167
17148
|
|
|
17168
|
-
pp$
|
|
17149
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17169
17150
|
this.next();
|
|
17170
17151
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17171
17152
|
};
|
|
17172
17153
|
|
|
17173
|
-
pp$
|
|
17154
|
+
pp$8.parseIfStatement = function(node) {
|
|
17174
17155
|
this.next();
|
|
17175
17156
|
node.test = this.parseParenExpression();
|
|
17176
17157
|
// allow function declarations in branches, but only in non-strict mode
|
|
17177
17158
|
node.consequent = this.parseStatement("if");
|
|
17178
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17159
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17179
17160
|
return this.finishNode(node, "IfStatement")
|
|
17180
17161
|
};
|
|
17181
17162
|
|
|
17182
|
-
pp$
|
|
17163
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17183
17164
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17184
17165
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17185
17166
|
this.next();
|
|
@@ -17188,16 +17169,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17188
17169
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17189
17170
|
// possibility to insert one.
|
|
17190
17171
|
|
|
17191
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17172
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17192
17173
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17193
17174
|
return this.finishNode(node, "ReturnStatement")
|
|
17194
17175
|
};
|
|
17195
17176
|
|
|
17196
|
-
pp$
|
|
17177
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17197
17178
|
this.next();
|
|
17198
17179
|
node.discriminant = this.parseParenExpression();
|
|
17199
17180
|
node.cases = [];
|
|
17200
|
-
this.expect(types.braceL);
|
|
17181
|
+
this.expect(types$1.braceL);
|
|
17201
17182
|
this.labels.push(switchLabel);
|
|
17202
17183
|
this.enterScope(0);
|
|
17203
17184
|
|
|
@@ -17206,9 +17187,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17206
17187
|
// adding statements to.
|
|
17207
17188
|
|
|
17208
17189
|
var cur;
|
|
17209
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
17210
|
-
if (this.type === types._case || this.type === types._default) {
|
|
17211
|
-
var isCase = this.type === types._case;
|
|
17190
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17191
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17192
|
+
var isCase = this.type === types$1._case;
|
|
17212
17193
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17213
17194
|
node.cases.push(cur = this.startNode());
|
|
17214
17195
|
cur.consequent = [];
|
|
@@ -17220,7 +17201,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17220
17201
|
sawDefault = true;
|
|
17221
17202
|
cur.test = null;
|
|
17222
17203
|
}
|
|
17223
|
-
this.expect(types.colon);
|
|
17204
|
+
this.expect(types$1.colon);
|
|
17224
17205
|
} else {
|
|
17225
17206
|
if (!cur) { this.unexpected(); }
|
|
17226
17207
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17233,7 +17214,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17233
17214
|
return this.finishNode(node, "SwitchStatement")
|
|
17234
17215
|
};
|
|
17235
17216
|
|
|
17236
|
-
pp$
|
|
17217
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17237
17218
|
this.next();
|
|
17238
17219
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17239
17220
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17244,21 +17225,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17244
17225
|
|
|
17245
17226
|
// Reused empty array added for node fields that are always empty.
|
|
17246
17227
|
|
|
17247
|
-
var empty = [];
|
|
17228
|
+
var empty$1 = [];
|
|
17248
17229
|
|
|
17249
|
-
pp$
|
|
17230
|
+
pp$8.parseTryStatement = function(node) {
|
|
17250
17231
|
this.next();
|
|
17251
17232
|
node.block = this.parseBlock();
|
|
17252
17233
|
node.handler = null;
|
|
17253
|
-
if (this.type === types._catch) {
|
|
17234
|
+
if (this.type === types$1._catch) {
|
|
17254
17235
|
var clause = this.startNode();
|
|
17255
17236
|
this.next();
|
|
17256
|
-
if (this.eat(types.parenL)) {
|
|
17237
|
+
if (this.eat(types$1.parenL)) {
|
|
17257
17238
|
clause.param = this.parseBindingAtom();
|
|
17258
17239
|
var simple = clause.param.type === "Identifier";
|
|
17259
17240
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17260
17241
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17261
|
-
this.expect(types.parenR);
|
|
17242
|
+
this.expect(types$1.parenR);
|
|
17262
17243
|
} else {
|
|
17263
17244
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17264
17245
|
clause.param = null;
|
|
@@ -17268,20 +17249,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17268
17249
|
this.exitScope();
|
|
17269
17250
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17270
17251
|
}
|
|
17271
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17252
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17272
17253
|
if (!node.handler && !node.finalizer)
|
|
17273
17254
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17274
17255
|
return this.finishNode(node, "TryStatement")
|
|
17275
17256
|
};
|
|
17276
17257
|
|
|
17277
|
-
pp$
|
|
17258
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17278
17259
|
this.next();
|
|
17279
17260
|
this.parseVar(node, false, kind);
|
|
17280
17261
|
this.semicolon();
|
|
17281
17262
|
return this.finishNode(node, "VariableDeclaration")
|
|
17282
17263
|
};
|
|
17283
17264
|
|
|
17284
|
-
pp$
|
|
17265
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17285
17266
|
this.next();
|
|
17286
17267
|
node.test = this.parseParenExpression();
|
|
17287
17268
|
this.labels.push(loopLabel);
|
|
@@ -17290,7 +17271,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17290
17271
|
return this.finishNode(node, "WhileStatement")
|
|
17291
17272
|
};
|
|
17292
17273
|
|
|
17293
|
-
pp$
|
|
17274
|
+
pp$8.parseWithStatement = function(node) {
|
|
17294
17275
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17295
17276
|
this.next();
|
|
17296
17277
|
node.object = this.parseParenExpression();
|
|
@@ -17298,12 +17279,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17298
17279
|
return this.finishNode(node, "WithStatement")
|
|
17299
17280
|
};
|
|
17300
17281
|
|
|
17301
|
-
pp$
|
|
17282
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17302
17283
|
this.next();
|
|
17303
17284
|
return this.finishNode(node, "EmptyStatement")
|
|
17304
17285
|
};
|
|
17305
17286
|
|
|
17306
|
-
pp$
|
|
17287
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17307
17288
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17308
17289
|
{
|
|
17309
17290
|
var label = list[i$1];
|
|
@@ -17311,7 +17292,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17311
17292
|
if (label.name === maybeName)
|
|
17312
17293
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17313
17294
|
} }
|
|
17314
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17295
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17315
17296
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17316
17297
|
var label$1 = this.labels[i];
|
|
17317
17298
|
if (label$1.statementStart === node.start) {
|
|
@@ -17327,7 +17308,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17327
17308
|
return this.finishNode(node, "LabeledStatement")
|
|
17328
17309
|
};
|
|
17329
17310
|
|
|
17330
|
-
pp$
|
|
17311
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17331
17312
|
node.expression = expr;
|
|
17332
17313
|
this.semicolon();
|
|
17333
17314
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17337,14 +17318,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17337
17318
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17338
17319
|
// function bodies).
|
|
17339
17320
|
|
|
17340
|
-
pp$
|
|
17321
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17341
17322
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17342
17323
|
if ( node === void 0 ) node = this.startNode();
|
|
17343
17324
|
|
|
17344
17325
|
node.body = [];
|
|
17345
|
-
this.expect(types.braceL);
|
|
17326
|
+
this.expect(types$1.braceL);
|
|
17346
17327
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17347
|
-
while (this.type !== types.braceR) {
|
|
17328
|
+
while (this.type !== types$1.braceR) {
|
|
17348
17329
|
var stmt = this.parseStatement(null);
|
|
17349
17330
|
node.body.push(stmt);
|
|
17350
17331
|
}
|
|
@@ -17358,13 +17339,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17358
17339
|
// `parseStatement` will already have parsed the init statement or
|
|
17359
17340
|
// expression.
|
|
17360
17341
|
|
|
17361
|
-
pp$
|
|
17342
|
+
pp$8.parseFor = function(node, init) {
|
|
17362
17343
|
node.init = init;
|
|
17363
|
-
this.expect(types.semi);
|
|
17364
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
17365
|
-
this.expect(types.semi);
|
|
17366
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
17367
|
-
this.expect(types.parenR);
|
|
17344
|
+
this.expect(types$1.semi);
|
|
17345
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17346
|
+
this.expect(types$1.semi);
|
|
17347
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17348
|
+
this.expect(types$1.parenR);
|
|
17368
17349
|
node.body = this.parseStatement("for");
|
|
17369
17350
|
this.exitScope();
|
|
17370
17351
|
this.labels.pop();
|
|
@@ -17374,8 +17355,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17374
17355
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17375
17356
|
// same from parser's perspective.
|
|
17376
17357
|
|
|
17377
|
-
pp$
|
|
17378
|
-
var isForIn = this.type === types._in;
|
|
17358
|
+
pp$8.parseForIn = function(node, init) {
|
|
17359
|
+
var isForIn = this.type === types$1._in;
|
|
17379
17360
|
this.next();
|
|
17380
17361
|
|
|
17381
17362
|
if (
|
|
@@ -17396,7 +17377,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17396
17377
|
}
|
|
17397
17378
|
node.left = init;
|
|
17398
17379
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17399
|
-
this.expect(types.parenR);
|
|
17380
|
+
this.expect(types$1.parenR);
|
|
17400
17381
|
node.body = this.parseStatement("for");
|
|
17401
17382
|
this.exitScope();
|
|
17402
17383
|
this.labels.pop();
|
|
@@ -17405,28 +17386,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17405
17386
|
|
|
17406
17387
|
// Parse a list of variable declarations.
|
|
17407
17388
|
|
|
17408
|
-
pp$
|
|
17389
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17409
17390
|
node.declarations = [];
|
|
17410
17391
|
node.kind = kind;
|
|
17411
17392
|
for (;;) {
|
|
17412
17393
|
var decl = this.startNode();
|
|
17413
17394
|
this.parseVarId(decl, kind);
|
|
17414
|
-
if (this.eat(types.eq)) {
|
|
17395
|
+
if (this.eat(types$1.eq)) {
|
|
17415
17396
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17416
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17397
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17417
17398
|
this.unexpected();
|
|
17418
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17399
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17419
17400
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17420
17401
|
} else {
|
|
17421
17402
|
decl.init = null;
|
|
17422
17403
|
}
|
|
17423
17404
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17424
|
-
if (!this.eat(types.comma)) { break }
|
|
17405
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17425
17406
|
}
|
|
17426
17407
|
return node
|
|
17427
17408
|
};
|
|
17428
17409
|
|
|
17429
|
-
pp$
|
|
17410
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17430
17411
|
decl.id = this.parseBindingAtom();
|
|
17431
17412
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17432
17413
|
};
|
|
@@ -17437,18 +17418,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17437
17418
|
// `statement & FUNC_STATEMENT`).
|
|
17438
17419
|
|
|
17439
17420
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17440
|
-
pp$
|
|
17421
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17441
17422
|
this.initFunction(node);
|
|
17442
17423
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17443
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17424
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17444
17425
|
{ this.unexpected(); }
|
|
17445
|
-
node.generator = this.eat(types.star);
|
|
17426
|
+
node.generator = this.eat(types$1.star);
|
|
17446
17427
|
}
|
|
17447
17428
|
if (this.options.ecmaVersion >= 8)
|
|
17448
17429
|
{ node.async = !!isAsync; }
|
|
17449
17430
|
|
|
17450
17431
|
if (statement & FUNC_STATEMENT) {
|
|
17451
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17432
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17452
17433
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17453
17434
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17454
17435
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17464,7 +17445,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17464
17445
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17465
17446
|
|
|
17466
17447
|
if (!(statement & FUNC_STATEMENT))
|
|
17467
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17448
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17468
17449
|
|
|
17469
17450
|
this.parseFunctionParams(node);
|
|
17470
17451
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17475,16 +17456,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17475
17456
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17476
17457
|
};
|
|
17477
17458
|
|
|
17478
|
-
pp$
|
|
17479
|
-
this.expect(types.parenL);
|
|
17480
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17459
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17460
|
+
this.expect(types$1.parenL);
|
|
17461
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17481
17462
|
this.checkYieldAwaitInDefaultParams();
|
|
17482
17463
|
};
|
|
17483
17464
|
|
|
17484
17465
|
// Parse a class declaration or literal (depending on the
|
|
17485
17466
|
// `isStatement` parameter).
|
|
17486
17467
|
|
|
17487
|
-
pp$
|
|
17468
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17488
17469
|
this.next();
|
|
17489
17470
|
|
|
17490
17471
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17498,8 +17479,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17498
17479
|
var classBody = this.startNode();
|
|
17499
17480
|
var hadConstructor = false;
|
|
17500
17481
|
classBody.body = [];
|
|
17501
|
-
this.expect(types.braceL);
|
|
17502
|
-
while (this.type !== types.braceR) {
|
|
17482
|
+
this.expect(types$1.braceL);
|
|
17483
|
+
while (this.type !== types$1.braceR) {
|
|
17503
17484
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17504
17485
|
if (element) {
|
|
17505
17486
|
classBody.body.push(element);
|
|
@@ -17518,8 +17499,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17518
17499
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17519
17500
|
};
|
|
17520
17501
|
|
|
17521
|
-
pp$
|
|
17522
|
-
if (this.eat(types.semi)) { return null }
|
|
17502
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17503
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17523
17504
|
|
|
17524
17505
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17525
17506
|
var node = this.startNode();
|
|
@@ -17531,11 +17512,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17531
17512
|
|
|
17532
17513
|
if (this.eatContextual("static")) {
|
|
17533
17514
|
// Parse static init block
|
|
17534
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17515
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17535
17516
|
this.parseClassStaticBlock(node);
|
|
17536
17517
|
return node
|
|
17537
17518
|
}
|
|
17538
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17519
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17539
17520
|
isStatic = true;
|
|
17540
17521
|
} else {
|
|
17541
17522
|
keyName = "static";
|
|
@@ -17543,13 +17524,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17543
17524
|
}
|
|
17544
17525
|
node.static = isStatic;
|
|
17545
17526
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17546
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17527
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17547
17528
|
isAsync = true;
|
|
17548
17529
|
} else {
|
|
17549
17530
|
keyName = "async";
|
|
17550
17531
|
}
|
|
17551
17532
|
}
|
|
17552
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17533
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17553
17534
|
isGenerator = true;
|
|
17554
17535
|
}
|
|
17555
17536
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17576,7 +17557,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17576
17557
|
}
|
|
17577
17558
|
|
|
17578
17559
|
// Parse element value
|
|
17579
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17560
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17580
17561
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17581
17562
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17582
17563
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17590,19 +17571,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17590
17571
|
return node
|
|
17591
17572
|
};
|
|
17592
17573
|
|
|
17593
|
-
pp$
|
|
17574
|
+
pp$8.isClassElementNameStart = function() {
|
|
17594
17575
|
return (
|
|
17595
|
-
this.type === types.name ||
|
|
17596
|
-
this.type === types.privateId ||
|
|
17597
|
-
this.type === types.num ||
|
|
17598
|
-
this.type === types.string ||
|
|
17599
|
-
this.type === types.bracketL ||
|
|
17576
|
+
this.type === types$1.name ||
|
|
17577
|
+
this.type === types$1.privateId ||
|
|
17578
|
+
this.type === types$1.num ||
|
|
17579
|
+
this.type === types$1.string ||
|
|
17580
|
+
this.type === types$1.bracketL ||
|
|
17600
17581
|
this.type.keyword
|
|
17601
17582
|
)
|
|
17602
17583
|
};
|
|
17603
17584
|
|
|
17604
|
-
pp$
|
|
17605
|
-
if (this.type === types.privateId) {
|
|
17585
|
+
pp$8.parseClassElementName = function(element) {
|
|
17586
|
+
if (this.type === types$1.privateId) {
|
|
17606
17587
|
if (this.value === "constructor") {
|
|
17607
17588
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17608
17589
|
}
|
|
@@ -17613,7 +17594,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17613
17594
|
}
|
|
17614
17595
|
};
|
|
17615
17596
|
|
|
17616
|
-
pp$
|
|
17597
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17617
17598
|
// Check key and flags
|
|
17618
17599
|
var key = method.key;
|
|
17619
17600
|
if (method.kind === "constructor") {
|
|
@@ -17637,14 +17618,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17637
17618
|
return this.finishNode(method, "MethodDefinition")
|
|
17638
17619
|
};
|
|
17639
17620
|
|
|
17640
|
-
pp$
|
|
17621
|
+
pp$8.parseClassField = function(field) {
|
|
17641
17622
|
if (checkKeyName(field, "constructor")) {
|
|
17642
17623
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17643
17624
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17644
17625
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17645
17626
|
}
|
|
17646
17627
|
|
|
17647
|
-
if (this.eat(types.eq)) {
|
|
17628
|
+
if (this.eat(types$1.eq)) {
|
|
17648
17629
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17649
17630
|
var scope = this.currentThisScope();
|
|
17650
17631
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17659,13 +17640,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17659
17640
|
return this.finishNode(field, "PropertyDefinition")
|
|
17660
17641
|
};
|
|
17661
17642
|
|
|
17662
|
-
pp$
|
|
17643
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17663
17644
|
node.body = [];
|
|
17664
17645
|
|
|
17665
17646
|
var oldLabels = this.labels;
|
|
17666
17647
|
this.labels = [];
|
|
17667
17648
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17668
|
-
while (this.type !== types.braceR) {
|
|
17649
|
+
while (this.type !== types$1.braceR) {
|
|
17669
17650
|
var stmt = this.parseStatement(null);
|
|
17670
17651
|
node.body.push(stmt);
|
|
17671
17652
|
}
|
|
@@ -17676,8 +17657,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17676
17657
|
return this.finishNode(node, "StaticBlock")
|
|
17677
17658
|
};
|
|
17678
17659
|
|
|
17679
|
-
pp$
|
|
17680
|
-
if (this.type === types.name) {
|
|
17660
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17661
|
+
if (this.type === types$1.name) {
|
|
17681
17662
|
node.id = this.parseIdent();
|
|
17682
17663
|
if (isStatement)
|
|
17683
17664
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17688,17 +17669,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17688
17669
|
}
|
|
17689
17670
|
};
|
|
17690
17671
|
|
|
17691
|
-
pp$
|
|
17692
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17672
|
+
pp$8.parseClassSuper = function(node) {
|
|
17673
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17693
17674
|
};
|
|
17694
17675
|
|
|
17695
|
-
pp$
|
|
17676
|
+
pp$8.enterClassBody = function() {
|
|
17696
17677
|
var element = {declared: Object.create(null), used: []};
|
|
17697
17678
|
this.privateNameStack.push(element);
|
|
17698
17679
|
return element.declared
|
|
17699
17680
|
};
|
|
17700
17681
|
|
|
17701
|
-
pp$
|
|
17682
|
+
pp$8.exitClassBody = function() {
|
|
17702
17683
|
var ref = this.privateNameStack.pop();
|
|
17703
17684
|
var declared = ref.declared;
|
|
17704
17685
|
var used = ref.used;
|
|
@@ -17753,10 +17734,10 @@ function checkKeyName(node, name) {
|
|
|
17753
17734
|
|
|
17754
17735
|
// Parses module export declaration.
|
|
17755
17736
|
|
|
17756
|
-
pp$
|
|
17737
|
+
pp$8.parseExport = function(node, exports) {
|
|
17757
17738
|
this.next();
|
|
17758
17739
|
// export * from '...'
|
|
17759
|
-
if (this.eat(types.star)) {
|
|
17740
|
+
if (this.eat(types$1.star)) {
|
|
17760
17741
|
if (this.options.ecmaVersion >= 11) {
|
|
17761
17742
|
if (this.eatContextual("as")) {
|
|
17762
17743
|
node.exported = this.parseIdent(true);
|
|
@@ -17766,20 +17747,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17766
17747
|
}
|
|
17767
17748
|
}
|
|
17768
17749
|
this.expectContextual("from");
|
|
17769
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17750
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17770
17751
|
node.source = this.parseExprAtom();
|
|
17771
17752
|
this.semicolon();
|
|
17772
17753
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17773
17754
|
}
|
|
17774
|
-
if (this.eat(types._default)) { // export default ...
|
|
17755
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17775
17756
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17776
17757
|
var isAsync;
|
|
17777
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17758
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17778
17759
|
var fNode = this.startNode();
|
|
17779
17760
|
this.next();
|
|
17780
17761
|
if (isAsync) { this.next(); }
|
|
17781
17762
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17782
|
-
} else if (this.type === types._class) {
|
|
17763
|
+
} else if (this.type === types$1._class) {
|
|
17783
17764
|
var cNode = this.startNode();
|
|
17784
17765
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17785
17766
|
} else {
|
|
@@ -17801,7 +17782,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17801
17782
|
node.declaration = null;
|
|
17802
17783
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17803
17784
|
if (this.eatContextual("from")) {
|
|
17804
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17785
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17805
17786
|
node.source = this.parseExprAtom();
|
|
17806
17787
|
} else {
|
|
17807
17788
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17820,14 +17801,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17820
17801
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17821
17802
|
};
|
|
17822
17803
|
|
|
17823
|
-
pp$
|
|
17804
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17824
17805
|
if (!exports) { return }
|
|
17825
17806
|
if (has(exports, name))
|
|
17826
17807
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17827
17808
|
exports[name] = true;
|
|
17828
17809
|
};
|
|
17829
17810
|
|
|
17830
|
-
pp$
|
|
17811
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17831
17812
|
var type = pat.type;
|
|
17832
17813
|
if (type === "Identifier")
|
|
17833
17814
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17854,7 +17835,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17854
17835
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17855
17836
|
};
|
|
17856
17837
|
|
|
17857
|
-
pp$
|
|
17838
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17858
17839
|
if (!exports) { return }
|
|
17859
17840
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17860
17841
|
{
|
|
@@ -17864,7 +17845,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17864
17845
|
}
|
|
17865
17846
|
};
|
|
17866
17847
|
|
|
17867
|
-
pp$
|
|
17848
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17868
17849
|
return this.type.keyword === "var" ||
|
|
17869
17850
|
this.type.keyword === "const" ||
|
|
17870
17851
|
this.type.keyword === "class" ||
|
|
@@ -17875,14 +17856,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17875
17856
|
|
|
17876
17857
|
// Parses a comma-separated list of module exports.
|
|
17877
17858
|
|
|
17878
|
-
pp$
|
|
17859
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17879
17860
|
var nodes = [], first = true;
|
|
17880
17861
|
// export { x, y as z } [from '...']
|
|
17881
|
-
this.expect(types.braceL);
|
|
17882
|
-
while (!this.eat(types.braceR)) {
|
|
17862
|
+
this.expect(types$1.braceL);
|
|
17863
|
+
while (!this.eat(types$1.braceR)) {
|
|
17883
17864
|
if (!first) {
|
|
17884
|
-
this.expect(types.comma);
|
|
17885
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17865
|
+
this.expect(types$1.comma);
|
|
17866
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17886
17867
|
} else { first = false; }
|
|
17887
17868
|
|
|
17888
17869
|
var node = this.startNode();
|
|
@@ -17896,16 +17877,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17896
17877
|
|
|
17897
17878
|
// Parses import declaration.
|
|
17898
17879
|
|
|
17899
|
-
pp$
|
|
17880
|
+
pp$8.parseImport = function(node) {
|
|
17900
17881
|
this.next();
|
|
17901
17882
|
// import '...'
|
|
17902
|
-
if (this.type === types.string) {
|
|
17903
|
-
node.specifiers = empty;
|
|
17883
|
+
if (this.type === types$1.string) {
|
|
17884
|
+
node.specifiers = empty$1;
|
|
17904
17885
|
node.source = this.parseExprAtom();
|
|
17905
17886
|
} else {
|
|
17906
17887
|
node.specifiers = this.parseImportSpecifiers();
|
|
17907
17888
|
this.expectContextual("from");
|
|
17908
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17889
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17909
17890
|
}
|
|
17910
17891
|
this.semicolon();
|
|
17911
17892
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17913,17 +17894,17 @@ pp$1.parseImport = function(node) {
|
|
|
17913
17894
|
|
|
17914
17895
|
// Parses a comma-separated list of module imports.
|
|
17915
17896
|
|
|
17916
|
-
pp$
|
|
17897
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17917
17898
|
var nodes = [], first = true;
|
|
17918
|
-
if (this.type === types.name) {
|
|
17899
|
+
if (this.type === types$1.name) {
|
|
17919
17900
|
// import defaultObj, { x, y as z } from '...'
|
|
17920
17901
|
var node = this.startNode();
|
|
17921
17902
|
node.local = this.parseIdent();
|
|
17922
17903
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17923
17904
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17924
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17905
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17925
17906
|
}
|
|
17926
|
-
if (this.type === types.star) {
|
|
17907
|
+
if (this.type === types$1.star) {
|
|
17927
17908
|
var node$1 = this.startNode();
|
|
17928
17909
|
this.next();
|
|
17929
17910
|
this.expectContextual("as");
|
|
@@ -17932,11 +17913,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17932
17913
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17933
17914
|
return nodes
|
|
17934
17915
|
}
|
|
17935
|
-
this.expect(types.braceL);
|
|
17936
|
-
while (!this.eat(types.braceR)) {
|
|
17916
|
+
this.expect(types$1.braceL);
|
|
17917
|
+
while (!this.eat(types$1.braceR)) {
|
|
17937
17918
|
if (!first) {
|
|
17938
|
-
this.expect(types.comma);
|
|
17939
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17919
|
+
this.expect(types$1.comma);
|
|
17920
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17940
17921
|
} else { first = false; }
|
|
17941
17922
|
|
|
17942
17923
|
var node$2 = this.startNode();
|
|
@@ -17954,12 +17935,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17954
17935
|
};
|
|
17955
17936
|
|
|
17956
17937
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17957
|
-
pp$
|
|
17938
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17958
17939
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17959
17940
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17960
17941
|
}
|
|
17961
17942
|
};
|
|
17962
|
-
pp$
|
|
17943
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17963
17944
|
return (
|
|
17964
17945
|
statement.type === "ExpressionStatement" &&
|
|
17965
17946
|
statement.expression.type === "Literal" &&
|
|
@@ -17969,12 +17950,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17969
17950
|
)
|
|
17970
17951
|
};
|
|
17971
17952
|
|
|
17972
|
-
var pp$
|
|
17953
|
+
var pp$7 = Parser.prototype;
|
|
17973
17954
|
|
|
17974
17955
|
// Convert existing expression atom to assignable pattern
|
|
17975
17956
|
// if possible.
|
|
17976
17957
|
|
|
17977
|
-
pp$
|
|
17958
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17978
17959
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17979
17960
|
switch (node.type) {
|
|
17980
17961
|
case "Identifier":
|
|
@@ -18055,7 +18036,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
18055
18036
|
|
|
18056
18037
|
// Convert list of expression atoms to binding list.
|
|
18057
18038
|
|
|
18058
|
-
pp$
|
|
18039
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
18059
18040
|
var end = exprList.length;
|
|
18060
18041
|
for (var i = 0; i < end; i++) {
|
|
18061
18042
|
var elt = exprList[i];
|
|
@@ -18071,19 +18052,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
18071
18052
|
|
|
18072
18053
|
// Parses spread element.
|
|
18073
18054
|
|
|
18074
|
-
pp$
|
|
18055
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
18075
18056
|
var node = this.startNode();
|
|
18076
18057
|
this.next();
|
|
18077
18058
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
18078
18059
|
return this.finishNode(node, "SpreadElement")
|
|
18079
18060
|
};
|
|
18080
18061
|
|
|
18081
|
-
pp$
|
|
18062
|
+
pp$7.parseRestBinding = function() {
|
|
18082
18063
|
var node = this.startNode();
|
|
18083
18064
|
this.next();
|
|
18084
18065
|
|
|
18085
18066
|
// RestElement inside of a function parameter must be an identifier
|
|
18086
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
18067
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
18087
18068
|
{ this.unexpected(); }
|
|
18088
18069
|
|
|
18089
18070
|
node.argument = this.parseBindingAtom();
|
|
@@ -18093,36 +18074,36 @@ pp$2.parseRestBinding = function() {
|
|
|
18093
18074
|
|
|
18094
18075
|
// Parses lvalue (assignable) atom.
|
|
18095
18076
|
|
|
18096
|
-
pp$
|
|
18077
|
+
pp$7.parseBindingAtom = function() {
|
|
18097
18078
|
if (this.options.ecmaVersion >= 6) {
|
|
18098
18079
|
switch (this.type) {
|
|
18099
|
-
case types.bracketL:
|
|
18080
|
+
case types$1.bracketL:
|
|
18100
18081
|
var node = this.startNode();
|
|
18101
18082
|
this.next();
|
|
18102
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
18083
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
18103
18084
|
return this.finishNode(node, "ArrayPattern")
|
|
18104
18085
|
|
|
18105
|
-
case types.braceL:
|
|
18086
|
+
case types$1.braceL:
|
|
18106
18087
|
return this.parseObj(true)
|
|
18107
18088
|
}
|
|
18108
18089
|
}
|
|
18109
18090
|
return this.parseIdent()
|
|
18110
18091
|
};
|
|
18111
18092
|
|
|
18112
|
-
pp$
|
|
18093
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
18113
18094
|
var elts = [], first = true;
|
|
18114
18095
|
while (!this.eat(close)) {
|
|
18115
18096
|
if (first) { first = false; }
|
|
18116
|
-
else { this.expect(types.comma); }
|
|
18117
|
-
if (allowEmpty && this.type === types.comma) {
|
|
18097
|
+
else { this.expect(types$1.comma); }
|
|
18098
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
18118
18099
|
elts.push(null);
|
|
18119
18100
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
18120
18101
|
break
|
|
18121
|
-
} else if (this.type === types.ellipsis) {
|
|
18102
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18122
18103
|
var rest = this.parseRestBinding();
|
|
18123
18104
|
this.parseBindingListItem(rest);
|
|
18124
18105
|
elts.push(rest);
|
|
18125
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18106
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18126
18107
|
this.expect(close);
|
|
18127
18108
|
break
|
|
18128
18109
|
} else {
|
|
@@ -18134,15 +18115,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
18134
18115
|
return elts
|
|
18135
18116
|
};
|
|
18136
18117
|
|
|
18137
|
-
pp$
|
|
18118
|
+
pp$7.parseBindingListItem = function(param) {
|
|
18138
18119
|
return param
|
|
18139
18120
|
};
|
|
18140
18121
|
|
|
18141
18122
|
// Parses assignment pattern around given atom if possible.
|
|
18142
18123
|
|
|
18143
|
-
pp$
|
|
18124
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18144
18125
|
left = left || this.parseBindingAtom();
|
|
18145
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18126
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18146
18127
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18147
18128
|
node.left = left;
|
|
18148
18129
|
node.right = this.parseMaybeAssign();
|
|
@@ -18213,7 +18194,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18213
18194
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18214
18195
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18215
18196
|
|
|
18216
|
-
pp$
|
|
18197
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18217
18198
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18218
18199
|
|
|
18219
18200
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18251,7 +18232,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18251
18232
|
}
|
|
18252
18233
|
};
|
|
18253
18234
|
|
|
18254
|
-
pp$
|
|
18235
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18255
18236
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18256
18237
|
|
|
18257
18238
|
switch (expr.type) {
|
|
@@ -18276,7 +18257,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18276
18257
|
}
|
|
18277
18258
|
};
|
|
18278
18259
|
|
|
18279
|
-
pp$
|
|
18260
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18280
18261
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18281
18262
|
|
|
18282
18263
|
switch (expr.type) {
|
|
@@ -18308,7 +18289,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18308
18289
|
this.generator = !!generator;
|
|
18309
18290
|
};
|
|
18310
18291
|
|
|
18311
|
-
var types
|
|
18292
|
+
var types = {
|
|
18312
18293
|
b_stat: new TokContext("{", false),
|
|
18313
18294
|
b_expr: new TokContext("{", true),
|
|
18314
18295
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18321,38 +18302,38 @@ var types$1 = {
|
|
|
18321
18302
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18322
18303
|
};
|
|
18323
18304
|
|
|
18324
|
-
var pp$
|
|
18305
|
+
var pp$6 = Parser.prototype;
|
|
18325
18306
|
|
|
18326
|
-
pp$
|
|
18327
|
-
return [types
|
|
18307
|
+
pp$6.initialContext = function() {
|
|
18308
|
+
return [types.b_stat]
|
|
18328
18309
|
};
|
|
18329
18310
|
|
|
18330
|
-
pp$
|
|
18311
|
+
pp$6.curContext = function() {
|
|
18331
18312
|
return this.context[this.context.length - 1]
|
|
18332
18313
|
};
|
|
18333
18314
|
|
|
18334
|
-
pp$
|
|
18315
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18335
18316
|
var parent = this.curContext();
|
|
18336
|
-
if (parent === types
|
|
18317
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18337
18318
|
{ return true }
|
|
18338
|
-
if (prevType === types.colon && (parent === types
|
|
18319
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18339
18320
|
{ return !parent.isExpr }
|
|
18340
18321
|
|
|
18341
18322
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18342
18323
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18343
18324
|
// `tt.name`.
|
|
18344
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18325
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18345
18326
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
18346
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
18327
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18347
18328
|
{ return true }
|
|
18348
|
-
if (prevType === types.braceL)
|
|
18349
|
-
{ return parent === types
|
|
18350
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18329
|
+
if (prevType === types$1.braceL)
|
|
18330
|
+
{ return parent === types.b_stat }
|
|
18331
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18351
18332
|
{ return false }
|
|
18352
18333
|
return !this.exprAllowed
|
|
18353
18334
|
};
|
|
18354
18335
|
|
|
18355
|
-
pp$
|
|
18336
|
+
pp$6.inGeneratorContext = function() {
|
|
18356
18337
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18357
18338
|
var context = this.context[i];
|
|
18358
18339
|
if (context.token === "function")
|
|
@@ -18361,9 +18342,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18361
18342
|
return false
|
|
18362
18343
|
};
|
|
18363
18344
|
|
|
18364
|
-
pp$
|
|
18345
|
+
pp$6.updateContext = function(prevType) {
|
|
18365
18346
|
var update, type = this.type;
|
|
18366
|
-
if (type.keyword && prevType === types.dot)
|
|
18347
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18367
18348
|
{ this.exprAllowed = false; }
|
|
18368
18349
|
else if (update = type.updateContext)
|
|
18369
18350
|
{ update.call(this, prevType); }
|
|
@@ -18372,7 +18353,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18372
18353
|
};
|
|
18373
18354
|
|
|
18374
18355
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18375
|
-
pp$
|
|
18356
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18376
18357
|
if (this.curContext() !== tokenCtx) {
|
|
18377
18358
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18378
18359
|
}
|
|
@@ -18380,71 +18361,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18380
18361
|
|
|
18381
18362
|
// Token-specific context update code
|
|
18382
18363
|
|
|
18383
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18364
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18384
18365
|
if (this.context.length === 1) {
|
|
18385
18366
|
this.exprAllowed = true;
|
|
18386
18367
|
return
|
|
18387
18368
|
}
|
|
18388
18369
|
var out = this.context.pop();
|
|
18389
|
-
if (out === types
|
|
18370
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18390
18371
|
out = this.context.pop();
|
|
18391
18372
|
}
|
|
18392
18373
|
this.exprAllowed = !out.isExpr;
|
|
18393
18374
|
};
|
|
18394
18375
|
|
|
18395
|
-
types.braceL.updateContext = function(prevType) {
|
|
18396
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18376
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18377
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18397
18378
|
this.exprAllowed = true;
|
|
18398
18379
|
};
|
|
18399
18380
|
|
|
18400
|
-
types.dollarBraceL.updateContext = function() {
|
|
18401
|
-
this.context.push(types
|
|
18381
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18382
|
+
this.context.push(types.b_tmpl);
|
|
18402
18383
|
this.exprAllowed = true;
|
|
18403
18384
|
};
|
|
18404
18385
|
|
|
18405
|
-
types.parenL.updateContext = function(prevType) {
|
|
18406
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
18407
|
-
this.context.push(statementParens ? types
|
|
18386
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18387
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18388
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18408
18389
|
this.exprAllowed = true;
|
|
18409
18390
|
};
|
|
18410
18391
|
|
|
18411
|
-
types.incDec.updateContext = function() {
|
|
18392
|
+
types$1.incDec.updateContext = function() {
|
|
18412
18393
|
// tokExprAllowed stays unchanged
|
|
18413
18394
|
};
|
|
18414
18395
|
|
|
18415
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
18416
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
18417
|
-
!(prevType === types.semi && this.curContext() !== types
|
|
18418
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18419
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types
|
|
18420
|
-
{ this.context.push(types
|
|
18396
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18397
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18398
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18399
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18400
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18401
|
+
{ this.context.push(types.f_expr); }
|
|
18421
18402
|
else
|
|
18422
|
-
{ this.context.push(types
|
|
18403
|
+
{ this.context.push(types.f_stat); }
|
|
18423
18404
|
this.exprAllowed = false;
|
|
18424
18405
|
};
|
|
18425
18406
|
|
|
18426
|
-
types.backQuote.updateContext = function() {
|
|
18427
|
-
if (this.curContext() === types
|
|
18407
|
+
types$1.backQuote.updateContext = function() {
|
|
18408
|
+
if (this.curContext() === types.q_tmpl)
|
|
18428
18409
|
{ this.context.pop(); }
|
|
18429
18410
|
else
|
|
18430
|
-
{ this.context.push(types
|
|
18411
|
+
{ this.context.push(types.q_tmpl); }
|
|
18431
18412
|
this.exprAllowed = false;
|
|
18432
18413
|
};
|
|
18433
18414
|
|
|
18434
|
-
types.star.updateContext = function(prevType) {
|
|
18435
|
-
if (prevType === types._function) {
|
|
18415
|
+
types$1.star.updateContext = function(prevType) {
|
|
18416
|
+
if (prevType === types$1._function) {
|
|
18436
18417
|
var index = this.context.length - 1;
|
|
18437
|
-
if (this.context[index] === types
|
|
18438
|
-
{ this.context[index] = types
|
|
18418
|
+
if (this.context[index] === types.f_expr)
|
|
18419
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18439
18420
|
else
|
|
18440
|
-
{ this.context[index] = types
|
|
18421
|
+
{ this.context[index] = types.f_gen; }
|
|
18441
18422
|
}
|
|
18442
18423
|
this.exprAllowed = true;
|
|
18443
18424
|
};
|
|
18444
18425
|
|
|
18445
|
-
types.name.updateContext = function(prevType) {
|
|
18426
|
+
types$1.name.updateContext = function(prevType) {
|
|
18446
18427
|
var allowed = false;
|
|
18447
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18428
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18448
18429
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18449
18430
|
this.value === "yield" && this.inGeneratorContext())
|
|
18450
18431
|
{ allowed = true; }
|
|
@@ -18454,14 +18435,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18454
18435
|
|
|
18455
18436
|
// A recursive descent parser operates by defining functions for all
|
|
18456
18437
|
|
|
18457
|
-
var pp$
|
|
18438
|
+
var pp$5 = Parser.prototype;
|
|
18458
18439
|
|
|
18459
18440
|
// Check if property name clashes with already added.
|
|
18460
18441
|
// Object/class getters and setters are not allowed to clash —
|
|
18461
18442
|
// either with each other or with an init property — and in
|
|
18462
18443
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18463
18444
|
|
|
18464
|
-
pp$
|
|
18445
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18465
18446
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18466
18447
|
{ return }
|
|
18467
18448
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18478,10 +18459,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18478
18459
|
if (name === "__proto__" && kind === "init") {
|
|
18479
18460
|
if (propHash.proto) {
|
|
18480
18461
|
if (refDestructuringErrors) {
|
|
18481
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
} else {
|
|
18462
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18463
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18464
|
+
}
|
|
18465
|
+
} else {
|
|
18466
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18467
|
+
}
|
|
18485
18468
|
}
|
|
18486
18469
|
propHash.proto = true;
|
|
18487
18470
|
}
|
|
@@ -18523,13 +18506,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18523
18506
|
// and object pattern might appear (so it's possible to raise
|
|
18524
18507
|
// delayed syntax error at correct position).
|
|
18525
18508
|
|
|
18526
|
-
pp$
|
|
18509
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18527
18510
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18528
18511
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18529
|
-
if (this.type === types.comma) {
|
|
18512
|
+
if (this.type === types$1.comma) {
|
|
18530
18513
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18531
18514
|
node.expressions = [expr];
|
|
18532
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18515
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18533
18516
|
return this.finishNode(node, "SequenceExpression")
|
|
18534
18517
|
}
|
|
18535
18518
|
return expr
|
|
@@ -18538,7 +18521,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18538
18521
|
// Parse an assignment expression. This includes applications of
|
|
18539
18522
|
// operators like `+=`.
|
|
18540
18523
|
|
|
18541
|
-
pp$
|
|
18524
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18542
18525
|
if (this.isContextual("yield")) {
|
|
18543
18526
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18544
18527
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18546,10 +18529,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18546
18529
|
else { this.exprAllowed = false; }
|
|
18547
18530
|
}
|
|
18548
18531
|
|
|
18549
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18532
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18550
18533
|
if (refDestructuringErrors) {
|
|
18551
18534
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18552
18535
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18536
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18553
18537
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18554
18538
|
} else {
|
|
18555
18539
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18557,7 +18541,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18557
18541
|
}
|
|
18558
18542
|
|
|
18559
18543
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18560
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18544
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18561
18545
|
this.potentialArrowAt = this.start;
|
|
18562
18546
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18563
18547
|
}
|
|
@@ -18566,20 +18550,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18566
18550
|
if (this.type.isAssign) {
|
|
18567
18551
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18568
18552
|
node.operator = this.value;
|
|
18569
|
-
if (this.type === types.eq)
|
|
18553
|
+
if (this.type === types$1.eq)
|
|
18570
18554
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18571
18555
|
if (!ownDestructuringErrors) {
|
|
18572
18556
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18573
18557
|
}
|
|
18574
18558
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18575
18559
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18576
|
-
if (this.type === types.eq)
|
|
18560
|
+
if (this.type === types$1.eq)
|
|
18577
18561
|
{ this.checkLValPattern(left); }
|
|
18578
18562
|
else
|
|
18579
18563
|
{ this.checkLValSimple(left); }
|
|
18580
18564
|
node.left = left;
|
|
18581
18565
|
this.next();
|
|
18582
18566
|
node.right = this.parseMaybeAssign(forInit);
|
|
18567
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18583
18568
|
return this.finishNode(node, "AssignmentExpression")
|
|
18584
18569
|
} else {
|
|
18585
18570
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18591,15 +18576,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18591
18576
|
|
|
18592
18577
|
// Parse a ternary conditional (`?:`) operator.
|
|
18593
18578
|
|
|
18594
|
-
pp$
|
|
18579
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18595
18580
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18596
18581
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18597
18582
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18598
|
-
if (this.eat(types.question)) {
|
|
18583
|
+
if (this.eat(types$1.question)) {
|
|
18599
18584
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18600
18585
|
node.test = expr;
|
|
18601
18586
|
node.consequent = this.parseMaybeAssign();
|
|
18602
|
-
this.expect(types.colon);
|
|
18587
|
+
this.expect(types$1.colon);
|
|
18603
18588
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18604
18589
|
return this.finishNode(node, "ConditionalExpression")
|
|
18605
18590
|
}
|
|
@@ -18608,7 +18593,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18608
18593
|
|
|
18609
18594
|
// Start the precedence parser.
|
|
18610
18595
|
|
|
18611
|
-
pp$
|
|
18596
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18612
18597
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18613
18598
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18614
18599
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18621,23 +18606,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18621
18606
|
// defer further parser to one of its callers when it encounters an
|
|
18622
18607
|
// operator that has a lower precedence than the set it is parsing.
|
|
18623
18608
|
|
|
18624
|
-
pp$
|
|
18609
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18625
18610
|
var prec = this.type.binop;
|
|
18626
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18611
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18627
18612
|
if (prec > minPrec) {
|
|
18628
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18629
|
-
var coalesce = this.type === types.coalesce;
|
|
18613
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18614
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18630
18615
|
if (coalesce) {
|
|
18631
18616
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18632
18617
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18633
|
-
prec = types.logicalAND.binop;
|
|
18618
|
+
prec = types$1.logicalAND.binop;
|
|
18634
18619
|
}
|
|
18635
18620
|
var op = this.value;
|
|
18636
18621
|
this.next();
|
|
18637
18622
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18638
18623
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18639
18624
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
18640
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
18625
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18641
18626
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18642
18627
|
}
|
|
18643
18628
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18646,7 +18631,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18646
18631
|
return left
|
|
18647
18632
|
};
|
|
18648
18633
|
|
|
18649
|
-
pp$
|
|
18634
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18635
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18650
18636
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18651
18637
|
node.left = left;
|
|
18652
18638
|
node.operator = op;
|
|
@@ -18656,13 +18642,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18656
18642
|
|
|
18657
18643
|
// Parse unary operators, both prefix and postfix.
|
|
18658
18644
|
|
|
18659
|
-
pp$
|
|
18645
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18660
18646
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18661
18647
|
if (this.isContextual("await") && this.canAwait) {
|
|
18662
18648
|
expr = this.parseAwait(forInit);
|
|
18663
18649
|
sawUnary = true;
|
|
18664
18650
|
} else if (this.type.prefix) {
|
|
18665
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18651
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18666
18652
|
node.operator = this.value;
|
|
18667
18653
|
node.prefix = true;
|
|
18668
18654
|
this.next();
|
|
@@ -18676,6 +18662,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18676
18662
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18677
18663
|
else { sawUnary = true; }
|
|
18678
18664
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18665
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18666
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18667
|
+
expr = this.parsePrivateIdent();
|
|
18668
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18669
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18679
18670
|
} else {
|
|
18680
18671
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18681
18672
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18690,7 +18681,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18690
18681
|
}
|
|
18691
18682
|
}
|
|
18692
18683
|
|
|
18693
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18684
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18694
18685
|
if (sawUnary)
|
|
18695
18686
|
{ this.unexpected(this.lastTokStart); }
|
|
18696
18687
|
else
|
|
@@ -18709,7 +18700,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18709
18700
|
|
|
18710
18701
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18711
18702
|
|
|
18712
|
-
pp$
|
|
18703
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18713
18704
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18714
18705
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18715
18706
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18723,7 +18714,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18723
18714
|
return result
|
|
18724
18715
|
};
|
|
18725
18716
|
|
|
18726
|
-
pp$
|
|
18717
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18727
18718
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18728
18719
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18729
18720
|
this.potentialArrowAt === base.start;
|
|
@@ -18746,19 +18737,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18746
18737
|
}
|
|
18747
18738
|
};
|
|
18748
18739
|
|
|
18749
|
-
pp$
|
|
18740
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18750
18741
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18751
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18742
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18752
18743
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18753
18744
|
|
|
18754
|
-
var computed = this.eat(types.bracketL);
|
|
18755
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18745
|
+
var computed = this.eat(types$1.bracketL);
|
|
18746
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18756
18747
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18757
18748
|
node.object = base;
|
|
18758
18749
|
if (computed) {
|
|
18759
18750
|
node.property = this.parseExpression();
|
|
18760
|
-
this.expect(types.bracketR);
|
|
18761
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18751
|
+
this.expect(types$1.bracketR);
|
|
18752
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18762
18753
|
node.property = this.parsePrivateIdent();
|
|
18763
18754
|
} else {
|
|
18764
18755
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18768,13 +18759,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18768
18759
|
node.optional = optional;
|
|
18769
18760
|
}
|
|
18770
18761
|
base = this.finishNode(node, "MemberExpression");
|
|
18771
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18762
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18772
18763
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18773
18764
|
this.yieldPos = 0;
|
|
18774
18765
|
this.awaitPos = 0;
|
|
18775
18766
|
this.awaitIdentPos = 0;
|
|
18776
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18777
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18767
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18768
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18778
18769
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18779
18770
|
this.checkYieldAwaitInDefaultParams();
|
|
18780
18771
|
if (this.awaitIdentPos > 0)
|
|
@@ -18795,7 +18786,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18795
18786
|
node$1.optional = optional;
|
|
18796
18787
|
}
|
|
18797
18788
|
base = this.finishNode(node$1, "CallExpression");
|
|
18798
|
-
} else if (this.type === types.backQuote) {
|
|
18789
|
+
} else if (this.type === types$1.backQuote) {
|
|
18799
18790
|
if (optional || optionalChained) {
|
|
18800
18791
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18801
18792
|
}
|
|
@@ -18812,19 +18803,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18812
18803
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18813
18804
|
// or `{}`.
|
|
18814
18805
|
|
|
18815
|
-
pp$
|
|
18806
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18816
18807
|
// If a division operator appears in an expression position, the
|
|
18817
18808
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18818
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18809
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18819
18810
|
|
|
18820
18811
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18821
18812
|
switch (this.type) {
|
|
18822
|
-
case types._super:
|
|
18813
|
+
case types$1._super:
|
|
18823
18814
|
if (!this.allowSuper)
|
|
18824
18815
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18825
18816
|
node = this.startNode();
|
|
18826
18817
|
this.next();
|
|
18827
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18818
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18828
18819
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18829
18820
|
// The `super` keyword can appear at below:
|
|
18830
18821
|
// SuperProperty:
|
|
@@ -18832,52 +18823,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18832
18823
|
// super . IdentifierName
|
|
18833
18824
|
// SuperCall:
|
|
18834
18825
|
// super ( Arguments )
|
|
18835
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18826
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18836
18827
|
{ this.unexpected(); }
|
|
18837
18828
|
return this.finishNode(node, "Super")
|
|
18838
18829
|
|
|
18839
|
-
case types._this:
|
|
18830
|
+
case types$1._this:
|
|
18840
18831
|
node = this.startNode();
|
|
18841
18832
|
this.next();
|
|
18842
18833
|
return this.finishNode(node, "ThisExpression")
|
|
18843
18834
|
|
|
18844
|
-
case types.name:
|
|
18835
|
+
case types$1.name:
|
|
18845
18836
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18846
18837
|
var id = this.parseIdent(false);
|
|
18847
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
|
|
18848
|
-
this.overrideContext(types
|
|
18838
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18839
|
+
this.overrideContext(types.f_expr);
|
|
18849
18840
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18850
18841
|
}
|
|
18851
18842
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18852
|
-
if (this.eat(types.arrow))
|
|
18843
|
+
if (this.eat(types$1.arrow))
|
|
18853
18844
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18854
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18845
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18855
18846
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18856
18847
|
id = this.parseIdent(false);
|
|
18857
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18848
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18858
18849
|
{ this.unexpected(); }
|
|
18859
18850
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18860
18851
|
}
|
|
18861
18852
|
}
|
|
18862
18853
|
return id
|
|
18863
18854
|
|
|
18864
|
-
case types.regexp:
|
|
18855
|
+
case types$1.regexp:
|
|
18865
18856
|
var value = this.value;
|
|
18866
18857
|
node = this.parseLiteral(value.value);
|
|
18867
18858
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18868
18859
|
return node
|
|
18869
18860
|
|
|
18870
|
-
case types.num: case types.string:
|
|
18861
|
+
case types$1.num: case types$1.string:
|
|
18871
18862
|
return this.parseLiteral(this.value)
|
|
18872
18863
|
|
|
18873
|
-
case types._null: case types._true: case types._false:
|
|
18864
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18874
18865
|
node = this.startNode();
|
|
18875
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18866
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18876
18867
|
node.raw = this.type.keyword;
|
|
18877
18868
|
this.next();
|
|
18878
18869
|
return this.finishNode(node, "Literal")
|
|
18879
18870
|
|
|
18880
|
-
case types.parenL:
|
|
18871
|
+
case types$1.parenL:
|
|
18881
18872
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18882
18873
|
if (refDestructuringErrors) {
|
|
18883
18874
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18887,31 +18878,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18887
18878
|
}
|
|
18888
18879
|
return expr
|
|
18889
18880
|
|
|
18890
|
-
case types.bracketL:
|
|
18881
|
+
case types$1.bracketL:
|
|
18891
18882
|
node = this.startNode();
|
|
18892
18883
|
this.next();
|
|
18893
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18884
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18894
18885
|
return this.finishNode(node, "ArrayExpression")
|
|
18895
18886
|
|
|
18896
|
-
case types.braceL:
|
|
18897
|
-
this.overrideContext(types
|
|
18887
|
+
case types$1.braceL:
|
|
18888
|
+
this.overrideContext(types.b_expr);
|
|
18898
18889
|
return this.parseObj(false, refDestructuringErrors)
|
|
18899
18890
|
|
|
18900
|
-
case types._function:
|
|
18891
|
+
case types$1._function:
|
|
18901
18892
|
node = this.startNode();
|
|
18902
18893
|
this.next();
|
|
18903
18894
|
return this.parseFunction(node, 0)
|
|
18904
18895
|
|
|
18905
|
-
case types._class:
|
|
18896
|
+
case types$1._class:
|
|
18906
18897
|
return this.parseClass(this.startNode(), false)
|
|
18907
18898
|
|
|
18908
|
-
case types._new:
|
|
18899
|
+
case types$1._new:
|
|
18909
18900
|
return this.parseNew()
|
|
18910
18901
|
|
|
18911
|
-
case types.backQuote:
|
|
18902
|
+
case types$1.backQuote:
|
|
18912
18903
|
return this.parseTemplate()
|
|
18913
18904
|
|
|
18914
|
-
case types._import:
|
|
18905
|
+
case types$1._import:
|
|
18915
18906
|
if (this.options.ecmaVersion >= 11) {
|
|
18916
18907
|
return this.parseExprImport()
|
|
18917
18908
|
} else {
|
|
@@ -18923,7 +18914,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18923
18914
|
}
|
|
18924
18915
|
};
|
|
18925
18916
|
|
|
18926
|
-
pp$
|
|
18917
|
+
pp$5.parseExprImport = function() {
|
|
18927
18918
|
var node = this.startNode();
|
|
18928
18919
|
|
|
18929
18920
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18932,9 +18923,9 @@ pp$4.parseExprImport = function() {
|
|
|
18932
18923
|
var meta = this.parseIdent(true);
|
|
18933
18924
|
|
|
18934
18925
|
switch (this.type) {
|
|
18935
|
-
case types.parenL:
|
|
18926
|
+
case types$1.parenL:
|
|
18936
18927
|
return this.parseDynamicImport(node)
|
|
18937
|
-
case types.dot:
|
|
18928
|
+
case types$1.dot:
|
|
18938
18929
|
node.meta = meta;
|
|
18939
18930
|
return this.parseImportMeta(node)
|
|
18940
18931
|
default:
|
|
@@ -18942,16 +18933,16 @@ pp$4.parseExprImport = function() {
|
|
|
18942
18933
|
}
|
|
18943
18934
|
};
|
|
18944
18935
|
|
|
18945
|
-
pp$
|
|
18936
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18946
18937
|
this.next(); // skip `(`
|
|
18947
18938
|
|
|
18948
18939
|
// Parse node.source.
|
|
18949
18940
|
node.source = this.parseMaybeAssign();
|
|
18950
18941
|
|
|
18951
18942
|
// Verify ending.
|
|
18952
|
-
if (!this.eat(types.parenR)) {
|
|
18943
|
+
if (!this.eat(types$1.parenR)) {
|
|
18953
18944
|
var errorPos = this.start;
|
|
18954
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
18945
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18955
18946
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18956
18947
|
} else {
|
|
18957
18948
|
this.unexpected(errorPos);
|
|
@@ -18961,7 +18952,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18961
18952
|
return this.finishNode(node, "ImportExpression")
|
|
18962
18953
|
};
|
|
18963
18954
|
|
|
18964
|
-
pp$
|
|
18955
|
+
pp$5.parseImportMeta = function(node) {
|
|
18965
18956
|
this.next(); // skip `.`
|
|
18966
18957
|
|
|
18967
18958
|
var containsEsc = this.containsEsc;
|
|
@@ -18977,7 +18968,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18977
18968
|
return this.finishNode(node, "MetaProperty")
|
|
18978
18969
|
};
|
|
18979
18970
|
|
|
18980
|
-
pp$
|
|
18971
|
+
pp$5.parseLiteral = function(value) {
|
|
18981
18972
|
var node = this.startNode();
|
|
18982
18973
|
node.value = value;
|
|
18983
18974
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18986,14 +18977,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18986
18977
|
return this.finishNode(node, "Literal")
|
|
18987
18978
|
};
|
|
18988
18979
|
|
|
18989
|
-
pp$
|
|
18990
|
-
this.expect(types.parenL);
|
|
18980
|
+
pp$5.parseParenExpression = function() {
|
|
18981
|
+
this.expect(types$1.parenL);
|
|
18991
18982
|
var val = this.parseExpression();
|
|
18992
|
-
this.expect(types.parenR);
|
|
18983
|
+
this.expect(types$1.parenR);
|
|
18993
18984
|
return val
|
|
18994
18985
|
};
|
|
18995
18986
|
|
|
18996
|
-
pp$
|
|
18987
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18997
18988
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18998
18989
|
if (this.options.ecmaVersion >= 6) {
|
|
18999
18990
|
this.next();
|
|
@@ -19004,24 +18995,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
19004
18995
|
this.yieldPos = 0;
|
|
19005
18996
|
this.awaitPos = 0;
|
|
19006
18997
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
19007
|
-
while (this.type !== types.parenR) {
|
|
19008
|
-
first ? first = false : this.expect(types.comma);
|
|
19009
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
18998
|
+
while (this.type !== types$1.parenR) {
|
|
18999
|
+
first ? first = false : this.expect(types$1.comma);
|
|
19000
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
19010
19001
|
lastIsComma = true;
|
|
19011
19002
|
break
|
|
19012
|
-
} else if (this.type === types.ellipsis) {
|
|
19003
|
+
} else if (this.type === types$1.ellipsis) {
|
|
19013
19004
|
spreadStart = this.start;
|
|
19014
19005
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
19015
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
19006
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
19016
19007
|
break
|
|
19017
19008
|
} else {
|
|
19018
19009
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
19019
19010
|
}
|
|
19020
19011
|
}
|
|
19021
19012
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
19022
|
-
this.expect(types.parenR);
|
|
19013
|
+
this.expect(types$1.parenR);
|
|
19023
19014
|
|
|
19024
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
19015
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
19025
19016
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
19026
19017
|
this.checkYieldAwaitInDefaultParams();
|
|
19027
19018
|
this.yieldPos = oldYieldPos;
|
|
@@ -19055,12 +19046,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
19055
19046
|
}
|
|
19056
19047
|
};
|
|
19057
19048
|
|
|
19058
|
-
pp$
|
|
19049
|
+
pp$5.parseParenItem = function(item) {
|
|
19059
19050
|
return item
|
|
19060
19051
|
};
|
|
19061
19052
|
|
|
19062
|
-
pp$
|
|
19063
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
19053
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
19054
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
19064
19055
|
};
|
|
19065
19056
|
|
|
19066
19057
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -19069,13 +19060,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
19069
19060
|
// argument to parseSubscripts to prevent it from consuming the
|
|
19070
19061
|
// argument list.
|
|
19071
19062
|
|
|
19072
|
-
var empty
|
|
19063
|
+
var empty = [];
|
|
19073
19064
|
|
|
19074
|
-
pp$
|
|
19065
|
+
pp$5.parseNew = function() {
|
|
19075
19066
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
19076
19067
|
var node = this.startNode();
|
|
19077
19068
|
var meta = this.parseIdent(true);
|
|
19078
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
19069
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
19079
19070
|
node.meta = meta;
|
|
19080
19071
|
var containsEsc = this.containsEsc;
|
|
19081
19072
|
node.property = this.parseIdent(true);
|
|
@@ -19087,23 +19078,23 @@ pp$4.parseNew = function() {
|
|
|
19087
19078
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
19088
19079
|
return this.finishNode(node, "MetaProperty")
|
|
19089
19080
|
}
|
|
19090
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
19081
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
19091
19082
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
19092
19083
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
19093
19084
|
this.raise(startPos, "Cannot use new with import()");
|
|
19094
19085
|
}
|
|
19095
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19096
|
-
else { node.arguments = empty
|
|
19086
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19087
|
+
else { node.arguments = empty; }
|
|
19097
19088
|
return this.finishNode(node, "NewExpression")
|
|
19098
19089
|
};
|
|
19099
19090
|
|
|
19100
19091
|
// Parse template expression.
|
|
19101
19092
|
|
|
19102
|
-
pp$
|
|
19093
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
19103
19094
|
var isTagged = ref.isTagged;
|
|
19104
19095
|
|
|
19105
19096
|
var elem = this.startNode();
|
|
19106
|
-
if (this.type === types.invalidTemplate) {
|
|
19097
|
+
if (this.type === types$1.invalidTemplate) {
|
|
19107
19098
|
if (!isTagged) {
|
|
19108
19099
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
19109
19100
|
}
|
|
@@ -19118,11 +19109,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
19118
19109
|
};
|
|
19119
19110
|
}
|
|
19120
19111
|
this.next();
|
|
19121
|
-
elem.tail = this.type === types.backQuote;
|
|
19112
|
+
elem.tail = this.type === types$1.backQuote;
|
|
19122
19113
|
return this.finishNode(elem, "TemplateElement")
|
|
19123
19114
|
};
|
|
19124
19115
|
|
|
19125
|
-
pp$
|
|
19116
|
+
pp$5.parseTemplate = function(ref) {
|
|
19126
19117
|
if ( ref === void 0 ) ref = {};
|
|
19127
19118
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
19128
19119
|
|
|
@@ -19132,32 +19123,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
19132
19123
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
19133
19124
|
node.quasis = [curElt];
|
|
19134
19125
|
while (!curElt.tail) {
|
|
19135
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19136
|
-
this.expect(types.dollarBraceL);
|
|
19126
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19127
|
+
this.expect(types$1.dollarBraceL);
|
|
19137
19128
|
node.expressions.push(this.parseExpression());
|
|
19138
|
-
this.expect(types.braceR);
|
|
19129
|
+
this.expect(types$1.braceR);
|
|
19139
19130
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19140
19131
|
}
|
|
19141
19132
|
this.next();
|
|
19142
19133
|
return this.finishNode(node, "TemplateLiteral")
|
|
19143
19134
|
};
|
|
19144
19135
|
|
|
19145
|
-
pp$
|
|
19136
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19146
19137
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
19147
|
-
(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)) &&
|
|
19138
|
+
(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)) &&
|
|
19148
19139
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19149
19140
|
};
|
|
19150
19141
|
|
|
19151
19142
|
// Parse an object literal or binding pattern.
|
|
19152
19143
|
|
|
19153
|
-
pp$
|
|
19144
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19154
19145
|
var node = this.startNode(), first = true, propHash = {};
|
|
19155
19146
|
node.properties = [];
|
|
19156
19147
|
this.next();
|
|
19157
|
-
while (!this.eat(types.braceR)) {
|
|
19148
|
+
while (!this.eat(types$1.braceR)) {
|
|
19158
19149
|
if (!first) {
|
|
19159
|
-
this.expect(types.comma);
|
|
19160
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19150
|
+
this.expect(types$1.comma);
|
|
19151
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19161
19152
|
} else { first = false; }
|
|
19162
19153
|
|
|
19163
19154
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19167,18 +19158,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19167
19158
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19168
19159
|
};
|
|
19169
19160
|
|
|
19170
|
-
pp$
|
|
19161
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19171
19162
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19172
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19163
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19173
19164
|
if (isPattern) {
|
|
19174
19165
|
prop.argument = this.parseIdent(false);
|
|
19175
|
-
if (this.type === types.comma) {
|
|
19166
|
+
if (this.type === types$1.comma) {
|
|
19176
19167
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19177
19168
|
}
|
|
19178
19169
|
return this.finishNode(prop, "RestElement")
|
|
19179
19170
|
}
|
|
19180
19171
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19181
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19172
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19182
19173
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19183
19174
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19184
19175
|
}
|
|
@@ -19189,7 +19180,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19189
19180
|
// Parse argument.
|
|
19190
19181
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19191
19182
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19192
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19183
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19193
19184
|
refDestructuringErrors.trailingComma = this.start;
|
|
19194
19185
|
}
|
|
19195
19186
|
// Finish
|
|
@@ -19203,13 +19194,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19203
19194
|
startLoc = this.startLoc;
|
|
19204
19195
|
}
|
|
19205
19196
|
if (!isPattern)
|
|
19206
|
-
{ isGenerator = this.eat(types.star); }
|
|
19197
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19207
19198
|
}
|
|
19208
19199
|
var containsEsc = this.containsEsc;
|
|
19209
19200
|
this.parsePropertyName(prop);
|
|
19210
19201
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19211
19202
|
isAsync = true;
|
|
19212
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19203
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19213
19204
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19214
19205
|
} else {
|
|
19215
19206
|
isAsync = false;
|
|
@@ -19218,14 +19209,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19218
19209
|
return this.finishNode(prop, "Property")
|
|
19219
19210
|
};
|
|
19220
19211
|
|
|
19221
|
-
pp$
|
|
19222
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19212
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19213
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19223
19214
|
{ this.unexpected(); }
|
|
19224
19215
|
|
|
19225
|
-
if (this.eat(types.colon)) {
|
|
19216
|
+
if (this.eat(types$1.colon)) {
|
|
19226
19217
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19227
19218
|
prop.kind = "init";
|
|
19228
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19219
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19229
19220
|
if (isPattern) { this.unexpected(); }
|
|
19230
19221
|
prop.kind = "init";
|
|
19231
19222
|
prop.method = true;
|
|
@@ -19233,7 +19224,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19233
19224
|
} else if (!isPattern && !containsEsc &&
|
|
19234
19225
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19235
19226
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19236
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19227
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19237
19228
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19238
19229
|
prop.kind = prop.key.name;
|
|
19239
19230
|
this.parsePropertyName(prop);
|
|
@@ -19257,7 +19248,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19257
19248
|
prop.kind = "init";
|
|
19258
19249
|
if (isPattern) {
|
|
19259
19250
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19260
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19251
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19261
19252
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19262
19253
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19263
19254
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19268,23 +19259,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19268
19259
|
} else { this.unexpected(); }
|
|
19269
19260
|
};
|
|
19270
19261
|
|
|
19271
|
-
pp$
|
|
19262
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19272
19263
|
if (this.options.ecmaVersion >= 6) {
|
|
19273
|
-
if (this.eat(types.bracketL)) {
|
|
19264
|
+
if (this.eat(types$1.bracketL)) {
|
|
19274
19265
|
prop.computed = true;
|
|
19275
19266
|
prop.key = this.parseMaybeAssign();
|
|
19276
|
-
this.expect(types.bracketR);
|
|
19267
|
+
this.expect(types$1.bracketR);
|
|
19277
19268
|
return prop.key
|
|
19278
19269
|
} else {
|
|
19279
19270
|
prop.computed = false;
|
|
19280
19271
|
}
|
|
19281
19272
|
}
|
|
19282
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19273
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19283
19274
|
};
|
|
19284
19275
|
|
|
19285
19276
|
// Initialize empty function node.
|
|
19286
19277
|
|
|
19287
|
-
pp$
|
|
19278
|
+
pp$5.initFunction = function(node) {
|
|
19288
19279
|
node.id = null;
|
|
19289
19280
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19290
19281
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19292,7 +19283,7 @@ pp$4.initFunction = function(node) {
|
|
|
19292
19283
|
|
|
19293
19284
|
// Parse object or class method.
|
|
19294
19285
|
|
|
19295
|
-
pp$
|
|
19286
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19296
19287
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19297
19288
|
|
|
19298
19289
|
this.initFunction(node);
|
|
@@ -19306,8 +19297,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19306
19297
|
this.awaitIdentPos = 0;
|
|
19307
19298
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19308
19299
|
|
|
19309
|
-
this.expect(types.parenL);
|
|
19310
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19300
|
+
this.expect(types$1.parenL);
|
|
19301
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19311
19302
|
this.checkYieldAwaitInDefaultParams();
|
|
19312
19303
|
this.parseFunctionBody(node, false, true, false);
|
|
19313
19304
|
|
|
@@ -19319,7 +19310,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19319
19310
|
|
|
19320
19311
|
// Parse arrow function expression with given parameters.
|
|
19321
19312
|
|
|
19322
|
-
pp$
|
|
19313
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19323
19314
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19324
19315
|
|
|
19325
19316
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19341,8 +19332,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19341
19332
|
|
|
19342
19333
|
// Parse function body and check parameters.
|
|
19343
19334
|
|
|
19344
|
-
pp$
|
|
19345
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19335
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19336
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19346
19337
|
var oldStrict = this.strict, useStrict = false;
|
|
19347
19338
|
|
|
19348
19339
|
if (isExpression) {
|
|
@@ -19378,7 +19369,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19378
19369
|
this.exitScope();
|
|
19379
19370
|
};
|
|
19380
19371
|
|
|
19381
|
-
pp$
|
|
19372
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19382
19373
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19383
19374
|
{
|
|
19384
19375
|
var param = list[i];
|
|
@@ -19391,7 +19382,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19391
19382
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19392
19383
|
// or "arguments" and duplicate parameters.
|
|
19393
19384
|
|
|
19394
|
-
pp$
|
|
19385
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19395
19386
|
var nameHash = Object.create(null);
|
|
19396
19387
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19397
19388
|
{
|
|
@@ -19407,20 +19398,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19407
19398
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19408
19399
|
// for array literals).
|
|
19409
19400
|
|
|
19410
|
-
pp$
|
|
19401
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19411
19402
|
var elts = [], first = true;
|
|
19412
19403
|
while (!this.eat(close)) {
|
|
19413
19404
|
if (!first) {
|
|
19414
|
-
this.expect(types.comma);
|
|
19405
|
+
this.expect(types$1.comma);
|
|
19415
19406
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19416
19407
|
} else { first = false; }
|
|
19417
19408
|
|
|
19418
19409
|
var elt = (void 0);
|
|
19419
|
-
if (allowEmpty && this.type === types.comma)
|
|
19410
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19420
19411
|
{ elt = null; }
|
|
19421
|
-
else if (this.type === types.ellipsis) {
|
|
19412
|
+
else if (this.type === types$1.ellipsis) {
|
|
19422
19413
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19423
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19414
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19424
19415
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19425
19416
|
} else {
|
|
19426
19417
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19430,7 +19421,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19430
19421
|
return elts
|
|
19431
19422
|
};
|
|
19432
19423
|
|
|
19433
|
-
pp$
|
|
19424
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19434
19425
|
var start = ref.start;
|
|
19435
19426
|
var end = ref.end;
|
|
19436
19427
|
var name = ref.name;
|
|
@@ -19459,9 +19450,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19459
19450
|
// when parsing properties), it will also convert keywords into
|
|
19460
19451
|
// identifiers.
|
|
19461
19452
|
|
|
19462
|
-
pp$
|
|
19453
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19463
19454
|
var node = this.startNode();
|
|
19464
|
-
if (this.type === types.name) {
|
|
19455
|
+
if (this.type === types$1.name) {
|
|
19465
19456
|
node.name = this.value;
|
|
19466
19457
|
} else if (this.type.keyword) {
|
|
19467
19458
|
node.name = this.type.keyword;
|
|
@@ -19487,9 +19478,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19487
19478
|
return node
|
|
19488
19479
|
};
|
|
19489
19480
|
|
|
19490
|
-
pp$
|
|
19481
|
+
pp$5.parsePrivateIdent = function() {
|
|
19491
19482
|
var node = this.startNode();
|
|
19492
|
-
if (this.type === types.privateId) {
|
|
19483
|
+
if (this.type === types$1.privateId) {
|
|
19493
19484
|
node.name = this.value;
|
|
19494
19485
|
} else {
|
|
19495
19486
|
this.unexpected();
|
|
@@ -19509,22 +19500,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19509
19500
|
|
|
19510
19501
|
// Parses yield expression inside generator.
|
|
19511
19502
|
|
|
19512
|
-
pp$
|
|
19503
|
+
pp$5.parseYield = function(forInit) {
|
|
19513
19504
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19514
19505
|
|
|
19515
19506
|
var node = this.startNode();
|
|
19516
19507
|
this.next();
|
|
19517
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19508
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19518
19509
|
node.delegate = false;
|
|
19519
19510
|
node.argument = null;
|
|
19520
19511
|
} else {
|
|
19521
|
-
node.delegate = this.eat(types.star);
|
|
19512
|
+
node.delegate = this.eat(types$1.star);
|
|
19522
19513
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19523
19514
|
}
|
|
19524
19515
|
return this.finishNode(node, "YieldExpression")
|
|
19525
19516
|
};
|
|
19526
19517
|
|
|
19527
|
-
pp$
|
|
19518
|
+
pp$5.parseAwait = function(forInit) {
|
|
19528
19519
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19529
19520
|
|
|
19530
19521
|
var node = this.startNode();
|
|
@@ -19533,7 +19524,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19533
19524
|
return this.finishNode(node, "AwaitExpression")
|
|
19534
19525
|
};
|
|
19535
19526
|
|
|
19536
|
-
var pp$
|
|
19527
|
+
var pp$4 = Parser.prototype;
|
|
19537
19528
|
|
|
19538
19529
|
// This function is used to raise exceptions on parse errors. It
|
|
19539
19530
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19541,7 +19532,7 @@ var pp$5 = Parser.prototype;
|
|
|
19541
19532
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19542
19533
|
// message.
|
|
19543
19534
|
|
|
19544
|
-
pp$
|
|
19535
|
+
pp$4.raise = function(pos, message) {
|
|
19545
19536
|
var loc = getLineInfo(this.input, pos);
|
|
19546
19537
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19547
19538
|
var err = new SyntaxError(message);
|
|
@@ -19549,15 +19540,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19549
19540
|
throw err
|
|
19550
19541
|
};
|
|
19551
19542
|
|
|
19552
|
-
pp$
|
|
19543
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19553
19544
|
|
|
19554
|
-
pp$
|
|
19545
|
+
pp$4.curPosition = function() {
|
|
19555
19546
|
if (this.options.locations) {
|
|
19556
19547
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19557
19548
|
}
|
|
19558
19549
|
};
|
|
19559
19550
|
|
|
19560
|
-
var pp$
|
|
19551
|
+
var pp$3 = Parser.prototype;
|
|
19561
19552
|
|
|
19562
19553
|
var Scope = function Scope(flags) {
|
|
19563
19554
|
this.flags = flags;
|
|
@@ -19573,22 +19564,22 @@ var Scope = function Scope(flags) {
|
|
|
19573
19564
|
|
|
19574
19565
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19575
19566
|
|
|
19576
|
-
pp$
|
|
19567
|
+
pp$3.enterScope = function(flags) {
|
|
19577
19568
|
this.scopeStack.push(new Scope(flags));
|
|
19578
19569
|
};
|
|
19579
19570
|
|
|
19580
|
-
pp$
|
|
19571
|
+
pp$3.exitScope = function() {
|
|
19581
19572
|
this.scopeStack.pop();
|
|
19582
19573
|
};
|
|
19583
19574
|
|
|
19584
19575
|
// The spec says:
|
|
19585
19576
|
// > At the top level of a function, or script, function declarations are
|
|
19586
19577
|
// > treated like var declarations rather than like lexical declarations.
|
|
19587
|
-
pp$
|
|
19578
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19588
19579
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19589
19580
|
};
|
|
19590
19581
|
|
|
19591
|
-
pp$
|
|
19582
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19592
19583
|
var redeclared = false;
|
|
19593
19584
|
if (bindingType === BIND_LEXICAL) {
|
|
19594
19585
|
var scope = this.currentScope();
|
|
@@ -19623,7 +19614,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19623
19614
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19624
19615
|
};
|
|
19625
19616
|
|
|
19626
|
-
pp$
|
|
19617
|
+
pp$3.checkLocalExport = function(id) {
|
|
19627
19618
|
// scope.functions must be empty as Module code is always strict.
|
|
19628
19619
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19629
19620
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19631,11 +19622,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19631
19622
|
}
|
|
19632
19623
|
};
|
|
19633
19624
|
|
|
19634
|
-
pp$
|
|
19625
|
+
pp$3.currentScope = function() {
|
|
19635
19626
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19636
19627
|
};
|
|
19637
19628
|
|
|
19638
|
-
pp$
|
|
19629
|
+
pp$3.currentVarScope = function() {
|
|
19639
19630
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19640
19631
|
var scope = this.scopeStack[i];
|
|
19641
19632
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19643,7 +19634,7 @@ pp$6.currentVarScope = function() {
|
|
|
19643
19634
|
};
|
|
19644
19635
|
|
|
19645
19636
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19646
|
-
pp$
|
|
19637
|
+
pp$3.currentThisScope = function() {
|
|
19647
19638
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19648
19639
|
var scope = this.scopeStack[i];
|
|
19649
19640
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19664,13 +19655,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19664
19655
|
|
|
19665
19656
|
// Start an AST node, attaching a start offset.
|
|
19666
19657
|
|
|
19667
|
-
var pp$
|
|
19658
|
+
var pp$2 = Parser.prototype;
|
|
19668
19659
|
|
|
19669
|
-
pp$
|
|
19660
|
+
pp$2.startNode = function() {
|
|
19670
19661
|
return new Node(this, this.start, this.startLoc)
|
|
19671
19662
|
};
|
|
19672
19663
|
|
|
19673
|
-
pp$
|
|
19664
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19674
19665
|
return new Node(this, pos, loc)
|
|
19675
19666
|
};
|
|
19676
19667
|
|
|
@@ -19686,17 +19677,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19686
19677
|
return node
|
|
19687
19678
|
}
|
|
19688
19679
|
|
|
19689
|
-
pp$
|
|
19680
|
+
pp$2.finishNode = function(node, type) {
|
|
19690
19681
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19691
19682
|
};
|
|
19692
19683
|
|
|
19693
19684
|
// Finish node at given position
|
|
19694
19685
|
|
|
19695
|
-
pp$
|
|
19686
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19696
19687
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19697
19688
|
};
|
|
19698
19689
|
|
|
19699
|
-
pp$
|
|
19690
|
+
pp$2.copyNode = function(node) {
|
|
19700
19691
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19701
19692
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19702
19693
|
return newNode
|
|
@@ -19753,7 +19744,7 @@ buildUnicodeData(10);
|
|
|
19753
19744
|
buildUnicodeData(11);
|
|
19754
19745
|
buildUnicodeData(12);
|
|
19755
19746
|
|
|
19756
|
-
var pp$
|
|
19747
|
+
var pp$1 = Parser.prototype;
|
|
19757
19748
|
|
|
19758
19749
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19759
19750
|
this.parser = parser;
|
|
@@ -19849,7 +19840,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19849
19840
|
return false
|
|
19850
19841
|
};
|
|
19851
19842
|
|
|
19852
|
-
function codePointToString(ch) {
|
|
19843
|
+
function codePointToString$1(ch) {
|
|
19853
19844
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19854
19845
|
ch -= 0x10000;
|
|
19855
19846
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19861,7 +19852,7 @@ function codePointToString(ch) {
|
|
|
19861
19852
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19862
19853
|
* @returns {void}
|
|
19863
19854
|
*/
|
|
19864
|
-
pp$
|
|
19855
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19865
19856
|
var validFlags = state.validFlags;
|
|
19866
19857
|
var flags = state.flags;
|
|
19867
19858
|
|
|
@@ -19882,7 +19873,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19882
19873
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19883
19874
|
* @returns {void}
|
|
19884
19875
|
*/
|
|
19885
|
-
pp$
|
|
19876
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19886
19877
|
this.regexp_pattern(state);
|
|
19887
19878
|
|
|
19888
19879
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19897,7 +19888,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19897
19888
|
};
|
|
19898
19889
|
|
|
19899
19890
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19900
|
-
pp$
|
|
19891
|
+
pp$1.regexp_pattern = function(state) {
|
|
19901
19892
|
state.pos = 0;
|
|
19902
19893
|
state.lastIntValue = 0;
|
|
19903
19894
|
state.lastStringValue = "";
|
|
@@ -19931,7 +19922,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19931
19922
|
};
|
|
19932
19923
|
|
|
19933
19924
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19934
|
-
pp$
|
|
19925
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19935
19926
|
this.regexp_alternative(state);
|
|
19936
19927
|
while (state.eat(0x7C /* | */)) {
|
|
19937
19928
|
this.regexp_alternative(state);
|
|
@@ -19947,13 +19938,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19947
19938
|
};
|
|
19948
19939
|
|
|
19949
19940
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19950
|
-
pp$
|
|
19941
|
+
pp$1.regexp_alternative = function(state) {
|
|
19951
19942
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19952
19943
|
{ }
|
|
19953
19944
|
};
|
|
19954
19945
|
|
|
19955
19946
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19956
|
-
pp$
|
|
19947
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19957
19948
|
if (this.regexp_eatAssertion(state)) {
|
|
19958
19949
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19959
19950
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19976,7 +19967,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19976
19967
|
};
|
|
19977
19968
|
|
|
19978
19969
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19979
|
-
pp$
|
|
19970
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19980
19971
|
var start = state.pos;
|
|
19981
19972
|
state.lastAssertionIsQuantifiable = false;
|
|
19982
19973
|
|
|
@@ -20014,7 +20005,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
20014
20005
|
};
|
|
20015
20006
|
|
|
20016
20007
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
20017
|
-
pp$
|
|
20008
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
20018
20009
|
if ( noError === void 0 ) noError = false;
|
|
20019
20010
|
|
|
20020
20011
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -20025,7 +20016,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
20025
20016
|
};
|
|
20026
20017
|
|
|
20027
20018
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
20028
|
-
pp$
|
|
20019
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
20029
20020
|
return (
|
|
20030
20021
|
state.eat(0x2A /* * */) ||
|
|
20031
20022
|
state.eat(0x2B /* + */) ||
|
|
@@ -20033,7 +20024,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
20033
20024
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
20034
20025
|
)
|
|
20035
20026
|
};
|
|
20036
|
-
pp$
|
|
20027
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
20037
20028
|
var start = state.pos;
|
|
20038
20029
|
if (state.eat(0x7B /* { */)) {
|
|
20039
20030
|
var min = 0, max = -1;
|
|
@@ -20059,7 +20050,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
20059
20050
|
};
|
|
20060
20051
|
|
|
20061
20052
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
20062
|
-
pp$
|
|
20053
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
20063
20054
|
return (
|
|
20064
20055
|
this.regexp_eatPatternCharacters(state) ||
|
|
20065
20056
|
state.eat(0x2E /* . */) ||
|
|
@@ -20069,7 +20060,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
20069
20060
|
this.regexp_eatCapturingGroup(state)
|
|
20070
20061
|
)
|
|
20071
20062
|
};
|
|
20072
|
-
pp$
|
|
20063
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
20073
20064
|
var start = state.pos;
|
|
20074
20065
|
if (state.eat(0x5C /* \ */)) {
|
|
20075
20066
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -20079,7 +20070,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
20079
20070
|
}
|
|
20080
20071
|
return false
|
|
20081
20072
|
};
|
|
20082
|
-
pp$
|
|
20073
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
20083
20074
|
var start = state.pos;
|
|
20084
20075
|
if (state.eat(0x28 /* ( */)) {
|
|
20085
20076
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -20093,7 +20084,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
20093
20084
|
}
|
|
20094
20085
|
return false
|
|
20095
20086
|
};
|
|
20096
|
-
pp$
|
|
20087
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
20097
20088
|
if (state.eat(0x28 /* ( */)) {
|
|
20098
20089
|
if (this.options.ecmaVersion >= 9) {
|
|
20099
20090
|
this.regexp_groupSpecifier(state);
|
|
@@ -20111,7 +20102,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
20111
20102
|
};
|
|
20112
20103
|
|
|
20113
20104
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
20114
|
-
pp$
|
|
20105
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
20115
20106
|
return (
|
|
20116
20107
|
state.eat(0x2E /* . */) ||
|
|
20117
20108
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -20124,7 +20115,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
20124
20115
|
};
|
|
20125
20116
|
|
|
20126
20117
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
20127
|
-
pp$
|
|
20118
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
20128
20119
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
20129
20120
|
state.raise("Nothing to repeat");
|
|
20130
20121
|
}
|
|
@@ -20132,7 +20123,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
20132
20123
|
};
|
|
20133
20124
|
|
|
20134
20125
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
20135
|
-
pp$
|
|
20126
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
20136
20127
|
var ch = state.current();
|
|
20137
20128
|
if (isSyntaxCharacter(ch)) {
|
|
20138
20129
|
state.lastIntValue = ch;
|
|
@@ -20154,7 +20145,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20154
20145
|
|
|
20155
20146
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20156
20147
|
// But eat eager.
|
|
20157
|
-
pp$
|
|
20148
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20158
20149
|
var start = state.pos;
|
|
20159
20150
|
var ch = 0;
|
|
20160
20151
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20164,7 +20155,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20164
20155
|
};
|
|
20165
20156
|
|
|
20166
20157
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20167
|
-
pp$
|
|
20158
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20168
20159
|
var ch = state.current();
|
|
20169
20160
|
if (
|
|
20170
20161
|
ch !== -1 &&
|
|
@@ -20185,7 +20176,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20185
20176
|
// GroupSpecifier ::
|
|
20186
20177
|
// [empty]
|
|
20187
20178
|
// `?` GroupName
|
|
20188
|
-
pp$
|
|
20179
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20189
20180
|
if (state.eat(0x3F /* ? */)) {
|
|
20190
20181
|
if (this.regexp_eatGroupName(state)) {
|
|
20191
20182
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20201,7 +20192,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20201
20192
|
// GroupName ::
|
|
20202
20193
|
// `<` RegExpIdentifierName `>`
|
|
20203
20194
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20204
|
-
pp$
|
|
20195
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20205
20196
|
state.lastStringValue = "";
|
|
20206
20197
|
if (state.eat(0x3C /* < */)) {
|
|
20207
20198
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20216,12 +20207,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20216
20207
|
// RegExpIdentifierStart
|
|
20217
20208
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20218
20209
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20219
|
-
pp$
|
|
20210
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20220
20211
|
state.lastStringValue = "";
|
|
20221
20212
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20222
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20213
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20223
20214
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20224
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20215
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20225
20216
|
}
|
|
20226
20217
|
return true
|
|
20227
20218
|
}
|
|
@@ -20233,7 +20224,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20233
20224
|
// `$`
|
|
20234
20225
|
// `_`
|
|
20235
20226
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20236
|
-
pp$
|
|
20227
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20237
20228
|
var start = state.pos;
|
|
20238
20229
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20239
20230
|
var ch = state.current(forceU);
|
|
@@ -20261,7 +20252,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20261
20252
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20262
20253
|
// <ZWNJ>
|
|
20263
20254
|
// <ZWJ>
|
|
20264
|
-
pp$
|
|
20255
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20265
20256
|
var start = state.pos;
|
|
20266
20257
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20267
20258
|
var ch = state.current(forceU);
|
|
@@ -20283,7 +20274,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20283
20274
|
}
|
|
20284
20275
|
|
|
20285
20276
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20286
|
-
pp$
|
|
20277
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20287
20278
|
if (
|
|
20288
20279
|
this.regexp_eatBackReference(state) ||
|
|
20289
20280
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20301,7 +20292,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20301
20292
|
}
|
|
20302
20293
|
return false
|
|
20303
20294
|
};
|
|
20304
|
-
pp$
|
|
20295
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20305
20296
|
var start = state.pos;
|
|
20306
20297
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20307
20298
|
var n = state.lastIntValue;
|
|
@@ -20319,7 +20310,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20319
20310
|
}
|
|
20320
20311
|
return false
|
|
20321
20312
|
};
|
|
20322
|
-
pp$
|
|
20313
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20323
20314
|
if (state.eat(0x6B /* k */)) {
|
|
20324
20315
|
if (this.regexp_eatGroupName(state)) {
|
|
20325
20316
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20331,7 +20322,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20331
20322
|
};
|
|
20332
20323
|
|
|
20333
20324
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20334
|
-
pp$
|
|
20325
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20335
20326
|
return (
|
|
20336
20327
|
this.regexp_eatControlEscape(state) ||
|
|
20337
20328
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20342,7 +20333,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20342
20333
|
this.regexp_eatIdentityEscape(state)
|
|
20343
20334
|
)
|
|
20344
20335
|
};
|
|
20345
|
-
pp$
|
|
20336
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20346
20337
|
var start = state.pos;
|
|
20347
20338
|
if (state.eat(0x63 /* c */)) {
|
|
20348
20339
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20352,7 +20343,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20352
20343
|
}
|
|
20353
20344
|
return false
|
|
20354
20345
|
};
|
|
20355
|
-
pp$
|
|
20346
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20356
20347
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20357
20348
|
state.lastIntValue = 0;
|
|
20358
20349
|
state.advance();
|
|
@@ -20362,7 +20353,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20362
20353
|
};
|
|
20363
20354
|
|
|
20364
20355
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20365
|
-
pp$
|
|
20356
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20366
20357
|
var ch = state.current();
|
|
20367
20358
|
if (ch === 0x74 /* t */) {
|
|
20368
20359
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20393,7 +20384,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20393
20384
|
};
|
|
20394
20385
|
|
|
20395
20386
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20396
|
-
pp$
|
|
20387
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20397
20388
|
var ch = state.current();
|
|
20398
20389
|
if (isControlLetter(ch)) {
|
|
20399
20390
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20410,7 +20401,7 @@ function isControlLetter(ch) {
|
|
|
20410
20401
|
}
|
|
20411
20402
|
|
|
20412
20403
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20413
|
-
pp$
|
|
20404
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20414
20405
|
if ( forceU === void 0 ) forceU = false;
|
|
20415
20406
|
|
|
20416
20407
|
var start = state.pos;
|
|
@@ -20455,7 +20446,7 @@ function isValidUnicode(ch) {
|
|
|
20455
20446
|
}
|
|
20456
20447
|
|
|
20457
20448
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20458
|
-
pp$
|
|
20449
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20459
20450
|
if (state.switchU) {
|
|
20460
20451
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20461
20452
|
return true
|
|
@@ -20478,7 +20469,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20478
20469
|
};
|
|
20479
20470
|
|
|
20480
20471
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20481
|
-
pp$
|
|
20472
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20482
20473
|
state.lastIntValue = 0;
|
|
20483
20474
|
var ch = state.current();
|
|
20484
20475
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20492,7 +20483,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20492
20483
|
};
|
|
20493
20484
|
|
|
20494
20485
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20495
|
-
pp$
|
|
20486
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20496
20487
|
var ch = state.current();
|
|
20497
20488
|
|
|
20498
20489
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20534,7 +20525,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20534
20525
|
// UnicodePropertyValueExpression ::
|
|
20535
20526
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20536
20527
|
// LoneUnicodePropertyNameOrValue
|
|
20537
|
-
pp$
|
|
20528
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20538
20529
|
var start = state.pos;
|
|
20539
20530
|
|
|
20540
20531
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20556,24 +20547,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20556
20547
|
}
|
|
20557
20548
|
return false
|
|
20558
20549
|
};
|
|
20559
|
-
pp$
|
|
20550
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20560
20551
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20561
20552
|
{ state.raise("Invalid property name"); }
|
|
20562
20553
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20563
20554
|
{ state.raise("Invalid property value"); }
|
|
20564
20555
|
};
|
|
20565
|
-
pp$
|
|
20556
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20566
20557
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20567
20558
|
{ state.raise("Invalid property name"); }
|
|
20568
20559
|
};
|
|
20569
20560
|
|
|
20570
20561
|
// UnicodePropertyName ::
|
|
20571
20562
|
// UnicodePropertyNameCharacters
|
|
20572
|
-
pp$
|
|
20563
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20573
20564
|
var ch = 0;
|
|
20574
20565
|
state.lastStringValue = "";
|
|
20575
20566
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20576
|
-
state.lastStringValue += codePointToString(ch);
|
|
20567
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20577
20568
|
state.advance();
|
|
20578
20569
|
}
|
|
20579
20570
|
return state.lastStringValue !== ""
|
|
@@ -20584,11 +20575,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20584
20575
|
|
|
20585
20576
|
// UnicodePropertyValue ::
|
|
20586
20577
|
// UnicodePropertyValueCharacters
|
|
20587
|
-
pp$
|
|
20578
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20588
20579
|
var ch = 0;
|
|
20589
20580
|
state.lastStringValue = "";
|
|
20590
20581
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20591
|
-
state.lastStringValue += codePointToString(ch);
|
|
20582
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20592
20583
|
state.advance();
|
|
20593
20584
|
}
|
|
20594
20585
|
return state.lastStringValue !== ""
|
|
@@ -20599,12 +20590,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20599
20590
|
|
|
20600
20591
|
// LoneUnicodePropertyNameOrValue ::
|
|
20601
20592
|
// UnicodePropertyValueCharacters
|
|
20602
|
-
pp$
|
|
20593
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20603
20594
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20604
20595
|
};
|
|
20605
20596
|
|
|
20606
20597
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20607
|
-
pp$
|
|
20598
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20608
20599
|
if (state.eat(0x5B /* [ */)) {
|
|
20609
20600
|
state.eat(0x5E /* ^ */);
|
|
20610
20601
|
this.regexp_classRanges(state);
|
|
@@ -20620,7 +20611,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20620
20611
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20621
20612
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20622
20613
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20623
|
-
pp$
|
|
20614
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20624
20615
|
while (this.regexp_eatClassAtom(state)) {
|
|
20625
20616
|
var left = state.lastIntValue;
|
|
20626
20617
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20637,7 +20628,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20637
20628
|
|
|
20638
20629
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20639
20630
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20640
|
-
pp$
|
|
20631
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20641
20632
|
var start = state.pos;
|
|
20642
20633
|
|
|
20643
20634
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20666,7 +20657,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20666
20657
|
};
|
|
20667
20658
|
|
|
20668
20659
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20669
|
-
pp$
|
|
20660
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20670
20661
|
var start = state.pos;
|
|
20671
20662
|
|
|
20672
20663
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20693,7 +20684,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20693
20684
|
};
|
|
20694
20685
|
|
|
20695
20686
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20696
|
-
pp$
|
|
20687
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20697
20688
|
var ch = state.current();
|
|
20698
20689
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20699
20690
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20704,7 +20695,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20704
20695
|
};
|
|
20705
20696
|
|
|
20706
20697
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20707
|
-
pp$
|
|
20698
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20708
20699
|
var start = state.pos;
|
|
20709
20700
|
if (state.eat(0x78 /* x */)) {
|
|
20710
20701
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20719,7 +20710,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20719
20710
|
};
|
|
20720
20711
|
|
|
20721
20712
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20722
|
-
pp$
|
|
20713
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20723
20714
|
var start = state.pos;
|
|
20724
20715
|
var ch = 0;
|
|
20725
20716
|
state.lastIntValue = 0;
|
|
@@ -20734,7 +20725,7 @@ function isDecimalDigit(ch) {
|
|
|
20734
20725
|
}
|
|
20735
20726
|
|
|
20736
20727
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20737
|
-
pp$
|
|
20728
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20738
20729
|
var start = state.pos;
|
|
20739
20730
|
var ch = 0;
|
|
20740
20731
|
state.lastIntValue = 0;
|
|
@@ -20763,7 +20754,7 @@ function hexToInt(ch) {
|
|
|
20763
20754
|
|
|
20764
20755
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20765
20756
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20766
|
-
pp$
|
|
20757
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20767
20758
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20768
20759
|
var n1 = state.lastIntValue;
|
|
20769
20760
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20782,7 +20773,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20782
20773
|
};
|
|
20783
20774
|
|
|
20784
20775
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20785
|
-
pp$
|
|
20776
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20786
20777
|
var ch = state.current();
|
|
20787
20778
|
if (isOctalDigit(ch)) {
|
|
20788
20779
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20799,7 +20790,7 @@ function isOctalDigit(ch) {
|
|
|
20799
20790
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20800
20791
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20801
20792
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20802
|
-
pp$
|
|
20793
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20803
20794
|
var start = state.pos;
|
|
20804
20795
|
state.lastIntValue = 0;
|
|
20805
20796
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20831,11 +20822,11 @@ var Token = function Token(p) {
|
|
|
20831
20822
|
|
|
20832
20823
|
// ## Tokenizer
|
|
20833
20824
|
|
|
20834
|
-
var pp
|
|
20825
|
+
var pp = Parser.prototype;
|
|
20835
20826
|
|
|
20836
20827
|
// Move to the next token
|
|
20837
20828
|
|
|
20838
|
-
pp
|
|
20829
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20839
20830
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20840
20831
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20841
20832
|
if (this.options.onToken)
|
|
@@ -20848,21 +20839,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20848
20839
|
this.nextToken();
|
|
20849
20840
|
};
|
|
20850
20841
|
|
|
20851
|
-
pp
|
|
20842
|
+
pp.getToken = function() {
|
|
20852
20843
|
this.next();
|
|
20853
20844
|
return new Token(this)
|
|
20854
20845
|
};
|
|
20855
20846
|
|
|
20856
20847
|
// If we're in an ES6 environment, make parsers iterable
|
|
20857
20848
|
if (typeof Symbol !== "undefined")
|
|
20858
|
-
{ pp
|
|
20849
|
+
{ pp[Symbol.iterator] = function() {
|
|
20859
20850
|
var this$1$1 = this;
|
|
20860
20851
|
|
|
20861
20852
|
return {
|
|
20862
20853
|
next: function () {
|
|
20863
20854
|
var token = this$1$1.getToken();
|
|
20864
20855
|
return {
|
|
20865
|
-
done: token.type === types.eof,
|
|
20856
|
+
done: token.type === types$1.eof,
|
|
20866
20857
|
value: token
|
|
20867
20858
|
}
|
|
20868
20859
|
}
|
|
@@ -20875,19 +20866,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20875
20866
|
// Read a single token, updating the parser object's token-related
|
|
20876
20867
|
// properties.
|
|
20877
20868
|
|
|
20878
|
-
pp
|
|
20869
|
+
pp.nextToken = function() {
|
|
20879
20870
|
var curContext = this.curContext();
|
|
20880
20871
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20881
20872
|
|
|
20882
20873
|
this.start = this.pos;
|
|
20883
20874
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20884
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20875
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20885
20876
|
|
|
20886
20877
|
if (curContext.override) { return curContext.override(this) }
|
|
20887
20878
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20888
20879
|
};
|
|
20889
20880
|
|
|
20890
|
-
pp
|
|
20881
|
+
pp.readToken = function(code) {
|
|
20891
20882
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20892
20883
|
// identifiers, so '\' also dispatches to that.
|
|
20893
20884
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20896,14 +20887,14 @@ pp$9.readToken = function(code) {
|
|
|
20896
20887
|
return this.getTokenFromCode(code)
|
|
20897
20888
|
};
|
|
20898
20889
|
|
|
20899
|
-
pp
|
|
20890
|
+
pp.fullCharCodeAtPos = function() {
|
|
20900
20891
|
var code = this.input.charCodeAt(this.pos);
|
|
20901
20892
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20902
20893
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20903
20894
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20904
20895
|
};
|
|
20905
20896
|
|
|
20906
|
-
pp
|
|
20897
|
+
pp.skipBlockComment = function() {
|
|
20907
20898
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20908
20899
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20909
20900
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20921,7 +20912,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20921
20912
|
startLoc, this.curPosition()); }
|
|
20922
20913
|
};
|
|
20923
20914
|
|
|
20924
|
-
pp
|
|
20915
|
+
pp.skipLineComment = function(startSkip) {
|
|
20925
20916
|
var start = this.pos;
|
|
20926
20917
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20927
20918
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20936,7 +20927,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20936
20927
|
// Called at the start of the parse and after every token. Skips
|
|
20937
20928
|
// whitespace and comments, and.
|
|
20938
20929
|
|
|
20939
|
-
pp
|
|
20930
|
+
pp.skipSpace = function() {
|
|
20940
20931
|
loop: while (this.pos < this.input.length) {
|
|
20941
20932
|
var ch = this.input.charCodeAt(this.pos);
|
|
20942
20933
|
switch (ch) {
|
|
@@ -20981,7 +20972,7 @@ pp$9.skipSpace = function() {
|
|
|
20981
20972
|
// the token, so that the next one's `start` will point at the
|
|
20982
20973
|
// right position.
|
|
20983
20974
|
|
|
20984
|
-
pp
|
|
20975
|
+
pp.finishToken = function(type, val) {
|
|
20985
20976
|
this.end = this.pos;
|
|
20986
20977
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20987
20978
|
var prevType = this.type;
|
|
@@ -21000,62 +20991,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
21000
20991
|
//
|
|
21001
20992
|
// All in the name of speed.
|
|
21002
20993
|
//
|
|
21003
|
-
pp
|
|
20994
|
+
pp.readToken_dot = function() {
|
|
21004
20995
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21005
20996
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
21006
20997
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21007
20998
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
21008
20999
|
this.pos += 3;
|
|
21009
|
-
return this.finishToken(types.ellipsis)
|
|
21000
|
+
return this.finishToken(types$1.ellipsis)
|
|
21010
21001
|
} else {
|
|
21011
21002
|
++this.pos;
|
|
21012
|
-
return this.finishToken(types.dot)
|
|
21003
|
+
return this.finishToken(types$1.dot)
|
|
21013
21004
|
}
|
|
21014
21005
|
};
|
|
21015
21006
|
|
|
21016
|
-
pp
|
|
21007
|
+
pp.readToken_slash = function() { // '/'
|
|
21017
21008
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21018
21009
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
21019
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21020
|
-
return this.finishOp(types.slash, 1)
|
|
21010
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21011
|
+
return this.finishOp(types$1.slash, 1)
|
|
21021
21012
|
};
|
|
21022
21013
|
|
|
21023
|
-
pp
|
|
21014
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
21024
21015
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21025
21016
|
var size = 1;
|
|
21026
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
21017
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
21027
21018
|
|
|
21028
21019
|
// exponentiation operator ** and **=
|
|
21029
21020
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
21030
21021
|
++size;
|
|
21031
|
-
tokentype = types.starstar;
|
|
21022
|
+
tokentype = types$1.starstar;
|
|
21032
21023
|
next = this.input.charCodeAt(this.pos + 2);
|
|
21033
21024
|
}
|
|
21034
21025
|
|
|
21035
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
21026
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21036
21027
|
return this.finishOp(tokentype, size)
|
|
21037
21028
|
};
|
|
21038
21029
|
|
|
21039
|
-
pp
|
|
21030
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
21040
21031
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21041
21032
|
if (next === code) {
|
|
21042
21033
|
if (this.options.ecmaVersion >= 12) {
|
|
21043
21034
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21044
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
21035
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
21045
21036
|
}
|
|
21046
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
21037
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
21047
21038
|
}
|
|
21048
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21049
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
21039
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21040
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
21050
21041
|
};
|
|
21051
21042
|
|
|
21052
|
-
pp
|
|
21043
|
+
pp.readToken_caret = function() { // '^'
|
|
21053
21044
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21054
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21055
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
21045
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21046
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
21056
21047
|
};
|
|
21057
21048
|
|
|
21058
|
-
pp
|
|
21049
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
21059
21050
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21060
21051
|
if (next === code) {
|
|
21061
21052
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -21065,19 +21056,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
21065
21056
|
this.skipSpace();
|
|
21066
21057
|
return this.nextToken()
|
|
21067
21058
|
}
|
|
21068
|
-
return this.finishOp(types.incDec, 2)
|
|
21059
|
+
return this.finishOp(types$1.incDec, 2)
|
|
21069
21060
|
}
|
|
21070
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21071
|
-
return this.finishOp(types.plusMin, 1)
|
|
21061
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21062
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
21072
21063
|
};
|
|
21073
21064
|
|
|
21074
|
-
pp
|
|
21065
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
21075
21066
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21076
21067
|
var size = 1;
|
|
21077
21068
|
if (next === code) {
|
|
21078
21069
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
21079
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
21080
|
-
return this.finishOp(types.bitShift, size)
|
|
21070
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21071
|
+
return this.finishOp(types$1.bitShift, size)
|
|
21081
21072
|
}
|
|
21082
21073
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
21083
21074
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -21087,53 +21078,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
21087
21078
|
return this.nextToken()
|
|
21088
21079
|
}
|
|
21089
21080
|
if (next === 61) { size = 2; }
|
|
21090
|
-
return this.finishOp(types.relational, size)
|
|
21081
|
+
return this.finishOp(types$1.relational, size)
|
|
21091
21082
|
};
|
|
21092
21083
|
|
|
21093
|
-
pp
|
|
21084
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
21094
21085
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21095
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21086
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21096
21087
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
21097
21088
|
this.pos += 2;
|
|
21098
|
-
return this.finishToken(types.arrow)
|
|
21089
|
+
return this.finishToken(types$1.arrow)
|
|
21099
21090
|
}
|
|
21100
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
21091
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
21101
21092
|
};
|
|
21102
21093
|
|
|
21103
|
-
pp
|
|
21094
|
+
pp.readToken_question = function() { // '?'
|
|
21104
21095
|
var ecmaVersion = this.options.ecmaVersion;
|
|
21105
21096
|
if (ecmaVersion >= 11) {
|
|
21106
21097
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21107
21098
|
if (next === 46) {
|
|
21108
21099
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21109
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
21100
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
21110
21101
|
}
|
|
21111
21102
|
if (next === 63) {
|
|
21112
21103
|
if (ecmaVersion >= 12) {
|
|
21113
21104
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
21114
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
21105
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
21115
21106
|
}
|
|
21116
|
-
return this.finishOp(types.coalesce, 2)
|
|
21107
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
21117
21108
|
}
|
|
21118
21109
|
}
|
|
21119
|
-
return this.finishOp(types.question, 1)
|
|
21110
|
+
return this.finishOp(types$1.question, 1)
|
|
21120
21111
|
};
|
|
21121
21112
|
|
|
21122
|
-
pp
|
|
21113
|
+
pp.readToken_numberSign = function() { // '#'
|
|
21123
21114
|
var ecmaVersion = this.options.ecmaVersion;
|
|
21124
21115
|
var code = 35; // '#'
|
|
21125
21116
|
if (ecmaVersion >= 13) {
|
|
21126
21117
|
++this.pos;
|
|
21127
21118
|
code = this.fullCharCodeAtPos();
|
|
21128
21119
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
21129
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21120
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
21130
21121
|
}
|
|
21131
21122
|
}
|
|
21132
21123
|
|
|
21133
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21124
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21134
21125
|
};
|
|
21135
21126
|
|
|
21136
|
-
pp
|
|
21127
|
+
pp.getTokenFromCode = function(code) {
|
|
21137
21128
|
switch (code) {
|
|
21138
21129
|
// The interpretation of a dot depends on whether it is followed
|
|
21139
21130
|
// by a digit or another two dots.
|
|
@@ -21141,20 +21132,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21141
21132
|
return this.readToken_dot()
|
|
21142
21133
|
|
|
21143
21134
|
// Punctuation tokens.
|
|
21144
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
21145
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
21146
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
21147
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
21148
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
21149
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
21150
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
21151
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
21152
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
21135
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21136
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21137
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21138
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21139
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21140
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21141
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21142
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21143
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21153
21144
|
|
|
21154
21145
|
case 96: // '`'
|
|
21155
21146
|
if (this.options.ecmaVersion < 6) { break }
|
|
21156
21147
|
++this.pos;
|
|
21157
|
-
return this.finishToken(types.backQuote)
|
|
21148
|
+
return this.finishToken(types$1.backQuote)
|
|
21158
21149
|
|
|
21159
21150
|
case 48: // '0'
|
|
21160
21151
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21177,7 +21168,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21177
21168
|
// often referred to. `finishOp` simply skips the amount of
|
|
21178
21169
|
// characters it is given as second argument, and returns a token
|
|
21179
21170
|
// of the type given by its first argument.
|
|
21180
|
-
|
|
21181
21171
|
case 47: // '/'
|
|
21182
21172
|
return this.readToken_slash()
|
|
21183
21173
|
|
|
@@ -21203,22 +21193,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21203
21193
|
return this.readToken_question()
|
|
21204
21194
|
|
|
21205
21195
|
case 126: // '~'
|
|
21206
|
-
return this.finishOp(types.prefix, 1)
|
|
21196
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21207
21197
|
|
|
21208
21198
|
case 35: // '#'
|
|
21209
21199
|
return this.readToken_numberSign()
|
|
21210
21200
|
}
|
|
21211
21201
|
|
|
21212
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21202
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21213
21203
|
};
|
|
21214
21204
|
|
|
21215
|
-
pp
|
|
21205
|
+
pp.finishOp = function(type, size) {
|
|
21216
21206
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21217
21207
|
this.pos += size;
|
|
21218
21208
|
return this.finishToken(type, str)
|
|
21219
21209
|
};
|
|
21220
21210
|
|
|
21221
|
-
pp
|
|
21211
|
+
pp.readRegexp = function() {
|
|
21222
21212
|
var escaped, inClass, start = this.pos;
|
|
21223
21213
|
for (;;) {
|
|
21224
21214
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21253,14 +21243,14 @@ pp$9.readRegexp = function() {
|
|
|
21253
21243
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21254
21244
|
}
|
|
21255
21245
|
|
|
21256
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21246
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21257
21247
|
};
|
|
21258
21248
|
|
|
21259
21249
|
// Read an integer in the given radix. Return null if zero digits
|
|
21260
21250
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21261
21251
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21262
21252
|
|
|
21263
|
-
pp
|
|
21253
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21264
21254
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21265
21255
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21266
21256
|
|
|
@@ -21314,7 +21304,7 @@ function stringToBigInt(str) {
|
|
|
21314
21304
|
return BigInt(str.replace(/_/g, ""))
|
|
21315
21305
|
}
|
|
21316
21306
|
|
|
21317
|
-
pp
|
|
21307
|
+
pp.readRadixNumber = function(radix) {
|
|
21318
21308
|
var start = this.pos;
|
|
21319
21309
|
this.pos += 2; // 0x
|
|
21320
21310
|
var val = this.readInt(radix);
|
|
@@ -21323,12 +21313,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21323
21313
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21324
21314
|
++this.pos;
|
|
21325
21315
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21326
|
-
return this.finishToken(types.num, val)
|
|
21316
|
+
return this.finishToken(types$1.num, val)
|
|
21327
21317
|
};
|
|
21328
21318
|
|
|
21329
21319
|
// Read an integer, octal integer, or floating-point number.
|
|
21330
21320
|
|
|
21331
|
-
pp
|
|
21321
|
+
pp.readNumber = function(startsWithDot) {
|
|
21332
21322
|
var start = this.pos;
|
|
21333
21323
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21334
21324
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21338,7 +21328,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21338
21328
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21339
21329
|
++this.pos;
|
|
21340
21330
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21341
|
-
return this.finishToken(types.num, val$1)
|
|
21331
|
+
return this.finishToken(types$1.num, val$1)
|
|
21342
21332
|
}
|
|
21343
21333
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21344
21334
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21354,12 +21344,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21354
21344
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21355
21345
|
|
|
21356
21346
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21357
|
-
return this.finishToken(types.num, val)
|
|
21347
|
+
return this.finishToken(types$1.num, val)
|
|
21358
21348
|
};
|
|
21359
21349
|
|
|
21360
21350
|
// Read a string value, interpreting backslash-escapes.
|
|
21361
21351
|
|
|
21362
|
-
pp
|
|
21352
|
+
pp.readCodePoint = function() {
|
|
21363
21353
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21364
21354
|
|
|
21365
21355
|
if (ch === 123) { // '{'
|
|
@@ -21374,14 +21364,14 @@ pp$9.readCodePoint = function() {
|
|
|
21374
21364
|
return code
|
|
21375
21365
|
};
|
|
21376
21366
|
|
|
21377
|
-
function codePointToString
|
|
21367
|
+
function codePointToString(code) {
|
|
21378
21368
|
// UTF-16 Decoding
|
|
21379
21369
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21380
21370
|
code -= 0x10000;
|
|
21381
21371
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21382
21372
|
}
|
|
21383
21373
|
|
|
21384
|
-
pp
|
|
21374
|
+
pp.readString = function(quote) {
|
|
21385
21375
|
var out = "", chunkStart = ++this.pos;
|
|
21386
21376
|
for (;;) {
|
|
21387
21377
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21404,14 +21394,14 @@ pp$9.readString = function(quote) {
|
|
|
21404
21394
|
}
|
|
21405
21395
|
}
|
|
21406
21396
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21407
|
-
return this.finishToken(types.string, out)
|
|
21397
|
+
return this.finishToken(types$1.string, out)
|
|
21408
21398
|
};
|
|
21409
21399
|
|
|
21410
21400
|
// Reads template string tokens.
|
|
21411
21401
|
|
|
21412
21402
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21413
21403
|
|
|
21414
|
-
pp
|
|
21404
|
+
pp.tryReadTemplateToken = function() {
|
|
21415
21405
|
this.inTemplateElement = true;
|
|
21416
21406
|
try {
|
|
21417
21407
|
this.readTmplToken();
|
|
@@ -21426,7 +21416,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21426
21416
|
this.inTemplateElement = false;
|
|
21427
21417
|
};
|
|
21428
21418
|
|
|
21429
|
-
pp
|
|
21419
|
+
pp.invalidStringToken = function(position, message) {
|
|
21430
21420
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21431
21421
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21432
21422
|
} else {
|
|
@@ -21434,23 +21424,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21434
21424
|
}
|
|
21435
21425
|
};
|
|
21436
21426
|
|
|
21437
|
-
pp
|
|
21427
|
+
pp.readTmplToken = function() {
|
|
21438
21428
|
var out = "", chunkStart = this.pos;
|
|
21439
21429
|
for (;;) {
|
|
21440
21430
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21441
21431
|
var ch = this.input.charCodeAt(this.pos);
|
|
21442
21432
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
21443
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
21433
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21444
21434
|
if (ch === 36) {
|
|
21445
21435
|
this.pos += 2;
|
|
21446
|
-
return this.finishToken(types.dollarBraceL)
|
|
21436
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21447
21437
|
} else {
|
|
21448
21438
|
++this.pos;
|
|
21449
|
-
return this.finishToken(types.backQuote)
|
|
21439
|
+
return this.finishToken(types$1.backQuote)
|
|
21450
21440
|
}
|
|
21451
21441
|
}
|
|
21452
21442
|
out += this.input.slice(chunkStart, this.pos);
|
|
21453
|
-
return this.finishToken(types.template, out)
|
|
21443
|
+
return this.finishToken(types$1.template, out)
|
|
21454
21444
|
}
|
|
21455
21445
|
if (ch === 92) { // '\'
|
|
21456
21446
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21481,7 +21471,7 @@ pp$9.readTmplToken = function() {
|
|
|
21481
21471
|
};
|
|
21482
21472
|
|
|
21483
21473
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21484
|
-
pp
|
|
21474
|
+
pp.readInvalidTemplateToken = function() {
|
|
21485
21475
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21486
21476
|
switch (this.input[this.pos]) {
|
|
21487
21477
|
case "\\":
|
|
@@ -21492,10 +21482,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21492
21482
|
if (this.input[this.pos + 1] !== "{") {
|
|
21493
21483
|
break
|
|
21494
21484
|
}
|
|
21495
|
-
// falls through
|
|
21496
21485
|
|
|
21486
|
+
// falls through
|
|
21497
21487
|
case "`":
|
|
21498
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21488
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21499
21489
|
|
|
21500
21490
|
// no default
|
|
21501
21491
|
}
|
|
@@ -21505,14 +21495,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21505
21495
|
|
|
21506
21496
|
// Used to read escaped characters
|
|
21507
21497
|
|
|
21508
|
-
pp
|
|
21498
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21509
21499
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21510
21500
|
++this.pos;
|
|
21511
21501
|
switch (ch) {
|
|
21512
21502
|
case 110: return "\n" // 'n' -> '\n'
|
|
21513
21503
|
case 114: return "\r" // 'r' -> '\r'
|
|
21514
21504
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21515
|
-
case 117: return codePointToString
|
|
21505
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21516
21506
|
case 116: return "\t" // 't' -> '\t'
|
|
21517
21507
|
case 98: return "\b" // 'b' -> '\b'
|
|
21518
21508
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21570,7 +21560,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21570
21560
|
|
|
21571
21561
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21572
21562
|
|
|
21573
|
-
pp
|
|
21563
|
+
pp.readHexChar = function(len) {
|
|
21574
21564
|
var codePos = this.pos;
|
|
21575
21565
|
var n = this.readInt(16, len);
|
|
21576
21566
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21583,7 +21573,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21583
21573
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21584
21574
|
// as a micro-optimization.
|
|
21585
21575
|
|
|
21586
|
-
pp
|
|
21576
|
+
pp.readWord1 = function() {
|
|
21587
21577
|
this.containsEsc = false;
|
|
21588
21578
|
var word = "", first = true, chunkStart = this.pos;
|
|
21589
21579
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21601,7 +21591,7 @@ pp$9.readWord1 = function() {
|
|
|
21601
21591
|
var esc = this.readCodePoint();
|
|
21602
21592
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21603
21593
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21604
|
-
word += codePointToString
|
|
21594
|
+
word += codePointToString(esc);
|
|
21605
21595
|
chunkStart = this.pos;
|
|
21606
21596
|
} else {
|
|
21607
21597
|
break
|
|
@@ -21614,18 +21604,18 @@ pp$9.readWord1 = function() {
|
|
|
21614
21604
|
// Read an identifier or keyword token. Will check for reserved
|
|
21615
21605
|
// words when necessary.
|
|
21616
21606
|
|
|
21617
|
-
pp
|
|
21607
|
+
pp.readWord = function() {
|
|
21618
21608
|
var word = this.readWord1();
|
|
21619
|
-
var type = types.name;
|
|
21609
|
+
var type = types$1.name;
|
|
21620
21610
|
if (this.keywords.test(word)) {
|
|
21621
|
-
type = keywords
|
|
21611
|
+
type = keywords[word];
|
|
21622
21612
|
}
|
|
21623
21613
|
return this.finishToken(type, word)
|
|
21624
21614
|
};
|
|
21625
21615
|
|
|
21626
21616
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21627
21617
|
|
|
21628
|
-
var version = "8.
|
|
21618
|
+
var version = "8.6.0";
|
|
21629
21619
|
|
|
21630
21620
|
Parser.acorn = {
|
|
21631
21621
|
Parser: Parser,
|
|
@@ -21636,10 +21626,10 @@ Parser.acorn = {
|
|
|
21636
21626
|
getLineInfo: getLineInfo,
|
|
21637
21627
|
Node: Node,
|
|
21638
21628
|
TokenType: TokenType,
|
|
21639
|
-
tokTypes: types,
|
|
21640
|
-
keywordTypes: keywords
|
|
21629
|
+
tokTypes: types$1,
|
|
21630
|
+
keywordTypes: keywords,
|
|
21641
21631
|
TokContext: TokContext,
|
|
21642
|
-
tokContexts: types
|
|
21632
|
+
tokContexts: types,
|
|
21643
21633
|
isIdentifierChar: isIdentifierChar,
|
|
21644
21634
|
isIdentifierStart: isIdentifierStart,
|
|
21645
21635
|
Token: Token,
|
|
@@ -21652,20 +21642,7 @@ Parser.acorn = {
|
|
|
21652
21642
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21653
21643
|
function mkdirpath(path) {
|
|
21654
21644
|
const dir = path$2.dirname(path);
|
|
21655
|
-
|
|
21656
|
-
fs.readdirSync(dir);
|
|
21657
|
-
}
|
|
21658
|
-
catch (_a) {
|
|
21659
|
-
mkdirpath(dir);
|
|
21660
|
-
try {
|
|
21661
|
-
fs.mkdirSync(dir);
|
|
21662
|
-
}
|
|
21663
|
-
catch (err) {
|
|
21664
|
-
if (err.code !== 'EEXIST') {
|
|
21665
|
-
throw err;
|
|
21666
|
-
}
|
|
21667
|
-
}
|
|
21668
|
-
}
|
|
21645
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21669
21646
|
}
|
|
21670
21647
|
function writeFile(dest, data) {
|
|
21671
21648
|
return new Promise((fulfil, reject) => {
|
|
@@ -23609,10 +23586,8 @@ exports.defaultOnWarn = defaultOnWarn;
|
|
|
23609
23586
|
exports.defineConfig = defineConfig;
|
|
23610
23587
|
exports.ensureArray = ensureArray$1;
|
|
23611
23588
|
exports.error = error;
|
|
23612
|
-
exports.fseventsImporter = fseventsImporter;
|
|
23613
23589
|
exports.generatedCodePresets = generatedCodePresets;
|
|
23614
23590
|
exports.getAliasName = getAliasName;
|
|
23615
|
-
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
23616
23591
|
exports.getOrCreate = getOrCreate;
|
|
23617
23592
|
exports.loadFsEvents = loadFsEvents;
|
|
23618
23593
|
exports.objectifyOptionWithPresets = objectifyOptionWithPresets;
|