rollup 2.59.0 → 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 +57 -0
- package/dist/bin/rollup +6 -5
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +671 -648
- 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.d.ts +1 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +3 -5
- package/dist/shared/loadConfigFile.js +120 -50
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +670 -649
- package/dist/shared/watch-cli.js +36 -13
- package/dist/shared/watch.js +2 -2
- package/package.json +21 -21
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.61.0
|
|
4
|
+
Thu, 09 Dec 2021 05:43:43 GMT - commit 49d41f78987a1dd13488df009fe2db1b5d1b6e7c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version$1 = "2.
|
|
16
|
+
var version$1 = "2.61.0";
|
|
17
17
|
|
|
18
18
|
var charToInteger = {};
|
|
19
19
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1798,21 +1798,6 @@ class ExternalModule {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
1800
|
|
|
1801
|
-
function getAugmentedNamespace(n) {
|
|
1802
|
-
if (n.__esModule) return n;
|
|
1803
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
1804
|
-
Object.keys(n).forEach(function (k) {
|
|
1805
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1806
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
1807
|
-
enumerable: true,
|
|
1808
|
-
get: function () {
|
|
1809
|
-
return n[k];
|
|
1810
|
-
}
|
|
1811
|
-
});
|
|
1812
|
-
});
|
|
1813
|
-
return a;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
1801
|
var utils$3 = {};
|
|
1817
1802
|
|
|
1818
1803
|
const path$1 = require$$0__default;
|
|
@@ -12227,7 +12212,7 @@ class Module {
|
|
|
12227
12212
|
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12228
12213
|
},
|
|
12229
12214
|
get importedIds() {
|
|
12230
|
-
return Array.from(module.sources, source => module.resolvedIds[source].id);
|
|
12215
|
+
return Array.from(module.sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
12231
12216
|
},
|
|
12232
12217
|
get importers() {
|
|
12233
12218
|
return module.importers.sort();
|
|
@@ -14454,13 +14439,14 @@ class Chunk {
|
|
|
14454
14439
|
const id = this.orderedModules[0].id;
|
|
14455
14440
|
const sanitizedId = this.outputOptions.sanitizeFileName(id);
|
|
14456
14441
|
let path;
|
|
14442
|
+
const patternOpt = unsetOptions.has('entryFileNames')
|
|
14443
|
+
? '[name][assetExtname].js'
|
|
14444
|
+
: options.entryFileNames;
|
|
14445
|
+
const pattern = typeof patternOpt === 'function' ? patternOpt(this.getChunkInfo()) : patternOpt;
|
|
14457
14446
|
if (isAbsolute(id)) {
|
|
14458
|
-
const extension = extname(id);
|
|
14459
|
-
const pattern = unsetOptions.has('entryFileNames')
|
|
14460
|
-
? '[name][assetExtname].js'
|
|
14461
|
-
: options.entryFileNames;
|
|
14462
14447
|
const currentDir = dirname(sanitizedId);
|
|
14463
|
-
const
|
|
14448
|
+
const extension = extname(id);
|
|
14449
|
+
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14464
14450
|
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14465
14451
|
ext: () => extension.substr(1),
|
|
14466
14452
|
extname: () => extension,
|
|
@@ -14477,7 +14463,15 @@ class Chunk {
|
|
|
14477
14463
|
}
|
|
14478
14464
|
}
|
|
14479
14465
|
else {
|
|
14480
|
-
|
|
14466
|
+
const extension = extname(sanitizedId);
|
|
14467
|
+
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14468
|
+
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14469
|
+
ext: () => extension.substr(1),
|
|
14470
|
+
extname: () => extension,
|
|
14471
|
+
format: () => options.format,
|
|
14472
|
+
name: () => getAliasName(sanitizedId)
|
|
14473
|
+
});
|
|
14474
|
+
path = `_virtual/${fileName}`;
|
|
14481
14475
|
}
|
|
14482
14476
|
return makeUnique(normalize(path), existingNames);
|
|
14483
14477
|
}
|
|
@@ -14839,11 +14833,11 @@ class Chunk {
|
|
|
14839
14833
|
continue;
|
|
14840
14834
|
}
|
|
14841
14835
|
const renderedResolution = resolution instanceof Module
|
|
14842
|
-
? `'${this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions)}'`
|
|
14836
|
+
? `'${escapeId(this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions))}'`
|
|
14843
14837
|
: resolution instanceof ExternalModule
|
|
14844
|
-
? `'${resolution.renormalizeRenderPath
|
|
14838
|
+
? `'${escapeId(resolution.renormalizeRenderPath
|
|
14845
14839
|
? this.getRelativePath(resolution.renderPath, stripKnownJsExtensions)
|
|
14846
|
-
: resolution.renderPath}'`
|
|
14840
|
+
: resolution.renderPath)}'`
|
|
14847
14841
|
: resolution;
|
|
14848
14842
|
node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
|
|
14849
14843
|
!(facadeChunk === null || facadeChunk === void 0 ? void 0 : facadeChunk.strictFacade) &&
|
|
@@ -16009,7 +16003,7 @@ var reservedWords = {
|
|
|
16009
16003
|
|
|
16010
16004
|
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
|
|
16011
16005
|
|
|
16012
|
-
var keywords = {
|
|
16006
|
+
var keywords$1 = {
|
|
16013
16007
|
5: ecma5AndLessKeywords,
|
|
16014
16008
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16015
16009
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16128,17 +16122,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16128
16122
|
|
|
16129
16123
|
// Map keyword names to token types.
|
|
16130
16124
|
|
|
16131
|
-
var keywords
|
|
16125
|
+
var keywords = {};
|
|
16132
16126
|
|
|
16133
16127
|
// Succinct definitions of keyword token types
|
|
16134
16128
|
function kw(name, options) {
|
|
16135
16129
|
if ( options === void 0 ) options = {};
|
|
16136
16130
|
|
|
16137
16131
|
options.keyword = name;
|
|
16138
|
-
return keywords
|
|
16132
|
+
return keywords[name] = new TokenType(name, options)
|
|
16139
16133
|
}
|
|
16140
16134
|
|
|
16141
|
-
var types = {
|
|
16135
|
+
var types$1 = {
|
|
16142
16136
|
num: new TokenType("num", startsExpr),
|
|
16143
16137
|
regexp: new TokenType("regexp", startsExpr),
|
|
16144
16138
|
string: new TokenType("string", startsExpr),
|
|
@@ -16480,7 +16474,7 @@ var
|
|
|
16480
16474
|
var Parser = function Parser(options, input, startPos) {
|
|
16481
16475
|
this.options = options = getOptions(options);
|
|
16482
16476
|
this.sourceFile = options.sourceFile;
|
|
16483
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16477
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16484
16478
|
var reserved = "";
|
|
16485
16479
|
if (options.allowReserved !== true) {
|
|
16486
16480
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16511,7 +16505,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16511
16505
|
|
|
16512
16506
|
// Properties of the current token:
|
|
16513
16507
|
// Its type
|
|
16514
|
-
this.type = types.eof;
|
|
16508
|
+
this.type = types$1.eof;
|
|
16515
16509
|
// For tokens that include more information than their type, the value
|
|
16516
16510
|
this.value = null;
|
|
16517
16511
|
// Its start and end offset
|
|
@@ -16571,8 +16565,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16571
16565
|
};
|
|
16572
16566
|
|
|
16573
16567
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16568
|
+
|
|
16574
16569
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16570
|
+
|
|
16575
16571
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16572
|
+
|
|
16576
16573
|
prototypeAccessors.canAwait.get = function () {
|
|
16577
16574
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16578
16575
|
var scope = this.scopeStack[i];
|
|
@@ -16581,20 +16578,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16581
16578
|
}
|
|
16582
16579
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16583
16580
|
};
|
|
16581
|
+
|
|
16584
16582
|
prototypeAccessors.allowSuper.get = function () {
|
|
16585
16583
|
var ref = this.currentThisScope();
|
|
16586
16584
|
var flags = ref.flags;
|
|
16587
16585
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16588
16586
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16589
16587
|
};
|
|
16588
|
+
|
|
16590
16589
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16590
|
+
|
|
16591
16591
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16592
|
+
|
|
16592
16593
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16593
16594
|
var ref = this.currentThisScope();
|
|
16594
16595
|
var flags = ref.flags;
|
|
16595
16596
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16596
16597
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16597
16598
|
};
|
|
16599
|
+
|
|
16598
16600
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16599
16601
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16600
16602
|
};
|
|
@@ -16624,12 +16626,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16624
16626
|
|
|
16625
16627
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16626
16628
|
|
|
16627
|
-
var pp = Parser.prototype;
|
|
16629
|
+
var pp$9 = Parser.prototype;
|
|
16628
16630
|
|
|
16629
16631
|
// ## Parser utilities
|
|
16630
16632
|
|
|
16631
16633
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16632
|
-
pp.strictDirective = function(start) {
|
|
16634
|
+
pp$9.strictDirective = function(start) {
|
|
16633
16635
|
for (;;) {
|
|
16634
16636
|
// Try to find string literal.
|
|
16635
16637
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16657,7 +16659,7 @@ pp.strictDirective = function(start) {
|
|
|
16657
16659
|
// Predicate that tests whether the next token is of the given
|
|
16658
16660
|
// type, and if yes, consumes it as a side effect.
|
|
16659
16661
|
|
|
16660
|
-
pp.eat = function(type) {
|
|
16662
|
+
pp$9.eat = function(type) {
|
|
16661
16663
|
if (this.type === type) {
|
|
16662
16664
|
this.next();
|
|
16663
16665
|
return true
|
|
@@ -16668,13 +16670,13 @@ pp.eat = function(type) {
|
|
|
16668
16670
|
|
|
16669
16671
|
// Tests whether parsed token is a contextual keyword.
|
|
16670
16672
|
|
|
16671
|
-
pp.isContextual = function(name) {
|
|
16672
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16673
|
+
pp$9.isContextual = function(name) {
|
|
16674
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16673
16675
|
};
|
|
16674
16676
|
|
|
16675
16677
|
// Consumes contextual keyword if possible.
|
|
16676
16678
|
|
|
16677
|
-
pp.eatContextual = function(name) {
|
|
16679
|
+
pp$9.eatContextual = function(name) {
|
|
16678
16680
|
if (!this.isContextual(name)) { return false }
|
|
16679
16681
|
this.next();
|
|
16680
16682
|
return true
|
|
@@ -16682,19 +16684,19 @@ pp.eatContextual = function(name) {
|
|
|
16682
16684
|
|
|
16683
16685
|
// Asserts that following token is given contextual keyword.
|
|
16684
16686
|
|
|
16685
|
-
pp.expectContextual = function(name) {
|
|
16687
|
+
pp$9.expectContextual = function(name) {
|
|
16686
16688
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16687
16689
|
};
|
|
16688
16690
|
|
|
16689
16691
|
// Test whether a semicolon can be inserted at the current position.
|
|
16690
16692
|
|
|
16691
|
-
pp.canInsertSemicolon = function() {
|
|
16692
|
-
return this.type === types.eof ||
|
|
16693
|
-
this.type === types.braceR ||
|
|
16693
|
+
pp$9.canInsertSemicolon = function() {
|
|
16694
|
+
return this.type === types$1.eof ||
|
|
16695
|
+
this.type === types$1.braceR ||
|
|
16694
16696
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16695
16697
|
};
|
|
16696
16698
|
|
|
16697
|
-
pp.insertSemicolon = function() {
|
|
16699
|
+
pp$9.insertSemicolon = function() {
|
|
16698
16700
|
if (this.canInsertSemicolon()) {
|
|
16699
16701
|
if (this.options.onInsertedSemicolon)
|
|
16700
16702
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16705,11 +16707,11 @@ pp.insertSemicolon = function() {
|
|
|
16705
16707
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16706
16708
|
// pretend that there is a semicolon at this position.
|
|
16707
16709
|
|
|
16708
|
-
pp.semicolon = function() {
|
|
16709
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16710
|
+
pp$9.semicolon = function() {
|
|
16711
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16710
16712
|
};
|
|
16711
16713
|
|
|
16712
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16714
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16713
16715
|
if (this.type === tokType) {
|
|
16714
16716
|
if (this.options.onTrailingComma)
|
|
16715
16717
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16722,13 +16724,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16722
16724
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16723
16725
|
// raise an unexpected token error.
|
|
16724
16726
|
|
|
16725
|
-
pp.expect = function(type) {
|
|
16727
|
+
pp$9.expect = function(type) {
|
|
16726
16728
|
this.eat(type) || this.unexpected();
|
|
16727
16729
|
};
|
|
16728
16730
|
|
|
16729
16731
|
// Raise an unexpected token error.
|
|
16730
16732
|
|
|
16731
|
-
pp.unexpected = function(pos) {
|
|
16733
|
+
pp$9.unexpected = function(pos) {
|
|
16732
16734
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16733
16735
|
};
|
|
16734
16736
|
|
|
@@ -16741,7 +16743,7 @@ function DestructuringErrors() {
|
|
|
16741
16743
|
-1;
|
|
16742
16744
|
}
|
|
16743
16745
|
|
|
16744
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16746
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16745
16747
|
if (!refDestructuringErrors) { return }
|
|
16746
16748
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16747
16749
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16749,7 +16751,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16749
16751
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16750
16752
|
};
|
|
16751
16753
|
|
|
16752
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16754
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16753
16755
|
if (!refDestructuringErrors) { return false }
|
|
16754
16756
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16755
16757
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16760,20 +16762,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16760
16762
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16761
16763
|
};
|
|
16762
16764
|
|
|
16763
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16765
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16764
16766
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16765
16767
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16766
16768
|
if (this.awaitPos)
|
|
16767
16769
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16768
16770
|
};
|
|
16769
16771
|
|
|
16770
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16772
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16771
16773
|
if (expr.type === "ParenthesizedExpression")
|
|
16772
16774
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16773
16775
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16774
16776
|
};
|
|
16775
16777
|
|
|
16776
|
-
var pp$
|
|
16778
|
+
var pp$8 = Parser.prototype;
|
|
16777
16779
|
|
|
16778
16780
|
// ### Statement parsing
|
|
16779
16781
|
|
|
@@ -16782,10 +16784,10 @@ var pp$1 = Parser.prototype;
|
|
|
16782
16784
|
// `program` argument. If present, the statements will be appended
|
|
16783
16785
|
// to its body instead of creating a new node.
|
|
16784
16786
|
|
|
16785
|
-
pp$
|
|
16787
|
+
pp$8.parseTopLevel = function(node) {
|
|
16786
16788
|
var exports = Object.create(null);
|
|
16787
16789
|
if (!node.body) { node.body = []; }
|
|
16788
|
-
while (this.type !== types.eof) {
|
|
16790
|
+
while (this.type !== types$1.eof) {
|
|
16789
16791
|
var stmt = this.parseStatement(null, true, exports);
|
|
16790
16792
|
node.body.push(stmt);
|
|
16791
16793
|
}
|
|
@@ -16804,7 +16806,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16804
16806
|
|
|
16805
16807
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16806
16808
|
|
|
16807
|
-
pp$
|
|
16809
|
+
pp$8.isLet = function(context) {
|
|
16808
16810
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16809
16811
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16810
16812
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16830,7 +16832,7 @@ pp$1.isLet = function(context) {
|
|
|
16830
16832
|
// check 'async [no LineTerminator here] function'
|
|
16831
16833
|
// - 'async /*foo*/ function' is OK.
|
|
16832
16834
|
// - 'async /*\n*/ function' is invalid.
|
|
16833
|
-
pp$
|
|
16835
|
+
pp$8.isAsyncFunction = function() {
|
|
16834
16836
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16835
16837
|
{ return false }
|
|
16836
16838
|
|
|
@@ -16850,11 +16852,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16850
16852
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16851
16853
|
// does not help.
|
|
16852
16854
|
|
|
16853
|
-
pp$
|
|
16855
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16854
16856
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16855
16857
|
|
|
16856
16858
|
if (this.isLet(context)) {
|
|
16857
|
-
starttype = types._var;
|
|
16859
|
+
starttype = types$1._var;
|
|
16858
16860
|
kind = "let";
|
|
16859
16861
|
}
|
|
16860
16862
|
|
|
@@ -16863,35 +16865,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16863
16865
|
// complexity.
|
|
16864
16866
|
|
|
16865
16867
|
switch (starttype) {
|
|
16866
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16867
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
16868
|
-
case types._do: return this.parseDoStatement(node)
|
|
16869
|
-
case types._for: return this.parseForStatement(node)
|
|
16870
|
-
case types._function:
|
|
16868
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16869
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
16870
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
16871
|
+
case types$1._for: return this.parseForStatement(node)
|
|
16872
|
+
case types$1._function:
|
|
16871
16873
|
// Function as sole body of either an if statement or a labeled statement
|
|
16872
16874
|
// works, but not when it is part of a labeled statement that is the sole
|
|
16873
16875
|
// body of an if statement.
|
|
16874
16876
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
16875
16877
|
return this.parseFunctionStatement(node, false, !context)
|
|
16876
|
-
case types._class:
|
|
16878
|
+
case types$1._class:
|
|
16877
16879
|
if (context) { this.unexpected(); }
|
|
16878
16880
|
return this.parseClass(node, true)
|
|
16879
|
-
case types._if: return this.parseIfStatement(node)
|
|
16880
|
-
case types._return: return this.parseReturnStatement(node)
|
|
16881
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
16882
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
16883
|
-
case types._try: return this.parseTryStatement(node)
|
|
16884
|
-
case types._const: case types._var:
|
|
16881
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
16882
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
16883
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
16884
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
16885
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
16886
|
+
case types$1._const: case types$1._var:
|
|
16885
16887
|
kind = kind || this.value;
|
|
16886
16888
|
if (context && kind !== "var") { this.unexpected(); }
|
|
16887
16889
|
return this.parseVarStatement(node, kind)
|
|
16888
|
-
case types._while: return this.parseWhileStatement(node)
|
|
16889
|
-
case types._with: return this.parseWithStatement(node)
|
|
16890
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
16891
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
16892
|
-
case types._export:
|
|
16893
|
-
case types._import:
|
|
16894
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
16890
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
16891
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
16892
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
16893
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
16894
|
+
case types$1._export:
|
|
16895
|
+
case types$1._import:
|
|
16896
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
16895
16897
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16896
16898
|
var skip = skipWhiteSpace.exec(this.input);
|
|
16897
16899
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -16905,7 +16907,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16905
16907
|
if (!this.inModule)
|
|
16906
16908
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
16907
16909
|
}
|
|
16908
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16910
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16909
16911
|
|
|
16910
16912
|
// If the statement does not start with a statement keyword or a
|
|
16911
16913
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -16920,17 +16922,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16920
16922
|
}
|
|
16921
16923
|
|
|
16922
16924
|
var maybeName = this.value, expr = this.parseExpression();
|
|
16923
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
16925
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
16924
16926
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
16925
16927
|
else { return this.parseExpressionStatement(node, expr) }
|
|
16926
16928
|
}
|
|
16927
16929
|
};
|
|
16928
16930
|
|
|
16929
|
-
pp$
|
|
16931
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
16930
16932
|
var isBreak = keyword === "break";
|
|
16931
16933
|
this.next();
|
|
16932
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16933
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
16934
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16935
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
16934
16936
|
else {
|
|
16935
16937
|
node.label = this.parseIdent();
|
|
16936
16938
|
this.semicolon();
|
|
@@ -16950,21 +16952,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
16950
16952
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
16951
16953
|
};
|
|
16952
16954
|
|
|
16953
|
-
pp$
|
|
16955
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
16954
16956
|
this.next();
|
|
16955
16957
|
this.semicolon();
|
|
16956
16958
|
return this.finishNode(node, "DebuggerStatement")
|
|
16957
16959
|
};
|
|
16958
16960
|
|
|
16959
|
-
pp$
|
|
16961
|
+
pp$8.parseDoStatement = function(node) {
|
|
16960
16962
|
this.next();
|
|
16961
16963
|
this.labels.push(loopLabel);
|
|
16962
16964
|
node.body = this.parseStatement("do");
|
|
16963
16965
|
this.labels.pop();
|
|
16964
|
-
this.expect(types._while);
|
|
16966
|
+
this.expect(types$1._while);
|
|
16965
16967
|
node.test = this.parseParenExpression();
|
|
16966
16968
|
if (this.options.ecmaVersion >= 6)
|
|
16967
|
-
{ this.eat(types.semi); }
|
|
16969
|
+
{ this.eat(types$1.semi); }
|
|
16968
16970
|
else
|
|
16969
16971
|
{ this.semicolon(); }
|
|
16970
16972
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -16978,25 +16980,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
16978
16980
|
// part (semicolon immediately after the opening parenthesis), it
|
|
16979
16981
|
// is a regular `for` loop.
|
|
16980
16982
|
|
|
16981
|
-
pp$
|
|
16983
|
+
pp$8.parseForStatement = function(node) {
|
|
16982
16984
|
this.next();
|
|
16983
16985
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
16984
16986
|
this.labels.push(loopLabel);
|
|
16985
16987
|
this.enterScope(0);
|
|
16986
|
-
this.expect(types.parenL);
|
|
16987
|
-
if (this.type === types.semi) {
|
|
16988
|
+
this.expect(types$1.parenL);
|
|
16989
|
+
if (this.type === types$1.semi) {
|
|
16988
16990
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
16989
16991
|
return this.parseFor(node, null)
|
|
16990
16992
|
}
|
|
16991
16993
|
var isLet = this.isLet();
|
|
16992
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
16994
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
16993
16995
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
16994
16996
|
this.next();
|
|
16995
16997
|
this.parseVar(init$1, true, kind);
|
|
16996
16998
|
this.finishNode(init$1, "VariableDeclaration");
|
|
16997
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
16999
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
16998
17000
|
if (this.options.ecmaVersion >= 9) {
|
|
16999
|
-
if (this.type === types._in) {
|
|
17001
|
+
if (this.type === types$1._in) {
|
|
17000
17002
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17001
17003
|
} else { node.await = awaitAt > -1; }
|
|
17002
17004
|
}
|
|
@@ -17008,9 +17010,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17008
17010
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17009
17011
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17010
17012
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17011
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17013
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17012
17014
|
if (this.options.ecmaVersion >= 9) {
|
|
17013
|
-
if (this.type === types._in) {
|
|
17015
|
+
if (this.type === types$1._in) {
|
|
17014
17016
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17015
17017
|
} else { node.await = awaitAt > -1; }
|
|
17016
17018
|
}
|
|
@@ -17025,21 +17027,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17025
17027
|
return this.parseFor(node, init)
|
|
17026
17028
|
};
|
|
17027
17029
|
|
|
17028
|
-
pp$
|
|
17030
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17029
17031
|
this.next();
|
|
17030
17032
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17031
17033
|
};
|
|
17032
17034
|
|
|
17033
|
-
pp$
|
|
17035
|
+
pp$8.parseIfStatement = function(node) {
|
|
17034
17036
|
this.next();
|
|
17035
17037
|
node.test = this.parseParenExpression();
|
|
17036
17038
|
// allow function declarations in branches, but only in non-strict mode
|
|
17037
17039
|
node.consequent = this.parseStatement("if");
|
|
17038
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17040
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17039
17041
|
return this.finishNode(node, "IfStatement")
|
|
17040
17042
|
};
|
|
17041
17043
|
|
|
17042
|
-
pp$
|
|
17044
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17043
17045
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17044
17046
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17045
17047
|
this.next();
|
|
@@ -17048,16 +17050,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17048
17050
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17049
17051
|
// possibility to insert one.
|
|
17050
17052
|
|
|
17051
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17053
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17052
17054
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17053
17055
|
return this.finishNode(node, "ReturnStatement")
|
|
17054
17056
|
};
|
|
17055
17057
|
|
|
17056
|
-
pp$
|
|
17058
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17057
17059
|
this.next();
|
|
17058
17060
|
node.discriminant = this.parseParenExpression();
|
|
17059
17061
|
node.cases = [];
|
|
17060
|
-
this.expect(types.braceL);
|
|
17062
|
+
this.expect(types$1.braceL);
|
|
17061
17063
|
this.labels.push(switchLabel);
|
|
17062
17064
|
this.enterScope(0);
|
|
17063
17065
|
|
|
@@ -17066,9 +17068,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17066
17068
|
// adding statements to.
|
|
17067
17069
|
|
|
17068
17070
|
var cur;
|
|
17069
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
17070
|
-
if (this.type === types._case || this.type === types._default) {
|
|
17071
|
-
var isCase = this.type === types._case;
|
|
17071
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17072
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17073
|
+
var isCase = this.type === types$1._case;
|
|
17072
17074
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17073
17075
|
node.cases.push(cur = this.startNode());
|
|
17074
17076
|
cur.consequent = [];
|
|
@@ -17080,7 +17082,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17080
17082
|
sawDefault = true;
|
|
17081
17083
|
cur.test = null;
|
|
17082
17084
|
}
|
|
17083
|
-
this.expect(types.colon);
|
|
17085
|
+
this.expect(types$1.colon);
|
|
17084
17086
|
} else {
|
|
17085
17087
|
if (!cur) { this.unexpected(); }
|
|
17086
17088
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17093,7 +17095,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17093
17095
|
return this.finishNode(node, "SwitchStatement")
|
|
17094
17096
|
};
|
|
17095
17097
|
|
|
17096
|
-
pp$
|
|
17098
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17097
17099
|
this.next();
|
|
17098
17100
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17099
17101
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17104,21 +17106,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17104
17106
|
|
|
17105
17107
|
// Reused empty array added for node fields that are always empty.
|
|
17106
17108
|
|
|
17107
|
-
var empty = [];
|
|
17109
|
+
var empty$1 = [];
|
|
17108
17110
|
|
|
17109
|
-
pp$
|
|
17111
|
+
pp$8.parseTryStatement = function(node) {
|
|
17110
17112
|
this.next();
|
|
17111
17113
|
node.block = this.parseBlock();
|
|
17112
17114
|
node.handler = null;
|
|
17113
|
-
if (this.type === types._catch) {
|
|
17115
|
+
if (this.type === types$1._catch) {
|
|
17114
17116
|
var clause = this.startNode();
|
|
17115
17117
|
this.next();
|
|
17116
|
-
if (this.eat(types.parenL)) {
|
|
17118
|
+
if (this.eat(types$1.parenL)) {
|
|
17117
17119
|
clause.param = this.parseBindingAtom();
|
|
17118
17120
|
var simple = clause.param.type === "Identifier";
|
|
17119
17121
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17120
17122
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17121
|
-
this.expect(types.parenR);
|
|
17123
|
+
this.expect(types$1.parenR);
|
|
17122
17124
|
} else {
|
|
17123
17125
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17124
17126
|
clause.param = null;
|
|
@@ -17128,20 +17130,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17128
17130
|
this.exitScope();
|
|
17129
17131
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17130
17132
|
}
|
|
17131
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17133
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17132
17134
|
if (!node.handler && !node.finalizer)
|
|
17133
17135
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17134
17136
|
return this.finishNode(node, "TryStatement")
|
|
17135
17137
|
};
|
|
17136
17138
|
|
|
17137
|
-
pp$
|
|
17139
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17138
17140
|
this.next();
|
|
17139
17141
|
this.parseVar(node, false, kind);
|
|
17140
17142
|
this.semicolon();
|
|
17141
17143
|
return this.finishNode(node, "VariableDeclaration")
|
|
17142
17144
|
};
|
|
17143
17145
|
|
|
17144
|
-
pp$
|
|
17146
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17145
17147
|
this.next();
|
|
17146
17148
|
node.test = this.parseParenExpression();
|
|
17147
17149
|
this.labels.push(loopLabel);
|
|
@@ -17150,7 +17152,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17150
17152
|
return this.finishNode(node, "WhileStatement")
|
|
17151
17153
|
};
|
|
17152
17154
|
|
|
17153
|
-
pp$
|
|
17155
|
+
pp$8.parseWithStatement = function(node) {
|
|
17154
17156
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17155
17157
|
this.next();
|
|
17156
17158
|
node.object = this.parseParenExpression();
|
|
@@ -17158,12 +17160,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17158
17160
|
return this.finishNode(node, "WithStatement")
|
|
17159
17161
|
};
|
|
17160
17162
|
|
|
17161
|
-
pp$
|
|
17163
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17162
17164
|
this.next();
|
|
17163
17165
|
return this.finishNode(node, "EmptyStatement")
|
|
17164
17166
|
};
|
|
17165
17167
|
|
|
17166
|
-
pp$
|
|
17168
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17167
17169
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17168
17170
|
{
|
|
17169
17171
|
var label = list[i$1];
|
|
@@ -17171,7 +17173,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17171
17173
|
if (label.name === maybeName)
|
|
17172
17174
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17173
17175
|
} }
|
|
17174
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17176
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17175
17177
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17176
17178
|
var label$1 = this.labels[i];
|
|
17177
17179
|
if (label$1.statementStart === node.start) {
|
|
@@ -17187,7 +17189,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17187
17189
|
return this.finishNode(node, "LabeledStatement")
|
|
17188
17190
|
};
|
|
17189
17191
|
|
|
17190
|
-
pp$
|
|
17192
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17191
17193
|
node.expression = expr;
|
|
17192
17194
|
this.semicolon();
|
|
17193
17195
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17197,14 +17199,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17197
17199
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17198
17200
|
// function bodies).
|
|
17199
17201
|
|
|
17200
|
-
pp$
|
|
17202
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17201
17203
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17202
17204
|
if ( node === void 0 ) node = this.startNode();
|
|
17203
17205
|
|
|
17204
17206
|
node.body = [];
|
|
17205
|
-
this.expect(types.braceL);
|
|
17207
|
+
this.expect(types$1.braceL);
|
|
17206
17208
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17207
|
-
while (this.type !== types.braceR) {
|
|
17209
|
+
while (this.type !== types$1.braceR) {
|
|
17208
17210
|
var stmt = this.parseStatement(null);
|
|
17209
17211
|
node.body.push(stmt);
|
|
17210
17212
|
}
|
|
@@ -17218,13 +17220,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17218
17220
|
// `parseStatement` will already have parsed the init statement or
|
|
17219
17221
|
// expression.
|
|
17220
17222
|
|
|
17221
|
-
pp$
|
|
17223
|
+
pp$8.parseFor = function(node, init) {
|
|
17222
17224
|
node.init = init;
|
|
17223
|
-
this.expect(types.semi);
|
|
17224
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
17225
|
-
this.expect(types.semi);
|
|
17226
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
17227
|
-
this.expect(types.parenR);
|
|
17225
|
+
this.expect(types$1.semi);
|
|
17226
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17227
|
+
this.expect(types$1.semi);
|
|
17228
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17229
|
+
this.expect(types$1.parenR);
|
|
17228
17230
|
node.body = this.parseStatement("for");
|
|
17229
17231
|
this.exitScope();
|
|
17230
17232
|
this.labels.pop();
|
|
@@ -17234,8 +17236,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17234
17236
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17235
17237
|
// same from parser's perspective.
|
|
17236
17238
|
|
|
17237
|
-
pp$
|
|
17238
|
-
var isForIn = this.type === types._in;
|
|
17239
|
+
pp$8.parseForIn = function(node, init) {
|
|
17240
|
+
var isForIn = this.type === types$1._in;
|
|
17239
17241
|
this.next();
|
|
17240
17242
|
|
|
17241
17243
|
if (
|
|
@@ -17256,7 +17258,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17256
17258
|
}
|
|
17257
17259
|
node.left = init;
|
|
17258
17260
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17259
|
-
this.expect(types.parenR);
|
|
17261
|
+
this.expect(types$1.parenR);
|
|
17260
17262
|
node.body = this.parseStatement("for");
|
|
17261
17263
|
this.exitScope();
|
|
17262
17264
|
this.labels.pop();
|
|
@@ -17265,28 +17267,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17265
17267
|
|
|
17266
17268
|
// Parse a list of variable declarations.
|
|
17267
17269
|
|
|
17268
|
-
pp$
|
|
17270
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17269
17271
|
node.declarations = [];
|
|
17270
17272
|
node.kind = kind;
|
|
17271
17273
|
for (;;) {
|
|
17272
17274
|
var decl = this.startNode();
|
|
17273
17275
|
this.parseVarId(decl, kind);
|
|
17274
|
-
if (this.eat(types.eq)) {
|
|
17276
|
+
if (this.eat(types$1.eq)) {
|
|
17275
17277
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17276
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17278
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17277
17279
|
this.unexpected();
|
|
17278
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17280
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17279
17281
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17280
17282
|
} else {
|
|
17281
17283
|
decl.init = null;
|
|
17282
17284
|
}
|
|
17283
17285
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17284
|
-
if (!this.eat(types.comma)) { break }
|
|
17286
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17285
17287
|
}
|
|
17286
17288
|
return node
|
|
17287
17289
|
};
|
|
17288
17290
|
|
|
17289
|
-
pp$
|
|
17291
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17290
17292
|
decl.id = this.parseBindingAtom();
|
|
17291
17293
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17292
17294
|
};
|
|
@@ -17297,18 +17299,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17297
17299
|
// `statement & FUNC_STATEMENT`).
|
|
17298
17300
|
|
|
17299
17301
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17300
|
-
pp$
|
|
17302
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17301
17303
|
this.initFunction(node);
|
|
17302
17304
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17303
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17305
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17304
17306
|
{ this.unexpected(); }
|
|
17305
|
-
node.generator = this.eat(types.star);
|
|
17307
|
+
node.generator = this.eat(types$1.star);
|
|
17306
17308
|
}
|
|
17307
17309
|
if (this.options.ecmaVersion >= 8)
|
|
17308
17310
|
{ node.async = !!isAsync; }
|
|
17309
17311
|
|
|
17310
17312
|
if (statement & FUNC_STATEMENT) {
|
|
17311
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17313
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17312
17314
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17313
17315
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17314
17316
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17324,7 +17326,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17324
17326
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17325
17327
|
|
|
17326
17328
|
if (!(statement & FUNC_STATEMENT))
|
|
17327
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17329
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17328
17330
|
|
|
17329
17331
|
this.parseFunctionParams(node);
|
|
17330
17332
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17335,16 +17337,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17335
17337
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17336
17338
|
};
|
|
17337
17339
|
|
|
17338
|
-
pp$
|
|
17339
|
-
this.expect(types.parenL);
|
|
17340
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17340
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17341
|
+
this.expect(types$1.parenL);
|
|
17342
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17341
17343
|
this.checkYieldAwaitInDefaultParams();
|
|
17342
17344
|
};
|
|
17343
17345
|
|
|
17344
17346
|
// Parse a class declaration or literal (depending on the
|
|
17345
17347
|
// `isStatement` parameter).
|
|
17346
17348
|
|
|
17347
|
-
pp$
|
|
17349
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17348
17350
|
this.next();
|
|
17349
17351
|
|
|
17350
17352
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17358,8 +17360,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17358
17360
|
var classBody = this.startNode();
|
|
17359
17361
|
var hadConstructor = false;
|
|
17360
17362
|
classBody.body = [];
|
|
17361
|
-
this.expect(types.braceL);
|
|
17362
|
-
while (this.type !== types.braceR) {
|
|
17363
|
+
this.expect(types$1.braceL);
|
|
17364
|
+
while (this.type !== types$1.braceR) {
|
|
17363
17365
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17364
17366
|
if (element) {
|
|
17365
17367
|
classBody.body.push(element);
|
|
@@ -17378,8 +17380,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17378
17380
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17379
17381
|
};
|
|
17380
17382
|
|
|
17381
|
-
pp$
|
|
17382
|
-
if (this.eat(types.semi)) { return null }
|
|
17383
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17384
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17383
17385
|
|
|
17384
17386
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17385
17387
|
var node = this.startNode();
|
|
@@ -17391,11 +17393,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17391
17393
|
|
|
17392
17394
|
if (this.eatContextual("static")) {
|
|
17393
17395
|
// Parse static init block
|
|
17394
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17396
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17395
17397
|
this.parseClassStaticBlock(node);
|
|
17396
17398
|
return node
|
|
17397
17399
|
}
|
|
17398
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17400
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17399
17401
|
isStatic = true;
|
|
17400
17402
|
} else {
|
|
17401
17403
|
keyName = "static";
|
|
@@ -17403,13 +17405,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17403
17405
|
}
|
|
17404
17406
|
node.static = isStatic;
|
|
17405
17407
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17406
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17408
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17407
17409
|
isAsync = true;
|
|
17408
17410
|
} else {
|
|
17409
17411
|
keyName = "async";
|
|
17410
17412
|
}
|
|
17411
17413
|
}
|
|
17412
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17414
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17413
17415
|
isGenerator = true;
|
|
17414
17416
|
}
|
|
17415
17417
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17436,7 +17438,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17436
17438
|
}
|
|
17437
17439
|
|
|
17438
17440
|
// Parse element value
|
|
17439
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17441
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17440
17442
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17441
17443
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17442
17444
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17450,19 +17452,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17450
17452
|
return node
|
|
17451
17453
|
};
|
|
17452
17454
|
|
|
17453
|
-
pp$
|
|
17455
|
+
pp$8.isClassElementNameStart = function() {
|
|
17454
17456
|
return (
|
|
17455
|
-
this.type === types.name ||
|
|
17456
|
-
this.type === types.privateId ||
|
|
17457
|
-
this.type === types.num ||
|
|
17458
|
-
this.type === types.string ||
|
|
17459
|
-
this.type === types.bracketL ||
|
|
17457
|
+
this.type === types$1.name ||
|
|
17458
|
+
this.type === types$1.privateId ||
|
|
17459
|
+
this.type === types$1.num ||
|
|
17460
|
+
this.type === types$1.string ||
|
|
17461
|
+
this.type === types$1.bracketL ||
|
|
17460
17462
|
this.type.keyword
|
|
17461
17463
|
)
|
|
17462
17464
|
};
|
|
17463
17465
|
|
|
17464
|
-
pp$
|
|
17465
|
-
if (this.type === types.privateId) {
|
|
17466
|
+
pp$8.parseClassElementName = function(element) {
|
|
17467
|
+
if (this.type === types$1.privateId) {
|
|
17466
17468
|
if (this.value === "constructor") {
|
|
17467
17469
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17468
17470
|
}
|
|
@@ -17473,7 +17475,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17473
17475
|
}
|
|
17474
17476
|
};
|
|
17475
17477
|
|
|
17476
|
-
pp$
|
|
17478
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17477
17479
|
// Check key and flags
|
|
17478
17480
|
var key = method.key;
|
|
17479
17481
|
if (method.kind === "constructor") {
|
|
@@ -17497,14 +17499,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17497
17499
|
return this.finishNode(method, "MethodDefinition")
|
|
17498
17500
|
};
|
|
17499
17501
|
|
|
17500
|
-
pp$
|
|
17502
|
+
pp$8.parseClassField = function(field) {
|
|
17501
17503
|
if (checkKeyName(field, "constructor")) {
|
|
17502
17504
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17503
17505
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17504
17506
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17505
17507
|
}
|
|
17506
17508
|
|
|
17507
|
-
if (this.eat(types.eq)) {
|
|
17509
|
+
if (this.eat(types$1.eq)) {
|
|
17508
17510
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17509
17511
|
var scope = this.currentThisScope();
|
|
17510
17512
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17519,13 +17521,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17519
17521
|
return this.finishNode(field, "PropertyDefinition")
|
|
17520
17522
|
};
|
|
17521
17523
|
|
|
17522
|
-
pp$
|
|
17524
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17523
17525
|
node.body = [];
|
|
17524
17526
|
|
|
17525
17527
|
var oldLabels = this.labels;
|
|
17526
17528
|
this.labels = [];
|
|
17527
17529
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17528
|
-
while (this.type !== types.braceR) {
|
|
17530
|
+
while (this.type !== types$1.braceR) {
|
|
17529
17531
|
var stmt = this.parseStatement(null);
|
|
17530
17532
|
node.body.push(stmt);
|
|
17531
17533
|
}
|
|
@@ -17536,8 +17538,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17536
17538
|
return this.finishNode(node, "StaticBlock")
|
|
17537
17539
|
};
|
|
17538
17540
|
|
|
17539
|
-
pp$
|
|
17540
|
-
if (this.type === types.name) {
|
|
17541
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17542
|
+
if (this.type === types$1.name) {
|
|
17541
17543
|
node.id = this.parseIdent();
|
|
17542
17544
|
if (isStatement)
|
|
17543
17545
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17548,17 +17550,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17548
17550
|
}
|
|
17549
17551
|
};
|
|
17550
17552
|
|
|
17551
|
-
pp$
|
|
17552
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17553
|
+
pp$8.parseClassSuper = function(node) {
|
|
17554
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17553
17555
|
};
|
|
17554
17556
|
|
|
17555
|
-
pp$
|
|
17557
|
+
pp$8.enterClassBody = function() {
|
|
17556
17558
|
var element = {declared: Object.create(null), used: []};
|
|
17557
17559
|
this.privateNameStack.push(element);
|
|
17558
17560
|
return element.declared
|
|
17559
17561
|
};
|
|
17560
17562
|
|
|
17561
|
-
pp$
|
|
17563
|
+
pp$8.exitClassBody = function() {
|
|
17562
17564
|
var ref = this.privateNameStack.pop();
|
|
17563
17565
|
var declared = ref.declared;
|
|
17564
17566
|
var used = ref.used;
|
|
@@ -17613,10 +17615,10 @@ function checkKeyName(node, name) {
|
|
|
17613
17615
|
|
|
17614
17616
|
// Parses module export declaration.
|
|
17615
17617
|
|
|
17616
|
-
pp$
|
|
17618
|
+
pp$8.parseExport = function(node, exports) {
|
|
17617
17619
|
this.next();
|
|
17618
17620
|
// export * from '...'
|
|
17619
|
-
if (this.eat(types.star)) {
|
|
17621
|
+
if (this.eat(types$1.star)) {
|
|
17620
17622
|
if (this.options.ecmaVersion >= 11) {
|
|
17621
17623
|
if (this.eatContextual("as")) {
|
|
17622
17624
|
node.exported = this.parseIdent(true);
|
|
@@ -17626,20 +17628,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17626
17628
|
}
|
|
17627
17629
|
}
|
|
17628
17630
|
this.expectContextual("from");
|
|
17629
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17631
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17630
17632
|
node.source = this.parseExprAtom();
|
|
17631
17633
|
this.semicolon();
|
|
17632
17634
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17633
17635
|
}
|
|
17634
|
-
if (this.eat(types._default)) { // export default ...
|
|
17636
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17635
17637
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17636
17638
|
var isAsync;
|
|
17637
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17639
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17638
17640
|
var fNode = this.startNode();
|
|
17639
17641
|
this.next();
|
|
17640
17642
|
if (isAsync) { this.next(); }
|
|
17641
17643
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17642
|
-
} else if (this.type === types._class) {
|
|
17644
|
+
} else if (this.type === types$1._class) {
|
|
17643
17645
|
var cNode = this.startNode();
|
|
17644
17646
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17645
17647
|
} else {
|
|
@@ -17661,7 +17663,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17661
17663
|
node.declaration = null;
|
|
17662
17664
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17663
17665
|
if (this.eatContextual("from")) {
|
|
17664
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17666
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17665
17667
|
node.source = this.parseExprAtom();
|
|
17666
17668
|
} else {
|
|
17667
17669
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17680,14 +17682,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17680
17682
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17681
17683
|
};
|
|
17682
17684
|
|
|
17683
|
-
pp$
|
|
17685
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17684
17686
|
if (!exports) { return }
|
|
17685
17687
|
if (has(exports, name))
|
|
17686
17688
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17687
17689
|
exports[name] = true;
|
|
17688
17690
|
};
|
|
17689
17691
|
|
|
17690
|
-
pp$
|
|
17692
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17691
17693
|
var type = pat.type;
|
|
17692
17694
|
if (type === "Identifier")
|
|
17693
17695
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17714,7 +17716,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17714
17716
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17715
17717
|
};
|
|
17716
17718
|
|
|
17717
|
-
pp$
|
|
17719
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17718
17720
|
if (!exports) { return }
|
|
17719
17721
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17720
17722
|
{
|
|
@@ -17724,7 +17726,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17724
17726
|
}
|
|
17725
17727
|
};
|
|
17726
17728
|
|
|
17727
|
-
pp$
|
|
17729
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17728
17730
|
return this.type.keyword === "var" ||
|
|
17729
17731
|
this.type.keyword === "const" ||
|
|
17730
17732
|
this.type.keyword === "class" ||
|
|
@@ -17735,14 +17737,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17735
17737
|
|
|
17736
17738
|
// Parses a comma-separated list of module exports.
|
|
17737
17739
|
|
|
17738
|
-
pp$
|
|
17740
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17739
17741
|
var nodes = [], first = true;
|
|
17740
17742
|
// export { x, y as z } [from '...']
|
|
17741
|
-
this.expect(types.braceL);
|
|
17742
|
-
while (!this.eat(types.braceR)) {
|
|
17743
|
+
this.expect(types$1.braceL);
|
|
17744
|
+
while (!this.eat(types$1.braceR)) {
|
|
17743
17745
|
if (!first) {
|
|
17744
|
-
this.expect(types.comma);
|
|
17745
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17746
|
+
this.expect(types$1.comma);
|
|
17747
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17746
17748
|
} else { first = false; }
|
|
17747
17749
|
|
|
17748
17750
|
var node = this.startNode();
|
|
@@ -17756,16 +17758,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17756
17758
|
|
|
17757
17759
|
// Parses import declaration.
|
|
17758
17760
|
|
|
17759
|
-
pp$
|
|
17761
|
+
pp$8.parseImport = function(node) {
|
|
17760
17762
|
this.next();
|
|
17761
17763
|
// import '...'
|
|
17762
|
-
if (this.type === types.string) {
|
|
17763
|
-
node.specifiers = empty;
|
|
17764
|
+
if (this.type === types$1.string) {
|
|
17765
|
+
node.specifiers = empty$1;
|
|
17764
17766
|
node.source = this.parseExprAtom();
|
|
17765
17767
|
} else {
|
|
17766
17768
|
node.specifiers = this.parseImportSpecifiers();
|
|
17767
17769
|
this.expectContextual("from");
|
|
17768
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17770
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17769
17771
|
}
|
|
17770
17772
|
this.semicolon();
|
|
17771
17773
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17773,17 +17775,17 @@ pp$1.parseImport = function(node) {
|
|
|
17773
17775
|
|
|
17774
17776
|
// Parses a comma-separated list of module imports.
|
|
17775
17777
|
|
|
17776
|
-
pp$
|
|
17778
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17777
17779
|
var nodes = [], first = true;
|
|
17778
|
-
if (this.type === types.name) {
|
|
17780
|
+
if (this.type === types$1.name) {
|
|
17779
17781
|
// import defaultObj, { x, y as z } from '...'
|
|
17780
17782
|
var node = this.startNode();
|
|
17781
17783
|
node.local = this.parseIdent();
|
|
17782
17784
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17783
17785
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17784
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17786
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17785
17787
|
}
|
|
17786
|
-
if (this.type === types.star) {
|
|
17788
|
+
if (this.type === types$1.star) {
|
|
17787
17789
|
var node$1 = this.startNode();
|
|
17788
17790
|
this.next();
|
|
17789
17791
|
this.expectContextual("as");
|
|
@@ -17792,11 +17794,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17792
17794
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17793
17795
|
return nodes
|
|
17794
17796
|
}
|
|
17795
|
-
this.expect(types.braceL);
|
|
17796
|
-
while (!this.eat(types.braceR)) {
|
|
17797
|
+
this.expect(types$1.braceL);
|
|
17798
|
+
while (!this.eat(types$1.braceR)) {
|
|
17797
17799
|
if (!first) {
|
|
17798
|
-
this.expect(types.comma);
|
|
17799
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17800
|
+
this.expect(types$1.comma);
|
|
17801
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17800
17802
|
} else { first = false; }
|
|
17801
17803
|
|
|
17802
17804
|
var node$2 = this.startNode();
|
|
@@ -17814,12 +17816,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17814
17816
|
};
|
|
17815
17817
|
|
|
17816
17818
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17817
|
-
pp$
|
|
17819
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17818
17820
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17819
17821
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17820
17822
|
}
|
|
17821
17823
|
};
|
|
17822
|
-
pp$
|
|
17824
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17823
17825
|
return (
|
|
17824
17826
|
statement.type === "ExpressionStatement" &&
|
|
17825
17827
|
statement.expression.type === "Literal" &&
|
|
@@ -17829,12 +17831,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17829
17831
|
)
|
|
17830
17832
|
};
|
|
17831
17833
|
|
|
17832
|
-
var pp$
|
|
17834
|
+
var pp$7 = Parser.prototype;
|
|
17833
17835
|
|
|
17834
17836
|
// Convert existing expression atom to assignable pattern
|
|
17835
17837
|
// if possible.
|
|
17836
17838
|
|
|
17837
|
-
pp$
|
|
17839
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17838
17840
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17839
17841
|
switch (node.type) {
|
|
17840
17842
|
case "Identifier":
|
|
@@ -17915,7 +17917,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
17915
17917
|
|
|
17916
17918
|
// Convert list of expression atoms to binding list.
|
|
17917
17919
|
|
|
17918
|
-
pp$
|
|
17920
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
17919
17921
|
var end = exprList.length;
|
|
17920
17922
|
for (var i = 0; i < end; i++) {
|
|
17921
17923
|
var elt = exprList[i];
|
|
@@ -17931,19 +17933,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
17931
17933
|
|
|
17932
17934
|
// Parses spread element.
|
|
17933
17935
|
|
|
17934
|
-
pp$
|
|
17936
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
17935
17937
|
var node = this.startNode();
|
|
17936
17938
|
this.next();
|
|
17937
17939
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
17938
17940
|
return this.finishNode(node, "SpreadElement")
|
|
17939
17941
|
};
|
|
17940
17942
|
|
|
17941
|
-
pp$
|
|
17943
|
+
pp$7.parseRestBinding = function() {
|
|
17942
17944
|
var node = this.startNode();
|
|
17943
17945
|
this.next();
|
|
17944
17946
|
|
|
17945
17947
|
// RestElement inside of a function parameter must be an identifier
|
|
17946
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
17948
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
17947
17949
|
{ this.unexpected(); }
|
|
17948
17950
|
|
|
17949
17951
|
node.argument = this.parseBindingAtom();
|
|
@@ -17953,36 +17955,36 @@ pp$2.parseRestBinding = function() {
|
|
|
17953
17955
|
|
|
17954
17956
|
// Parses lvalue (assignable) atom.
|
|
17955
17957
|
|
|
17956
|
-
pp$
|
|
17958
|
+
pp$7.parseBindingAtom = function() {
|
|
17957
17959
|
if (this.options.ecmaVersion >= 6) {
|
|
17958
17960
|
switch (this.type) {
|
|
17959
|
-
case types.bracketL:
|
|
17961
|
+
case types$1.bracketL:
|
|
17960
17962
|
var node = this.startNode();
|
|
17961
17963
|
this.next();
|
|
17962
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
17964
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
17963
17965
|
return this.finishNode(node, "ArrayPattern")
|
|
17964
17966
|
|
|
17965
|
-
case types.braceL:
|
|
17967
|
+
case types$1.braceL:
|
|
17966
17968
|
return this.parseObj(true)
|
|
17967
17969
|
}
|
|
17968
17970
|
}
|
|
17969
17971
|
return this.parseIdent()
|
|
17970
17972
|
};
|
|
17971
17973
|
|
|
17972
|
-
pp$
|
|
17974
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
17973
17975
|
var elts = [], first = true;
|
|
17974
17976
|
while (!this.eat(close)) {
|
|
17975
17977
|
if (first) { first = false; }
|
|
17976
|
-
else { this.expect(types.comma); }
|
|
17977
|
-
if (allowEmpty && this.type === types.comma) {
|
|
17978
|
+
else { this.expect(types$1.comma); }
|
|
17979
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
17978
17980
|
elts.push(null);
|
|
17979
17981
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
17980
17982
|
break
|
|
17981
|
-
} else if (this.type === types.ellipsis) {
|
|
17983
|
+
} else if (this.type === types$1.ellipsis) {
|
|
17982
17984
|
var rest = this.parseRestBinding();
|
|
17983
17985
|
this.parseBindingListItem(rest);
|
|
17984
17986
|
elts.push(rest);
|
|
17985
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
17987
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
17986
17988
|
this.expect(close);
|
|
17987
17989
|
break
|
|
17988
17990
|
} else {
|
|
@@ -17994,15 +17996,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
17994
17996
|
return elts
|
|
17995
17997
|
};
|
|
17996
17998
|
|
|
17997
|
-
pp$
|
|
17999
|
+
pp$7.parseBindingListItem = function(param) {
|
|
17998
18000
|
return param
|
|
17999
18001
|
};
|
|
18000
18002
|
|
|
18001
18003
|
// Parses assignment pattern around given atom if possible.
|
|
18002
18004
|
|
|
18003
|
-
pp$
|
|
18005
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18004
18006
|
left = left || this.parseBindingAtom();
|
|
18005
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18007
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18006
18008
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18007
18009
|
node.left = left;
|
|
18008
18010
|
node.right = this.parseMaybeAssign();
|
|
@@ -18073,7 +18075,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18073
18075
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18074
18076
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18075
18077
|
|
|
18076
|
-
pp$
|
|
18078
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18077
18079
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18078
18080
|
|
|
18079
18081
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18111,7 +18113,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18111
18113
|
}
|
|
18112
18114
|
};
|
|
18113
18115
|
|
|
18114
|
-
pp$
|
|
18116
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18115
18117
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18116
18118
|
|
|
18117
18119
|
switch (expr.type) {
|
|
@@ -18136,7 +18138,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18136
18138
|
}
|
|
18137
18139
|
};
|
|
18138
18140
|
|
|
18139
|
-
pp$
|
|
18141
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18140
18142
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18141
18143
|
|
|
18142
18144
|
switch (expr.type) {
|
|
@@ -18168,7 +18170,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18168
18170
|
this.generator = !!generator;
|
|
18169
18171
|
};
|
|
18170
18172
|
|
|
18171
|
-
var types
|
|
18173
|
+
var types = {
|
|
18172
18174
|
b_stat: new TokContext("{", false),
|
|
18173
18175
|
b_expr: new TokContext("{", true),
|
|
18174
18176
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18181,38 +18183,38 @@ var types$1 = {
|
|
|
18181
18183
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18182
18184
|
};
|
|
18183
18185
|
|
|
18184
|
-
var pp$
|
|
18186
|
+
var pp$6 = Parser.prototype;
|
|
18185
18187
|
|
|
18186
|
-
pp$
|
|
18187
|
-
return [types
|
|
18188
|
+
pp$6.initialContext = function() {
|
|
18189
|
+
return [types.b_stat]
|
|
18188
18190
|
};
|
|
18189
18191
|
|
|
18190
|
-
pp$
|
|
18192
|
+
pp$6.curContext = function() {
|
|
18191
18193
|
return this.context[this.context.length - 1]
|
|
18192
18194
|
};
|
|
18193
18195
|
|
|
18194
|
-
pp$
|
|
18196
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18195
18197
|
var parent = this.curContext();
|
|
18196
|
-
if (parent === types
|
|
18198
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18197
18199
|
{ return true }
|
|
18198
|
-
if (prevType === types.colon && (parent === types
|
|
18200
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18199
18201
|
{ return !parent.isExpr }
|
|
18200
18202
|
|
|
18201
18203
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18202
18204
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18203
18205
|
// `tt.name`.
|
|
18204
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18206
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18205
18207
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
18206
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
18208
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18207
18209
|
{ return true }
|
|
18208
|
-
if (prevType === types.braceL)
|
|
18209
|
-
{ return parent === types
|
|
18210
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18210
|
+
if (prevType === types$1.braceL)
|
|
18211
|
+
{ return parent === types.b_stat }
|
|
18212
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18211
18213
|
{ return false }
|
|
18212
18214
|
return !this.exprAllowed
|
|
18213
18215
|
};
|
|
18214
18216
|
|
|
18215
|
-
pp$
|
|
18217
|
+
pp$6.inGeneratorContext = function() {
|
|
18216
18218
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18217
18219
|
var context = this.context[i];
|
|
18218
18220
|
if (context.token === "function")
|
|
@@ -18221,9 +18223,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18221
18223
|
return false
|
|
18222
18224
|
};
|
|
18223
18225
|
|
|
18224
|
-
pp$
|
|
18226
|
+
pp$6.updateContext = function(prevType) {
|
|
18225
18227
|
var update, type = this.type;
|
|
18226
|
-
if (type.keyword && prevType === types.dot)
|
|
18228
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18227
18229
|
{ this.exprAllowed = false; }
|
|
18228
18230
|
else if (update = type.updateContext)
|
|
18229
18231
|
{ update.call(this, prevType); }
|
|
@@ -18232,7 +18234,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18232
18234
|
};
|
|
18233
18235
|
|
|
18234
18236
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18235
|
-
pp$
|
|
18237
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18236
18238
|
if (this.curContext() !== tokenCtx) {
|
|
18237
18239
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18238
18240
|
}
|
|
@@ -18240,71 +18242,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18240
18242
|
|
|
18241
18243
|
// Token-specific context update code
|
|
18242
18244
|
|
|
18243
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18245
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18244
18246
|
if (this.context.length === 1) {
|
|
18245
18247
|
this.exprAllowed = true;
|
|
18246
18248
|
return
|
|
18247
18249
|
}
|
|
18248
18250
|
var out = this.context.pop();
|
|
18249
|
-
if (out === types
|
|
18251
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18250
18252
|
out = this.context.pop();
|
|
18251
18253
|
}
|
|
18252
18254
|
this.exprAllowed = !out.isExpr;
|
|
18253
18255
|
};
|
|
18254
18256
|
|
|
18255
|
-
types.braceL.updateContext = function(prevType) {
|
|
18256
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18257
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18258
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18257
18259
|
this.exprAllowed = true;
|
|
18258
18260
|
};
|
|
18259
18261
|
|
|
18260
|
-
types.dollarBraceL.updateContext = function() {
|
|
18261
|
-
this.context.push(types
|
|
18262
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18263
|
+
this.context.push(types.b_tmpl);
|
|
18262
18264
|
this.exprAllowed = true;
|
|
18263
18265
|
};
|
|
18264
18266
|
|
|
18265
|
-
types.parenL.updateContext = function(prevType) {
|
|
18266
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
18267
|
-
this.context.push(statementParens ? types
|
|
18267
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18268
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18269
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18268
18270
|
this.exprAllowed = true;
|
|
18269
18271
|
};
|
|
18270
18272
|
|
|
18271
|
-
types.incDec.updateContext = function() {
|
|
18273
|
+
types$1.incDec.updateContext = function() {
|
|
18272
18274
|
// tokExprAllowed stays unchanged
|
|
18273
18275
|
};
|
|
18274
18276
|
|
|
18275
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
18276
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
18277
|
-
!(prevType === types.semi && this.curContext() !== types
|
|
18278
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18279
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types
|
|
18280
|
-
{ this.context.push(types
|
|
18277
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18278
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18279
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18280
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18281
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18282
|
+
{ this.context.push(types.f_expr); }
|
|
18281
18283
|
else
|
|
18282
|
-
{ this.context.push(types
|
|
18284
|
+
{ this.context.push(types.f_stat); }
|
|
18283
18285
|
this.exprAllowed = false;
|
|
18284
18286
|
};
|
|
18285
18287
|
|
|
18286
|
-
types.backQuote.updateContext = function() {
|
|
18287
|
-
if (this.curContext() === types
|
|
18288
|
+
types$1.backQuote.updateContext = function() {
|
|
18289
|
+
if (this.curContext() === types.q_tmpl)
|
|
18288
18290
|
{ this.context.pop(); }
|
|
18289
18291
|
else
|
|
18290
|
-
{ this.context.push(types
|
|
18292
|
+
{ this.context.push(types.q_tmpl); }
|
|
18291
18293
|
this.exprAllowed = false;
|
|
18292
18294
|
};
|
|
18293
18295
|
|
|
18294
|
-
types.star.updateContext = function(prevType) {
|
|
18295
|
-
if (prevType === types._function) {
|
|
18296
|
+
types$1.star.updateContext = function(prevType) {
|
|
18297
|
+
if (prevType === types$1._function) {
|
|
18296
18298
|
var index = this.context.length - 1;
|
|
18297
|
-
if (this.context[index] === types
|
|
18298
|
-
{ this.context[index] = types
|
|
18299
|
+
if (this.context[index] === types.f_expr)
|
|
18300
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18299
18301
|
else
|
|
18300
|
-
{ this.context[index] = types
|
|
18302
|
+
{ this.context[index] = types.f_gen; }
|
|
18301
18303
|
}
|
|
18302
18304
|
this.exprAllowed = true;
|
|
18303
18305
|
};
|
|
18304
18306
|
|
|
18305
|
-
types.name.updateContext = function(prevType) {
|
|
18307
|
+
types$1.name.updateContext = function(prevType) {
|
|
18306
18308
|
var allowed = false;
|
|
18307
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18309
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18308
18310
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18309
18311
|
this.value === "yield" && this.inGeneratorContext())
|
|
18310
18312
|
{ allowed = true; }
|
|
@@ -18314,14 +18316,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18314
18316
|
|
|
18315
18317
|
// A recursive descent parser operates by defining functions for all
|
|
18316
18318
|
|
|
18317
|
-
var pp$
|
|
18319
|
+
var pp$5 = Parser.prototype;
|
|
18318
18320
|
|
|
18319
18321
|
// Check if property name clashes with already added.
|
|
18320
18322
|
// Object/class getters and setters are not allowed to clash —
|
|
18321
18323
|
// either with each other or with an init property — and in
|
|
18322
18324
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18323
18325
|
|
|
18324
|
-
pp$
|
|
18326
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18325
18327
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18326
18328
|
{ return }
|
|
18327
18329
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18338,10 +18340,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18338
18340
|
if (name === "__proto__" && kind === "init") {
|
|
18339
18341
|
if (propHash.proto) {
|
|
18340
18342
|
if (refDestructuringErrors) {
|
|
18341
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
} else {
|
|
18343
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18344
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18345
|
+
}
|
|
18346
|
+
} else {
|
|
18347
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18348
|
+
}
|
|
18345
18349
|
}
|
|
18346
18350
|
propHash.proto = true;
|
|
18347
18351
|
}
|
|
@@ -18383,13 +18387,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18383
18387
|
// and object pattern might appear (so it's possible to raise
|
|
18384
18388
|
// delayed syntax error at correct position).
|
|
18385
18389
|
|
|
18386
|
-
pp$
|
|
18390
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18387
18391
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18388
18392
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18389
|
-
if (this.type === types.comma) {
|
|
18393
|
+
if (this.type === types$1.comma) {
|
|
18390
18394
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18391
18395
|
node.expressions = [expr];
|
|
18392
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18396
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18393
18397
|
return this.finishNode(node, "SequenceExpression")
|
|
18394
18398
|
}
|
|
18395
18399
|
return expr
|
|
@@ -18398,7 +18402,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18398
18402
|
// Parse an assignment expression. This includes applications of
|
|
18399
18403
|
// operators like `+=`.
|
|
18400
18404
|
|
|
18401
|
-
pp$
|
|
18405
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18402
18406
|
if (this.isContextual("yield")) {
|
|
18403
18407
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18404
18408
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18406,10 +18410,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18406
18410
|
else { this.exprAllowed = false; }
|
|
18407
18411
|
}
|
|
18408
18412
|
|
|
18409
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18413
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18410
18414
|
if (refDestructuringErrors) {
|
|
18411
18415
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18412
18416
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18417
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18413
18418
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18414
18419
|
} else {
|
|
18415
18420
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18417,7 +18422,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18417
18422
|
}
|
|
18418
18423
|
|
|
18419
18424
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18420
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18425
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18421
18426
|
this.potentialArrowAt = this.start;
|
|
18422
18427
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18423
18428
|
}
|
|
@@ -18426,20 +18431,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18426
18431
|
if (this.type.isAssign) {
|
|
18427
18432
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18428
18433
|
node.operator = this.value;
|
|
18429
|
-
if (this.type === types.eq)
|
|
18434
|
+
if (this.type === types$1.eq)
|
|
18430
18435
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18431
18436
|
if (!ownDestructuringErrors) {
|
|
18432
18437
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18433
18438
|
}
|
|
18434
18439
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18435
18440
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18436
|
-
if (this.type === types.eq)
|
|
18441
|
+
if (this.type === types$1.eq)
|
|
18437
18442
|
{ this.checkLValPattern(left); }
|
|
18438
18443
|
else
|
|
18439
18444
|
{ this.checkLValSimple(left); }
|
|
18440
18445
|
node.left = left;
|
|
18441
18446
|
this.next();
|
|
18442
18447
|
node.right = this.parseMaybeAssign(forInit);
|
|
18448
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18443
18449
|
return this.finishNode(node, "AssignmentExpression")
|
|
18444
18450
|
} else {
|
|
18445
18451
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18451,15 +18457,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18451
18457
|
|
|
18452
18458
|
// Parse a ternary conditional (`?:`) operator.
|
|
18453
18459
|
|
|
18454
|
-
pp$
|
|
18460
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18455
18461
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18456
18462
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18457
18463
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18458
|
-
if (this.eat(types.question)) {
|
|
18464
|
+
if (this.eat(types$1.question)) {
|
|
18459
18465
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18460
18466
|
node.test = expr;
|
|
18461
18467
|
node.consequent = this.parseMaybeAssign();
|
|
18462
|
-
this.expect(types.colon);
|
|
18468
|
+
this.expect(types$1.colon);
|
|
18463
18469
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18464
18470
|
return this.finishNode(node, "ConditionalExpression")
|
|
18465
18471
|
}
|
|
@@ -18468,7 +18474,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18468
18474
|
|
|
18469
18475
|
// Start the precedence parser.
|
|
18470
18476
|
|
|
18471
|
-
pp$
|
|
18477
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18472
18478
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18473
18479
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18474
18480
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18481,23 +18487,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18481
18487
|
// defer further parser to one of its callers when it encounters an
|
|
18482
18488
|
// operator that has a lower precedence than the set it is parsing.
|
|
18483
18489
|
|
|
18484
|
-
pp$
|
|
18490
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18485
18491
|
var prec = this.type.binop;
|
|
18486
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18492
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18487
18493
|
if (prec > minPrec) {
|
|
18488
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18489
|
-
var coalesce = this.type === types.coalesce;
|
|
18494
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18495
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18490
18496
|
if (coalesce) {
|
|
18491
18497
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18492
18498
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18493
|
-
prec = types.logicalAND.binop;
|
|
18499
|
+
prec = types$1.logicalAND.binop;
|
|
18494
18500
|
}
|
|
18495
18501
|
var op = this.value;
|
|
18496
18502
|
this.next();
|
|
18497
18503
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18498
18504
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18499
18505
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
18500
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
18506
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18501
18507
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18502
18508
|
}
|
|
18503
18509
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18506,7 +18512,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18506
18512
|
return left
|
|
18507
18513
|
};
|
|
18508
18514
|
|
|
18509
|
-
pp$
|
|
18515
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18516
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18510
18517
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18511
18518
|
node.left = left;
|
|
18512
18519
|
node.operator = op;
|
|
@@ -18516,13 +18523,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18516
18523
|
|
|
18517
18524
|
// Parse unary operators, both prefix and postfix.
|
|
18518
18525
|
|
|
18519
|
-
pp$
|
|
18526
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18520
18527
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18521
18528
|
if (this.isContextual("await") && this.canAwait) {
|
|
18522
18529
|
expr = this.parseAwait(forInit);
|
|
18523
18530
|
sawUnary = true;
|
|
18524
18531
|
} else if (this.type.prefix) {
|
|
18525
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18532
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18526
18533
|
node.operator = this.value;
|
|
18527
18534
|
node.prefix = true;
|
|
18528
18535
|
this.next();
|
|
@@ -18536,6 +18543,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18536
18543
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18537
18544
|
else { sawUnary = true; }
|
|
18538
18545
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18546
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18547
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18548
|
+
expr = this.parsePrivateIdent();
|
|
18549
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18550
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18539
18551
|
} else {
|
|
18540
18552
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18541
18553
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18550,7 +18562,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18550
18562
|
}
|
|
18551
18563
|
}
|
|
18552
18564
|
|
|
18553
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18565
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18554
18566
|
if (sawUnary)
|
|
18555
18567
|
{ this.unexpected(this.lastTokStart); }
|
|
18556
18568
|
else
|
|
@@ -18569,7 +18581,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18569
18581
|
|
|
18570
18582
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18571
18583
|
|
|
18572
|
-
pp$
|
|
18584
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18573
18585
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18574
18586
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18575
18587
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18583,7 +18595,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18583
18595
|
return result
|
|
18584
18596
|
};
|
|
18585
18597
|
|
|
18586
|
-
pp$
|
|
18598
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18587
18599
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18588
18600
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18589
18601
|
this.potentialArrowAt === base.start;
|
|
@@ -18606,19 +18618,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18606
18618
|
}
|
|
18607
18619
|
};
|
|
18608
18620
|
|
|
18609
|
-
pp$
|
|
18621
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18610
18622
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18611
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18623
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18612
18624
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18613
18625
|
|
|
18614
|
-
var computed = this.eat(types.bracketL);
|
|
18615
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18626
|
+
var computed = this.eat(types$1.bracketL);
|
|
18627
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18616
18628
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18617
18629
|
node.object = base;
|
|
18618
18630
|
if (computed) {
|
|
18619
18631
|
node.property = this.parseExpression();
|
|
18620
|
-
this.expect(types.bracketR);
|
|
18621
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18632
|
+
this.expect(types$1.bracketR);
|
|
18633
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18622
18634
|
node.property = this.parsePrivateIdent();
|
|
18623
18635
|
} else {
|
|
18624
18636
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18628,13 +18640,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18628
18640
|
node.optional = optional;
|
|
18629
18641
|
}
|
|
18630
18642
|
base = this.finishNode(node, "MemberExpression");
|
|
18631
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18643
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18632
18644
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18633
18645
|
this.yieldPos = 0;
|
|
18634
18646
|
this.awaitPos = 0;
|
|
18635
18647
|
this.awaitIdentPos = 0;
|
|
18636
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18637
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18648
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18649
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18638
18650
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18639
18651
|
this.checkYieldAwaitInDefaultParams();
|
|
18640
18652
|
if (this.awaitIdentPos > 0)
|
|
@@ -18655,7 +18667,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18655
18667
|
node$1.optional = optional;
|
|
18656
18668
|
}
|
|
18657
18669
|
base = this.finishNode(node$1, "CallExpression");
|
|
18658
|
-
} else if (this.type === types.backQuote) {
|
|
18670
|
+
} else if (this.type === types$1.backQuote) {
|
|
18659
18671
|
if (optional || optionalChained) {
|
|
18660
18672
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18661
18673
|
}
|
|
@@ -18672,19 +18684,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18672
18684
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18673
18685
|
// or `{}`.
|
|
18674
18686
|
|
|
18675
|
-
pp$
|
|
18687
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18676
18688
|
// If a division operator appears in an expression position, the
|
|
18677
18689
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18678
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18690
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18679
18691
|
|
|
18680
18692
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18681
18693
|
switch (this.type) {
|
|
18682
|
-
case types._super:
|
|
18694
|
+
case types$1._super:
|
|
18683
18695
|
if (!this.allowSuper)
|
|
18684
18696
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18685
18697
|
node = this.startNode();
|
|
18686
18698
|
this.next();
|
|
18687
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18699
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18688
18700
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18689
18701
|
// The `super` keyword can appear at below:
|
|
18690
18702
|
// SuperProperty:
|
|
@@ -18692,52 +18704,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18692
18704
|
// super . IdentifierName
|
|
18693
18705
|
// SuperCall:
|
|
18694
18706
|
// super ( Arguments )
|
|
18695
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18707
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18696
18708
|
{ this.unexpected(); }
|
|
18697
18709
|
return this.finishNode(node, "Super")
|
|
18698
18710
|
|
|
18699
|
-
case types._this:
|
|
18711
|
+
case types$1._this:
|
|
18700
18712
|
node = this.startNode();
|
|
18701
18713
|
this.next();
|
|
18702
18714
|
return this.finishNode(node, "ThisExpression")
|
|
18703
18715
|
|
|
18704
|
-
case types.name:
|
|
18716
|
+
case types$1.name:
|
|
18705
18717
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18706
18718
|
var id = this.parseIdent(false);
|
|
18707
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
|
|
18708
|
-
this.overrideContext(types
|
|
18719
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18720
|
+
this.overrideContext(types.f_expr);
|
|
18709
18721
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18710
18722
|
}
|
|
18711
18723
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18712
|
-
if (this.eat(types.arrow))
|
|
18724
|
+
if (this.eat(types$1.arrow))
|
|
18713
18725
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18714
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18726
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18715
18727
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18716
18728
|
id = this.parseIdent(false);
|
|
18717
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18729
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18718
18730
|
{ this.unexpected(); }
|
|
18719
18731
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18720
18732
|
}
|
|
18721
18733
|
}
|
|
18722
18734
|
return id
|
|
18723
18735
|
|
|
18724
|
-
case types.regexp:
|
|
18736
|
+
case types$1.regexp:
|
|
18725
18737
|
var value = this.value;
|
|
18726
18738
|
node = this.parseLiteral(value.value);
|
|
18727
18739
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18728
18740
|
return node
|
|
18729
18741
|
|
|
18730
|
-
case types.num: case types.string:
|
|
18742
|
+
case types$1.num: case types$1.string:
|
|
18731
18743
|
return this.parseLiteral(this.value)
|
|
18732
18744
|
|
|
18733
|
-
case types._null: case types._true: case types._false:
|
|
18745
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18734
18746
|
node = this.startNode();
|
|
18735
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18747
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18736
18748
|
node.raw = this.type.keyword;
|
|
18737
18749
|
this.next();
|
|
18738
18750
|
return this.finishNode(node, "Literal")
|
|
18739
18751
|
|
|
18740
|
-
case types.parenL:
|
|
18752
|
+
case types$1.parenL:
|
|
18741
18753
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18742
18754
|
if (refDestructuringErrors) {
|
|
18743
18755
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18747,31 +18759,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18747
18759
|
}
|
|
18748
18760
|
return expr
|
|
18749
18761
|
|
|
18750
|
-
case types.bracketL:
|
|
18762
|
+
case types$1.bracketL:
|
|
18751
18763
|
node = this.startNode();
|
|
18752
18764
|
this.next();
|
|
18753
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18765
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18754
18766
|
return this.finishNode(node, "ArrayExpression")
|
|
18755
18767
|
|
|
18756
|
-
case types.braceL:
|
|
18757
|
-
this.overrideContext(types
|
|
18768
|
+
case types$1.braceL:
|
|
18769
|
+
this.overrideContext(types.b_expr);
|
|
18758
18770
|
return this.parseObj(false, refDestructuringErrors)
|
|
18759
18771
|
|
|
18760
|
-
case types._function:
|
|
18772
|
+
case types$1._function:
|
|
18761
18773
|
node = this.startNode();
|
|
18762
18774
|
this.next();
|
|
18763
18775
|
return this.parseFunction(node, 0)
|
|
18764
18776
|
|
|
18765
|
-
case types._class:
|
|
18777
|
+
case types$1._class:
|
|
18766
18778
|
return this.parseClass(this.startNode(), false)
|
|
18767
18779
|
|
|
18768
|
-
case types._new:
|
|
18780
|
+
case types$1._new:
|
|
18769
18781
|
return this.parseNew()
|
|
18770
18782
|
|
|
18771
|
-
case types.backQuote:
|
|
18783
|
+
case types$1.backQuote:
|
|
18772
18784
|
return this.parseTemplate()
|
|
18773
18785
|
|
|
18774
|
-
case types._import:
|
|
18786
|
+
case types$1._import:
|
|
18775
18787
|
if (this.options.ecmaVersion >= 11) {
|
|
18776
18788
|
return this.parseExprImport()
|
|
18777
18789
|
} else {
|
|
@@ -18783,7 +18795,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18783
18795
|
}
|
|
18784
18796
|
};
|
|
18785
18797
|
|
|
18786
|
-
pp$
|
|
18798
|
+
pp$5.parseExprImport = function() {
|
|
18787
18799
|
var node = this.startNode();
|
|
18788
18800
|
|
|
18789
18801
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18792,9 +18804,9 @@ pp$4.parseExprImport = function() {
|
|
|
18792
18804
|
var meta = this.parseIdent(true);
|
|
18793
18805
|
|
|
18794
18806
|
switch (this.type) {
|
|
18795
|
-
case types.parenL:
|
|
18807
|
+
case types$1.parenL:
|
|
18796
18808
|
return this.parseDynamicImport(node)
|
|
18797
|
-
case types.dot:
|
|
18809
|
+
case types$1.dot:
|
|
18798
18810
|
node.meta = meta;
|
|
18799
18811
|
return this.parseImportMeta(node)
|
|
18800
18812
|
default:
|
|
@@ -18802,16 +18814,16 @@ pp$4.parseExprImport = function() {
|
|
|
18802
18814
|
}
|
|
18803
18815
|
};
|
|
18804
18816
|
|
|
18805
|
-
pp$
|
|
18817
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18806
18818
|
this.next(); // skip `(`
|
|
18807
18819
|
|
|
18808
18820
|
// Parse node.source.
|
|
18809
18821
|
node.source = this.parseMaybeAssign();
|
|
18810
18822
|
|
|
18811
18823
|
// Verify ending.
|
|
18812
|
-
if (!this.eat(types.parenR)) {
|
|
18824
|
+
if (!this.eat(types$1.parenR)) {
|
|
18813
18825
|
var errorPos = this.start;
|
|
18814
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
18826
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18815
18827
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18816
18828
|
} else {
|
|
18817
18829
|
this.unexpected(errorPos);
|
|
@@ -18821,7 +18833,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18821
18833
|
return this.finishNode(node, "ImportExpression")
|
|
18822
18834
|
};
|
|
18823
18835
|
|
|
18824
|
-
pp$
|
|
18836
|
+
pp$5.parseImportMeta = function(node) {
|
|
18825
18837
|
this.next(); // skip `.`
|
|
18826
18838
|
|
|
18827
18839
|
var containsEsc = this.containsEsc;
|
|
@@ -18837,7 +18849,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18837
18849
|
return this.finishNode(node, "MetaProperty")
|
|
18838
18850
|
};
|
|
18839
18851
|
|
|
18840
|
-
pp$
|
|
18852
|
+
pp$5.parseLiteral = function(value) {
|
|
18841
18853
|
var node = this.startNode();
|
|
18842
18854
|
node.value = value;
|
|
18843
18855
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18846,14 +18858,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18846
18858
|
return this.finishNode(node, "Literal")
|
|
18847
18859
|
};
|
|
18848
18860
|
|
|
18849
|
-
pp$
|
|
18850
|
-
this.expect(types.parenL);
|
|
18861
|
+
pp$5.parseParenExpression = function() {
|
|
18862
|
+
this.expect(types$1.parenL);
|
|
18851
18863
|
var val = this.parseExpression();
|
|
18852
|
-
this.expect(types.parenR);
|
|
18864
|
+
this.expect(types$1.parenR);
|
|
18853
18865
|
return val
|
|
18854
18866
|
};
|
|
18855
18867
|
|
|
18856
|
-
pp$
|
|
18868
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18857
18869
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18858
18870
|
if (this.options.ecmaVersion >= 6) {
|
|
18859
18871
|
this.next();
|
|
@@ -18864,24 +18876,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18864
18876
|
this.yieldPos = 0;
|
|
18865
18877
|
this.awaitPos = 0;
|
|
18866
18878
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
18867
|
-
while (this.type !== types.parenR) {
|
|
18868
|
-
first ? first = false : this.expect(types.comma);
|
|
18869
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
18879
|
+
while (this.type !== types$1.parenR) {
|
|
18880
|
+
first ? first = false : this.expect(types$1.comma);
|
|
18881
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
18870
18882
|
lastIsComma = true;
|
|
18871
18883
|
break
|
|
18872
|
-
} else if (this.type === types.ellipsis) {
|
|
18884
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18873
18885
|
spreadStart = this.start;
|
|
18874
18886
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
18875
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18887
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18876
18888
|
break
|
|
18877
18889
|
} else {
|
|
18878
18890
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
18879
18891
|
}
|
|
18880
18892
|
}
|
|
18881
18893
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
18882
|
-
this.expect(types.parenR);
|
|
18894
|
+
this.expect(types$1.parenR);
|
|
18883
18895
|
|
|
18884
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18896
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18885
18897
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18886
18898
|
this.checkYieldAwaitInDefaultParams();
|
|
18887
18899
|
this.yieldPos = oldYieldPos;
|
|
@@ -18915,12 +18927,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18915
18927
|
}
|
|
18916
18928
|
};
|
|
18917
18929
|
|
|
18918
|
-
pp$
|
|
18930
|
+
pp$5.parseParenItem = function(item) {
|
|
18919
18931
|
return item
|
|
18920
18932
|
};
|
|
18921
18933
|
|
|
18922
|
-
pp$
|
|
18923
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
18934
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
18935
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
18924
18936
|
};
|
|
18925
18937
|
|
|
18926
18938
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -18929,13 +18941,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
18929
18941
|
// argument to parseSubscripts to prevent it from consuming the
|
|
18930
18942
|
// argument list.
|
|
18931
18943
|
|
|
18932
|
-
var empty
|
|
18944
|
+
var empty = [];
|
|
18933
18945
|
|
|
18934
|
-
pp$
|
|
18946
|
+
pp$5.parseNew = function() {
|
|
18935
18947
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
18936
18948
|
var node = this.startNode();
|
|
18937
18949
|
var meta = this.parseIdent(true);
|
|
18938
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
18950
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
18939
18951
|
node.meta = meta;
|
|
18940
18952
|
var containsEsc = this.containsEsc;
|
|
18941
18953
|
node.property = this.parseIdent(true);
|
|
@@ -18947,23 +18959,23 @@ pp$4.parseNew = function() {
|
|
|
18947
18959
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
18948
18960
|
return this.finishNode(node, "MetaProperty")
|
|
18949
18961
|
}
|
|
18950
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
18962
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
18951
18963
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
18952
18964
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
18953
18965
|
this.raise(startPos, "Cannot use new with import()");
|
|
18954
18966
|
}
|
|
18955
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
18956
|
-
else { node.arguments = empty
|
|
18967
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
18968
|
+
else { node.arguments = empty; }
|
|
18957
18969
|
return this.finishNode(node, "NewExpression")
|
|
18958
18970
|
};
|
|
18959
18971
|
|
|
18960
18972
|
// Parse template expression.
|
|
18961
18973
|
|
|
18962
|
-
pp$
|
|
18974
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
18963
18975
|
var isTagged = ref.isTagged;
|
|
18964
18976
|
|
|
18965
18977
|
var elem = this.startNode();
|
|
18966
|
-
if (this.type === types.invalidTemplate) {
|
|
18978
|
+
if (this.type === types$1.invalidTemplate) {
|
|
18967
18979
|
if (!isTagged) {
|
|
18968
18980
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
18969
18981
|
}
|
|
@@ -18978,11 +18990,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
18978
18990
|
};
|
|
18979
18991
|
}
|
|
18980
18992
|
this.next();
|
|
18981
|
-
elem.tail = this.type === types.backQuote;
|
|
18993
|
+
elem.tail = this.type === types$1.backQuote;
|
|
18982
18994
|
return this.finishNode(elem, "TemplateElement")
|
|
18983
18995
|
};
|
|
18984
18996
|
|
|
18985
|
-
pp$
|
|
18997
|
+
pp$5.parseTemplate = function(ref) {
|
|
18986
18998
|
if ( ref === void 0 ) ref = {};
|
|
18987
18999
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
18988
19000
|
|
|
@@ -18992,32 +19004,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
18992
19004
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
18993
19005
|
node.quasis = [curElt];
|
|
18994
19006
|
while (!curElt.tail) {
|
|
18995
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
18996
|
-
this.expect(types.dollarBraceL);
|
|
19007
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19008
|
+
this.expect(types$1.dollarBraceL);
|
|
18997
19009
|
node.expressions.push(this.parseExpression());
|
|
18998
|
-
this.expect(types.braceR);
|
|
19010
|
+
this.expect(types$1.braceR);
|
|
18999
19011
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19000
19012
|
}
|
|
19001
19013
|
this.next();
|
|
19002
19014
|
return this.finishNode(node, "TemplateLiteral")
|
|
19003
19015
|
};
|
|
19004
19016
|
|
|
19005
|
-
pp$
|
|
19017
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19006
19018
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
19007
|
-
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
|
|
19019
|
+
(this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
|
|
19008
19020
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19009
19021
|
};
|
|
19010
19022
|
|
|
19011
19023
|
// Parse an object literal or binding pattern.
|
|
19012
19024
|
|
|
19013
|
-
pp$
|
|
19025
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19014
19026
|
var node = this.startNode(), first = true, propHash = {};
|
|
19015
19027
|
node.properties = [];
|
|
19016
19028
|
this.next();
|
|
19017
|
-
while (!this.eat(types.braceR)) {
|
|
19029
|
+
while (!this.eat(types$1.braceR)) {
|
|
19018
19030
|
if (!first) {
|
|
19019
|
-
this.expect(types.comma);
|
|
19020
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19031
|
+
this.expect(types$1.comma);
|
|
19032
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19021
19033
|
} else { first = false; }
|
|
19022
19034
|
|
|
19023
19035
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19027,18 +19039,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19027
19039
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19028
19040
|
};
|
|
19029
19041
|
|
|
19030
|
-
pp$
|
|
19042
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19031
19043
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19032
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19044
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19033
19045
|
if (isPattern) {
|
|
19034
19046
|
prop.argument = this.parseIdent(false);
|
|
19035
|
-
if (this.type === types.comma) {
|
|
19047
|
+
if (this.type === types$1.comma) {
|
|
19036
19048
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19037
19049
|
}
|
|
19038
19050
|
return this.finishNode(prop, "RestElement")
|
|
19039
19051
|
}
|
|
19040
19052
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19041
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19053
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19042
19054
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19043
19055
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19044
19056
|
}
|
|
@@ -19049,7 +19061,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19049
19061
|
// Parse argument.
|
|
19050
19062
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19051
19063
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19052
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19064
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19053
19065
|
refDestructuringErrors.trailingComma = this.start;
|
|
19054
19066
|
}
|
|
19055
19067
|
// Finish
|
|
@@ -19063,13 +19075,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19063
19075
|
startLoc = this.startLoc;
|
|
19064
19076
|
}
|
|
19065
19077
|
if (!isPattern)
|
|
19066
|
-
{ isGenerator = this.eat(types.star); }
|
|
19078
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19067
19079
|
}
|
|
19068
19080
|
var containsEsc = this.containsEsc;
|
|
19069
19081
|
this.parsePropertyName(prop);
|
|
19070
19082
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19071
19083
|
isAsync = true;
|
|
19072
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19084
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19073
19085
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19074
19086
|
} else {
|
|
19075
19087
|
isAsync = false;
|
|
@@ -19078,14 +19090,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19078
19090
|
return this.finishNode(prop, "Property")
|
|
19079
19091
|
};
|
|
19080
19092
|
|
|
19081
|
-
pp$
|
|
19082
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19093
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19094
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19083
19095
|
{ this.unexpected(); }
|
|
19084
19096
|
|
|
19085
|
-
if (this.eat(types.colon)) {
|
|
19097
|
+
if (this.eat(types$1.colon)) {
|
|
19086
19098
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19087
19099
|
prop.kind = "init";
|
|
19088
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19100
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19089
19101
|
if (isPattern) { this.unexpected(); }
|
|
19090
19102
|
prop.kind = "init";
|
|
19091
19103
|
prop.method = true;
|
|
@@ -19093,7 +19105,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19093
19105
|
} else if (!isPattern && !containsEsc &&
|
|
19094
19106
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19095
19107
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19096
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19108
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19097
19109
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19098
19110
|
prop.kind = prop.key.name;
|
|
19099
19111
|
this.parsePropertyName(prop);
|
|
@@ -19117,7 +19129,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19117
19129
|
prop.kind = "init";
|
|
19118
19130
|
if (isPattern) {
|
|
19119
19131
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19120
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19132
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19121
19133
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19122
19134
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19123
19135
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19128,23 +19140,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19128
19140
|
} else { this.unexpected(); }
|
|
19129
19141
|
};
|
|
19130
19142
|
|
|
19131
|
-
pp$
|
|
19143
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19132
19144
|
if (this.options.ecmaVersion >= 6) {
|
|
19133
|
-
if (this.eat(types.bracketL)) {
|
|
19145
|
+
if (this.eat(types$1.bracketL)) {
|
|
19134
19146
|
prop.computed = true;
|
|
19135
19147
|
prop.key = this.parseMaybeAssign();
|
|
19136
|
-
this.expect(types.bracketR);
|
|
19148
|
+
this.expect(types$1.bracketR);
|
|
19137
19149
|
return prop.key
|
|
19138
19150
|
} else {
|
|
19139
19151
|
prop.computed = false;
|
|
19140
19152
|
}
|
|
19141
19153
|
}
|
|
19142
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19154
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19143
19155
|
};
|
|
19144
19156
|
|
|
19145
19157
|
// Initialize empty function node.
|
|
19146
19158
|
|
|
19147
|
-
pp$
|
|
19159
|
+
pp$5.initFunction = function(node) {
|
|
19148
19160
|
node.id = null;
|
|
19149
19161
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19150
19162
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19152,7 +19164,7 @@ pp$4.initFunction = function(node) {
|
|
|
19152
19164
|
|
|
19153
19165
|
// Parse object or class method.
|
|
19154
19166
|
|
|
19155
|
-
pp$
|
|
19167
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19156
19168
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19157
19169
|
|
|
19158
19170
|
this.initFunction(node);
|
|
@@ -19166,8 +19178,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19166
19178
|
this.awaitIdentPos = 0;
|
|
19167
19179
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19168
19180
|
|
|
19169
|
-
this.expect(types.parenL);
|
|
19170
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19181
|
+
this.expect(types$1.parenL);
|
|
19182
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19171
19183
|
this.checkYieldAwaitInDefaultParams();
|
|
19172
19184
|
this.parseFunctionBody(node, false, true, false);
|
|
19173
19185
|
|
|
@@ -19179,7 +19191,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19179
19191
|
|
|
19180
19192
|
// Parse arrow function expression with given parameters.
|
|
19181
19193
|
|
|
19182
|
-
pp$
|
|
19194
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19183
19195
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19184
19196
|
|
|
19185
19197
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19201,8 +19213,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19201
19213
|
|
|
19202
19214
|
// Parse function body and check parameters.
|
|
19203
19215
|
|
|
19204
|
-
pp$
|
|
19205
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19216
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19217
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19206
19218
|
var oldStrict = this.strict, useStrict = false;
|
|
19207
19219
|
|
|
19208
19220
|
if (isExpression) {
|
|
@@ -19238,7 +19250,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19238
19250
|
this.exitScope();
|
|
19239
19251
|
};
|
|
19240
19252
|
|
|
19241
|
-
pp$
|
|
19253
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19242
19254
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19243
19255
|
{
|
|
19244
19256
|
var param = list[i];
|
|
@@ -19251,7 +19263,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19251
19263
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19252
19264
|
// or "arguments" and duplicate parameters.
|
|
19253
19265
|
|
|
19254
|
-
pp$
|
|
19266
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19255
19267
|
var nameHash = Object.create(null);
|
|
19256
19268
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19257
19269
|
{
|
|
@@ -19267,20 +19279,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19267
19279
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19268
19280
|
// for array literals).
|
|
19269
19281
|
|
|
19270
|
-
pp$
|
|
19282
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19271
19283
|
var elts = [], first = true;
|
|
19272
19284
|
while (!this.eat(close)) {
|
|
19273
19285
|
if (!first) {
|
|
19274
|
-
this.expect(types.comma);
|
|
19286
|
+
this.expect(types$1.comma);
|
|
19275
19287
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19276
19288
|
} else { first = false; }
|
|
19277
19289
|
|
|
19278
19290
|
var elt = (void 0);
|
|
19279
|
-
if (allowEmpty && this.type === types.comma)
|
|
19291
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19280
19292
|
{ elt = null; }
|
|
19281
|
-
else if (this.type === types.ellipsis) {
|
|
19293
|
+
else if (this.type === types$1.ellipsis) {
|
|
19282
19294
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19283
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19295
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19284
19296
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19285
19297
|
} else {
|
|
19286
19298
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19290,7 +19302,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19290
19302
|
return elts
|
|
19291
19303
|
};
|
|
19292
19304
|
|
|
19293
|
-
pp$
|
|
19305
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19294
19306
|
var start = ref.start;
|
|
19295
19307
|
var end = ref.end;
|
|
19296
19308
|
var name = ref.name;
|
|
@@ -19319,9 +19331,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19319
19331
|
// when parsing properties), it will also convert keywords into
|
|
19320
19332
|
// identifiers.
|
|
19321
19333
|
|
|
19322
|
-
pp$
|
|
19334
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19323
19335
|
var node = this.startNode();
|
|
19324
|
-
if (this.type === types.name) {
|
|
19336
|
+
if (this.type === types$1.name) {
|
|
19325
19337
|
node.name = this.value;
|
|
19326
19338
|
} else if (this.type.keyword) {
|
|
19327
19339
|
node.name = this.type.keyword;
|
|
@@ -19347,9 +19359,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19347
19359
|
return node
|
|
19348
19360
|
};
|
|
19349
19361
|
|
|
19350
|
-
pp$
|
|
19362
|
+
pp$5.parsePrivateIdent = function() {
|
|
19351
19363
|
var node = this.startNode();
|
|
19352
|
-
if (this.type === types.privateId) {
|
|
19364
|
+
if (this.type === types$1.privateId) {
|
|
19353
19365
|
node.name = this.value;
|
|
19354
19366
|
} else {
|
|
19355
19367
|
this.unexpected();
|
|
@@ -19369,22 +19381,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19369
19381
|
|
|
19370
19382
|
// Parses yield expression inside generator.
|
|
19371
19383
|
|
|
19372
|
-
pp$
|
|
19384
|
+
pp$5.parseYield = function(forInit) {
|
|
19373
19385
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19374
19386
|
|
|
19375
19387
|
var node = this.startNode();
|
|
19376
19388
|
this.next();
|
|
19377
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19389
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19378
19390
|
node.delegate = false;
|
|
19379
19391
|
node.argument = null;
|
|
19380
19392
|
} else {
|
|
19381
|
-
node.delegate = this.eat(types.star);
|
|
19393
|
+
node.delegate = this.eat(types$1.star);
|
|
19382
19394
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19383
19395
|
}
|
|
19384
19396
|
return this.finishNode(node, "YieldExpression")
|
|
19385
19397
|
};
|
|
19386
19398
|
|
|
19387
|
-
pp$
|
|
19399
|
+
pp$5.parseAwait = function(forInit) {
|
|
19388
19400
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19389
19401
|
|
|
19390
19402
|
var node = this.startNode();
|
|
@@ -19393,7 +19405,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19393
19405
|
return this.finishNode(node, "AwaitExpression")
|
|
19394
19406
|
};
|
|
19395
19407
|
|
|
19396
|
-
var pp$
|
|
19408
|
+
var pp$4 = Parser.prototype;
|
|
19397
19409
|
|
|
19398
19410
|
// This function is used to raise exceptions on parse errors. It
|
|
19399
19411
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19401,7 +19413,7 @@ var pp$5 = Parser.prototype;
|
|
|
19401
19413
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19402
19414
|
// message.
|
|
19403
19415
|
|
|
19404
|
-
pp$
|
|
19416
|
+
pp$4.raise = function(pos, message) {
|
|
19405
19417
|
var loc = getLineInfo(this.input, pos);
|
|
19406
19418
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19407
19419
|
var err = new SyntaxError(message);
|
|
@@ -19409,15 +19421,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19409
19421
|
throw err
|
|
19410
19422
|
};
|
|
19411
19423
|
|
|
19412
|
-
pp$
|
|
19424
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19413
19425
|
|
|
19414
|
-
pp$
|
|
19426
|
+
pp$4.curPosition = function() {
|
|
19415
19427
|
if (this.options.locations) {
|
|
19416
19428
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19417
19429
|
}
|
|
19418
19430
|
};
|
|
19419
19431
|
|
|
19420
|
-
var pp$
|
|
19432
|
+
var pp$3 = Parser.prototype;
|
|
19421
19433
|
|
|
19422
19434
|
var Scope = function Scope(flags) {
|
|
19423
19435
|
this.flags = flags;
|
|
@@ -19433,22 +19445,22 @@ var Scope = function Scope(flags) {
|
|
|
19433
19445
|
|
|
19434
19446
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19435
19447
|
|
|
19436
|
-
pp$
|
|
19448
|
+
pp$3.enterScope = function(flags) {
|
|
19437
19449
|
this.scopeStack.push(new Scope(flags));
|
|
19438
19450
|
};
|
|
19439
19451
|
|
|
19440
|
-
pp$
|
|
19452
|
+
pp$3.exitScope = function() {
|
|
19441
19453
|
this.scopeStack.pop();
|
|
19442
19454
|
};
|
|
19443
19455
|
|
|
19444
19456
|
// The spec says:
|
|
19445
19457
|
// > At the top level of a function, or script, function declarations are
|
|
19446
19458
|
// > treated like var declarations rather than like lexical declarations.
|
|
19447
|
-
pp$
|
|
19459
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19448
19460
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19449
19461
|
};
|
|
19450
19462
|
|
|
19451
|
-
pp$
|
|
19463
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19452
19464
|
var redeclared = false;
|
|
19453
19465
|
if (bindingType === BIND_LEXICAL) {
|
|
19454
19466
|
var scope = this.currentScope();
|
|
@@ -19483,7 +19495,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19483
19495
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19484
19496
|
};
|
|
19485
19497
|
|
|
19486
|
-
pp$
|
|
19498
|
+
pp$3.checkLocalExport = function(id) {
|
|
19487
19499
|
// scope.functions must be empty as Module code is always strict.
|
|
19488
19500
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19489
19501
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19491,11 +19503,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19491
19503
|
}
|
|
19492
19504
|
};
|
|
19493
19505
|
|
|
19494
|
-
pp$
|
|
19506
|
+
pp$3.currentScope = function() {
|
|
19495
19507
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19496
19508
|
};
|
|
19497
19509
|
|
|
19498
|
-
pp$
|
|
19510
|
+
pp$3.currentVarScope = function() {
|
|
19499
19511
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19500
19512
|
var scope = this.scopeStack[i];
|
|
19501
19513
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19503,7 +19515,7 @@ pp$6.currentVarScope = function() {
|
|
|
19503
19515
|
};
|
|
19504
19516
|
|
|
19505
19517
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19506
|
-
pp$
|
|
19518
|
+
pp$3.currentThisScope = function() {
|
|
19507
19519
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19508
19520
|
var scope = this.scopeStack[i];
|
|
19509
19521
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19524,13 +19536,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19524
19536
|
|
|
19525
19537
|
// Start an AST node, attaching a start offset.
|
|
19526
19538
|
|
|
19527
|
-
var pp$
|
|
19539
|
+
var pp$2 = Parser.prototype;
|
|
19528
19540
|
|
|
19529
|
-
pp$
|
|
19541
|
+
pp$2.startNode = function() {
|
|
19530
19542
|
return new Node(this, this.start, this.startLoc)
|
|
19531
19543
|
};
|
|
19532
19544
|
|
|
19533
|
-
pp$
|
|
19545
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19534
19546
|
return new Node(this, pos, loc)
|
|
19535
19547
|
};
|
|
19536
19548
|
|
|
@@ -19546,17 +19558,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19546
19558
|
return node
|
|
19547
19559
|
}
|
|
19548
19560
|
|
|
19549
|
-
pp$
|
|
19561
|
+
pp$2.finishNode = function(node, type) {
|
|
19550
19562
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19551
19563
|
};
|
|
19552
19564
|
|
|
19553
19565
|
// Finish node at given position
|
|
19554
19566
|
|
|
19555
|
-
pp$
|
|
19567
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19556
19568
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19557
19569
|
};
|
|
19558
19570
|
|
|
19559
|
-
pp$
|
|
19571
|
+
pp$2.copyNode = function(node) {
|
|
19560
19572
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19561
19573
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19562
19574
|
return newNode
|
|
@@ -19613,7 +19625,7 @@ buildUnicodeData(10);
|
|
|
19613
19625
|
buildUnicodeData(11);
|
|
19614
19626
|
buildUnicodeData(12);
|
|
19615
19627
|
|
|
19616
|
-
var pp$
|
|
19628
|
+
var pp$1 = Parser.prototype;
|
|
19617
19629
|
|
|
19618
19630
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19619
19631
|
this.parser = parser;
|
|
@@ -19709,7 +19721,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19709
19721
|
return false
|
|
19710
19722
|
};
|
|
19711
19723
|
|
|
19712
|
-
function codePointToString(ch) {
|
|
19724
|
+
function codePointToString$1(ch) {
|
|
19713
19725
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19714
19726
|
ch -= 0x10000;
|
|
19715
19727
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19721,7 +19733,7 @@ function codePointToString(ch) {
|
|
|
19721
19733
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19722
19734
|
* @returns {void}
|
|
19723
19735
|
*/
|
|
19724
|
-
pp$
|
|
19736
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19725
19737
|
var validFlags = state.validFlags;
|
|
19726
19738
|
var flags = state.flags;
|
|
19727
19739
|
|
|
@@ -19742,7 +19754,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19742
19754
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19743
19755
|
* @returns {void}
|
|
19744
19756
|
*/
|
|
19745
|
-
pp$
|
|
19757
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19746
19758
|
this.regexp_pattern(state);
|
|
19747
19759
|
|
|
19748
19760
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19757,7 +19769,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19757
19769
|
};
|
|
19758
19770
|
|
|
19759
19771
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19760
|
-
pp$
|
|
19772
|
+
pp$1.regexp_pattern = function(state) {
|
|
19761
19773
|
state.pos = 0;
|
|
19762
19774
|
state.lastIntValue = 0;
|
|
19763
19775
|
state.lastStringValue = "";
|
|
@@ -19791,7 +19803,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19791
19803
|
};
|
|
19792
19804
|
|
|
19793
19805
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19794
|
-
pp$
|
|
19806
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19795
19807
|
this.regexp_alternative(state);
|
|
19796
19808
|
while (state.eat(0x7C /* | */)) {
|
|
19797
19809
|
this.regexp_alternative(state);
|
|
@@ -19807,13 +19819,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19807
19819
|
};
|
|
19808
19820
|
|
|
19809
19821
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19810
|
-
pp$
|
|
19822
|
+
pp$1.regexp_alternative = function(state) {
|
|
19811
19823
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19812
19824
|
{ }
|
|
19813
19825
|
};
|
|
19814
19826
|
|
|
19815
19827
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19816
|
-
pp$
|
|
19828
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19817
19829
|
if (this.regexp_eatAssertion(state)) {
|
|
19818
19830
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19819
19831
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19836,7 +19848,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19836
19848
|
};
|
|
19837
19849
|
|
|
19838
19850
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19839
|
-
pp$
|
|
19851
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19840
19852
|
var start = state.pos;
|
|
19841
19853
|
state.lastAssertionIsQuantifiable = false;
|
|
19842
19854
|
|
|
@@ -19874,7 +19886,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
19874
19886
|
};
|
|
19875
19887
|
|
|
19876
19888
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
19877
|
-
pp$
|
|
19889
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
19878
19890
|
if ( noError === void 0 ) noError = false;
|
|
19879
19891
|
|
|
19880
19892
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -19885,7 +19897,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
19885
19897
|
};
|
|
19886
19898
|
|
|
19887
19899
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
19888
|
-
pp$
|
|
19900
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
19889
19901
|
return (
|
|
19890
19902
|
state.eat(0x2A /* * */) ||
|
|
19891
19903
|
state.eat(0x2B /* + */) ||
|
|
@@ -19893,7 +19905,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
19893
19905
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
19894
19906
|
)
|
|
19895
19907
|
};
|
|
19896
|
-
pp$
|
|
19908
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
19897
19909
|
var start = state.pos;
|
|
19898
19910
|
if (state.eat(0x7B /* { */)) {
|
|
19899
19911
|
var min = 0, max = -1;
|
|
@@ -19919,7 +19931,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
19919
19931
|
};
|
|
19920
19932
|
|
|
19921
19933
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
19922
|
-
pp$
|
|
19934
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
19923
19935
|
return (
|
|
19924
19936
|
this.regexp_eatPatternCharacters(state) ||
|
|
19925
19937
|
state.eat(0x2E /* . */) ||
|
|
@@ -19929,7 +19941,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
19929
19941
|
this.regexp_eatCapturingGroup(state)
|
|
19930
19942
|
)
|
|
19931
19943
|
};
|
|
19932
|
-
pp$
|
|
19944
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
19933
19945
|
var start = state.pos;
|
|
19934
19946
|
if (state.eat(0x5C /* \ */)) {
|
|
19935
19947
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -19939,7 +19951,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
19939
19951
|
}
|
|
19940
19952
|
return false
|
|
19941
19953
|
};
|
|
19942
|
-
pp$
|
|
19954
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
19943
19955
|
var start = state.pos;
|
|
19944
19956
|
if (state.eat(0x28 /* ( */)) {
|
|
19945
19957
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -19953,7 +19965,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
19953
19965
|
}
|
|
19954
19966
|
return false
|
|
19955
19967
|
};
|
|
19956
|
-
pp$
|
|
19968
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
19957
19969
|
if (state.eat(0x28 /* ( */)) {
|
|
19958
19970
|
if (this.options.ecmaVersion >= 9) {
|
|
19959
19971
|
this.regexp_groupSpecifier(state);
|
|
@@ -19971,7 +19983,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
19971
19983
|
};
|
|
19972
19984
|
|
|
19973
19985
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
19974
|
-
pp$
|
|
19986
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
19975
19987
|
return (
|
|
19976
19988
|
state.eat(0x2E /* . */) ||
|
|
19977
19989
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -19984,7 +19996,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
19984
19996
|
};
|
|
19985
19997
|
|
|
19986
19998
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
19987
|
-
pp$
|
|
19999
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
19988
20000
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
19989
20001
|
state.raise("Nothing to repeat");
|
|
19990
20002
|
}
|
|
@@ -19992,7 +20004,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
19992
20004
|
};
|
|
19993
20005
|
|
|
19994
20006
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
19995
|
-
pp$
|
|
20007
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
19996
20008
|
var ch = state.current();
|
|
19997
20009
|
if (isSyntaxCharacter(ch)) {
|
|
19998
20010
|
state.lastIntValue = ch;
|
|
@@ -20014,7 +20026,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20014
20026
|
|
|
20015
20027
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20016
20028
|
// But eat eager.
|
|
20017
|
-
pp$
|
|
20029
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20018
20030
|
var start = state.pos;
|
|
20019
20031
|
var ch = 0;
|
|
20020
20032
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20024,7 +20036,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20024
20036
|
};
|
|
20025
20037
|
|
|
20026
20038
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20027
|
-
pp$
|
|
20039
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20028
20040
|
var ch = state.current();
|
|
20029
20041
|
if (
|
|
20030
20042
|
ch !== -1 &&
|
|
@@ -20045,7 +20057,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20045
20057
|
// GroupSpecifier ::
|
|
20046
20058
|
// [empty]
|
|
20047
20059
|
// `?` GroupName
|
|
20048
|
-
pp$
|
|
20060
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20049
20061
|
if (state.eat(0x3F /* ? */)) {
|
|
20050
20062
|
if (this.regexp_eatGroupName(state)) {
|
|
20051
20063
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20061,7 +20073,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20061
20073
|
// GroupName ::
|
|
20062
20074
|
// `<` RegExpIdentifierName `>`
|
|
20063
20075
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20064
|
-
pp$
|
|
20076
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20065
20077
|
state.lastStringValue = "";
|
|
20066
20078
|
if (state.eat(0x3C /* < */)) {
|
|
20067
20079
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20076,12 +20088,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20076
20088
|
// RegExpIdentifierStart
|
|
20077
20089
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20078
20090
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20079
|
-
pp$
|
|
20091
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20080
20092
|
state.lastStringValue = "";
|
|
20081
20093
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20082
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20094
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20083
20095
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20084
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20096
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20085
20097
|
}
|
|
20086
20098
|
return true
|
|
20087
20099
|
}
|
|
@@ -20093,7 +20105,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20093
20105
|
// `$`
|
|
20094
20106
|
// `_`
|
|
20095
20107
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20096
|
-
pp$
|
|
20108
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20097
20109
|
var start = state.pos;
|
|
20098
20110
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20099
20111
|
var ch = state.current(forceU);
|
|
@@ -20121,7 +20133,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20121
20133
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20122
20134
|
// <ZWNJ>
|
|
20123
20135
|
// <ZWJ>
|
|
20124
|
-
pp$
|
|
20136
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20125
20137
|
var start = state.pos;
|
|
20126
20138
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20127
20139
|
var ch = state.current(forceU);
|
|
@@ -20143,7 +20155,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20143
20155
|
}
|
|
20144
20156
|
|
|
20145
20157
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20146
|
-
pp$
|
|
20158
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20147
20159
|
if (
|
|
20148
20160
|
this.regexp_eatBackReference(state) ||
|
|
20149
20161
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20161,7 +20173,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20161
20173
|
}
|
|
20162
20174
|
return false
|
|
20163
20175
|
};
|
|
20164
|
-
pp$
|
|
20176
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20165
20177
|
var start = state.pos;
|
|
20166
20178
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20167
20179
|
var n = state.lastIntValue;
|
|
@@ -20179,7 +20191,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20179
20191
|
}
|
|
20180
20192
|
return false
|
|
20181
20193
|
};
|
|
20182
|
-
pp$
|
|
20194
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20183
20195
|
if (state.eat(0x6B /* k */)) {
|
|
20184
20196
|
if (this.regexp_eatGroupName(state)) {
|
|
20185
20197
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20191,7 +20203,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20191
20203
|
};
|
|
20192
20204
|
|
|
20193
20205
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20194
|
-
pp$
|
|
20206
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20195
20207
|
return (
|
|
20196
20208
|
this.regexp_eatControlEscape(state) ||
|
|
20197
20209
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20202,7 +20214,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20202
20214
|
this.regexp_eatIdentityEscape(state)
|
|
20203
20215
|
)
|
|
20204
20216
|
};
|
|
20205
|
-
pp$
|
|
20217
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20206
20218
|
var start = state.pos;
|
|
20207
20219
|
if (state.eat(0x63 /* c */)) {
|
|
20208
20220
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20212,7 +20224,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20212
20224
|
}
|
|
20213
20225
|
return false
|
|
20214
20226
|
};
|
|
20215
|
-
pp$
|
|
20227
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20216
20228
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20217
20229
|
state.lastIntValue = 0;
|
|
20218
20230
|
state.advance();
|
|
@@ -20222,7 +20234,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20222
20234
|
};
|
|
20223
20235
|
|
|
20224
20236
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20225
|
-
pp$
|
|
20237
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20226
20238
|
var ch = state.current();
|
|
20227
20239
|
if (ch === 0x74 /* t */) {
|
|
20228
20240
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20253,7 +20265,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20253
20265
|
};
|
|
20254
20266
|
|
|
20255
20267
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20256
|
-
pp$
|
|
20268
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20257
20269
|
var ch = state.current();
|
|
20258
20270
|
if (isControlLetter(ch)) {
|
|
20259
20271
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20270,7 +20282,7 @@ function isControlLetter(ch) {
|
|
|
20270
20282
|
}
|
|
20271
20283
|
|
|
20272
20284
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20273
|
-
pp$
|
|
20285
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20274
20286
|
if ( forceU === void 0 ) forceU = false;
|
|
20275
20287
|
|
|
20276
20288
|
var start = state.pos;
|
|
@@ -20315,7 +20327,7 @@ function isValidUnicode(ch) {
|
|
|
20315
20327
|
}
|
|
20316
20328
|
|
|
20317
20329
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20318
|
-
pp$
|
|
20330
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20319
20331
|
if (state.switchU) {
|
|
20320
20332
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20321
20333
|
return true
|
|
@@ -20338,7 +20350,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20338
20350
|
};
|
|
20339
20351
|
|
|
20340
20352
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20341
|
-
pp$
|
|
20353
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20342
20354
|
state.lastIntValue = 0;
|
|
20343
20355
|
var ch = state.current();
|
|
20344
20356
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20352,7 +20364,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20352
20364
|
};
|
|
20353
20365
|
|
|
20354
20366
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20355
|
-
pp$
|
|
20367
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20356
20368
|
var ch = state.current();
|
|
20357
20369
|
|
|
20358
20370
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20394,7 +20406,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20394
20406
|
// UnicodePropertyValueExpression ::
|
|
20395
20407
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20396
20408
|
// LoneUnicodePropertyNameOrValue
|
|
20397
|
-
pp$
|
|
20409
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20398
20410
|
var start = state.pos;
|
|
20399
20411
|
|
|
20400
20412
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20416,24 +20428,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20416
20428
|
}
|
|
20417
20429
|
return false
|
|
20418
20430
|
};
|
|
20419
|
-
pp$
|
|
20431
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20420
20432
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20421
20433
|
{ state.raise("Invalid property name"); }
|
|
20422
20434
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20423
20435
|
{ state.raise("Invalid property value"); }
|
|
20424
20436
|
};
|
|
20425
|
-
pp$
|
|
20437
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20426
20438
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20427
20439
|
{ state.raise("Invalid property name"); }
|
|
20428
20440
|
};
|
|
20429
20441
|
|
|
20430
20442
|
// UnicodePropertyName ::
|
|
20431
20443
|
// UnicodePropertyNameCharacters
|
|
20432
|
-
pp$
|
|
20444
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20433
20445
|
var ch = 0;
|
|
20434
20446
|
state.lastStringValue = "";
|
|
20435
20447
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20436
|
-
state.lastStringValue += codePointToString(ch);
|
|
20448
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20437
20449
|
state.advance();
|
|
20438
20450
|
}
|
|
20439
20451
|
return state.lastStringValue !== ""
|
|
@@ -20444,11 +20456,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20444
20456
|
|
|
20445
20457
|
// UnicodePropertyValue ::
|
|
20446
20458
|
// UnicodePropertyValueCharacters
|
|
20447
|
-
pp$
|
|
20459
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20448
20460
|
var ch = 0;
|
|
20449
20461
|
state.lastStringValue = "";
|
|
20450
20462
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20451
|
-
state.lastStringValue += codePointToString(ch);
|
|
20463
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20452
20464
|
state.advance();
|
|
20453
20465
|
}
|
|
20454
20466
|
return state.lastStringValue !== ""
|
|
@@ -20459,12 +20471,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20459
20471
|
|
|
20460
20472
|
// LoneUnicodePropertyNameOrValue ::
|
|
20461
20473
|
// UnicodePropertyValueCharacters
|
|
20462
|
-
pp$
|
|
20474
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20463
20475
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20464
20476
|
};
|
|
20465
20477
|
|
|
20466
20478
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20467
|
-
pp$
|
|
20479
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20468
20480
|
if (state.eat(0x5B /* [ */)) {
|
|
20469
20481
|
state.eat(0x5E /* ^ */);
|
|
20470
20482
|
this.regexp_classRanges(state);
|
|
@@ -20480,7 +20492,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20480
20492
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20481
20493
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20482
20494
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20483
|
-
pp$
|
|
20495
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20484
20496
|
while (this.regexp_eatClassAtom(state)) {
|
|
20485
20497
|
var left = state.lastIntValue;
|
|
20486
20498
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20497,7 +20509,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20497
20509
|
|
|
20498
20510
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20499
20511
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20500
|
-
pp$
|
|
20512
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20501
20513
|
var start = state.pos;
|
|
20502
20514
|
|
|
20503
20515
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20526,7 +20538,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20526
20538
|
};
|
|
20527
20539
|
|
|
20528
20540
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20529
|
-
pp$
|
|
20541
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20530
20542
|
var start = state.pos;
|
|
20531
20543
|
|
|
20532
20544
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20553,7 +20565,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20553
20565
|
};
|
|
20554
20566
|
|
|
20555
20567
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20556
|
-
pp$
|
|
20568
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20557
20569
|
var ch = state.current();
|
|
20558
20570
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20559
20571
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20564,7 +20576,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20564
20576
|
};
|
|
20565
20577
|
|
|
20566
20578
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20567
|
-
pp$
|
|
20579
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20568
20580
|
var start = state.pos;
|
|
20569
20581
|
if (state.eat(0x78 /* x */)) {
|
|
20570
20582
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20579,7 +20591,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20579
20591
|
};
|
|
20580
20592
|
|
|
20581
20593
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20582
|
-
pp$
|
|
20594
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20583
20595
|
var start = state.pos;
|
|
20584
20596
|
var ch = 0;
|
|
20585
20597
|
state.lastIntValue = 0;
|
|
@@ -20594,7 +20606,7 @@ function isDecimalDigit(ch) {
|
|
|
20594
20606
|
}
|
|
20595
20607
|
|
|
20596
20608
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20597
|
-
pp$
|
|
20609
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20598
20610
|
var start = state.pos;
|
|
20599
20611
|
var ch = 0;
|
|
20600
20612
|
state.lastIntValue = 0;
|
|
@@ -20623,7 +20635,7 @@ function hexToInt(ch) {
|
|
|
20623
20635
|
|
|
20624
20636
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20625
20637
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20626
|
-
pp$
|
|
20638
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20627
20639
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20628
20640
|
var n1 = state.lastIntValue;
|
|
20629
20641
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20642,7 +20654,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20642
20654
|
};
|
|
20643
20655
|
|
|
20644
20656
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20645
|
-
pp$
|
|
20657
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20646
20658
|
var ch = state.current();
|
|
20647
20659
|
if (isOctalDigit(ch)) {
|
|
20648
20660
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20659,7 +20671,7 @@ function isOctalDigit(ch) {
|
|
|
20659
20671
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20660
20672
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20661
20673
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20662
|
-
pp$
|
|
20674
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20663
20675
|
var start = state.pos;
|
|
20664
20676
|
state.lastIntValue = 0;
|
|
20665
20677
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20691,11 +20703,11 @@ var Token = function Token(p) {
|
|
|
20691
20703
|
|
|
20692
20704
|
// ## Tokenizer
|
|
20693
20705
|
|
|
20694
|
-
var pp
|
|
20706
|
+
var pp = Parser.prototype;
|
|
20695
20707
|
|
|
20696
20708
|
// Move to the next token
|
|
20697
20709
|
|
|
20698
|
-
pp
|
|
20710
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20699
20711
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20700
20712
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20701
20713
|
if (this.options.onToken)
|
|
@@ -20708,21 +20720,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20708
20720
|
this.nextToken();
|
|
20709
20721
|
};
|
|
20710
20722
|
|
|
20711
|
-
pp
|
|
20723
|
+
pp.getToken = function() {
|
|
20712
20724
|
this.next();
|
|
20713
20725
|
return new Token(this)
|
|
20714
20726
|
};
|
|
20715
20727
|
|
|
20716
20728
|
// If we're in an ES6 environment, make parsers iterable
|
|
20717
20729
|
if (typeof Symbol !== "undefined")
|
|
20718
|
-
{ pp
|
|
20730
|
+
{ pp[Symbol.iterator] = function() {
|
|
20719
20731
|
var this$1$1 = this;
|
|
20720
20732
|
|
|
20721
20733
|
return {
|
|
20722
20734
|
next: function () {
|
|
20723
20735
|
var token = this$1$1.getToken();
|
|
20724
20736
|
return {
|
|
20725
|
-
done: token.type === types.eof,
|
|
20737
|
+
done: token.type === types$1.eof,
|
|
20726
20738
|
value: token
|
|
20727
20739
|
}
|
|
20728
20740
|
}
|
|
@@ -20735,19 +20747,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20735
20747
|
// Read a single token, updating the parser object's token-related
|
|
20736
20748
|
// properties.
|
|
20737
20749
|
|
|
20738
|
-
pp
|
|
20750
|
+
pp.nextToken = function() {
|
|
20739
20751
|
var curContext = this.curContext();
|
|
20740
20752
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20741
20753
|
|
|
20742
20754
|
this.start = this.pos;
|
|
20743
20755
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20744
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20756
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20745
20757
|
|
|
20746
20758
|
if (curContext.override) { return curContext.override(this) }
|
|
20747
20759
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20748
20760
|
};
|
|
20749
20761
|
|
|
20750
|
-
pp
|
|
20762
|
+
pp.readToken = function(code) {
|
|
20751
20763
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20752
20764
|
// identifiers, so '\' also dispatches to that.
|
|
20753
20765
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20756,14 +20768,14 @@ pp$9.readToken = function(code) {
|
|
|
20756
20768
|
return this.getTokenFromCode(code)
|
|
20757
20769
|
};
|
|
20758
20770
|
|
|
20759
|
-
pp
|
|
20771
|
+
pp.fullCharCodeAtPos = function() {
|
|
20760
20772
|
var code = this.input.charCodeAt(this.pos);
|
|
20761
20773
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20762
20774
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20763
20775
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20764
20776
|
};
|
|
20765
20777
|
|
|
20766
|
-
pp
|
|
20778
|
+
pp.skipBlockComment = function() {
|
|
20767
20779
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20768
20780
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20769
20781
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20781,7 +20793,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20781
20793
|
startLoc, this.curPosition()); }
|
|
20782
20794
|
};
|
|
20783
20795
|
|
|
20784
|
-
pp
|
|
20796
|
+
pp.skipLineComment = function(startSkip) {
|
|
20785
20797
|
var start = this.pos;
|
|
20786
20798
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20787
20799
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20796,7 +20808,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20796
20808
|
// Called at the start of the parse and after every token. Skips
|
|
20797
20809
|
// whitespace and comments, and.
|
|
20798
20810
|
|
|
20799
|
-
pp
|
|
20811
|
+
pp.skipSpace = function() {
|
|
20800
20812
|
loop: while (this.pos < this.input.length) {
|
|
20801
20813
|
var ch = this.input.charCodeAt(this.pos);
|
|
20802
20814
|
switch (ch) {
|
|
@@ -20841,7 +20853,7 @@ pp$9.skipSpace = function() {
|
|
|
20841
20853
|
// the token, so that the next one's `start` will point at the
|
|
20842
20854
|
// right position.
|
|
20843
20855
|
|
|
20844
|
-
pp
|
|
20856
|
+
pp.finishToken = function(type, val) {
|
|
20845
20857
|
this.end = this.pos;
|
|
20846
20858
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20847
20859
|
var prevType = this.type;
|
|
@@ -20860,62 +20872,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
20860
20872
|
//
|
|
20861
20873
|
// All in the name of speed.
|
|
20862
20874
|
//
|
|
20863
|
-
pp
|
|
20875
|
+
pp.readToken_dot = function() {
|
|
20864
20876
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20865
20877
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
20866
20878
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20867
20879
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
20868
20880
|
this.pos += 3;
|
|
20869
|
-
return this.finishToken(types.ellipsis)
|
|
20881
|
+
return this.finishToken(types$1.ellipsis)
|
|
20870
20882
|
} else {
|
|
20871
20883
|
++this.pos;
|
|
20872
|
-
return this.finishToken(types.dot)
|
|
20884
|
+
return this.finishToken(types$1.dot)
|
|
20873
20885
|
}
|
|
20874
20886
|
};
|
|
20875
20887
|
|
|
20876
|
-
pp
|
|
20888
|
+
pp.readToken_slash = function() { // '/'
|
|
20877
20889
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20878
20890
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
20879
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20880
|
-
return this.finishOp(types.slash, 1)
|
|
20891
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20892
|
+
return this.finishOp(types$1.slash, 1)
|
|
20881
20893
|
};
|
|
20882
20894
|
|
|
20883
|
-
pp
|
|
20895
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
20884
20896
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20885
20897
|
var size = 1;
|
|
20886
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
20898
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
20887
20899
|
|
|
20888
20900
|
// exponentiation operator ** and **=
|
|
20889
20901
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
20890
20902
|
++size;
|
|
20891
|
-
tokentype = types.starstar;
|
|
20903
|
+
tokentype = types$1.starstar;
|
|
20892
20904
|
next = this.input.charCodeAt(this.pos + 2);
|
|
20893
20905
|
}
|
|
20894
20906
|
|
|
20895
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20907
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20896
20908
|
return this.finishOp(tokentype, size)
|
|
20897
20909
|
};
|
|
20898
20910
|
|
|
20899
|
-
pp
|
|
20911
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
20900
20912
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20901
20913
|
if (next === code) {
|
|
20902
20914
|
if (this.options.ecmaVersion >= 12) {
|
|
20903
20915
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20904
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
20916
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20905
20917
|
}
|
|
20906
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
20918
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
20907
20919
|
}
|
|
20908
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20909
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
20920
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20921
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
20910
20922
|
};
|
|
20911
20923
|
|
|
20912
|
-
pp
|
|
20924
|
+
pp.readToken_caret = function() { // '^'
|
|
20913
20925
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20914
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20915
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
20926
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20927
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
20916
20928
|
};
|
|
20917
20929
|
|
|
20918
|
-
pp
|
|
20930
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
20919
20931
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20920
20932
|
if (next === code) {
|
|
20921
20933
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -20925,19 +20937,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
20925
20937
|
this.skipSpace();
|
|
20926
20938
|
return this.nextToken()
|
|
20927
20939
|
}
|
|
20928
|
-
return this.finishOp(types.incDec, 2)
|
|
20940
|
+
return this.finishOp(types$1.incDec, 2)
|
|
20929
20941
|
}
|
|
20930
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20931
|
-
return this.finishOp(types.plusMin, 1)
|
|
20942
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20943
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
20932
20944
|
};
|
|
20933
20945
|
|
|
20934
|
-
pp
|
|
20946
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
20935
20947
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20936
20948
|
var size = 1;
|
|
20937
20949
|
if (next === code) {
|
|
20938
20950
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
20939
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20940
|
-
return this.finishOp(types.bitShift, size)
|
|
20951
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20952
|
+
return this.finishOp(types$1.bitShift, size)
|
|
20941
20953
|
}
|
|
20942
20954
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
20943
20955
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -20947,53 +20959,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
20947
20959
|
return this.nextToken()
|
|
20948
20960
|
}
|
|
20949
20961
|
if (next === 61) { size = 2; }
|
|
20950
|
-
return this.finishOp(types.relational, size)
|
|
20962
|
+
return this.finishOp(types$1.relational, size)
|
|
20951
20963
|
};
|
|
20952
20964
|
|
|
20953
|
-
pp
|
|
20965
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
20954
20966
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20955
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
20967
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
20956
20968
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
20957
20969
|
this.pos += 2;
|
|
20958
|
-
return this.finishToken(types.arrow)
|
|
20970
|
+
return this.finishToken(types$1.arrow)
|
|
20959
20971
|
}
|
|
20960
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
20972
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
20961
20973
|
};
|
|
20962
20974
|
|
|
20963
|
-
pp
|
|
20975
|
+
pp.readToken_question = function() { // '?'
|
|
20964
20976
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20965
20977
|
if (ecmaVersion >= 11) {
|
|
20966
20978
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20967
20979
|
if (next === 46) {
|
|
20968
20980
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20969
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
20981
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
20970
20982
|
}
|
|
20971
20983
|
if (next === 63) {
|
|
20972
20984
|
if (ecmaVersion >= 12) {
|
|
20973
20985
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
20974
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
20986
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20975
20987
|
}
|
|
20976
|
-
return this.finishOp(types.coalesce, 2)
|
|
20988
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
20977
20989
|
}
|
|
20978
20990
|
}
|
|
20979
|
-
return this.finishOp(types.question, 1)
|
|
20991
|
+
return this.finishOp(types$1.question, 1)
|
|
20980
20992
|
};
|
|
20981
20993
|
|
|
20982
|
-
pp
|
|
20994
|
+
pp.readToken_numberSign = function() { // '#'
|
|
20983
20995
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20984
20996
|
var code = 35; // '#'
|
|
20985
20997
|
if (ecmaVersion >= 13) {
|
|
20986
20998
|
++this.pos;
|
|
20987
20999
|
code = this.fullCharCodeAtPos();
|
|
20988
21000
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
20989
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21001
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
20990
21002
|
}
|
|
20991
21003
|
}
|
|
20992
21004
|
|
|
20993
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21005
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
20994
21006
|
};
|
|
20995
21007
|
|
|
20996
|
-
pp
|
|
21008
|
+
pp.getTokenFromCode = function(code) {
|
|
20997
21009
|
switch (code) {
|
|
20998
21010
|
// The interpretation of a dot depends on whether it is followed
|
|
20999
21011
|
// by a digit or another two dots.
|
|
@@ -21001,20 +21013,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21001
21013
|
return this.readToken_dot()
|
|
21002
21014
|
|
|
21003
21015
|
// Punctuation tokens.
|
|
21004
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
21005
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
21006
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
21007
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
21008
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
21009
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
21010
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
21011
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
21012
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
21016
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21017
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21018
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21019
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21020
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21021
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21022
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21023
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21024
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21013
21025
|
|
|
21014
21026
|
case 96: // '`'
|
|
21015
21027
|
if (this.options.ecmaVersion < 6) { break }
|
|
21016
21028
|
++this.pos;
|
|
21017
|
-
return this.finishToken(types.backQuote)
|
|
21029
|
+
return this.finishToken(types$1.backQuote)
|
|
21018
21030
|
|
|
21019
21031
|
case 48: // '0'
|
|
21020
21032
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21037,7 +21049,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21037
21049
|
// often referred to. `finishOp` simply skips the amount of
|
|
21038
21050
|
// characters it is given as second argument, and returns a token
|
|
21039
21051
|
// of the type given by its first argument.
|
|
21040
|
-
|
|
21041
21052
|
case 47: // '/'
|
|
21042
21053
|
return this.readToken_slash()
|
|
21043
21054
|
|
|
@@ -21063,22 +21074,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21063
21074
|
return this.readToken_question()
|
|
21064
21075
|
|
|
21065
21076
|
case 126: // '~'
|
|
21066
|
-
return this.finishOp(types.prefix, 1)
|
|
21077
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21067
21078
|
|
|
21068
21079
|
case 35: // '#'
|
|
21069
21080
|
return this.readToken_numberSign()
|
|
21070
21081
|
}
|
|
21071
21082
|
|
|
21072
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21083
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21073
21084
|
};
|
|
21074
21085
|
|
|
21075
|
-
pp
|
|
21086
|
+
pp.finishOp = function(type, size) {
|
|
21076
21087
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21077
21088
|
this.pos += size;
|
|
21078
21089
|
return this.finishToken(type, str)
|
|
21079
21090
|
};
|
|
21080
21091
|
|
|
21081
|
-
pp
|
|
21092
|
+
pp.readRegexp = function() {
|
|
21082
21093
|
var escaped, inClass, start = this.pos;
|
|
21083
21094
|
for (;;) {
|
|
21084
21095
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21113,14 +21124,14 @@ pp$9.readRegexp = function() {
|
|
|
21113
21124
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21114
21125
|
}
|
|
21115
21126
|
|
|
21116
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21127
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21117
21128
|
};
|
|
21118
21129
|
|
|
21119
21130
|
// Read an integer in the given radix. Return null if zero digits
|
|
21120
21131
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21121
21132
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21122
21133
|
|
|
21123
|
-
pp
|
|
21134
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21124
21135
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21125
21136
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21126
21137
|
|
|
@@ -21174,7 +21185,7 @@ function stringToBigInt(str) {
|
|
|
21174
21185
|
return BigInt(str.replace(/_/g, ""))
|
|
21175
21186
|
}
|
|
21176
21187
|
|
|
21177
|
-
pp
|
|
21188
|
+
pp.readRadixNumber = function(radix) {
|
|
21178
21189
|
var start = this.pos;
|
|
21179
21190
|
this.pos += 2; // 0x
|
|
21180
21191
|
var val = this.readInt(radix);
|
|
@@ -21183,12 +21194,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21183
21194
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21184
21195
|
++this.pos;
|
|
21185
21196
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21186
|
-
return this.finishToken(types.num, val)
|
|
21197
|
+
return this.finishToken(types$1.num, val)
|
|
21187
21198
|
};
|
|
21188
21199
|
|
|
21189
21200
|
// Read an integer, octal integer, or floating-point number.
|
|
21190
21201
|
|
|
21191
|
-
pp
|
|
21202
|
+
pp.readNumber = function(startsWithDot) {
|
|
21192
21203
|
var start = this.pos;
|
|
21193
21204
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21194
21205
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21198,7 +21209,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21198
21209
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21199
21210
|
++this.pos;
|
|
21200
21211
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21201
|
-
return this.finishToken(types.num, val$1)
|
|
21212
|
+
return this.finishToken(types$1.num, val$1)
|
|
21202
21213
|
}
|
|
21203
21214
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21204
21215
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21214,12 +21225,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21214
21225
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21215
21226
|
|
|
21216
21227
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21217
|
-
return this.finishToken(types.num, val)
|
|
21228
|
+
return this.finishToken(types$1.num, val)
|
|
21218
21229
|
};
|
|
21219
21230
|
|
|
21220
21231
|
// Read a string value, interpreting backslash-escapes.
|
|
21221
21232
|
|
|
21222
|
-
pp
|
|
21233
|
+
pp.readCodePoint = function() {
|
|
21223
21234
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21224
21235
|
|
|
21225
21236
|
if (ch === 123) { // '{'
|
|
@@ -21234,14 +21245,14 @@ pp$9.readCodePoint = function() {
|
|
|
21234
21245
|
return code
|
|
21235
21246
|
};
|
|
21236
21247
|
|
|
21237
|
-
function codePointToString
|
|
21248
|
+
function codePointToString(code) {
|
|
21238
21249
|
// UTF-16 Decoding
|
|
21239
21250
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21240
21251
|
code -= 0x10000;
|
|
21241
21252
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21242
21253
|
}
|
|
21243
21254
|
|
|
21244
|
-
pp
|
|
21255
|
+
pp.readString = function(quote) {
|
|
21245
21256
|
var out = "", chunkStart = ++this.pos;
|
|
21246
21257
|
for (;;) {
|
|
21247
21258
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21264,14 +21275,14 @@ pp$9.readString = function(quote) {
|
|
|
21264
21275
|
}
|
|
21265
21276
|
}
|
|
21266
21277
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21267
|
-
return this.finishToken(types.string, out)
|
|
21278
|
+
return this.finishToken(types$1.string, out)
|
|
21268
21279
|
};
|
|
21269
21280
|
|
|
21270
21281
|
// Reads template string tokens.
|
|
21271
21282
|
|
|
21272
21283
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21273
21284
|
|
|
21274
|
-
pp
|
|
21285
|
+
pp.tryReadTemplateToken = function() {
|
|
21275
21286
|
this.inTemplateElement = true;
|
|
21276
21287
|
try {
|
|
21277
21288
|
this.readTmplToken();
|
|
@@ -21286,7 +21297,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21286
21297
|
this.inTemplateElement = false;
|
|
21287
21298
|
};
|
|
21288
21299
|
|
|
21289
|
-
pp
|
|
21300
|
+
pp.invalidStringToken = function(position, message) {
|
|
21290
21301
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21291
21302
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21292
21303
|
} else {
|
|
@@ -21294,23 +21305,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21294
21305
|
}
|
|
21295
21306
|
};
|
|
21296
21307
|
|
|
21297
|
-
pp
|
|
21308
|
+
pp.readTmplToken = function() {
|
|
21298
21309
|
var out = "", chunkStart = this.pos;
|
|
21299
21310
|
for (;;) {
|
|
21300
21311
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21301
21312
|
var ch = this.input.charCodeAt(this.pos);
|
|
21302
21313
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
21303
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
21314
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21304
21315
|
if (ch === 36) {
|
|
21305
21316
|
this.pos += 2;
|
|
21306
|
-
return this.finishToken(types.dollarBraceL)
|
|
21317
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21307
21318
|
} else {
|
|
21308
21319
|
++this.pos;
|
|
21309
|
-
return this.finishToken(types.backQuote)
|
|
21320
|
+
return this.finishToken(types$1.backQuote)
|
|
21310
21321
|
}
|
|
21311
21322
|
}
|
|
21312
21323
|
out += this.input.slice(chunkStart, this.pos);
|
|
21313
|
-
return this.finishToken(types.template, out)
|
|
21324
|
+
return this.finishToken(types$1.template, out)
|
|
21314
21325
|
}
|
|
21315
21326
|
if (ch === 92) { // '\'
|
|
21316
21327
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21341,7 +21352,7 @@ pp$9.readTmplToken = function() {
|
|
|
21341
21352
|
};
|
|
21342
21353
|
|
|
21343
21354
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21344
|
-
pp
|
|
21355
|
+
pp.readInvalidTemplateToken = function() {
|
|
21345
21356
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21346
21357
|
switch (this.input[this.pos]) {
|
|
21347
21358
|
case "\\":
|
|
@@ -21352,10 +21363,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21352
21363
|
if (this.input[this.pos + 1] !== "{") {
|
|
21353
21364
|
break
|
|
21354
21365
|
}
|
|
21355
|
-
// falls through
|
|
21356
21366
|
|
|
21367
|
+
// falls through
|
|
21357
21368
|
case "`":
|
|
21358
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21369
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21359
21370
|
|
|
21360
21371
|
// no default
|
|
21361
21372
|
}
|
|
@@ -21365,14 +21376,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21365
21376
|
|
|
21366
21377
|
// Used to read escaped characters
|
|
21367
21378
|
|
|
21368
|
-
pp
|
|
21379
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21369
21380
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21370
21381
|
++this.pos;
|
|
21371
21382
|
switch (ch) {
|
|
21372
21383
|
case 110: return "\n" // 'n' -> '\n'
|
|
21373
21384
|
case 114: return "\r" // 'r' -> '\r'
|
|
21374
21385
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21375
|
-
case 117: return codePointToString
|
|
21386
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21376
21387
|
case 116: return "\t" // 't' -> '\t'
|
|
21377
21388
|
case 98: return "\b" // 'b' -> '\b'
|
|
21378
21389
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21430,7 +21441,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21430
21441
|
|
|
21431
21442
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21432
21443
|
|
|
21433
|
-
pp
|
|
21444
|
+
pp.readHexChar = function(len) {
|
|
21434
21445
|
var codePos = this.pos;
|
|
21435
21446
|
var n = this.readInt(16, len);
|
|
21436
21447
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21443,7 +21454,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21443
21454
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21444
21455
|
// as a micro-optimization.
|
|
21445
21456
|
|
|
21446
|
-
pp
|
|
21457
|
+
pp.readWord1 = function() {
|
|
21447
21458
|
this.containsEsc = false;
|
|
21448
21459
|
var word = "", first = true, chunkStart = this.pos;
|
|
21449
21460
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21461,7 +21472,7 @@ pp$9.readWord1 = function() {
|
|
|
21461
21472
|
var esc = this.readCodePoint();
|
|
21462
21473
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21463
21474
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21464
|
-
word += codePointToString
|
|
21475
|
+
word += codePointToString(esc);
|
|
21465
21476
|
chunkStart = this.pos;
|
|
21466
21477
|
} else {
|
|
21467
21478
|
break
|
|
@@ -21474,18 +21485,18 @@ pp$9.readWord1 = function() {
|
|
|
21474
21485
|
// Read an identifier or keyword token. Will check for reserved
|
|
21475
21486
|
// words when necessary.
|
|
21476
21487
|
|
|
21477
|
-
pp
|
|
21488
|
+
pp.readWord = function() {
|
|
21478
21489
|
var word = this.readWord1();
|
|
21479
|
-
var type = types.name;
|
|
21490
|
+
var type = types$1.name;
|
|
21480
21491
|
if (this.keywords.test(word)) {
|
|
21481
|
-
type = keywords
|
|
21492
|
+
type = keywords[word];
|
|
21482
21493
|
}
|
|
21483
21494
|
return this.finishToken(type, word)
|
|
21484
21495
|
};
|
|
21485
21496
|
|
|
21486
21497
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21487
21498
|
|
|
21488
|
-
var version = "8.
|
|
21499
|
+
var version = "8.6.0";
|
|
21489
21500
|
|
|
21490
21501
|
Parser.acorn = {
|
|
21491
21502
|
Parser: Parser,
|
|
@@ -21496,10 +21507,10 @@ Parser.acorn = {
|
|
|
21496
21507
|
getLineInfo: getLineInfo,
|
|
21497
21508
|
Node: Node,
|
|
21498
21509
|
TokenType: TokenType,
|
|
21499
|
-
tokTypes: types,
|
|
21500
|
-
keywordTypes: keywords
|
|
21510
|
+
tokTypes: types$1,
|
|
21511
|
+
keywordTypes: keywords,
|
|
21501
21512
|
TokContext: TokContext,
|
|
21502
|
-
tokContexts: types
|
|
21513
|
+
tokContexts: types,
|
|
21503
21514
|
isIdentifierChar: isIdentifierChar,
|
|
21504
21515
|
isIdentifierStart: isIdentifierStart,
|
|
21505
21516
|
Token: Token,
|
|
@@ -21512,20 +21523,7 @@ Parser.acorn = {
|
|
|
21512
21523
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21513
21524
|
function mkdirpath(path) {
|
|
21514
21525
|
const dir = dirname(path);
|
|
21515
|
-
|
|
21516
|
-
fs.readdirSync(dir);
|
|
21517
|
-
}
|
|
21518
|
-
catch (_a) {
|
|
21519
|
-
mkdirpath(dir);
|
|
21520
|
-
try {
|
|
21521
|
-
fs.mkdirSync(dir);
|
|
21522
|
-
}
|
|
21523
|
-
catch (err) {
|
|
21524
|
-
if (err.code !== 'EEXIST') {
|
|
21525
|
-
throw err;
|
|
21526
|
-
}
|
|
21527
|
-
}
|
|
21528
|
-
}
|
|
21526
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21529
21527
|
}
|
|
21530
21528
|
function writeFile(dest, data) {
|
|
21531
21529
|
return new Promise((fulfil, reject) => {
|
|
@@ -21890,6 +21888,7 @@ class ModuleLoader {
|
|
|
21890
21888
|
this.implicitEntryModules = new Set();
|
|
21891
21889
|
this.indexedEntryModules = [];
|
|
21892
21890
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
21891
|
+
this.moduleLoadPromises = new Map();
|
|
21893
21892
|
this.nextEntryModuleIndex = 0;
|
|
21894
21893
|
this.readQueue = new Queue();
|
|
21895
21894
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
@@ -21951,6 +21950,9 @@ class ModuleLoader {
|
|
|
21951
21950
|
}
|
|
21952
21951
|
return module;
|
|
21953
21952
|
}
|
|
21953
|
+
preloadModule(resolvedId) {
|
|
21954
|
+
return this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true).then(module => module.info);
|
|
21955
|
+
}
|
|
21954
21956
|
addDefaultsToResolvedId(resolvedId) {
|
|
21955
21957
|
var _a, _b;
|
|
21956
21958
|
if (!resolvedId) {
|
|
@@ -22051,39 +22053,45 @@ class ModuleLoader {
|
|
|
22051
22053
|
}
|
|
22052
22054
|
}
|
|
22053
22055
|
}
|
|
22054
|
-
|
|
22056
|
+
// If this is a preload, then this method always waits for the dependencies of the module to be resolved.
|
|
22057
|
+
// Otherwise if the module does not exist, it waits for the module and all its dependencies to be loaded.
|
|
22058
|
+
// Otherwise it returns immediately.
|
|
22059
|
+
async fetchModule({ id, meta, moduleSideEffects, syntheticNamedExports }, importer, isEntry, isPreload) {
|
|
22055
22060
|
const existingModule = this.modulesById.get(id);
|
|
22056
22061
|
if (existingModule instanceof Module) {
|
|
22057
|
-
|
|
22058
|
-
existingModule.info.isEntry = true;
|
|
22059
|
-
this.implicitEntryModules.delete(existingModule);
|
|
22060
|
-
for (const dependant of existingModule.implicitlyLoadedAfter) {
|
|
22061
|
-
dependant.implicitlyLoadedBefore.delete(existingModule);
|
|
22062
|
-
}
|
|
22063
|
-
existingModule.implicitlyLoadedAfter.clear();
|
|
22064
|
-
}
|
|
22062
|
+
await this.handleExistingModule(existingModule, isEntry, isPreload);
|
|
22065
22063
|
return existingModule;
|
|
22066
22064
|
}
|
|
22067
22065
|
const module = new Module(this.graph, id, this.options, isEntry, moduleSideEffects, syntheticNamedExports, meta);
|
|
22068
22066
|
this.modulesById.set(id, module);
|
|
22069
22067
|
this.graph.watchFiles[id] = true;
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
...resolveDynamicImportPromises
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
/* rejections thrown here are also handled within PluginDriver - they are safe to ignore */
|
|
22068
|
+
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22069
|
+
this.getResolveStaticDependencyPromises(module),
|
|
22070
|
+
this.getResolveDynamicImportPromises(module)
|
|
22071
|
+
]);
|
|
22072
|
+
const loadAndResolveDependenciesPromise = loadPromise
|
|
22073
|
+
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
22074
|
+
.then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
|
|
22075
|
+
loadAndResolveDependenciesPromise.catch(() => {
|
|
22076
|
+
/* avoid unhandled promise rejections */
|
|
22080
22077
|
});
|
|
22078
|
+
if (isPreload) {
|
|
22079
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22080
|
+
await loadPromise;
|
|
22081
|
+
}
|
|
22082
|
+
else {
|
|
22083
|
+
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22084
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22085
|
+
await loadAndResolveDependenciesPromise;
|
|
22086
|
+
}
|
|
22087
|
+
return module;
|
|
22088
|
+
}
|
|
22089
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22081
22090
|
await Promise.all([
|
|
22082
22091
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22083
|
-
this.fetchDynamicDependencies(module,
|
|
22092
|
+
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22084
22093
|
]);
|
|
22085
22094
|
module.linkImports();
|
|
22086
|
-
return module;
|
|
22087
22095
|
}
|
|
22088
22096
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22089
22097
|
if (resolvedId.external) {
|
|
@@ -22098,7 +22106,7 @@ class ModuleLoader {
|
|
|
22098
22106
|
return Promise.resolve(externalModule);
|
|
22099
22107
|
}
|
|
22100
22108
|
else {
|
|
22101
|
-
return this.fetchModule(resolvedId, importer, false);
|
|
22109
|
+
return this.fetchModule(resolvedId, importer, false, false);
|
|
22102
22110
|
}
|
|
22103
22111
|
}
|
|
22104
22112
|
async fetchStaticDependencies(module, resolveStaticDependencyPromises) {
|
|
@@ -22169,6 +22177,26 @@ class ModuleLoader {
|
|
|
22169
22177
|
this.handleResolveId(await this.resolveId(source, module.id, EMPTY_OBJECT, false), source, module.id))
|
|
22170
22178
|
]);
|
|
22171
22179
|
}
|
|
22180
|
+
async handleExistingModule(module, isEntry, isPreload) {
|
|
22181
|
+
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22182
|
+
if (isPreload) {
|
|
22183
|
+
await loadPromise;
|
|
22184
|
+
return;
|
|
22185
|
+
}
|
|
22186
|
+
if (isEntry) {
|
|
22187
|
+
module.info.isEntry = true;
|
|
22188
|
+
this.implicitEntryModules.delete(module);
|
|
22189
|
+
for (const dependant of module.implicitlyLoadedAfter) {
|
|
22190
|
+
dependant.implicitlyLoadedBefore.delete(module);
|
|
22191
|
+
}
|
|
22192
|
+
module.implicitlyLoadedAfter.clear();
|
|
22193
|
+
}
|
|
22194
|
+
if (loadPromise) {
|
|
22195
|
+
this.moduleLoadPromises.delete(module);
|
|
22196
|
+
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22197
|
+
}
|
|
22198
|
+
return;
|
|
22199
|
+
}
|
|
22172
22200
|
handleResolveId(resolvedId, source, importer) {
|
|
22173
22201
|
if (resolvedId === null) {
|
|
22174
22202
|
if (isRelative(source)) {
|
|
@@ -22205,7 +22233,7 @@ class ModuleLoader {
|
|
|
22205
22233
|
}
|
|
22206
22234
|
return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
|
|
22207
22235
|
? resolveIdResult
|
|
22208
|
-
: { id: resolveIdResult }), undefined, isEntry);
|
|
22236
|
+
: { id: resolveIdResult }), undefined, isEntry, false);
|
|
22209
22237
|
}
|
|
22210
22238
|
async resolveDynamicImport(module, specifier, importer) {
|
|
22211
22239
|
const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
|
|
@@ -22333,12 +22361,16 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22333
22361
|
getModuleInfo: graph.getModuleInfo,
|
|
22334
22362
|
getWatchFiles: () => Object.keys(graph.watchFiles),
|
|
22335
22363
|
isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
|
|
22364
|
+
load(resolvedId) {
|
|
22365
|
+
return graph.moduleLoader.preloadModule(resolvedId);
|
|
22366
|
+
},
|
|
22336
22367
|
meta: {
|
|
22337
22368
|
rollupVersion: version$1,
|
|
22338
22369
|
watchMode: graph.watchMode
|
|
22339
22370
|
},
|
|
22340
22371
|
get moduleIds() {
|
|
22341
22372
|
function* wrappedModuleIds() {
|
|
22373
|
+
// We are wrapping this in a generator to only show the message once we are actually iterating
|
|
22342
22374
|
warnDeprecation({
|
|
22343
22375
|
message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
|
|
22344
22376
|
plugin: plugin.name
|
|
@@ -23050,12 +23082,15 @@ const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules) =
|
|
|
23050
23082
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
23051
23083
|
};
|
|
23052
23084
|
|
|
23085
|
+
// https://datatracker.ietf.org/doc/html/rfc2396
|
|
23086
|
+
// eslint-disable-next-line no-control-regex
|
|
23087
|
+
const INVALID_CHAR_RE = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
23053
23088
|
function sanitizeFileName(name) {
|
|
23054
23089
|
const match = /^[a-z]:/i.exec(name);
|
|
23055
23090
|
const driveLetter = match ? match[0] : '';
|
|
23056
23091
|
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
23057
23092
|
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
23058
|
-
return driveLetter + name.substr(driveLetter.length).replace(
|
|
23093
|
+
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_RE, '_');
|
|
23059
23094
|
}
|
|
23060
23095
|
|
|
23061
23096
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
@@ -23507,18 +23542,6 @@ function loadFsEvents() {
|
|
|
23507
23542
|
fsEventsImportError = err;
|
|
23508
23543
|
});
|
|
23509
23544
|
}
|
|
23510
|
-
// A call to this function will be injected into the chokidar code
|
|
23511
|
-
function getFsEvents() {
|
|
23512
|
-
if (fsEventsImportError)
|
|
23513
|
-
throw fsEventsImportError;
|
|
23514
|
-
return fsEvents;
|
|
23515
|
-
}
|
|
23516
|
-
|
|
23517
|
-
const fseventsImporter = {
|
|
23518
|
-
__proto__: null,
|
|
23519
|
-
loadFsEvents,
|
|
23520
|
-
getFsEvents
|
|
23521
|
-
};
|
|
23522
23545
|
|
|
23523
23546
|
class WatchEmitter extends EventEmitter {
|
|
23524
23547
|
constructor() {
|
|
@@ -23542,4 +23565,4 @@ function watch(configs) {
|
|
|
23542
23565
|
return emitter;
|
|
23543
23566
|
}
|
|
23544
23567
|
|
|
23545
|
-
export { createFilter, defaultOnWarn, defineConfig, ensureArray,
|
|
23568
|
+
export { createFilter, defaultOnWarn, defineConfig, ensureArray, generatedCodePresets, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|