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/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.61.0
|
|
4
|
+
Thu, 09 Dec 2021 05:43:43 GMT - commit 49d41f78987a1dd13488df009fe2db1b5d1b6e7c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -26,7 +26,7 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
var version$1 = "2.
|
|
29
|
+
var version$1 = "2.61.0";
|
|
30
30
|
|
|
31
31
|
function ensureArray$1(items) {
|
|
32
32
|
if (Array.isArray(items)) {
|
|
@@ -592,36 +592,9 @@ function loadFsEvents() {
|
|
|
592
592
|
fsEventsImportError = err;
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
|
-
// A call to this function will be injected into the chokidar code
|
|
596
|
-
function getFsEvents() {
|
|
597
|
-
if (fsEventsImportError)
|
|
598
|
-
throw fsEventsImportError;
|
|
599
|
-
return fsEvents;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
const fseventsImporter = {
|
|
603
|
-
__proto__: null,
|
|
604
|
-
loadFsEvents,
|
|
605
|
-
getFsEvents
|
|
606
|
-
};
|
|
607
595
|
|
|
608
596
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
609
597
|
|
|
610
|
-
function getAugmentedNamespace(n) {
|
|
611
|
-
if (n.__esModule) return n;
|
|
612
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
613
|
-
Object.keys(n).forEach(function (k) {
|
|
614
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
615
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
616
|
-
enumerable: true,
|
|
617
|
-
get: function () {
|
|
618
|
-
return n[k];
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
});
|
|
622
|
-
return a;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
598
|
var charToInteger = {};
|
|
626
599
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
627
600
|
for (var i = 0; i < chars$1.length; i++) {
|
|
@@ -12358,7 +12331,7 @@ class Module {
|
|
|
12358
12331
|
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12359
12332
|
},
|
|
12360
12333
|
get importedIds() {
|
|
12361
|
-
return Array.from(module.sources, source => module.resolvedIds[source].id);
|
|
12334
|
+
return Array.from(module.sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
12362
12335
|
},
|
|
12363
12336
|
get importers() {
|
|
12364
12337
|
return module.importers.sort();
|
|
@@ -14585,13 +14558,14 @@ class Chunk {
|
|
|
14585
14558
|
const id = this.orderedModules[0].id;
|
|
14586
14559
|
const sanitizedId = this.outputOptions.sanitizeFileName(id);
|
|
14587
14560
|
let path;
|
|
14561
|
+
const patternOpt = unsetOptions.has('entryFileNames')
|
|
14562
|
+
? '[name][assetExtname].js'
|
|
14563
|
+
: options.entryFileNames;
|
|
14564
|
+
const pattern = typeof patternOpt === 'function' ? patternOpt(this.getChunkInfo()) : patternOpt;
|
|
14588
14565
|
if (isAbsolute(id)) {
|
|
14589
|
-
const extension = path$2.extname(id);
|
|
14590
|
-
const pattern = unsetOptions.has('entryFileNames')
|
|
14591
|
-
? '[name][assetExtname].js'
|
|
14592
|
-
: options.entryFileNames;
|
|
14593
14566
|
const currentDir = path$2.dirname(sanitizedId);
|
|
14594
|
-
const
|
|
14567
|
+
const extension = path$2.extname(id);
|
|
14568
|
+
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14595
14569
|
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14596
14570
|
ext: () => extension.substr(1),
|
|
14597
14571
|
extname: () => extension,
|
|
@@ -14608,7 +14582,15 @@ class Chunk {
|
|
|
14608
14582
|
}
|
|
14609
14583
|
}
|
|
14610
14584
|
else {
|
|
14611
|
-
|
|
14585
|
+
const extension = path$2.extname(sanitizedId);
|
|
14586
|
+
const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
|
|
14587
|
+
assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
|
|
14588
|
+
ext: () => extension.substr(1),
|
|
14589
|
+
extname: () => extension,
|
|
14590
|
+
format: () => options.format,
|
|
14591
|
+
name: () => getAliasName(sanitizedId)
|
|
14592
|
+
});
|
|
14593
|
+
path = `_virtual/${fileName}`;
|
|
14612
14594
|
}
|
|
14613
14595
|
return makeUnique(normalize(path), existingNames);
|
|
14614
14596
|
}
|
|
@@ -14970,11 +14952,11 @@ class Chunk {
|
|
|
14970
14952
|
continue;
|
|
14971
14953
|
}
|
|
14972
14954
|
const renderedResolution = resolution instanceof Module
|
|
14973
|
-
? `'${this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions)}'`
|
|
14955
|
+
? `'${escapeId(this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions))}'`
|
|
14974
14956
|
: resolution instanceof ExternalModule
|
|
14975
|
-
? `'${resolution.renormalizeRenderPath
|
|
14957
|
+
? `'${escapeId(resolution.renormalizeRenderPath
|
|
14976
14958
|
? this.getRelativePath(resolution.renderPath, stripKnownJsExtensions)
|
|
14977
|
-
: resolution.renderPath}'`
|
|
14959
|
+
: resolution.renderPath)}'`
|
|
14978
14960
|
: resolution;
|
|
14979
14961
|
node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
|
|
14980
14962
|
!(facadeChunk === null || facadeChunk === void 0 ? void 0 : facadeChunk.strictFacade) &&
|
|
@@ -16140,7 +16122,7 @@ var reservedWords = {
|
|
|
16140
16122
|
|
|
16141
16123
|
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
|
|
16142
16124
|
|
|
16143
|
-
var keywords = {
|
|
16125
|
+
var keywords$1 = {
|
|
16144
16126
|
5: ecma5AndLessKeywords,
|
|
16145
16127
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16146
16128
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16259,17 +16241,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16259
16241
|
|
|
16260
16242
|
// Map keyword names to token types.
|
|
16261
16243
|
|
|
16262
|
-
var keywords
|
|
16244
|
+
var keywords = {};
|
|
16263
16245
|
|
|
16264
16246
|
// Succinct definitions of keyword token types
|
|
16265
16247
|
function kw(name, options) {
|
|
16266
16248
|
if ( options === void 0 ) options = {};
|
|
16267
16249
|
|
|
16268
16250
|
options.keyword = name;
|
|
16269
|
-
return keywords
|
|
16251
|
+
return keywords[name] = new TokenType(name, options)
|
|
16270
16252
|
}
|
|
16271
16253
|
|
|
16272
|
-
var types = {
|
|
16254
|
+
var types$1 = {
|
|
16273
16255
|
num: new TokenType("num", startsExpr),
|
|
16274
16256
|
regexp: new TokenType("regexp", startsExpr),
|
|
16275
16257
|
string: new TokenType("string", startsExpr),
|
|
@@ -16611,7 +16593,7 @@ var
|
|
|
16611
16593
|
var Parser = function Parser(options, input, startPos) {
|
|
16612
16594
|
this.options = options = getOptions(options);
|
|
16613
16595
|
this.sourceFile = options.sourceFile;
|
|
16614
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16596
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16615
16597
|
var reserved = "";
|
|
16616
16598
|
if (options.allowReserved !== true) {
|
|
16617
16599
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16642,7 +16624,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16642
16624
|
|
|
16643
16625
|
// Properties of the current token:
|
|
16644
16626
|
// Its type
|
|
16645
|
-
this.type = types.eof;
|
|
16627
|
+
this.type = types$1.eof;
|
|
16646
16628
|
// For tokens that include more information than their type, the value
|
|
16647
16629
|
this.value = null;
|
|
16648
16630
|
// Its start and end offset
|
|
@@ -16702,8 +16684,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16702
16684
|
};
|
|
16703
16685
|
|
|
16704
16686
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16687
|
+
|
|
16705
16688
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16689
|
+
|
|
16706
16690
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16691
|
+
|
|
16707
16692
|
prototypeAccessors.canAwait.get = function () {
|
|
16708
16693
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16709
16694
|
var scope = this.scopeStack[i];
|
|
@@ -16712,20 +16697,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16712
16697
|
}
|
|
16713
16698
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16714
16699
|
};
|
|
16700
|
+
|
|
16715
16701
|
prototypeAccessors.allowSuper.get = function () {
|
|
16716
16702
|
var ref = this.currentThisScope();
|
|
16717
16703
|
var flags = ref.flags;
|
|
16718
16704
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16719
16705
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16720
16706
|
};
|
|
16707
|
+
|
|
16721
16708
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16709
|
+
|
|
16722
16710
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16711
|
+
|
|
16723
16712
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16724
16713
|
var ref = this.currentThisScope();
|
|
16725
16714
|
var flags = ref.flags;
|
|
16726
16715
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16727
16716
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16728
16717
|
};
|
|
16718
|
+
|
|
16729
16719
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16730
16720
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16731
16721
|
};
|
|
@@ -16755,12 +16745,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16755
16745
|
|
|
16756
16746
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16757
16747
|
|
|
16758
|
-
var pp = Parser.prototype;
|
|
16748
|
+
var pp$9 = Parser.prototype;
|
|
16759
16749
|
|
|
16760
16750
|
// ## Parser utilities
|
|
16761
16751
|
|
|
16762
16752
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16763
|
-
pp.strictDirective = function(start) {
|
|
16753
|
+
pp$9.strictDirective = function(start) {
|
|
16764
16754
|
for (;;) {
|
|
16765
16755
|
// Try to find string literal.
|
|
16766
16756
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16788,7 +16778,7 @@ pp.strictDirective = function(start) {
|
|
|
16788
16778
|
// Predicate that tests whether the next token is of the given
|
|
16789
16779
|
// type, and if yes, consumes it as a side effect.
|
|
16790
16780
|
|
|
16791
|
-
pp.eat = function(type) {
|
|
16781
|
+
pp$9.eat = function(type) {
|
|
16792
16782
|
if (this.type === type) {
|
|
16793
16783
|
this.next();
|
|
16794
16784
|
return true
|
|
@@ -16799,13 +16789,13 @@ pp.eat = function(type) {
|
|
|
16799
16789
|
|
|
16800
16790
|
// Tests whether parsed token is a contextual keyword.
|
|
16801
16791
|
|
|
16802
|
-
pp.isContextual = function(name) {
|
|
16803
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16792
|
+
pp$9.isContextual = function(name) {
|
|
16793
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16804
16794
|
};
|
|
16805
16795
|
|
|
16806
16796
|
// Consumes contextual keyword if possible.
|
|
16807
16797
|
|
|
16808
|
-
pp.eatContextual = function(name) {
|
|
16798
|
+
pp$9.eatContextual = function(name) {
|
|
16809
16799
|
if (!this.isContextual(name)) { return false }
|
|
16810
16800
|
this.next();
|
|
16811
16801
|
return true
|
|
@@ -16813,19 +16803,19 @@ pp.eatContextual = function(name) {
|
|
|
16813
16803
|
|
|
16814
16804
|
// Asserts that following token is given contextual keyword.
|
|
16815
16805
|
|
|
16816
|
-
pp.expectContextual = function(name) {
|
|
16806
|
+
pp$9.expectContextual = function(name) {
|
|
16817
16807
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16818
16808
|
};
|
|
16819
16809
|
|
|
16820
16810
|
// Test whether a semicolon can be inserted at the current position.
|
|
16821
16811
|
|
|
16822
|
-
pp.canInsertSemicolon = function() {
|
|
16823
|
-
return this.type === types.eof ||
|
|
16824
|
-
this.type === types.braceR ||
|
|
16812
|
+
pp$9.canInsertSemicolon = function() {
|
|
16813
|
+
return this.type === types$1.eof ||
|
|
16814
|
+
this.type === types$1.braceR ||
|
|
16825
16815
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16826
16816
|
};
|
|
16827
16817
|
|
|
16828
|
-
pp.insertSemicolon = function() {
|
|
16818
|
+
pp$9.insertSemicolon = function() {
|
|
16829
16819
|
if (this.canInsertSemicolon()) {
|
|
16830
16820
|
if (this.options.onInsertedSemicolon)
|
|
16831
16821
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16836,11 +16826,11 @@ pp.insertSemicolon = function() {
|
|
|
16836
16826
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16837
16827
|
// pretend that there is a semicolon at this position.
|
|
16838
16828
|
|
|
16839
|
-
pp.semicolon = function() {
|
|
16840
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16829
|
+
pp$9.semicolon = function() {
|
|
16830
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16841
16831
|
};
|
|
16842
16832
|
|
|
16843
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16833
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16844
16834
|
if (this.type === tokType) {
|
|
16845
16835
|
if (this.options.onTrailingComma)
|
|
16846
16836
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16853,13 +16843,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16853
16843
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16854
16844
|
// raise an unexpected token error.
|
|
16855
16845
|
|
|
16856
|
-
pp.expect = function(type) {
|
|
16846
|
+
pp$9.expect = function(type) {
|
|
16857
16847
|
this.eat(type) || this.unexpected();
|
|
16858
16848
|
};
|
|
16859
16849
|
|
|
16860
16850
|
// Raise an unexpected token error.
|
|
16861
16851
|
|
|
16862
|
-
pp.unexpected = function(pos) {
|
|
16852
|
+
pp$9.unexpected = function(pos) {
|
|
16863
16853
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16864
16854
|
};
|
|
16865
16855
|
|
|
@@ -16872,7 +16862,7 @@ function DestructuringErrors() {
|
|
|
16872
16862
|
-1;
|
|
16873
16863
|
}
|
|
16874
16864
|
|
|
16875
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16865
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16876
16866
|
if (!refDestructuringErrors) { return }
|
|
16877
16867
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16878
16868
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16880,7 +16870,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16880
16870
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16881
16871
|
};
|
|
16882
16872
|
|
|
16883
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16873
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16884
16874
|
if (!refDestructuringErrors) { return false }
|
|
16885
16875
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16886
16876
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16891,20 +16881,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16891
16881
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16892
16882
|
};
|
|
16893
16883
|
|
|
16894
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16884
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16895
16885
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16896
16886
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16897
16887
|
if (this.awaitPos)
|
|
16898
16888
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16899
16889
|
};
|
|
16900
16890
|
|
|
16901
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16891
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16902
16892
|
if (expr.type === "ParenthesizedExpression")
|
|
16903
16893
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16904
16894
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16905
16895
|
};
|
|
16906
16896
|
|
|
16907
|
-
var pp$
|
|
16897
|
+
var pp$8 = Parser.prototype;
|
|
16908
16898
|
|
|
16909
16899
|
// ### Statement parsing
|
|
16910
16900
|
|
|
@@ -16913,10 +16903,10 @@ var pp$1 = Parser.prototype;
|
|
|
16913
16903
|
// `program` argument. If present, the statements will be appended
|
|
16914
16904
|
// to its body instead of creating a new node.
|
|
16915
16905
|
|
|
16916
|
-
pp$
|
|
16906
|
+
pp$8.parseTopLevel = function(node) {
|
|
16917
16907
|
var exports = Object.create(null);
|
|
16918
16908
|
if (!node.body) { node.body = []; }
|
|
16919
|
-
while (this.type !== types.eof) {
|
|
16909
|
+
while (this.type !== types$1.eof) {
|
|
16920
16910
|
var stmt = this.parseStatement(null, true, exports);
|
|
16921
16911
|
node.body.push(stmt);
|
|
16922
16912
|
}
|
|
@@ -16935,7 +16925,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16935
16925
|
|
|
16936
16926
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16937
16927
|
|
|
16938
|
-
pp$
|
|
16928
|
+
pp$8.isLet = function(context) {
|
|
16939
16929
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16940
16930
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16941
16931
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16961,7 +16951,7 @@ pp$1.isLet = function(context) {
|
|
|
16961
16951
|
// check 'async [no LineTerminator here] function'
|
|
16962
16952
|
// - 'async /*foo*/ function' is OK.
|
|
16963
16953
|
// - 'async /*\n*/ function' is invalid.
|
|
16964
|
-
pp$
|
|
16954
|
+
pp$8.isAsyncFunction = function() {
|
|
16965
16955
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16966
16956
|
{ return false }
|
|
16967
16957
|
|
|
@@ -16981,11 +16971,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16981
16971
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16982
16972
|
// does not help.
|
|
16983
16973
|
|
|
16984
|
-
pp$
|
|
16974
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16985
16975
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16986
16976
|
|
|
16987
16977
|
if (this.isLet(context)) {
|
|
16988
|
-
starttype = types._var;
|
|
16978
|
+
starttype = types$1._var;
|
|
16989
16979
|
kind = "let";
|
|
16990
16980
|
}
|
|
16991
16981
|
|
|
@@ -16994,35 +16984,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16994
16984
|
// complexity.
|
|
16995
16985
|
|
|
16996
16986
|
switch (starttype) {
|
|
16997
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16998
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
16999
|
-
case types._do: return this.parseDoStatement(node)
|
|
17000
|
-
case types._for: return this.parseForStatement(node)
|
|
17001
|
-
case types._function:
|
|
16987
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16988
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
16989
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
16990
|
+
case types$1._for: return this.parseForStatement(node)
|
|
16991
|
+
case types$1._function:
|
|
17002
16992
|
// Function as sole body of either an if statement or a labeled statement
|
|
17003
16993
|
// works, but not when it is part of a labeled statement that is the sole
|
|
17004
16994
|
// body of an if statement.
|
|
17005
16995
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
17006
16996
|
return this.parseFunctionStatement(node, false, !context)
|
|
17007
|
-
case types._class:
|
|
16997
|
+
case types$1._class:
|
|
17008
16998
|
if (context) { this.unexpected(); }
|
|
17009
16999
|
return this.parseClass(node, true)
|
|
17010
|
-
case types._if: return this.parseIfStatement(node)
|
|
17011
|
-
case types._return: return this.parseReturnStatement(node)
|
|
17012
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
17013
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
17014
|
-
case types._try: return this.parseTryStatement(node)
|
|
17015
|
-
case types._const: case types._var:
|
|
17000
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
17001
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
17002
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
17003
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
17004
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
17005
|
+
case types$1._const: case types$1._var:
|
|
17016
17006
|
kind = kind || this.value;
|
|
17017
17007
|
if (context && kind !== "var") { this.unexpected(); }
|
|
17018
17008
|
return this.parseVarStatement(node, kind)
|
|
17019
|
-
case types._while: return this.parseWhileStatement(node)
|
|
17020
|
-
case types._with: return this.parseWithStatement(node)
|
|
17021
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
17022
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
17023
|
-
case types._export:
|
|
17024
|
-
case types._import:
|
|
17025
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
17009
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
17010
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
17011
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
17012
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
17013
|
+
case types$1._export:
|
|
17014
|
+
case types$1._import:
|
|
17015
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
17026
17016
|
skipWhiteSpace.lastIndex = this.pos;
|
|
17027
17017
|
var skip = skipWhiteSpace.exec(this.input);
|
|
17028
17018
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -17036,7 +17026,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17036
17026
|
if (!this.inModule)
|
|
17037
17027
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
17038
17028
|
}
|
|
17039
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
17029
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
17040
17030
|
|
|
17041
17031
|
// If the statement does not start with a statement keyword or a
|
|
17042
17032
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -17051,17 +17041,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17051
17041
|
}
|
|
17052
17042
|
|
|
17053
17043
|
var maybeName = this.value, expr = this.parseExpression();
|
|
17054
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
17044
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
17055
17045
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
17056
17046
|
else { return this.parseExpressionStatement(node, expr) }
|
|
17057
17047
|
}
|
|
17058
17048
|
};
|
|
17059
17049
|
|
|
17060
|
-
pp$
|
|
17050
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
17061
17051
|
var isBreak = keyword === "break";
|
|
17062
17052
|
this.next();
|
|
17063
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
17064
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
17053
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
17054
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
17065
17055
|
else {
|
|
17066
17056
|
node.label = this.parseIdent();
|
|
17067
17057
|
this.semicolon();
|
|
@@ -17081,21 +17071,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
17081
17071
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
17082
17072
|
};
|
|
17083
17073
|
|
|
17084
|
-
pp$
|
|
17074
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
17085
17075
|
this.next();
|
|
17086
17076
|
this.semicolon();
|
|
17087
17077
|
return this.finishNode(node, "DebuggerStatement")
|
|
17088
17078
|
};
|
|
17089
17079
|
|
|
17090
|
-
pp$
|
|
17080
|
+
pp$8.parseDoStatement = function(node) {
|
|
17091
17081
|
this.next();
|
|
17092
17082
|
this.labels.push(loopLabel);
|
|
17093
17083
|
node.body = this.parseStatement("do");
|
|
17094
17084
|
this.labels.pop();
|
|
17095
|
-
this.expect(types._while);
|
|
17085
|
+
this.expect(types$1._while);
|
|
17096
17086
|
node.test = this.parseParenExpression();
|
|
17097
17087
|
if (this.options.ecmaVersion >= 6)
|
|
17098
|
-
{ this.eat(types.semi); }
|
|
17088
|
+
{ this.eat(types$1.semi); }
|
|
17099
17089
|
else
|
|
17100
17090
|
{ this.semicolon(); }
|
|
17101
17091
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -17109,25 +17099,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
17109
17099
|
// part (semicolon immediately after the opening parenthesis), it
|
|
17110
17100
|
// is a regular `for` loop.
|
|
17111
17101
|
|
|
17112
|
-
pp$
|
|
17102
|
+
pp$8.parseForStatement = function(node) {
|
|
17113
17103
|
this.next();
|
|
17114
17104
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
17115
17105
|
this.labels.push(loopLabel);
|
|
17116
17106
|
this.enterScope(0);
|
|
17117
|
-
this.expect(types.parenL);
|
|
17118
|
-
if (this.type === types.semi) {
|
|
17107
|
+
this.expect(types$1.parenL);
|
|
17108
|
+
if (this.type === types$1.semi) {
|
|
17119
17109
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17120
17110
|
return this.parseFor(node, null)
|
|
17121
17111
|
}
|
|
17122
17112
|
var isLet = this.isLet();
|
|
17123
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
17113
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
17124
17114
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
17125
17115
|
this.next();
|
|
17126
17116
|
this.parseVar(init$1, true, kind);
|
|
17127
17117
|
this.finishNode(init$1, "VariableDeclaration");
|
|
17128
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17118
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17129
17119
|
if (this.options.ecmaVersion >= 9) {
|
|
17130
|
-
if (this.type === types._in) {
|
|
17120
|
+
if (this.type === types$1._in) {
|
|
17131
17121
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17132
17122
|
} else { node.await = awaitAt > -1; }
|
|
17133
17123
|
}
|
|
@@ -17139,9 +17129,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17139
17129
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17140
17130
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17141
17131
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17142
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17132
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17143
17133
|
if (this.options.ecmaVersion >= 9) {
|
|
17144
|
-
if (this.type === types._in) {
|
|
17134
|
+
if (this.type === types$1._in) {
|
|
17145
17135
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17146
17136
|
} else { node.await = awaitAt > -1; }
|
|
17147
17137
|
}
|
|
@@ -17156,21 +17146,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17156
17146
|
return this.parseFor(node, init)
|
|
17157
17147
|
};
|
|
17158
17148
|
|
|
17159
|
-
pp$
|
|
17149
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17160
17150
|
this.next();
|
|
17161
17151
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17162
17152
|
};
|
|
17163
17153
|
|
|
17164
|
-
pp$
|
|
17154
|
+
pp$8.parseIfStatement = function(node) {
|
|
17165
17155
|
this.next();
|
|
17166
17156
|
node.test = this.parseParenExpression();
|
|
17167
17157
|
// allow function declarations in branches, but only in non-strict mode
|
|
17168
17158
|
node.consequent = this.parseStatement("if");
|
|
17169
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17159
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17170
17160
|
return this.finishNode(node, "IfStatement")
|
|
17171
17161
|
};
|
|
17172
17162
|
|
|
17173
|
-
pp$
|
|
17163
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17174
17164
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17175
17165
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17176
17166
|
this.next();
|
|
@@ -17179,16 +17169,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17179
17169
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17180
17170
|
// possibility to insert one.
|
|
17181
17171
|
|
|
17182
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17172
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17183
17173
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17184
17174
|
return this.finishNode(node, "ReturnStatement")
|
|
17185
17175
|
};
|
|
17186
17176
|
|
|
17187
|
-
pp$
|
|
17177
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17188
17178
|
this.next();
|
|
17189
17179
|
node.discriminant = this.parseParenExpression();
|
|
17190
17180
|
node.cases = [];
|
|
17191
|
-
this.expect(types.braceL);
|
|
17181
|
+
this.expect(types$1.braceL);
|
|
17192
17182
|
this.labels.push(switchLabel);
|
|
17193
17183
|
this.enterScope(0);
|
|
17194
17184
|
|
|
@@ -17197,9 +17187,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17197
17187
|
// adding statements to.
|
|
17198
17188
|
|
|
17199
17189
|
var cur;
|
|
17200
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
17201
|
-
if (this.type === types._case || this.type === types._default) {
|
|
17202
|
-
var isCase = this.type === types._case;
|
|
17190
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17191
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17192
|
+
var isCase = this.type === types$1._case;
|
|
17203
17193
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17204
17194
|
node.cases.push(cur = this.startNode());
|
|
17205
17195
|
cur.consequent = [];
|
|
@@ -17211,7 +17201,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17211
17201
|
sawDefault = true;
|
|
17212
17202
|
cur.test = null;
|
|
17213
17203
|
}
|
|
17214
|
-
this.expect(types.colon);
|
|
17204
|
+
this.expect(types$1.colon);
|
|
17215
17205
|
} else {
|
|
17216
17206
|
if (!cur) { this.unexpected(); }
|
|
17217
17207
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17224,7 +17214,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17224
17214
|
return this.finishNode(node, "SwitchStatement")
|
|
17225
17215
|
};
|
|
17226
17216
|
|
|
17227
|
-
pp$
|
|
17217
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17228
17218
|
this.next();
|
|
17229
17219
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17230
17220
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17235,21 +17225,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17235
17225
|
|
|
17236
17226
|
// Reused empty array added for node fields that are always empty.
|
|
17237
17227
|
|
|
17238
|
-
var empty = [];
|
|
17228
|
+
var empty$1 = [];
|
|
17239
17229
|
|
|
17240
|
-
pp$
|
|
17230
|
+
pp$8.parseTryStatement = function(node) {
|
|
17241
17231
|
this.next();
|
|
17242
17232
|
node.block = this.parseBlock();
|
|
17243
17233
|
node.handler = null;
|
|
17244
|
-
if (this.type === types._catch) {
|
|
17234
|
+
if (this.type === types$1._catch) {
|
|
17245
17235
|
var clause = this.startNode();
|
|
17246
17236
|
this.next();
|
|
17247
|
-
if (this.eat(types.parenL)) {
|
|
17237
|
+
if (this.eat(types$1.parenL)) {
|
|
17248
17238
|
clause.param = this.parseBindingAtom();
|
|
17249
17239
|
var simple = clause.param.type === "Identifier";
|
|
17250
17240
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17251
17241
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17252
|
-
this.expect(types.parenR);
|
|
17242
|
+
this.expect(types$1.parenR);
|
|
17253
17243
|
} else {
|
|
17254
17244
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17255
17245
|
clause.param = null;
|
|
@@ -17259,20 +17249,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17259
17249
|
this.exitScope();
|
|
17260
17250
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17261
17251
|
}
|
|
17262
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17252
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17263
17253
|
if (!node.handler && !node.finalizer)
|
|
17264
17254
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17265
17255
|
return this.finishNode(node, "TryStatement")
|
|
17266
17256
|
};
|
|
17267
17257
|
|
|
17268
|
-
pp$
|
|
17258
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17269
17259
|
this.next();
|
|
17270
17260
|
this.parseVar(node, false, kind);
|
|
17271
17261
|
this.semicolon();
|
|
17272
17262
|
return this.finishNode(node, "VariableDeclaration")
|
|
17273
17263
|
};
|
|
17274
17264
|
|
|
17275
|
-
pp$
|
|
17265
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17276
17266
|
this.next();
|
|
17277
17267
|
node.test = this.parseParenExpression();
|
|
17278
17268
|
this.labels.push(loopLabel);
|
|
@@ -17281,7 +17271,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17281
17271
|
return this.finishNode(node, "WhileStatement")
|
|
17282
17272
|
};
|
|
17283
17273
|
|
|
17284
|
-
pp$
|
|
17274
|
+
pp$8.parseWithStatement = function(node) {
|
|
17285
17275
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17286
17276
|
this.next();
|
|
17287
17277
|
node.object = this.parseParenExpression();
|
|
@@ -17289,12 +17279,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17289
17279
|
return this.finishNode(node, "WithStatement")
|
|
17290
17280
|
};
|
|
17291
17281
|
|
|
17292
|
-
pp$
|
|
17282
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17293
17283
|
this.next();
|
|
17294
17284
|
return this.finishNode(node, "EmptyStatement")
|
|
17295
17285
|
};
|
|
17296
17286
|
|
|
17297
|
-
pp$
|
|
17287
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17298
17288
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17299
17289
|
{
|
|
17300
17290
|
var label = list[i$1];
|
|
@@ -17302,7 +17292,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17302
17292
|
if (label.name === maybeName)
|
|
17303
17293
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17304
17294
|
} }
|
|
17305
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17295
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17306
17296
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17307
17297
|
var label$1 = this.labels[i];
|
|
17308
17298
|
if (label$1.statementStart === node.start) {
|
|
@@ -17318,7 +17308,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17318
17308
|
return this.finishNode(node, "LabeledStatement")
|
|
17319
17309
|
};
|
|
17320
17310
|
|
|
17321
|
-
pp$
|
|
17311
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17322
17312
|
node.expression = expr;
|
|
17323
17313
|
this.semicolon();
|
|
17324
17314
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17328,14 +17318,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17328
17318
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17329
17319
|
// function bodies).
|
|
17330
17320
|
|
|
17331
|
-
pp$
|
|
17321
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17332
17322
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17333
17323
|
if ( node === void 0 ) node = this.startNode();
|
|
17334
17324
|
|
|
17335
17325
|
node.body = [];
|
|
17336
|
-
this.expect(types.braceL);
|
|
17326
|
+
this.expect(types$1.braceL);
|
|
17337
17327
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17338
|
-
while (this.type !== types.braceR) {
|
|
17328
|
+
while (this.type !== types$1.braceR) {
|
|
17339
17329
|
var stmt = this.parseStatement(null);
|
|
17340
17330
|
node.body.push(stmt);
|
|
17341
17331
|
}
|
|
@@ -17349,13 +17339,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17349
17339
|
// `parseStatement` will already have parsed the init statement or
|
|
17350
17340
|
// expression.
|
|
17351
17341
|
|
|
17352
|
-
pp$
|
|
17342
|
+
pp$8.parseFor = function(node, init) {
|
|
17353
17343
|
node.init = init;
|
|
17354
|
-
this.expect(types.semi);
|
|
17355
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
17356
|
-
this.expect(types.semi);
|
|
17357
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
17358
|
-
this.expect(types.parenR);
|
|
17344
|
+
this.expect(types$1.semi);
|
|
17345
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17346
|
+
this.expect(types$1.semi);
|
|
17347
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17348
|
+
this.expect(types$1.parenR);
|
|
17359
17349
|
node.body = this.parseStatement("for");
|
|
17360
17350
|
this.exitScope();
|
|
17361
17351
|
this.labels.pop();
|
|
@@ -17365,8 +17355,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17365
17355
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17366
17356
|
// same from parser's perspective.
|
|
17367
17357
|
|
|
17368
|
-
pp$
|
|
17369
|
-
var isForIn = this.type === types._in;
|
|
17358
|
+
pp$8.parseForIn = function(node, init) {
|
|
17359
|
+
var isForIn = this.type === types$1._in;
|
|
17370
17360
|
this.next();
|
|
17371
17361
|
|
|
17372
17362
|
if (
|
|
@@ -17387,7 +17377,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17387
17377
|
}
|
|
17388
17378
|
node.left = init;
|
|
17389
17379
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17390
|
-
this.expect(types.parenR);
|
|
17380
|
+
this.expect(types$1.parenR);
|
|
17391
17381
|
node.body = this.parseStatement("for");
|
|
17392
17382
|
this.exitScope();
|
|
17393
17383
|
this.labels.pop();
|
|
@@ -17396,28 +17386,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17396
17386
|
|
|
17397
17387
|
// Parse a list of variable declarations.
|
|
17398
17388
|
|
|
17399
|
-
pp$
|
|
17389
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17400
17390
|
node.declarations = [];
|
|
17401
17391
|
node.kind = kind;
|
|
17402
17392
|
for (;;) {
|
|
17403
17393
|
var decl = this.startNode();
|
|
17404
17394
|
this.parseVarId(decl, kind);
|
|
17405
|
-
if (this.eat(types.eq)) {
|
|
17395
|
+
if (this.eat(types$1.eq)) {
|
|
17406
17396
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17407
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17397
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17408
17398
|
this.unexpected();
|
|
17409
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17399
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17410
17400
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17411
17401
|
} else {
|
|
17412
17402
|
decl.init = null;
|
|
17413
17403
|
}
|
|
17414
17404
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17415
|
-
if (!this.eat(types.comma)) { break }
|
|
17405
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17416
17406
|
}
|
|
17417
17407
|
return node
|
|
17418
17408
|
};
|
|
17419
17409
|
|
|
17420
|
-
pp$
|
|
17410
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17421
17411
|
decl.id = this.parseBindingAtom();
|
|
17422
17412
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17423
17413
|
};
|
|
@@ -17428,18 +17418,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17428
17418
|
// `statement & FUNC_STATEMENT`).
|
|
17429
17419
|
|
|
17430
17420
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17431
|
-
pp$
|
|
17421
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17432
17422
|
this.initFunction(node);
|
|
17433
17423
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17434
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17424
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17435
17425
|
{ this.unexpected(); }
|
|
17436
|
-
node.generator = this.eat(types.star);
|
|
17426
|
+
node.generator = this.eat(types$1.star);
|
|
17437
17427
|
}
|
|
17438
17428
|
if (this.options.ecmaVersion >= 8)
|
|
17439
17429
|
{ node.async = !!isAsync; }
|
|
17440
17430
|
|
|
17441
17431
|
if (statement & FUNC_STATEMENT) {
|
|
17442
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17432
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17443
17433
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17444
17434
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17445
17435
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17455,7 +17445,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17455
17445
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17456
17446
|
|
|
17457
17447
|
if (!(statement & FUNC_STATEMENT))
|
|
17458
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17448
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17459
17449
|
|
|
17460
17450
|
this.parseFunctionParams(node);
|
|
17461
17451
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17466,16 +17456,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17466
17456
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17467
17457
|
};
|
|
17468
17458
|
|
|
17469
|
-
pp$
|
|
17470
|
-
this.expect(types.parenL);
|
|
17471
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17459
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17460
|
+
this.expect(types$1.parenL);
|
|
17461
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17472
17462
|
this.checkYieldAwaitInDefaultParams();
|
|
17473
17463
|
};
|
|
17474
17464
|
|
|
17475
17465
|
// Parse a class declaration or literal (depending on the
|
|
17476
17466
|
// `isStatement` parameter).
|
|
17477
17467
|
|
|
17478
|
-
pp$
|
|
17468
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17479
17469
|
this.next();
|
|
17480
17470
|
|
|
17481
17471
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17489,8 +17479,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17489
17479
|
var classBody = this.startNode();
|
|
17490
17480
|
var hadConstructor = false;
|
|
17491
17481
|
classBody.body = [];
|
|
17492
|
-
this.expect(types.braceL);
|
|
17493
|
-
while (this.type !== types.braceR) {
|
|
17482
|
+
this.expect(types$1.braceL);
|
|
17483
|
+
while (this.type !== types$1.braceR) {
|
|
17494
17484
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17495
17485
|
if (element) {
|
|
17496
17486
|
classBody.body.push(element);
|
|
@@ -17509,8 +17499,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17509
17499
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17510
17500
|
};
|
|
17511
17501
|
|
|
17512
|
-
pp$
|
|
17513
|
-
if (this.eat(types.semi)) { return null }
|
|
17502
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17503
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17514
17504
|
|
|
17515
17505
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17516
17506
|
var node = this.startNode();
|
|
@@ -17522,11 +17512,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17522
17512
|
|
|
17523
17513
|
if (this.eatContextual("static")) {
|
|
17524
17514
|
// Parse static init block
|
|
17525
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17515
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17526
17516
|
this.parseClassStaticBlock(node);
|
|
17527
17517
|
return node
|
|
17528
17518
|
}
|
|
17529
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17519
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17530
17520
|
isStatic = true;
|
|
17531
17521
|
} else {
|
|
17532
17522
|
keyName = "static";
|
|
@@ -17534,13 +17524,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17534
17524
|
}
|
|
17535
17525
|
node.static = isStatic;
|
|
17536
17526
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17537
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17527
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17538
17528
|
isAsync = true;
|
|
17539
17529
|
} else {
|
|
17540
17530
|
keyName = "async";
|
|
17541
17531
|
}
|
|
17542
17532
|
}
|
|
17543
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17533
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17544
17534
|
isGenerator = true;
|
|
17545
17535
|
}
|
|
17546
17536
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17567,7 +17557,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17567
17557
|
}
|
|
17568
17558
|
|
|
17569
17559
|
// Parse element value
|
|
17570
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17560
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17571
17561
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17572
17562
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17573
17563
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17581,19 +17571,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17581
17571
|
return node
|
|
17582
17572
|
};
|
|
17583
17573
|
|
|
17584
|
-
pp$
|
|
17574
|
+
pp$8.isClassElementNameStart = function() {
|
|
17585
17575
|
return (
|
|
17586
|
-
this.type === types.name ||
|
|
17587
|
-
this.type === types.privateId ||
|
|
17588
|
-
this.type === types.num ||
|
|
17589
|
-
this.type === types.string ||
|
|
17590
|
-
this.type === types.bracketL ||
|
|
17576
|
+
this.type === types$1.name ||
|
|
17577
|
+
this.type === types$1.privateId ||
|
|
17578
|
+
this.type === types$1.num ||
|
|
17579
|
+
this.type === types$1.string ||
|
|
17580
|
+
this.type === types$1.bracketL ||
|
|
17591
17581
|
this.type.keyword
|
|
17592
17582
|
)
|
|
17593
17583
|
};
|
|
17594
17584
|
|
|
17595
|
-
pp$
|
|
17596
|
-
if (this.type === types.privateId) {
|
|
17585
|
+
pp$8.parseClassElementName = function(element) {
|
|
17586
|
+
if (this.type === types$1.privateId) {
|
|
17597
17587
|
if (this.value === "constructor") {
|
|
17598
17588
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17599
17589
|
}
|
|
@@ -17604,7 +17594,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17604
17594
|
}
|
|
17605
17595
|
};
|
|
17606
17596
|
|
|
17607
|
-
pp$
|
|
17597
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17608
17598
|
// Check key and flags
|
|
17609
17599
|
var key = method.key;
|
|
17610
17600
|
if (method.kind === "constructor") {
|
|
@@ -17628,14 +17618,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17628
17618
|
return this.finishNode(method, "MethodDefinition")
|
|
17629
17619
|
};
|
|
17630
17620
|
|
|
17631
|
-
pp$
|
|
17621
|
+
pp$8.parseClassField = function(field) {
|
|
17632
17622
|
if (checkKeyName(field, "constructor")) {
|
|
17633
17623
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17634
17624
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17635
17625
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17636
17626
|
}
|
|
17637
17627
|
|
|
17638
|
-
if (this.eat(types.eq)) {
|
|
17628
|
+
if (this.eat(types$1.eq)) {
|
|
17639
17629
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17640
17630
|
var scope = this.currentThisScope();
|
|
17641
17631
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17650,13 +17640,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17650
17640
|
return this.finishNode(field, "PropertyDefinition")
|
|
17651
17641
|
};
|
|
17652
17642
|
|
|
17653
|
-
pp$
|
|
17643
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17654
17644
|
node.body = [];
|
|
17655
17645
|
|
|
17656
17646
|
var oldLabels = this.labels;
|
|
17657
17647
|
this.labels = [];
|
|
17658
17648
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17659
|
-
while (this.type !== types.braceR) {
|
|
17649
|
+
while (this.type !== types$1.braceR) {
|
|
17660
17650
|
var stmt = this.parseStatement(null);
|
|
17661
17651
|
node.body.push(stmt);
|
|
17662
17652
|
}
|
|
@@ -17667,8 +17657,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17667
17657
|
return this.finishNode(node, "StaticBlock")
|
|
17668
17658
|
};
|
|
17669
17659
|
|
|
17670
|
-
pp$
|
|
17671
|
-
if (this.type === types.name) {
|
|
17660
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17661
|
+
if (this.type === types$1.name) {
|
|
17672
17662
|
node.id = this.parseIdent();
|
|
17673
17663
|
if (isStatement)
|
|
17674
17664
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17679,17 +17669,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17679
17669
|
}
|
|
17680
17670
|
};
|
|
17681
17671
|
|
|
17682
|
-
pp$
|
|
17683
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17672
|
+
pp$8.parseClassSuper = function(node) {
|
|
17673
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17684
17674
|
};
|
|
17685
17675
|
|
|
17686
|
-
pp$
|
|
17676
|
+
pp$8.enterClassBody = function() {
|
|
17687
17677
|
var element = {declared: Object.create(null), used: []};
|
|
17688
17678
|
this.privateNameStack.push(element);
|
|
17689
17679
|
return element.declared
|
|
17690
17680
|
};
|
|
17691
17681
|
|
|
17692
|
-
pp$
|
|
17682
|
+
pp$8.exitClassBody = function() {
|
|
17693
17683
|
var ref = this.privateNameStack.pop();
|
|
17694
17684
|
var declared = ref.declared;
|
|
17695
17685
|
var used = ref.used;
|
|
@@ -17744,10 +17734,10 @@ function checkKeyName(node, name) {
|
|
|
17744
17734
|
|
|
17745
17735
|
// Parses module export declaration.
|
|
17746
17736
|
|
|
17747
|
-
pp$
|
|
17737
|
+
pp$8.parseExport = function(node, exports) {
|
|
17748
17738
|
this.next();
|
|
17749
17739
|
// export * from '...'
|
|
17750
|
-
if (this.eat(types.star)) {
|
|
17740
|
+
if (this.eat(types$1.star)) {
|
|
17751
17741
|
if (this.options.ecmaVersion >= 11) {
|
|
17752
17742
|
if (this.eatContextual("as")) {
|
|
17753
17743
|
node.exported = this.parseIdent(true);
|
|
@@ -17757,20 +17747,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17757
17747
|
}
|
|
17758
17748
|
}
|
|
17759
17749
|
this.expectContextual("from");
|
|
17760
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17750
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17761
17751
|
node.source = this.parseExprAtom();
|
|
17762
17752
|
this.semicolon();
|
|
17763
17753
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17764
17754
|
}
|
|
17765
|
-
if (this.eat(types._default)) { // export default ...
|
|
17755
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17766
17756
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17767
17757
|
var isAsync;
|
|
17768
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17758
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17769
17759
|
var fNode = this.startNode();
|
|
17770
17760
|
this.next();
|
|
17771
17761
|
if (isAsync) { this.next(); }
|
|
17772
17762
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17773
|
-
} else if (this.type === types._class) {
|
|
17763
|
+
} else if (this.type === types$1._class) {
|
|
17774
17764
|
var cNode = this.startNode();
|
|
17775
17765
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17776
17766
|
} else {
|
|
@@ -17792,7 +17782,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17792
17782
|
node.declaration = null;
|
|
17793
17783
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17794
17784
|
if (this.eatContextual("from")) {
|
|
17795
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17785
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17796
17786
|
node.source = this.parseExprAtom();
|
|
17797
17787
|
} else {
|
|
17798
17788
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17811,14 +17801,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17811
17801
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17812
17802
|
};
|
|
17813
17803
|
|
|
17814
|
-
pp$
|
|
17804
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17815
17805
|
if (!exports) { return }
|
|
17816
17806
|
if (has(exports, name))
|
|
17817
17807
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17818
17808
|
exports[name] = true;
|
|
17819
17809
|
};
|
|
17820
17810
|
|
|
17821
|
-
pp$
|
|
17811
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17822
17812
|
var type = pat.type;
|
|
17823
17813
|
if (type === "Identifier")
|
|
17824
17814
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17845,7 +17835,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17845
17835
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17846
17836
|
};
|
|
17847
17837
|
|
|
17848
|
-
pp$
|
|
17838
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17849
17839
|
if (!exports) { return }
|
|
17850
17840
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17851
17841
|
{
|
|
@@ -17855,7 +17845,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17855
17845
|
}
|
|
17856
17846
|
};
|
|
17857
17847
|
|
|
17858
|
-
pp$
|
|
17848
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17859
17849
|
return this.type.keyword === "var" ||
|
|
17860
17850
|
this.type.keyword === "const" ||
|
|
17861
17851
|
this.type.keyword === "class" ||
|
|
@@ -17866,14 +17856,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17866
17856
|
|
|
17867
17857
|
// Parses a comma-separated list of module exports.
|
|
17868
17858
|
|
|
17869
|
-
pp$
|
|
17859
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17870
17860
|
var nodes = [], first = true;
|
|
17871
17861
|
// export { x, y as z } [from '...']
|
|
17872
|
-
this.expect(types.braceL);
|
|
17873
|
-
while (!this.eat(types.braceR)) {
|
|
17862
|
+
this.expect(types$1.braceL);
|
|
17863
|
+
while (!this.eat(types$1.braceR)) {
|
|
17874
17864
|
if (!first) {
|
|
17875
|
-
this.expect(types.comma);
|
|
17876
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17865
|
+
this.expect(types$1.comma);
|
|
17866
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17877
17867
|
} else { first = false; }
|
|
17878
17868
|
|
|
17879
17869
|
var node = this.startNode();
|
|
@@ -17887,16 +17877,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17887
17877
|
|
|
17888
17878
|
// Parses import declaration.
|
|
17889
17879
|
|
|
17890
|
-
pp$
|
|
17880
|
+
pp$8.parseImport = function(node) {
|
|
17891
17881
|
this.next();
|
|
17892
17882
|
// import '...'
|
|
17893
|
-
if (this.type === types.string) {
|
|
17894
|
-
node.specifiers = empty;
|
|
17883
|
+
if (this.type === types$1.string) {
|
|
17884
|
+
node.specifiers = empty$1;
|
|
17895
17885
|
node.source = this.parseExprAtom();
|
|
17896
17886
|
} else {
|
|
17897
17887
|
node.specifiers = this.parseImportSpecifiers();
|
|
17898
17888
|
this.expectContextual("from");
|
|
17899
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17889
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17900
17890
|
}
|
|
17901
17891
|
this.semicolon();
|
|
17902
17892
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17904,17 +17894,17 @@ pp$1.parseImport = function(node) {
|
|
|
17904
17894
|
|
|
17905
17895
|
// Parses a comma-separated list of module imports.
|
|
17906
17896
|
|
|
17907
|
-
pp$
|
|
17897
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17908
17898
|
var nodes = [], first = true;
|
|
17909
|
-
if (this.type === types.name) {
|
|
17899
|
+
if (this.type === types$1.name) {
|
|
17910
17900
|
// import defaultObj, { x, y as z } from '...'
|
|
17911
17901
|
var node = this.startNode();
|
|
17912
17902
|
node.local = this.parseIdent();
|
|
17913
17903
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17914
17904
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17915
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17905
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17916
17906
|
}
|
|
17917
|
-
if (this.type === types.star) {
|
|
17907
|
+
if (this.type === types$1.star) {
|
|
17918
17908
|
var node$1 = this.startNode();
|
|
17919
17909
|
this.next();
|
|
17920
17910
|
this.expectContextual("as");
|
|
@@ -17923,11 +17913,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17923
17913
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17924
17914
|
return nodes
|
|
17925
17915
|
}
|
|
17926
|
-
this.expect(types.braceL);
|
|
17927
|
-
while (!this.eat(types.braceR)) {
|
|
17916
|
+
this.expect(types$1.braceL);
|
|
17917
|
+
while (!this.eat(types$1.braceR)) {
|
|
17928
17918
|
if (!first) {
|
|
17929
|
-
this.expect(types.comma);
|
|
17930
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17919
|
+
this.expect(types$1.comma);
|
|
17920
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17931
17921
|
} else { first = false; }
|
|
17932
17922
|
|
|
17933
17923
|
var node$2 = this.startNode();
|
|
@@ -17945,12 +17935,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17945
17935
|
};
|
|
17946
17936
|
|
|
17947
17937
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17948
|
-
pp$
|
|
17938
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17949
17939
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17950
17940
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17951
17941
|
}
|
|
17952
17942
|
};
|
|
17953
|
-
pp$
|
|
17943
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17954
17944
|
return (
|
|
17955
17945
|
statement.type === "ExpressionStatement" &&
|
|
17956
17946
|
statement.expression.type === "Literal" &&
|
|
@@ -17960,12 +17950,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17960
17950
|
)
|
|
17961
17951
|
};
|
|
17962
17952
|
|
|
17963
|
-
var pp$
|
|
17953
|
+
var pp$7 = Parser.prototype;
|
|
17964
17954
|
|
|
17965
17955
|
// Convert existing expression atom to assignable pattern
|
|
17966
17956
|
// if possible.
|
|
17967
17957
|
|
|
17968
|
-
pp$
|
|
17958
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17969
17959
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17970
17960
|
switch (node.type) {
|
|
17971
17961
|
case "Identifier":
|
|
@@ -18046,7 +18036,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
18046
18036
|
|
|
18047
18037
|
// Convert list of expression atoms to binding list.
|
|
18048
18038
|
|
|
18049
|
-
pp$
|
|
18039
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
18050
18040
|
var end = exprList.length;
|
|
18051
18041
|
for (var i = 0; i < end; i++) {
|
|
18052
18042
|
var elt = exprList[i];
|
|
@@ -18062,19 +18052,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
18062
18052
|
|
|
18063
18053
|
// Parses spread element.
|
|
18064
18054
|
|
|
18065
|
-
pp$
|
|
18055
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
18066
18056
|
var node = this.startNode();
|
|
18067
18057
|
this.next();
|
|
18068
18058
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
18069
18059
|
return this.finishNode(node, "SpreadElement")
|
|
18070
18060
|
};
|
|
18071
18061
|
|
|
18072
|
-
pp$
|
|
18062
|
+
pp$7.parseRestBinding = function() {
|
|
18073
18063
|
var node = this.startNode();
|
|
18074
18064
|
this.next();
|
|
18075
18065
|
|
|
18076
18066
|
// RestElement inside of a function parameter must be an identifier
|
|
18077
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
18067
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
18078
18068
|
{ this.unexpected(); }
|
|
18079
18069
|
|
|
18080
18070
|
node.argument = this.parseBindingAtom();
|
|
@@ -18084,36 +18074,36 @@ pp$2.parseRestBinding = function() {
|
|
|
18084
18074
|
|
|
18085
18075
|
// Parses lvalue (assignable) atom.
|
|
18086
18076
|
|
|
18087
|
-
pp$
|
|
18077
|
+
pp$7.parseBindingAtom = function() {
|
|
18088
18078
|
if (this.options.ecmaVersion >= 6) {
|
|
18089
18079
|
switch (this.type) {
|
|
18090
|
-
case types.bracketL:
|
|
18080
|
+
case types$1.bracketL:
|
|
18091
18081
|
var node = this.startNode();
|
|
18092
18082
|
this.next();
|
|
18093
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
18083
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
18094
18084
|
return this.finishNode(node, "ArrayPattern")
|
|
18095
18085
|
|
|
18096
|
-
case types.braceL:
|
|
18086
|
+
case types$1.braceL:
|
|
18097
18087
|
return this.parseObj(true)
|
|
18098
18088
|
}
|
|
18099
18089
|
}
|
|
18100
18090
|
return this.parseIdent()
|
|
18101
18091
|
};
|
|
18102
18092
|
|
|
18103
|
-
pp$
|
|
18093
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
18104
18094
|
var elts = [], first = true;
|
|
18105
18095
|
while (!this.eat(close)) {
|
|
18106
18096
|
if (first) { first = false; }
|
|
18107
|
-
else { this.expect(types.comma); }
|
|
18108
|
-
if (allowEmpty && this.type === types.comma) {
|
|
18097
|
+
else { this.expect(types$1.comma); }
|
|
18098
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
18109
18099
|
elts.push(null);
|
|
18110
18100
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
18111
18101
|
break
|
|
18112
|
-
} else if (this.type === types.ellipsis) {
|
|
18102
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18113
18103
|
var rest = this.parseRestBinding();
|
|
18114
18104
|
this.parseBindingListItem(rest);
|
|
18115
18105
|
elts.push(rest);
|
|
18116
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18106
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18117
18107
|
this.expect(close);
|
|
18118
18108
|
break
|
|
18119
18109
|
} else {
|
|
@@ -18125,15 +18115,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
18125
18115
|
return elts
|
|
18126
18116
|
};
|
|
18127
18117
|
|
|
18128
|
-
pp$
|
|
18118
|
+
pp$7.parseBindingListItem = function(param) {
|
|
18129
18119
|
return param
|
|
18130
18120
|
};
|
|
18131
18121
|
|
|
18132
18122
|
// Parses assignment pattern around given atom if possible.
|
|
18133
18123
|
|
|
18134
|
-
pp$
|
|
18124
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18135
18125
|
left = left || this.parseBindingAtom();
|
|
18136
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18126
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18137
18127
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18138
18128
|
node.left = left;
|
|
18139
18129
|
node.right = this.parseMaybeAssign();
|
|
@@ -18204,7 +18194,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18204
18194
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18205
18195
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18206
18196
|
|
|
18207
|
-
pp$
|
|
18197
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18208
18198
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18209
18199
|
|
|
18210
18200
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18242,7 +18232,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18242
18232
|
}
|
|
18243
18233
|
};
|
|
18244
18234
|
|
|
18245
|
-
pp$
|
|
18235
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18246
18236
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18247
18237
|
|
|
18248
18238
|
switch (expr.type) {
|
|
@@ -18267,7 +18257,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18267
18257
|
}
|
|
18268
18258
|
};
|
|
18269
18259
|
|
|
18270
|
-
pp$
|
|
18260
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18271
18261
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18272
18262
|
|
|
18273
18263
|
switch (expr.type) {
|
|
@@ -18299,7 +18289,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18299
18289
|
this.generator = !!generator;
|
|
18300
18290
|
};
|
|
18301
18291
|
|
|
18302
|
-
var types
|
|
18292
|
+
var types = {
|
|
18303
18293
|
b_stat: new TokContext("{", false),
|
|
18304
18294
|
b_expr: new TokContext("{", true),
|
|
18305
18295
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18312,38 +18302,38 @@ var types$1 = {
|
|
|
18312
18302
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18313
18303
|
};
|
|
18314
18304
|
|
|
18315
|
-
var pp$
|
|
18305
|
+
var pp$6 = Parser.prototype;
|
|
18316
18306
|
|
|
18317
|
-
pp$
|
|
18318
|
-
return [types
|
|
18307
|
+
pp$6.initialContext = function() {
|
|
18308
|
+
return [types.b_stat]
|
|
18319
18309
|
};
|
|
18320
18310
|
|
|
18321
|
-
pp$
|
|
18311
|
+
pp$6.curContext = function() {
|
|
18322
18312
|
return this.context[this.context.length - 1]
|
|
18323
18313
|
};
|
|
18324
18314
|
|
|
18325
|
-
pp$
|
|
18315
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18326
18316
|
var parent = this.curContext();
|
|
18327
|
-
if (parent === types
|
|
18317
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18328
18318
|
{ return true }
|
|
18329
|
-
if (prevType === types.colon && (parent === types
|
|
18319
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18330
18320
|
{ return !parent.isExpr }
|
|
18331
18321
|
|
|
18332
18322
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18333
18323
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18334
18324
|
// `tt.name`.
|
|
18335
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18325
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18336
18326
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
18337
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
18327
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18338
18328
|
{ return true }
|
|
18339
|
-
if (prevType === types.braceL)
|
|
18340
|
-
{ return parent === types
|
|
18341
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18329
|
+
if (prevType === types$1.braceL)
|
|
18330
|
+
{ return parent === types.b_stat }
|
|
18331
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18342
18332
|
{ return false }
|
|
18343
18333
|
return !this.exprAllowed
|
|
18344
18334
|
};
|
|
18345
18335
|
|
|
18346
|
-
pp$
|
|
18336
|
+
pp$6.inGeneratorContext = function() {
|
|
18347
18337
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18348
18338
|
var context = this.context[i];
|
|
18349
18339
|
if (context.token === "function")
|
|
@@ -18352,9 +18342,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18352
18342
|
return false
|
|
18353
18343
|
};
|
|
18354
18344
|
|
|
18355
|
-
pp$
|
|
18345
|
+
pp$6.updateContext = function(prevType) {
|
|
18356
18346
|
var update, type = this.type;
|
|
18357
|
-
if (type.keyword && prevType === types.dot)
|
|
18347
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18358
18348
|
{ this.exprAllowed = false; }
|
|
18359
18349
|
else if (update = type.updateContext)
|
|
18360
18350
|
{ update.call(this, prevType); }
|
|
@@ -18363,7 +18353,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18363
18353
|
};
|
|
18364
18354
|
|
|
18365
18355
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18366
|
-
pp$
|
|
18356
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18367
18357
|
if (this.curContext() !== tokenCtx) {
|
|
18368
18358
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18369
18359
|
}
|
|
@@ -18371,71 +18361,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18371
18361
|
|
|
18372
18362
|
// Token-specific context update code
|
|
18373
18363
|
|
|
18374
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18364
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18375
18365
|
if (this.context.length === 1) {
|
|
18376
18366
|
this.exprAllowed = true;
|
|
18377
18367
|
return
|
|
18378
18368
|
}
|
|
18379
18369
|
var out = this.context.pop();
|
|
18380
|
-
if (out === types
|
|
18370
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18381
18371
|
out = this.context.pop();
|
|
18382
18372
|
}
|
|
18383
18373
|
this.exprAllowed = !out.isExpr;
|
|
18384
18374
|
};
|
|
18385
18375
|
|
|
18386
|
-
types.braceL.updateContext = function(prevType) {
|
|
18387
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18376
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18377
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18388
18378
|
this.exprAllowed = true;
|
|
18389
18379
|
};
|
|
18390
18380
|
|
|
18391
|
-
types.dollarBraceL.updateContext = function() {
|
|
18392
|
-
this.context.push(types
|
|
18381
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18382
|
+
this.context.push(types.b_tmpl);
|
|
18393
18383
|
this.exprAllowed = true;
|
|
18394
18384
|
};
|
|
18395
18385
|
|
|
18396
|
-
types.parenL.updateContext = function(prevType) {
|
|
18397
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
18398
|
-
this.context.push(statementParens ? types
|
|
18386
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18387
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18388
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18399
18389
|
this.exprAllowed = true;
|
|
18400
18390
|
};
|
|
18401
18391
|
|
|
18402
|
-
types.incDec.updateContext = function() {
|
|
18392
|
+
types$1.incDec.updateContext = function() {
|
|
18403
18393
|
// tokExprAllowed stays unchanged
|
|
18404
18394
|
};
|
|
18405
18395
|
|
|
18406
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
18407
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
18408
|
-
!(prevType === types.semi && this.curContext() !== types
|
|
18409
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18410
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types
|
|
18411
|
-
{ this.context.push(types
|
|
18396
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18397
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18398
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18399
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18400
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18401
|
+
{ this.context.push(types.f_expr); }
|
|
18412
18402
|
else
|
|
18413
|
-
{ this.context.push(types
|
|
18403
|
+
{ this.context.push(types.f_stat); }
|
|
18414
18404
|
this.exprAllowed = false;
|
|
18415
18405
|
};
|
|
18416
18406
|
|
|
18417
|
-
types.backQuote.updateContext = function() {
|
|
18418
|
-
if (this.curContext() === types
|
|
18407
|
+
types$1.backQuote.updateContext = function() {
|
|
18408
|
+
if (this.curContext() === types.q_tmpl)
|
|
18419
18409
|
{ this.context.pop(); }
|
|
18420
18410
|
else
|
|
18421
|
-
{ this.context.push(types
|
|
18411
|
+
{ this.context.push(types.q_tmpl); }
|
|
18422
18412
|
this.exprAllowed = false;
|
|
18423
18413
|
};
|
|
18424
18414
|
|
|
18425
|
-
types.star.updateContext = function(prevType) {
|
|
18426
|
-
if (prevType === types._function) {
|
|
18415
|
+
types$1.star.updateContext = function(prevType) {
|
|
18416
|
+
if (prevType === types$1._function) {
|
|
18427
18417
|
var index = this.context.length - 1;
|
|
18428
|
-
if (this.context[index] === types
|
|
18429
|
-
{ this.context[index] = types
|
|
18418
|
+
if (this.context[index] === types.f_expr)
|
|
18419
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18430
18420
|
else
|
|
18431
|
-
{ this.context[index] = types
|
|
18421
|
+
{ this.context[index] = types.f_gen; }
|
|
18432
18422
|
}
|
|
18433
18423
|
this.exprAllowed = true;
|
|
18434
18424
|
};
|
|
18435
18425
|
|
|
18436
|
-
types.name.updateContext = function(prevType) {
|
|
18426
|
+
types$1.name.updateContext = function(prevType) {
|
|
18437
18427
|
var allowed = false;
|
|
18438
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18428
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18439
18429
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18440
18430
|
this.value === "yield" && this.inGeneratorContext())
|
|
18441
18431
|
{ allowed = true; }
|
|
@@ -18445,14 +18435,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18445
18435
|
|
|
18446
18436
|
// A recursive descent parser operates by defining functions for all
|
|
18447
18437
|
|
|
18448
|
-
var pp$
|
|
18438
|
+
var pp$5 = Parser.prototype;
|
|
18449
18439
|
|
|
18450
18440
|
// Check if property name clashes with already added.
|
|
18451
18441
|
// Object/class getters and setters are not allowed to clash —
|
|
18452
18442
|
// either with each other or with an init property — and in
|
|
18453
18443
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18454
18444
|
|
|
18455
|
-
pp$
|
|
18445
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18456
18446
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18457
18447
|
{ return }
|
|
18458
18448
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18469,10 +18459,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18469
18459
|
if (name === "__proto__" && kind === "init") {
|
|
18470
18460
|
if (propHash.proto) {
|
|
18471
18461
|
if (refDestructuringErrors) {
|
|
18472
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
} else {
|
|
18462
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18463
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18464
|
+
}
|
|
18465
|
+
} else {
|
|
18466
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18467
|
+
}
|
|
18476
18468
|
}
|
|
18477
18469
|
propHash.proto = true;
|
|
18478
18470
|
}
|
|
@@ -18514,13 +18506,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18514
18506
|
// and object pattern might appear (so it's possible to raise
|
|
18515
18507
|
// delayed syntax error at correct position).
|
|
18516
18508
|
|
|
18517
|
-
pp$
|
|
18509
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18518
18510
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18519
18511
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18520
|
-
if (this.type === types.comma) {
|
|
18512
|
+
if (this.type === types$1.comma) {
|
|
18521
18513
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18522
18514
|
node.expressions = [expr];
|
|
18523
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18515
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18524
18516
|
return this.finishNode(node, "SequenceExpression")
|
|
18525
18517
|
}
|
|
18526
18518
|
return expr
|
|
@@ -18529,7 +18521,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18529
18521
|
// Parse an assignment expression. This includes applications of
|
|
18530
18522
|
// operators like `+=`.
|
|
18531
18523
|
|
|
18532
|
-
pp$
|
|
18524
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18533
18525
|
if (this.isContextual("yield")) {
|
|
18534
18526
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18535
18527
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18537,10 +18529,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18537
18529
|
else { this.exprAllowed = false; }
|
|
18538
18530
|
}
|
|
18539
18531
|
|
|
18540
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18532
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18541
18533
|
if (refDestructuringErrors) {
|
|
18542
18534
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18543
18535
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18536
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18544
18537
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18545
18538
|
} else {
|
|
18546
18539
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18548,7 +18541,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18548
18541
|
}
|
|
18549
18542
|
|
|
18550
18543
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18551
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18544
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18552
18545
|
this.potentialArrowAt = this.start;
|
|
18553
18546
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18554
18547
|
}
|
|
@@ -18557,20 +18550,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18557
18550
|
if (this.type.isAssign) {
|
|
18558
18551
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18559
18552
|
node.operator = this.value;
|
|
18560
|
-
if (this.type === types.eq)
|
|
18553
|
+
if (this.type === types$1.eq)
|
|
18561
18554
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18562
18555
|
if (!ownDestructuringErrors) {
|
|
18563
18556
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18564
18557
|
}
|
|
18565
18558
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18566
18559
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18567
|
-
if (this.type === types.eq)
|
|
18560
|
+
if (this.type === types$1.eq)
|
|
18568
18561
|
{ this.checkLValPattern(left); }
|
|
18569
18562
|
else
|
|
18570
18563
|
{ this.checkLValSimple(left); }
|
|
18571
18564
|
node.left = left;
|
|
18572
18565
|
this.next();
|
|
18573
18566
|
node.right = this.parseMaybeAssign(forInit);
|
|
18567
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18574
18568
|
return this.finishNode(node, "AssignmentExpression")
|
|
18575
18569
|
} else {
|
|
18576
18570
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18582,15 +18576,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18582
18576
|
|
|
18583
18577
|
// Parse a ternary conditional (`?:`) operator.
|
|
18584
18578
|
|
|
18585
|
-
pp$
|
|
18579
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18586
18580
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18587
18581
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18588
18582
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18589
|
-
if (this.eat(types.question)) {
|
|
18583
|
+
if (this.eat(types$1.question)) {
|
|
18590
18584
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18591
18585
|
node.test = expr;
|
|
18592
18586
|
node.consequent = this.parseMaybeAssign();
|
|
18593
|
-
this.expect(types.colon);
|
|
18587
|
+
this.expect(types$1.colon);
|
|
18594
18588
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18595
18589
|
return this.finishNode(node, "ConditionalExpression")
|
|
18596
18590
|
}
|
|
@@ -18599,7 +18593,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18599
18593
|
|
|
18600
18594
|
// Start the precedence parser.
|
|
18601
18595
|
|
|
18602
|
-
pp$
|
|
18596
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18603
18597
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18604
18598
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18605
18599
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18612,23 +18606,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18612
18606
|
// defer further parser to one of its callers when it encounters an
|
|
18613
18607
|
// operator that has a lower precedence than the set it is parsing.
|
|
18614
18608
|
|
|
18615
|
-
pp$
|
|
18609
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18616
18610
|
var prec = this.type.binop;
|
|
18617
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18611
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18618
18612
|
if (prec > minPrec) {
|
|
18619
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18620
|
-
var coalesce = this.type === types.coalesce;
|
|
18613
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18614
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18621
18615
|
if (coalesce) {
|
|
18622
18616
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18623
18617
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18624
|
-
prec = types.logicalAND.binop;
|
|
18618
|
+
prec = types$1.logicalAND.binop;
|
|
18625
18619
|
}
|
|
18626
18620
|
var op = this.value;
|
|
18627
18621
|
this.next();
|
|
18628
18622
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18629
18623
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18630
18624
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
18631
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
18625
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18632
18626
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18633
18627
|
}
|
|
18634
18628
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18637,7 +18631,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18637
18631
|
return left
|
|
18638
18632
|
};
|
|
18639
18633
|
|
|
18640
|
-
pp$
|
|
18634
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18635
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18641
18636
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18642
18637
|
node.left = left;
|
|
18643
18638
|
node.operator = op;
|
|
@@ -18647,13 +18642,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18647
18642
|
|
|
18648
18643
|
// Parse unary operators, both prefix and postfix.
|
|
18649
18644
|
|
|
18650
|
-
pp$
|
|
18645
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18651
18646
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18652
18647
|
if (this.isContextual("await") && this.canAwait) {
|
|
18653
18648
|
expr = this.parseAwait(forInit);
|
|
18654
18649
|
sawUnary = true;
|
|
18655
18650
|
} else if (this.type.prefix) {
|
|
18656
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18651
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18657
18652
|
node.operator = this.value;
|
|
18658
18653
|
node.prefix = true;
|
|
18659
18654
|
this.next();
|
|
@@ -18667,6 +18662,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18667
18662
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18668
18663
|
else { sawUnary = true; }
|
|
18669
18664
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18665
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18666
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18667
|
+
expr = this.parsePrivateIdent();
|
|
18668
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18669
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18670
18670
|
} else {
|
|
18671
18671
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18672
18672
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18681,7 +18681,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18681
18681
|
}
|
|
18682
18682
|
}
|
|
18683
18683
|
|
|
18684
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18684
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18685
18685
|
if (sawUnary)
|
|
18686
18686
|
{ this.unexpected(this.lastTokStart); }
|
|
18687
18687
|
else
|
|
@@ -18700,7 +18700,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18700
18700
|
|
|
18701
18701
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18702
18702
|
|
|
18703
|
-
pp$
|
|
18703
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18704
18704
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18705
18705
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18706
18706
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18714,7 +18714,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18714
18714
|
return result
|
|
18715
18715
|
};
|
|
18716
18716
|
|
|
18717
|
-
pp$
|
|
18717
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18718
18718
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18719
18719
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18720
18720
|
this.potentialArrowAt === base.start;
|
|
@@ -18737,19 +18737,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18737
18737
|
}
|
|
18738
18738
|
};
|
|
18739
18739
|
|
|
18740
|
-
pp$
|
|
18740
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18741
18741
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18742
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18742
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18743
18743
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18744
18744
|
|
|
18745
|
-
var computed = this.eat(types.bracketL);
|
|
18746
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18745
|
+
var computed = this.eat(types$1.bracketL);
|
|
18746
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18747
18747
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18748
18748
|
node.object = base;
|
|
18749
18749
|
if (computed) {
|
|
18750
18750
|
node.property = this.parseExpression();
|
|
18751
|
-
this.expect(types.bracketR);
|
|
18752
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18751
|
+
this.expect(types$1.bracketR);
|
|
18752
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18753
18753
|
node.property = this.parsePrivateIdent();
|
|
18754
18754
|
} else {
|
|
18755
18755
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18759,13 +18759,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18759
18759
|
node.optional = optional;
|
|
18760
18760
|
}
|
|
18761
18761
|
base = this.finishNode(node, "MemberExpression");
|
|
18762
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18762
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18763
18763
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18764
18764
|
this.yieldPos = 0;
|
|
18765
18765
|
this.awaitPos = 0;
|
|
18766
18766
|
this.awaitIdentPos = 0;
|
|
18767
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18768
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18767
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18768
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18769
18769
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18770
18770
|
this.checkYieldAwaitInDefaultParams();
|
|
18771
18771
|
if (this.awaitIdentPos > 0)
|
|
@@ -18786,7 +18786,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18786
18786
|
node$1.optional = optional;
|
|
18787
18787
|
}
|
|
18788
18788
|
base = this.finishNode(node$1, "CallExpression");
|
|
18789
|
-
} else if (this.type === types.backQuote) {
|
|
18789
|
+
} else if (this.type === types$1.backQuote) {
|
|
18790
18790
|
if (optional || optionalChained) {
|
|
18791
18791
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18792
18792
|
}
|
|
@@ -18803,19 +18803,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18803
18803
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18804
18804
|
// or `{}`.
|
|
18805
18805
|
|
|
18806
|
-
pp$
|
|
18806
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18807
18807
|
// If a division operator appears in an expression position, the
|
|
18808
18808
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18809
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18809
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18810
18810
|
|
|
18811
18811
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18812
18812
|
switch (this.type) {
|
|
18813
|
-
case types._super:
|
|
18813
|
+
case types$1._super:
|
|
18814
18814
|
if (!this.allowSuper)
|
|
18815
18815
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18816
18816
|
node = this.startNode();
|
|
18817
18817
|
this.next();
|
|
18818
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18818
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18819
18819
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18820
18820
|
// The `super` keyword can appear at below:
|
|
18821
18821
|
// SuperProperty:
|
|
@@ -18823,52 +18823,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18823
18823
|
// super . IdentifierName
|
|
18824
18824
|
// SuperCall:
|
|
18825
18825
|
// super ( Arguments )
|
|
18826
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18826
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18827
18827
|
{ this.unexpected(); }
|
|
18828
18828
|
return this.finishNode(node, "Super")
|
|
18829
18829
|
|
|
18830
|
-
case types._this:
|
|
18830
|
+
case types$1._this:
|
|
18831
18831
|
node = this.startNode();
|
|
18832
18832
|
this.next();
|
|
18833
18833
|
return this.finishNode(node, "ThisExpression")
|
|
18834
18834
|
|
|
18835
|
-
case types.name:
|
|
18835
|
+
case types$1.name:
|
|
18836
18836
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18837
18837
|
var id = this.parseIdent(false);
|
|
18838
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
|
|
18839
|
-
this.overrideContext(types
|
|
18838
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18839
|
+
this.overrideContext(types.f_expr);
|
|
18840
18840
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18841
18841
|
}
|
|
18842
18842
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18843
|
-
if (this.eat(types.arrow))
|
|
18843
|
+
if (this.eat(types$1.arrow))
|
|
18844
18844
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18845
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18845
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18846
18846
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18847
18847
|
id = this.parseIdent(false);
|
|
18848
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18848
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18849
18849
|
{ this.unexpected(); }
|
|
18850
18850
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18851
18851
|
}
|
|
18852
18852
|
}
|
|
18853
18853
|
return id
|
|
18854
18854
|
|
|
18855
|
-
case types.regexp:
|
|
18855
|
+
case types$1.regexp:
|
|
18856
18856
|
var value = this.value;
|
|
18857
18857
|
node = this.parseLiteral(value.value);
|
|
18858
18858
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18859
18859
|
return node
|
|
18860
18860
|
|
|
18861
|
-
case types.num: case types.string:
|
|
18861
|
+
case types$1.num: case types$1.string:
|
|
18862
18862
|
return this.parseLiteral(this.value)
|
|
18863
18863
|
|
|
18864
|
-
case types._null: case types._true: case types._false:
|
|
18864
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18865
18865
|
node = this.startNode();
|
|
18866
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18866
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18867
18867
|
node.raw = this.type.keyword;
|
|
18868
18868
|
this.next();
|
|
18869
18869
|
return this.finishNode(node, "Literal")
|
|
18870
18870
|
|
|
18871
|
-
case types.parenL:
|
|
18871
|
+
case types$1.parenL:
|
|
18872
18872
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18873
18873
|
if (refDestructuringErrors) {
|
|
18874
18874
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18878,31 +18878,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18878
18878
|
}
|
|
18879
18879
|
return expr
|
|
18880
18880
|
|
|
18881
|
-
case types.bracketL:
|
|
18881
|
+
case types$1.bracketL:
|
|
18882
18882
|
node = this.startNode();
|
|
18883
18883
|
this.next();
|
|
18884
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18884
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18885
18885
|
return this.finishNode(node, "ArrayExpression")
|
|
18886
18886
|
|
|
18887
|
-
case types.braceL:
|
|
18888
|
-
this.overrideContext(types
|
|
18887
|
+
case types$1.braceL:
|
|
18888
|
+
this.overrideContext(types.b_expr);
|
|
18889
18889
|
return this.parseObj(false, refDestructuringErrors)
|
|
18890
18890
|
|
|
18891
|
-
case types._function:
|
|
18891
|
+
case types$1._function:
|
|
18892
18892
|
node = this.startNode();
|
|
18893
18893
|
this.next();
|
|
18894
18894
|
return this.parseFunction(node, 0)
|
|
18895
18895
|
|
|
18896
|
-
case types._class:
|
|
18896
|
+
case types$1._class:
|
|
18897
18897
|
return this.parseClass(this.startNode(), false)
|
|
18898
18898
|
|
|
18899
|
-
case types._new:
|
|
18899
|
+
case types$1._new:
|
|
18900
18900
|
return this.parseNew()
|
|
18901
18901
|
|
|
18902
|
-
case types.backQuote:
|
|
18902
|
+
case types$1.backQuote:
|
|
18903
18903
|
return this.parseTemplate()
|
|
18904
18904
|
|
|
18905
|
-
case types._import:
|
|
18905
|
+
case types$1._import:
|
|
18906
18906
|
if (this.options.ecmaVersion >= 11) {
|
|
18907
18907
|
return this.parseExprImport()
|
|
18908
18908
|
} else {
|
|
@@ -18914,7 +18914,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18914
18914
|
}
|
|
18915
18915
|
};
|
|
18916
18916
|
|
|
18917
|
-
pp$
|
|
18917
|
+
pp$5.parseExprImport = function() {
|
|
18918
18918
|
var node = this.startNode();
|
|
18919
18919
|
|
|
18920
18920
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18923,9 +18923,9 @@ pp$4.parseExprImport = function() {
|
|
|
18923
18923
|
var meta = this.parseIdent(true);
|
|
18924
18924
|
|
|
18925
18925
|
switch (this.type) {
|
|
18926
|
-
case types.parenL:
|
|
18926
|
+
case types$1.parenL:
|
|
18927
18927
|
return this.parseDynamicImport(node)
|
|
18928
|
-
case types.dot:
|
|
18928
|
+
case types$1.dot:
|
|
18929
18929
|
node.meta = meta;
|
|
18930
18930
|
return this.parseImportMeta(node)
|
|
18931
18931
|
default:
|
|
@@ -18933,16 +18933,16 @@ pp$4.parseExprImport = function() {
|
|
|
18933
18933
|
}
|
|
18934
18934
|
};
|
|
18935
18935
|
|
|
18936
|
-
pp$
|
|
18936
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18937
18937
|
this.next(); // skip `(`
|
|
18938
18938
|
|
|
18939
18939
|
// Parse node.source.
|
|
18940
18940
|
node.source = this.parseMaybeAssign();
|
|
18941
18941
|
|
|
18942
18942
|
// Verify ending.
|
|
18943
|
-
if (!this.eat(types.parenR)) {
|
|
18943
|
+
if (!this.eat(types$1.parenR)) {
|
|
18944
18944
|
var errorPos = this.start;
|
|
18945
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
18945
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18946
18946
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18947
18947
|
} else {
|
|
18948
18948
|
this.unexpected(errorPos);
|
|
@@ -18952,7 +18952,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18952
18952
|
return this.finishNode(node, "ImportExpression")
|
|
18953
18953
|
};
|
|
18954
18954
|
|
|
18955
|
-
pp$
|
|
18955
|
+
pp$5.parseImportMeta = function(node) {
|
|
18956
18956
|
this.next(); // skip `.`
|
|
18957
18957
|
|
|
18958
18958
|
var containsEsc = this.containsEsc;
|
|
@@ -18968,7 +18968,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18968
18968
|
return this.finishNode(node, "MetaProperty")
|
|
18969
18969
|
};
|
|
18970
18970
|
|
|
18971
|
-
pp$
|
|
18971
|
+
pp$5.parseLiteral = function(value) {
|
|
18972
18972
|
var node = this.startNode();
|
|
18973
18973
|
node.value = value;
|
|
18974
18974
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18977,14 +18977,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18977
18977
|
return this.finishNode(node, "Literal")
|
|
18978
18978
|
};
|
|
18979
18979
|
|
|
18980
|
-
pp$
|
|
18981
|
-
this.expect(types.parenL);
|
|
18980
|
+
pp$5.parseParenExpression = function() {
|
|
18981
|
+
this.expect(types$1.parenL);
|
|
18982
18982
|
var val = this.parseExpression();
|
|
18983
|
-
this.expect(types.parenR);
|
|
18983
|
+
this.expect(types$1.parenR);
|
|
18984
18984
|
return val
|
|
18985
18985
|
};
|
|
18986
18986
|
|
|
18987
|
-
pp$
|
|
18987
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18988
18988
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18989
18989
|
if (this.options.ecmaVersion >= 6) {
|
|
18990
18990
|
this.next();
|
|
@@ -18995,24 +18995,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18995
18995
|
this.yieldPos = 0;
|
|
18996
18996
|
this.awaitPos = 0;
|
|
18997
18997
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
18998
|
-
while (this.type !== types.parenR) {
|
|
18999
|
-
first ? first = false : this.expect(types.comma);
|
|
19000
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
18998
|
+
while (this.type !== types$1.parenR) {
|
|
18999
|
+
first ? first = false : this.expect(types$1.comma);
|
|
19000
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
19001
19001
|
lastIsComma = true;
|
|
19002
19002
|
break
|
|
19003
|
-
} else if (this.type === types.ellipsis) {
|
|
19003
|
+
} else if (this.type === types$1.ellipsis) {
|
|
19004
19004
|
spreadStart = this.start;
|
|
19005
19005
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
19006
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
19006
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
19007
19007
|
break
|
|
19008
19008
|
} else {
|
|
19009
19009
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
19010
19010
|
}
|
|
19011
19011
|
}
|
|
19012
19012
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
19013
|
-
this.expect(types.parenR);
|
|
19013
|
+
this.expect(types$1.parenR);
|
|
19014
19014
|
|
|
19015
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
19015
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
19016
19016
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
19017
19017
|
this.checkYieldAwaitInDefaultParams();
|
|
19018
19018
|
this.yieldPos = oldYieldPos;
|
|
@@ -19046,12 +19046,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
19046
19046
|
}
|
|
19047
19047
|
};
|
|
19048
19048
|
|
|
19049
|
-
pp$
|
|
19049
|
+
pp$5.parseParenItem = function(item) {
|
|
19050
19050
|
return item
|
|
19051
19051
|
};
|
|
19052
19052
|
|
|
19053
|
-
pp$
|
|
19054
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
19053
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
19054
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
19055
19055
|
};
|
|
19056
19056
|
|
|
19057
19057
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -19060,13 +19060,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
19060
19060
|
// argument to parseSubscripts to prevent it from consuming the
|
|
19061
19061
|
// argument list.
|
|
19062
19062
|
|
|
19063
|
-
var empty
|
|
19063
|
+
var empty = [];
|
|
19064
19064
|
|
|
19065
|
-
pp$
|
|
19065
|
+
pp$5.parseNew = function() {
|
|
19066
19066
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
19067
19067
|
var node = this.startNode();
|
|
19068
19068
|
var meta = this.parseIdent(true);
|
|
19069
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
19069
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
19070
19070
|
node.meta = meta;
|
|
19071
19071
|
var containsEsc = this.containsEsc;
|
|
19072
19072
|
node.property = this.parseIdent(true);
|
|
@@ -19078,23 +19078,23 @@ pp$4.parseNew = function() {
|
|
|
19078
19078
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
19079
19079
|
return this.finishNode(node, "MetaProperty")
|
|
19080
19080
|
}
|
|
19081
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
19081
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
19082
19082
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
19083
19083
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
19084
19084
|
this.raise(startPos, "Cannot use new with import()");
|
|
19085
19085
|
}
|
|
19086
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19087
|
-
else { node.arguments = empty
|
|
19086
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19087
|
+
else { node.arguments = empty; }
|
|
19088
19088
|
return this.finishNode(node, "NewExpression")
|
|
19089
19089
|
};
|
|
19090
19090
|
|
|
19091
19091
|
// Parse template expression.
|
|
19092
19092
|
|
|
19093
|
-
pp$
|
|
19093
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
19094
19094
|
var isTagged = ref.isTagged;
|
|
19095
19095
|
|
|
19096
19096
|
var elem = this.startNode();
|
|
19097
|
-
if (this.type === types.invalidTemplate) {
|
|
19097
|
+
if (this.type === types$1.invalidTemplate) {
|
|
19098
19098
|
if (!isTagged) {
|
|
19099
19099
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
19100
19100
|
}
|
|
@@ -19109,11 +19109,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
19109
19109
|
};
|
|
19110
19110
|
}
|
|
19111
19111
|
this.next();
|
|
19112
|
-
elem.tail = this.type === types.backQuote;
|
|
19112
|
+
elem.tail = this.type === types$1.backQuote;
|
|
19113
19113
|
return this.finishNode(elem, "TemplateElement")
|
|
19114
19114
|
};
|
|
19115
19115
|
|
|
19116
|
-
pp$
|
|
19116
|
+
pp$5.parseTemplate = function(ref) {
|
|
19117
19117
|
if ( ref === void 0 ) ref = {};
|
|
19118
19118
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
19119
19119
|
|
|
@@ -19123,32 +19123,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
19123
19123
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
19124
19124
|
node.quasis = [curElt];
|
|
19125
19125
|
while (!curElt.tail) {
|
|
19126
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19127
|
-
this.expect(types.dollarBraceL);
|
|
19126
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19127
|
+
this.expect(types$1.dollarBraceL);
|
|
19128
19128
|
node.expressions.push(this.parseExpression());
|
|
19129
|
-
this.expect(types.braceR);
|
|
19129
|
+
this.expect(types$1.braceR);
|
|
19130
19130
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19131
19131
|
}
|
|
19132
19132
|
this.next();
|
|
19133
19133
|
return this.finishNode(node, "TemplateLiteral")
|
|
19134
19134
|
};
|
|
19135
19135
|
|
|
19136
|
-
pp$
|
|
19136
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19137
19137
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
19138
|
-
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
|
|
19138
|
+
(this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
|
|
19139
19139
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19140
19140
|
};
|
|
19141
19141
|
|
|
19142
19142
|
// Parse an object literal or binding pattern.
|
|
19143
19143
|
|
|
19144
|
-
pp$
|
|
19144
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19145
19145
|
var node = this.startNode(), first = true, propHash = {};
|
|
19146
19146
|
node.properties = [];
|
|
19147
19147
|
this.next();
|
|
19148
|
-
while (!this.eat(types.braceR)) {
|
|
19148
|
+
while (!this.eat(types$1.braceR)) {
|
|
19149
19149
|
if (!first) {
|
|
19150
|
-
this.expect(types.comma);
|
|
19151
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19150
|
+
this.expect(types$1.comma);
|
|
19151
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19152
19152
|
} else { first = false; }
|
|
19153
19153
|
|
|
19154
19154
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19158,18 +19158,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19158
19158
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19159
19159
|
};
|
|
19160
19160
|
|
|
19161
|
-
pp$
|
|
19161
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19162
19162
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19163
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19163
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19164
19164
|
if (isPattern) {
|
|
19165
19165
|
prop.argument = this.parseIdent(false);
|
|
19166
|
-
if (this.type === types.comma) {
|
|
19166
|
+
if (this.type === types$1.comma) {
|
|
19167
19167
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19168
19168
|
}
|
|
19169
19169
|
return this.finishNode(prop, "RestElement")
|
|
19170
19170
|
}
|
|
19171
19171
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19172
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19172
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19173
19173
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19174
19174
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19175
19175
|
}
|
|
@@ -19180,7 +19180,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19180
19180
|
// Parse argument.
|
|
19181
19181
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19182
19182
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19183
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19183
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19184
19184
|
refDestructuringErrors.trailingComma = this.start;
|
|
19185
19185
|
}
|
|
19186
19186
|
// Finish
|
|
@@ -19194,13 +19194,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19194
19194
|
startLoc = this.startLoc;
|
|
19195
19195
|
}
|
|
19196
19196
|
if (!isPattern)
|
|
19197
|
-
{ isGenerator = this.eat(types.star); }
|
|
19197
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19198
19198
|
}
|
|
19199
19199
|
var containsEsc = this.containsEsc;
|
|
19200
19200
|
this.parsePropertyName(prop);
|
|
19201
19201
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19202
19202
|
isAsync = true;
|
|
19203
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19203
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19204
19204
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19205
19205
|
} else {
|
|
19206
19206
|
isAsync = false;
|
|
@@ -19209,14 +19209,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19209
19209
|
return this.finishNode(prop, "Property")
|
|
19210
19210
|
};
|
|
19211
19211
|
|
|
19212
|
-
pp$
|
|
19213
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19212
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19213
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19214
19214
|
{ this.unexpected(); }
|
|
19215
19215
|
|
|
19216
|
-
if (this.eat(types.colon)) {
|
|
19216
|
+
if (this.eat(types$1.colon)) {
|
|
19217
19217
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19218
19218
|
prop.kind = "init";
|
|
19219
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19219
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19220
19220
|
if (isPattern) { this.unexpected(); }
|
|
19221
19221
|
prop.kind = "init";
|
|
19222
19222
|
prop.method = true;
|
|
@@ -19224,7 +19224,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19224
19224
|
} else if (!isPattern && !containsEsc &&
|
|
19225
19225
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19226
19226
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19227
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19227
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19228
19228
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19229
19229
|
prop.kind = prop.key.name;
|
|
19230
19230
|
this.parsePropertyName(prop);
|
|
@@ -19248,7 +19248,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19248
19248
|
prop.kind = "init";
|
|
19249
19249
|
if (isPattern) {
|
|
19250
19250
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19251
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19251
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19252
19252
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19253
19253
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19254
19254
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19259,23 +19259,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19259
19259
|
} else { this.unexpected(); }
|
|
19260
19260
|
};
|
|
19261
19261
|
|
|
19262
|
-
pp$
|
|
19262
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19263
19263
|
if (this.options.ecmaVersion >= 6) {
|
|
19264
|
-
if (this.eat(types.bracketL)) {
|
|
19264
|
+
if (this.eat(types$1.bracketL)) {
|
|
19265
19265
|
prop.computed = true;
|
|
19266
19266
|
prop.key = this.parseMaybeAssign();
|
|
19267
|
-
this.expect(types.bracketR);
|
|
19267
|
+
this.expect(types$1.bracketR);
|
|
19268
19268
|
return prop.key
|
|
19269
19269
|
} else {
|
|
19270
19270
|
prop.computed = false;
|
|
19271
19271
|
}
|
|
19272
19272
|
}
|
|
19273
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19273
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19274
19274
|
};
|
|
19275
19275
|
|
|
19276
19276
|
// Initialize empty function node.
|
|
19277
19277
|
|
|
19278
|
-
pp$
|
|
19278
|
+
pp$5.initFunction = function(node) {
|
|
19279
19279
|
node.id = null;
|
|
19280
19280
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19281
19281
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19283,7 +19283,7 @@ pp$4.initFunction = function(node) {
|
|
|
19283
19283
|
|
|
19284
19284
|
// Parse object or class method.
|
|
19285
19285
|
|
|
19286
|
-
pp$
|
|
19286
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19287
19287
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19288
19288
|
|
|
19289
19289
|
this.initFunction(node);
|
|
@@ -19297,8 +19297,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19297
19297
|
this.awaitIdentPos = 0;
|
|
19298
19298
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19299
19299
|
|
|
19300
|
-
this.expect(types.parenL);
|
|
19301
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19300
|
+
this.expect(types$1.parenL);
|
|
19301
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19302
19302
|
this.checkYieldAwaitInDefaultParams();
|
|
19303
19303
|
this.parseFunctionBody(node, false, true, false);
|
|
19304
19304
|
|
|
@@ -19310,7 +19310,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19310
19310
|
|
|
19311
19311
|
// Parse arrow function expression with given parameters.
|
|
19312
19312
|
|
|
19313
|
-
pp$
|
|
19313
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19314
19314
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19315
19315
|
|
|
19316
19316
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19332,8 +19332,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19332
19332
|
|
|
19333
19333
|
// Parse function body and check parameters.
|
|
19334
19334
|
|
|
19335
|
-
pp$
|
|
19336
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19335
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19336
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19337
19337
|
var oldStrict = this.strict, useStrict = false;
|
|
19338
19338
|
|
|
19339
19339
|
if (isExpression) {
|
|
@@ -19369,7 +19369,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19369
19369
|
this.exitScope();
|
|
19370
19370
|
};
|
|
19371
19371
|
|
|
19372
|
-
pp$
|
|
19372
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19373
19373
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19374
19374
|
{
|
|
19375
19375
|
var param = list[i];
|
|
@@ -19382,7 +19382,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19382
19382
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19383
19383
|
// or "arguments" and duplicate parameters.
|
|
19384
19384
|
|
|
19385
|
-
pp$
|
|
19385
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19386
19386
|
var nameHash = Object.create(null);
|
|
19387
19387
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19388
19388
|
{
|
|
@@ -19398,20 +19398,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19398
19398
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19399
19399
|
// for array literals).
|
|
19400
19400
|
|
|
19401
|
-
pp$
|
|
19401
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19402
19402
|
var elts = [], first = true;
|
|
19403
19403
|
while (!this.eat(close)) {
|
|
19404
19404
|
if (!first) {
|
|
19405
|
-
this.expect(types.comma);
|
|
19405
|
+
this.expect(types$1.comma);
|
|
19406
19406
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19407
19407
|
} else { first = false; }
|
|
19408
19408
|
|
|
19409
19409
|
var elt = (void 0);
|
|
19410
|
-
if (allowEmpty && this.type === types.comma)
|
|
19410
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19411
19411
|
{ elt = null; }
|
|
19412
|
-
else if (this.type === types.ellipsis) {
|
|
19412
|
+
else if (this.type === types$1.ellipsis) {
|
|
19413
19413
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19414
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19414
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19415
19415
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19416
19416
|
} else {
|
|
19417
19417
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19421,7 +19421,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19421
19421
|
return elts
|
|
19422
19422
|
};
|
|
19423
19423
|
|
|
19424
|
-
pp$
|
|
19424
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19425
19425
|
var start = ref.start;
|
|
19426
19426
|
var end = ref.end;
|
|
19427
19427
|
var name = ref.name;
|
|
@@ -19450,9 +19450,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19450
19450
|
// when parsing properties), it will also convert keywords into
|
|
19451
19451
|
// identifiers.
|
|
19452
19452
|
|
|
19453
|
-
pp$
|
|
19453
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19454
19454
|
var node = this.startNode();
|
|
19455
|
-
if (this.type === types.name) {
|
|
19455
|
+
if (this.type === types$1.name) {
|
|
19456
19456
|
node.name = this.value;
|
|
19457
19457
|
} else if (this.type.keyword) {
|
|
19458
19458
|
node.name = this.type.keyword;
|
|
@@ -19478,9 +19478,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19478
19478
|
return node
|
|
19479
19479
|
};
|
|
19480
19480
|
|
|
19481
|
-
pp$
|
|
19481
|
+
pp$5.parsePrivateIdent = function() {
|
|
19482
19482
|
var node = this.startNode();
|
|
19483
|
-
if (this.type === types.privateId) {
|
|
19483
|
+
if (this.type === types$1.privateId) {
|
|
19484
19484
|
node.name = this.value;
|
|
19485
19485
|
} else {
|
|
19486
19486
|
this.unexpected();
|
|
@@ -19500,22 +19500,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19500
19500
|
|
|
19501
19501
|
// Parses yield expression inside generator.
|
|
19502
19502
|
|
|
19503
|
-
pp$
|
|
19503
|
+
pp$5.parseYield = function(forInit) {
|
|
19504
19504
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19505
19505
|
|
|
19506
19506
|
var node = this.startNode();
|
|
19507
19507
|
this.next();
|
|
19508
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19508
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19509
19509
|
node.delegate = false;
|
|
19510
19510
|
node.argument = null;
|
|
19511
19511
|
} else {
|
|
19512
|
-
node.delegate = this.eat(types.star);
|
|
19512
|
+
node.delegate = this.eat(types$1.star);
|
|
19513
19513
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19514
19514
|
}
|
|
19515
19515
|
return this.finishNode(node, "YieldExpression")
|
|
19516
19516
|
};
|
|
19517
19517
|
|
|
19518
|
-
pp$
|
|
19518
|
+
pp$5.parseAwait = function(forInit) {
|
|
19519
19519
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19520
19520
|
|
|
19521
19521
|
var node = this.startNode();
|
|
@@ -19524,7 +19524,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19524
19524
|
return this.finishNode(node, "AwaitExpression")
|
|
19525
19525
|
};
|
|
19526
19526
|
|
|
19527
|
-
var pp$
|
|
19527
|
+
var pp$4 = Parser.prototype;
|
|
19528
19528
|
|
|
19529
19529
|
// This function is used to raise exceptions on parse errors. It
|
|
19530
19530
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19532,7 +19532,7 @@ var pp$5 = Parser.prototype;
|
|
|
19532
19532
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19533
19533
|
// message.
|
|
19534
19534
|
|
|
19535
|
-
pp$
|
|
19535
|
+
pp$4.raise = function(pos, message) {
|
|
19536
19536
|
var loc = getLineInfo(this.input, pos);
|
|
19537
19537
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19538
19538
|
var err = new SyntaxError(message);
|
|
@@ -19540,15 +19540,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19540
19540
|
throw err
|
|
19541
19541
|
};
|
|
19542
19542
|
|
|
19543
|
-
pp$
|
|
19543
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19544
19544
|
|
|
19545
|
-
pp$
|
|
19545
|
+
pp$4.curPosition = function() {
|
|
19546
19546
|
if (this.options.locations) {
|
|
19547
19547
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19548
19548
|
}
|
|
19549
19549
|
};
|
|
19550
19550
|
|
|
19551
|
-
var pp$
|
|
19551
|
+
var pp$3 = Parser.prototype;
|
|
19552
19552
|
|
|
19553
19553
|
var Scope = function Scope(flags) {
|
|
19554
19554
|
this.flags = flags;
|
|
@@ -19564,22 +19564,22 @@ var Scope = function Scope(flags) {
|
|
|
19564
19564
|
|
|
19565
19565
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19566
19566
|
|
|
19567
|
-
pp$
|
|
19567
|
+
pp$3.enterScope = function(flags) {
|
|
19568
19568
|
this.scopeStack.push(new Scope(flags));
|
|
19569
19569
|
};
|
|
19570
19570
|
|
|
19571
|
-
pp$
|
|
19571
|
+
pp$3.exitScope = function() {
|
|
19572
19572
|
this.scopeStack.pop();
|
|
19573
19573
|
};
|
|
19574
19574
|
|
|
19575
19575
|
// The spec says:
|
|
19576
19576
|
// > At the top level of a function, or script, function declarations are
|
|
19577
19577
|
// > treated like var declarations rather than like lexical declarations.
|
|
19578
|
-
pp$
|
|
19578
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19579
19579
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19580
19580
|
};
|
|
19581
19581
|
|
|
19582
|
-
pp$
|
|
19582
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19583
19583
|
var redeclared = false;
|
|
19584
19584
|
if (bindingType === BIND_LEXICAL) {
|
|
19585
19585
|
var scope = this.currentScope();
|
|
@@ -19614,7 +19614,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19614
19614
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19615
19615
|
};
|
|
19616
19616
|
|
|
19617
|
-
pp$
|
|
19617
|
+
pp$3.checkLocalExport = function(id) {
|
|
19618
19618
|
// scope.functions must be empty as Module code is always strict.
|
|
19619
19619
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19620
19620
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19622,11 +19622,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19622
19622
|
}
|
|
19623
19623
|
};
|
|
19624
19624
|
|
|
19625
|
-
pp$
|
|
19625
|
+
pp$3.currentScope = function() {
|
|
19626
19626
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19627
19627
|
};
|
|
19628
19628
|
|
|
19629
|
-
pp$
|
|
19629
|
+
pp$3.currentVarScope = function() {
|
|
19630
19630
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19631
19631
|
var scope = this.scopeStack[i];
|
|
19632
19632
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19634,7 +19634,7 @@ pp$6.currentVarScope = function() {
|
|
|
19634
19634
|
};
|
|
19635
19635
|
|
|
19636
19636
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19637
|
-
pp$
|
|
19637
|
+
pp$3.currentThisScope = function() {
|
|
19638
19638
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19639
19639
|
var scope = this.scopeStack[i];
|
|
19640
19640
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19655,13 +19655,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19655
19655
|
|
|
19656
19656
|
// Start an AST node, attaching a start offset.
|
|
19657
19657
|
|
|
19658
|
-
var pp$
|
|
19658
|
+
var pp$2 = Parser.prototype;
|
|
19659
19659
|
|
|
19660
|
-
pp$
|
|
19660
|
+
pp$2.startNode = function() {
|
|
19661
19661
|
return new Node(this, this.start, this.startLoc)
|
|
19662
19662
|
};
|
|
19663
19663
|
|
|
19664
|
-
pp$
|
|
19664
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19665
19665
|
return new Node(this, pos, loc)
|
|
19666
19666
|
};
|
|
19667
19667
|
|
|
@@ -19677,17 +19677,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19677
19677
|
return node
|
|
19678
19678
|
}
|
|
19679
19679
|
|
|
19680
|
-
pp$
|
|
19680
|
+
pp$2.finishNode = function(node, type) {
|
|
19681
19681
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19682
19682
|
};
|
|
19683
19683
|
|
|
19684
19684
|
// Finish node at given position
|
|
19685
19685
|
|
|
19686
|
-
pp$
|
|
19686
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19687
19687
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19688
19688
|
};
|
|
19689
19689
|
|
|
19690
|
-
pp$
|
|
19690
|
+
pp$2.copyNode = function(node) {
|
|
19691
19691
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19692
19692
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19693
19693
|
return newNode
|
|
@@ -19744,7 +19744,7 @@ buildUnicodeData(10);
|
|
|
19744
19744
|
buildUnicodeData(11);
|
|
19745
19745
|
buildUnicodeData(12);
|
|
19746
19746
|
|
|
19747
|
-
var pp$
|
|
19747
|
+
var pp$1 = Parser.prototype;
|
|
19748
19748
|
|
|
19749
19749
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19750
19750
|
this.parser = parser;
|
|
@@ -19840,7 +19840,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19840
19840
|
return false
|
|
19841
19841
|
};
|
|
19842
19842
|
|
|
19843
|
-
function codePointToString(ch) {
|
|
19843
|
+
function codePointToString$1(ch) {
|
|
19844
19844
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19845
19845
|
ch -= 0x10000;
|
|
19846
19846
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19852,7 +19852,7 @@ function codePointToString(ch) {
|
|
|
19852
19852
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19853
19853
|
* @returns {void}
|
|
19854
19854
|
*/
|
|
19855
|
-
pp$
|
|
19855
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19856
19856
|
var validFlags = state.validFlags;
|
|
19857
19857
|
var flags = state.flags;
|
|
19858
19858
|
|
|
@@ -19873,7 +19873,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19873
19873
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19874
19874
|
* @returns {void}
|
|
19875
19875
|
*/
|
|
19876
|
-
pp$
|
|
19876
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19877
19877
|
this.regexp_pattern(state);
|
|
19878
19878
|
|
|
19879
19879
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19888,7 +19888,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19888
19888
|
};
|
|
19889
19889
|
|
|
19890
19890
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19891
|
-
pp$
|
|
19891
|
+
pp$1.regexp_pattern = function(state) {
|
|
19892
19892
|
state.pos = 0;
|
|
19893
19893
|
state.lastIntValue = 0;
|
|
19894
19894
|
state.lastStringValue = "";
|
|
@@ -19922,7 +19922,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19922
19922
|
};
|
|
19923
19923
|
|
|
19924
19924
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19925
|
-
pp$
|
|
19925
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19926
19926
|
this.regexp_alternative(state);
|
|
19927
19927
|
while (state.eat(0x7C /* | */)) {
|
|
19928
19928
|
this.regexp_alternative(state);
|
|
@@ -19938,13 +19938,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19938
19938
|
};
|
|
19939
19939
|
|
|
19940
19940
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19941
|
-
pp$
|
|
19941
|
+
pp$1.regexp_alternative = function(state) {
|
|
19942
19942
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19943
19943
|
{ }
|
|
19944
19944
|
};
|
|
19945
19945
|
|
|
19946
19946
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19947
|
-
pp$
|
|
19947
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19948
19948
|
if (this.regexp_eatAssertion(state)) {
|
|
19949
19949
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19950
19950
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19967,7 +19967,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19967
19967
|
};
|
|
19968
19968
|
|
|
19969
19969
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19970
|
-
pp$
|
|
19970
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19971
19971
|
var start = state.pos;
|
|
19972
19972
|
state.lastAssertionIsQuantifiable = false;
|
|
19973
19973
|
|
|
@@ -20005,7 +20005,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
20005
20005
|
};
|
|
20006
20006
|
|
|
20007
20007
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
20008
|
-
pp$
|
|
20008
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
20009
20009
|
if ( noError === void 0 ) noError = false;
|
|
20010
20010
|
|
|
20011
20011
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -20016,7 +20016,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
20016
20016
|
};
|
|
20017
20017
|
|
|
20018
20018
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
20019
|
-
pp$
|
|
20019
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
20020
20020
|
return (
|
|
20021
20021
|
state.eat(0x2A /* * */) ||
|
|
20022
20022
|
state.eat(0x2B /* + */) ||
|
|
@@ -20024,7 +20024,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
20024
20024
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
20025
20025
|
)
|
|
20026
20026
|
};
|
|
20027
|
-
pp$
|
|
20027
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
20028
20028
|
var start = state.pos;
|
|
20029
20029
|
if (state.eat(0x7B /* { */)) {
|
|
20030
20030
|
var min = 0, max = -1;
|
|
@@ -20050,7 +20050,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
20050
20050
|
};
|
|
20051
20051
|
|
|
20052
20052
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
20053
|
-
pp$
|
|
20053
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
20054
20054
|
return (
|
|
20055
20055
|
this.regexp_eatPatternCharacters(state) ||
|
|
20056
20056
|
state.eat(0x2E /* . */) ||
|
|
@@ -20060,7 +20060,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
20060
20060
|
this.regexp_eatCapturingGroup(state)
|
|
20061
20061
|
)
|
|
20062
20062
|
};
|
|
20063
|
-
pp$
|
|
20063
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
20064
20064
|
var start = state.pos;
|
|
20065
20065
|
if (state.eat(0x5C /* \ */)) {
|
|
20066
20066
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -20070,7 +20070,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
20070
20070
|
}
|
|
20071
20071
|
return false
|
|
20072
20072
|
};
|
|
20073
|
-
pp$
|
|
20073
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
20074
20074
|
var start = state.pos;
|
|
20075
20075
|
if (state.eat(0x28 /* ( */)) {
|
|
20076
20076
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -20084,7 +20084,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
20084
20084
|
}
|
|
20085
20085
|
return false
|
|
20086
20086
|
};
|
|
20087
|
-
pp$
|
|
20087
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
20088
20088
|
if (state.eat(0x28 /* ( */)) {
|
|
20089
20089
|
if (this.options.ecmaVersion >= 9) {
|
|
20090
20090
|
this.regexp_groupSpecifier(state);
|
|
@@ -20102,7 +20102,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
20102
20102
|
};
|
|
20103
20103
|
|
|
20104
20104
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
20105
|
-
pp$
|
|
20105
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
20106
20106
|
return (
|
|
20107
20107
|
state.eat(0x2E /* . */) ||
|
|
20108
20108
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -20115,7 +20115,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
20115
20115
|
};
|
|
20116
20116
|
|
|
20117
20117
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
20118
|
-
pp$
|
|
20118
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
20119
20119
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
20120
20120
|
state.raise("Nothing to repeat");
|
|
20121
20121
|
}
|
|
@@ -20123,7 +20123,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
20123
20123
|
};
|
|
20124
20124
|
|
|
20125
20125
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
20126
|
-
pp$
|
|
20126
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
20127
20127
|
var ch = state.current();
|
|
20128
20128
|
if (isSyntaxCharacter(ch)) {
|
|
20129
20129
|
state.lastIntValue = ch;
|
|
@@ -20145,7 +20145,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20145
20145
|
|
|
20146
20146
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20147
20147
|
// But eat eager.
|
|
20148
|
-
pp$
|
|
20148
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20149
20149
|
var start = state.pos;
|
|
20150
20150
|
var ch = 0;
|
|
20151
20151
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20155,7 +20155,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20155
20155
|
};
|
|
20156
20156
|
|
|
20157
20157
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20158
|
-
pp$
|
|
20158
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20159
20159
|
var ch = state.current();
|
|
20160
20160
|
if (
|
|
20161
20161
|
ch !== -1 &&
|
|
@@ -20176,7 +20176,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20176
20176
|
// GroupSpecifier ::
|
|
20177
20177
|
// [empty]
|
|
20178
20178
|
// `?` GroupName
|
|
20179
|
-
pp$
|
|
20179
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20180
20180
|
if (state.eat(0x3F /* ? */)) {
|
|
20181
20181
|
if (this.regexp_eatGroupName(state)) {
|
|
20182
20182
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20192,7 +20192,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20192
20192
|
// GroupName ::
|
|
20193
20193
|
// `<` RegExpIdentifierName `>`
|
|
20194
20194
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20195
|
-
pp$
|
|
20195
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20196
20196
|
state.lastStringValue = "";
|
|
20197
20197
|
if (state.eat(0x3C /* < */)) {
|
|
20198
20198
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20207,12 +20207,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20207
20207
|
// RegExpIdentifierStart
|
|
20208
20208
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20209
20209
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20210
|
-
pp$
|
|
20210
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20211
20211
|
state.lastStringValue = "";
|
|
20212
20212
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20213
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20213
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20214
20214
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20215
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20215
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20216
20216
|
}
|
|
20217
20217
|
return true
|
|
20218
20218
|
}
|
|
@@ -20224,7 +20224,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20224
20224
|
// `$`
|
|
20225
20225
|
// `_`
|
|
20226
20226
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20227
|
-
pp$
|
|
20227
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20228
20228
|
var start = state.pos;
|
|
20229
20229
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20230
20230
|
var ch = state.current(forceU);
|
|
@@ -20252,7 +20252,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20252
20252
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20253
20253
|
// <ZWNJ>
|
|
20254
20254
|
// <ZWJ>
|
|
20255
|
-
pp$
|
|
20255
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20256
20256
|
var start = state.pos;
|
|
20257
20257
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20258
20258
|
var ch = state.current(forceU);
|
|
@@ -20274,7 +20274,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20274
20274
|
}
|
|
20275
20275
|
|
|
20276
20276
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20277
|
-
pp$
|
|
20277
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20278
20278
|
if (
|
|
20279
20279
|
this.regexp_eatBackReference(state) ||
|
|
20280
20280
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20292,7 +20292,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20292
20292
|
}
|
|
20293
20293
|
return false
|
|
20294
20294
|
};
|
|
20295
|
-
pp$
|
|
20295
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20296
20296
|
var start = state.pos;
|
|
20297
20297
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20298
20298
|
var n = state.lastIntValue;
|
|
@@ -20310,7 +20310,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20310
20310
|
}
|
|
20311
20311
|
return false
|
|
20312
20312
|
};
|
|
20313
|
-
pp$
|
|
20313
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20314
20314
|
if (state.eat(0x6B /* k */)) {
|
|
20315
20315
|
if (this.regexp_eatGroupName(state)) {
|
|
20316
20316
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20322,7 +20322,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20322
20322
|
};
|
|
20323
20323
|
|
|
20324
20324
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20325
|
-
pp$
|
|
20325
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20326
20326
|
return (
|
|
20327
20327
|
this.regexp_eatControlEscape(state) ||
|
|
20328
20328
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20333,7 +20333,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20333
20333
|
this.regexp_eatIdentityEscape(state)
|
|
20334
20334
|
)
|
|
20335
20335
|
};
|
|
20336
|
-
pp$
|
|
20336
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20337
20337
|
var start = state.pos;
|
|
20338
20338
|
if (state.eat(0x63 /* c */)) {
|
|
20339
20339
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20343,7 +20343,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20343
20343
|
}
|
|
20344
20344
|
return false
|
|
20345
20345
|
};
|
|
20346
|
-
pp$
|
|
20346
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20347
20347
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20348
20348
|
state.lastIntValue = 0;
|
|
20349
20349
|
state.advance();
|
|
@@ -20353,7 +20353,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20353
20353
|
};
|
|
20354
20354
|
|
|
20355
20355
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20356
|
-
pp$
|
|
20356
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20357
20357
|
var ch = state.current();
|
|
20358
20358
|
if (ch === 0x74 /* t */) {
|
|
20359
20359
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20384,7 +20384,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20384
20384
|
};
|
|
20385
20385
|
|
|
20386
20386
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20387
|
-
pp$
|
|
20387
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20388
20388
|
var ch = state.current();
|
|
20389
20389
|
if (isControlLetter(ch)) {
|
|
20390
20390
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20401,7 +20401,7 @@ function isControlLetter(ch) {
|
|
|
20401
20401
|
}
|
|
20402
20402
|
|
|
20403
20403
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20404
|
-
pp$
|
|
20404
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20405
20405
|
if ( forceU === void 0 ) forceU = false;
|
|
20406
20406
|
|
|
20407
20407
|
var start = state.pos;
|
|
@@ -20446,7 +20446,7 @@ function isValidUnicode(ch) {
|
|
|
20446
20446
|
}
|
|
20447
20447
|
|
|
20448
20448
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20449
|
-
pp$
|
|
20449
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20450
20450
|
if (state.switchU) {
|
|
20451
20451
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20452
20452
|
return true
|
|
@@ -20469,7 +20469,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20469
20469
|
};
|
|
20470
20470
|
|
|
20471
20471
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20472
|
-
pp$
|
|
20472
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20473
20473
|
state.lastIntValue = 0;
|
|
20474
20474
|
var ch = state.current();
|
|
20475
20475
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20483,7 +20483,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20483
20483
|
};
|
|
20484
20484
|
|
|
20485
20485
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20486
|
-
pp$
|
|
20486
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20487
20487
|
var ch = state.current();
|
|
20488
20488
|
|
|
20489
20489
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20525,7 +20525,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20525
20525
|
// UnicodePropertyValueExpression ::
|
|
20526
20526
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20527
20527
|
// LoneUnicodePropertyNameOrValue
|
|
20528
|
-
pp$
|
|
20528
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20529
20529
|
var start = state.pos;
|
|
20530
20530
|
|
|
20531
20531
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20547,24 +20547,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20547
20547
|
}
|
|
20548
20548
|
return false
|
|
20549
20549
|
};
|
|
20550
|
-
pp$
|
|
20550
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20551
20551
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20552
20552
|
{ state.raise("Invalid property name"); }
|
|
20553
20553
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20554
20554
|
{ state.raise("Invalid property value"); }
|
|
20555
20555
|
};
|
|
20556
|
-
pp$
|
|
20556
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20557
20557
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20558
20558
|
{ state.raise("Invalid property name"); }
|
|
20559
20559
|
};
|
|
20560
20560
|
|
|
20561
20561
|
// UnicodePropertyName ::
|
|
20562
20562
|
// UnicodePropertyNameCharacters
|
|
20563
|
-
pp$
|
|
20563
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20564
20564
|
var ch = 0;
|
|
20565
20565
|
state.lastStringValue = "";
|
|
20566
20566
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20567
|
-
state.lastStringValue += codePointToString(ch);
|
|
20567
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20568
20568
|
state.advance();
|
|
20569
20569
|
}
|
|
20570
20570
|
return state.lastStringValue !== ""
|
|
@@ -20575,11 +20575,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20575
20575
|
|
|
20576
20576
|
// UnicodePropertyValue ::
|
|
20577
20577
|
// UnicodePropertyValueCharacters
|
|
20578
|
-
pp$
|
|
20578
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20579
20579
|
var ch = 0;
|
|
20580
20580
|
state.lastStringValue = "";
|
|
20581
20581
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20582
|
-
state.lastStringValue += codePointToString(ch);
|
|
20582
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20583
20583
|
state.advance();
|
|
20584
20584
|
}
|
|
20585
20585
|
return state.lastStringValue !== ""
|
|
@@ -20590,12 +20590,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20590
20590
|
|
|
20591
20591
|
// LoneUnicodePropertyNameOrValue ::
|
|
20592
20592
|
// UnicodePropertyValueCharacters
|
|
20593
|
-
pp$
|
|
20593
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20594
20594
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20595
20595
|
};
|
|
20596
20596
|
|
|
20597
20597
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20598
|
-
pp$
|
|
20598
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20599
20599
|
if (state.eat(0x5B /* [ */)) {
|
|
20600
20600
|
state.eat(0x5E /* ^ */);
|
|
20601
20601
|
this.regexp_classRanges(state);
|
|
@@ -20611,7 +20611,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20611
20611
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20612
20612
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20613
20613
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20614
|
-
pp$
|
|
20614
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20615
20615
|
while (this.regexp_eatClassAtom(state)) {
|
|
20616
20616
|
var left = state.lastIntValue;
|
|
20617
20617
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20628,7 +20628,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20628
20628
|
|
|
20629
20629
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20630
20630
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20631
|
-
pp$
|
|
20631
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20632
20632
|
var start = state.pos;
|
|
20633
20633
|
|
|
20634
20634
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20657,7 +20657,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20657
20657
|
};
|
|
20658
20658
|
|
|
20659
20659
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20660
|
-
pp$
|
|
20660
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20661
20661
|
var start = state.pos;
|
|
20662
20662
|
|
|
20663
20663
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20684,7 +20684,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20684
20684
|
};
|
|
20685
20685
|
|
|
20686
20686
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20687
|
-
pp$
|
|
20687
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20688
20688
|
var ch = state.current();
|
|
20689
20689
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20690
20690
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20695,7 +20695,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20695
20695
|
};
|
|
20696
20696
|
|
|
20697
20697
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20698
|
-
pp$
|
|
20698
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20699
20699
|
var start = state.pos;
|
|
20700
20700
|
if (state.eat(0x78 /* x */)) {
|
|
20701
20701
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20710,7 +20710,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20710
20710
|
};
|
|
20711
20711
|
|
|
20712
20712
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20713
|
-
pp$
|
|
20713
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20714
20714
|
var start = state.pos;
|
|
20715
20715
|
var ch = 0;
|
|
20716
20716
|
state.lastIntValue = 0;
|
|
@@ -20725,7 +20725,7 @@ function isDecimalDigit(ch) {
|
|
|
20725
20725
|
}
|
|
20726
20726
|
|
|
20727
20727
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20728
|
-
pp$
|
|
20728
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20729
20729
|
var start = state.pos;
|
|
20730
20730
|
var ch = 0;
|
|
20731
20731
|
state.lastIntValue = 0;
|
|
@@ -20754,7 +20754,7 @@ function hexToInt(ch) {
|
|
|
20754
20754
|
|
|
20755
20755
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20756
20756
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20757
|
-
pp$
|
|
20757
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20758
20758
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20759
20759
|
var n1 = state.lastIntValue;
|
|
20760
20760
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20773,7 +20773,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20773
20773
|
};
|
|
20774
20774
|
|
|
20775
20775
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20776
|
-
pp$
|
|
20776
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20777
20777
|
var ch = state.current();
|
|
20778
20778
|
if (isOctalDigit(ch)) {
|
|
20779
20779
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20790,7 +20790,7 @@ function isOctalDigit(ch) {
|
|
|
20790
20790
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20791
20791
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20792
20792
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20793
|
-
pp$
|
|
20793
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20794
20794
|
var start = state.pos;
|
|
20795
20795
|
state.lastIntValue = 0;
|
|
20796
20796
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20822,11 +20822,11 @@ var Token = function Token(p) {
|
|
|
20822
20822
|
|
|
20823
20823
|
// ## Tokenizer
|
|
20824
20824
|
|
|
20825
|
-
var pp
|
|
20825
|
+
var pp = Parser.prototype;
|
|
20826
20826
|
|
|
20827
20827
|
// Move to the next token
|
|
20828
20828
|
|
|
20829
|
-
pp
|
|
20829
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20830
20830
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20831
20831
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20832
20832
|
if (this.options.onToken)
|
|
@@ -20839,21 +20839,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20839
20839
|
this.nextToken();
|
|
20840
20840
|
};
|
|
20841
20841
|
|
|
20842
|
-
pp
|
|
20842
|
+
pp.getToken = function() {
|
|
20843
20843
|
this.next();
|
|
20844
20844
|
return new Token(this)
|
|
20845
20845
|
};
|
|
20846
20846
|
|
|
20847
20847
|
// If we're in an ES6 environment, make parsers iterable
|
|
20848
20848
|
if (typeof Symbol !== "undefined")
|
|
20849
|
-
{ pp
|
|
20849
|
+
{ pp[Symbol.iterator] = function() {
|
|
20850
20850
|
var this$1$1 = this;
|
|
20851
20851
|
|
|
20852
20852
|
return {
|
|
20853
20853
|
next: function () {
|
|
20854
20854
|
var token = this$1$1.getToken();
|
|
20855
20855
|
return {
|
|
20856
|
-
done: token.type === types.eof,
|
|
20856
|
+
done: token.type === types$1.eof,
|
|
20857
20857
|
value: token
|
|
20858
20858
|
}
|
|
20859
20859
|
}
|
|
@@ -20866,19 +20866,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20866
20866
|
// Read a single token, updating the parser object's token-related
|
|
20867
20867
|
// properties.
|
|
20868
20868
|
|
|
20869
|
-
pp
|
|
20869
|
+
pp.nextToken = function() {
|
|
20870
20870
|
var curContext = this.curContext();
|
|
20871
20871
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20872
20872
|
|
|
20873
20873
|
this.start = this.pos;
|
|
20874
20874
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20875
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20875
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20876
20876
|
|
|
20877
20877
|
if (curContext.override) { return curContext.override(this) }
|
|
20878
20878
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20879
20879
|
};
|
|
20880
20880
|
|
|
20881
|
-
pp
|
|
20881
|
+
pp.readToken = function(code) {
|
|
20882
20882
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20883
20883
|
// identifiers, so '\' also dispatches to that.
|
|
20884
20884
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20887,14 +20887,14 @@ pp$9.readToken = function(code) {
|
|
|
20887
20887
|
return this.getTokenFromCode(code)
|
|
20888
20888
|
};
|
|
20889
20889
|
|
|
20890
|
-
pp
|
|
20890
|
+
pp.fullCharCodeAtPos = function() {
|
|
20891
20891
|
var code = this.input.charCodeAt(this.pos);
|
|
20892
20892
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20893
20893
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20894
20894
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20895
20895
|
};
|
|
20896
20896
|
|
|
20897
|
-
pp
|
|
20897
|
+
pp.skipBlockComment = function() {
|
|
20898
20898
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20899
20899
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20900
20900
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20912,7 +20912,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20912
20912
|
startLoc, this.curPosition()); }
|
|
20913
20913
|
};
|
|
20914
20914
|
|
|
20915
|
-
pp
|
|
20915
|
+
pp.skipLineComment = function(startSkip) {
|
|
20916
20916
|
var start = this.pos;
|
|
20917
20917
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20918
20918
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20927,7 +20927,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20927
20927
|
// Called at the start of the parse and after every token. Skips
|
|
20928
20928
|
// whitespace and comments, and.
|
|
20929
20929
|
|
|
20930
|
-
pp
|
|
20930
|
+
pp.skipSpace = function() {
|
|
20931
20931
|
loop: while (this.pos < this.input.length) {
|
|
20932
20932
|
var ch = this.input.charCodeAt(this.pos);
|
|
20933
20933
|
switch (ch) {
|
|
@@ -20972,7 +20972,7 @@ pp$9.skipSpace = function() {
|
|
|
20972
20972
|
// the token, so that the next one's `start` will point at the
|
|
20973
20973
|
// right position.
|
|
20974
20974
|
|
|
20975
|
-
pp
|
|
20975
|
+
pp.finishToken = function(type, val) {
|
|
20976
20976
|
this.end = this.pos;
|
|
20977
20977
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20978
20978
|
var prevType = this.type;
|
|
@@ -20991,62 +20991,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
20991
20991
|
//
|
|
20992
20992
|
// All in the name of speed.
|
|
20993
20993
|
//
|
|
20994
|
-
pp
|
|
20994
|
+
pp.readToken_dot = function() {
|
|
20995
20995
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20996
20996
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
20997
20997
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20998
20998
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
20999
20999
|
this.pos += 3;
|
|
21000
|
-
return this.finishToken(types.ellipsis)
|
|
21000
|
+
return this.finishToken(types$1.ellipsis)
|
|
21001
21001
|
} else {
|
|
21002
21002
|
++this.pos;
|
|
21003
|
-
return this.finishToken(types.dot)
|
|
21003
|
+
return this.finishToken(types$1.dot)
|
|
21004
21004
|
}
|
|
21005
21005
|
};
|
|
21006
21006
|
|
|
21007
|
-
pp
|
|
21007
|
+
pp.readToken_slash = function() { // '/'
|
|
21008
21008
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21009
21009
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
21010
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21011
|
-
return this.finishOp(types.slash, 1)
|
|
21010
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21011
|
+
return this.finishOp(types$1.slash, 1)
|
|
21012
21012
|
};
|
|
21013
21013
|
|
|
21014
|
-
pp
|
|
21014
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
21015
21015
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21016
21016
|
var size = 1;
|
|
21017
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
21017
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
21018
21018
|
|
|
21019
21019
|
// exponentiation operator ** and **=
|
|
21020
21020
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
21021
21021
|
++size;
|
|
21022
|
-
tokentype = types.starstar;
|
|
21022
|
+
tokentype = types$1.starstar;
|
|
21023
21023
|
next = this.input.charCodeAt(this.pos + 2);
|
|
21024
21024
|
}
|
|
21025
21025
|
|
|
21026
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
21026
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21027
21027
|
return this.finishOp(tokentype, size)
|
|
21028
21028
|
};
|
|
21029
21029
|
|
|
21030
|
-
pp
|
|
21030
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
21031
21031
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21032
21032
|
if (next === code) {
|
|
21033
21033
|
if (this.options.ecmaVersion >= 12) {
|
|
21034
21034
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21035
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
21035
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
21036
21036
|
}
|
|
21037
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
21037
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
21038
21038
|
}
|
|
21039
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21040
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
21039
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21040
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
21041
21041
|
};
|
|
21042
21042
|
|
|
21043
|
-
pp
|
|
21043
|
+
pp.readToken_caret = function() { // '^'
|
|
21044
21044
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21045
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21046
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
21045
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21046
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
21047
21047
|
};
|
|
21048
21048
|
|
|
21049
|
-
pp
|
|
21049
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
21050
21050
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21051
21051
|
if (next === code) {
|
|
21052
21052
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -21056,19 +21056,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
21056
21056
|
this.skipSpace();
|
|
21057
21057
|
return this.nextToken()
|
|
21058
21058
|
}
|
|
21059
|
-
return this.finishOp(types.incDec, 2)
|
|
21059
|
+
return this.finishOp(types$1.incDec, 2)
|
|
21060
21060
|
}
|
|
21061
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21062
|
-
return this.finishOp(types.plusMin, 1)
|
|
21061
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21062
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
21063
21063
|
};
|
|
21064
21064
|
|
|
21065
|
-
pp
|
|
21065
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
21066
21066
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21067
21067
|
var size = 1;
|
|
21068
21068
|
if (next === code) {
|
|
21069
21069
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
21070
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
21071
|
-
return this.finishOp(types.bitShift, size)
|
|
21070
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21071
|
+
return this.finishOp(types$1.bitShift, size)
|
|
21072
21072
|
}
|
|
21073
21073
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
21074
21074
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -21078,53 +21078,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
21078
21078
|
return this.nextToken()
|
|
21079
21079
|
}
|
|
21080
21080
|
if (next === 61) { size = 2; }
|
|
21081
|
-
return this.finishOp(types.relational, size)
|
|
21081
|
+
return this.finishOp(types$1.relational, size)
|
|
21082
21082
|
};
|
|
21083
21083
|
|
|
21084
|
-
pp
|
|
21084
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
21085
21085
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21086
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21086
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21087
21087
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
21088
21088
|
this.pos += 2;
|
|
21089
|
-
return this.finishToken(types.arrow)
|
|
21089
|
+
return this.finishToken(types$1.arrow)
|
|
21090
21090
|
}
|
|
21091
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
21091
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
21092
21092
|
};
|
|
21093
21093
|
|
|
21094
|
-
pp
|
|
21094
|
+
pp.readToken_question = function() { // '?'
|
|
21095
21095
|
var ecmaVersion = this.options.ecmaVersion;
|
|
21096
21096
|
if (ecmaVersion >= 11) {
|
|
21097
21097
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21098
21098
|
if (next === 46) {
|
|
21099
21099
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21100
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
21100
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
21101
21101
|
}
|
|
21102
21102
|
if (next === 63) {
|
|
21103
21103
|
if (ecmaVersion >= 12) {
|
|
21104
21104
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
21105
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
21105
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
21106
21106
|
}
|
|
21107
|
-
return this.finishOp(types.coalesce, 2)
|
|
21107
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
21108
21108
|
}
|
|
21109
21109
|
}
|
|
21110
|
-
return this.finishOp(types.question, 1)
|
|
21110
|
+
return this.finishOp(types$1.question, 1)
|
|
21111
21111
|
};
|
|
21112
21112
|
|
|
21113
|
-
pp
|
|
21113
|
+
pp.readToken_numberSign = function() { // '#'
|
|
21114
21114
|
var ecmaVersion = this.options.ecmaVersion;
|
|
21115
21115
|
var code = 35; // '#'
|
|
21116
21116
|
if (ecmaVersion >= 13) {
|
|
21117
21117
|
++this.pos;
|
|
21118
21118
|
code = this.fullCharCodeAtPos();
|
|
21119
21119
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
21120
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21120
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
21121
21121
|
}
|
|
21122
21122
|
}
|
|
21123
21123
|
|
|
21124
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21124
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21125
21125
|
};
|
|
21126
21126
|
|
|
21127
|
-
pp
|
|
21127
|
+
pp.getTokenFromCode = function(code) {
|
|
21128
21128
|
switch (code) {
|
|
21129
21129
|
// The interpretation of a dot depends on whether it is followed
|
|
21130
21130
|
// by a digit or another two dots.
|
|
@@ -21132,20 +21132,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21132
21132
|
return this.readToken_dot()
|
|
21133
21133
|
|
|
21134
21134
|
// Punctuation tokens.
|
|
21135
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
21136
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
21137
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
21138
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
21139
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
21140
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
21141
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
21142
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
21143
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
21135
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21136
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21137
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21138
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21139
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21140
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21141
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21142
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21143
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21144
21144
|
|
|
21145
21145
|
case 96: // '`'
|
|
21146
21146
|
if (this.options.ecmaVersion < 6) { break }
|
|
21147
21147
|
++this.pos;
|
|
21148
|
-
return this.finishToken(types.backQuote)
|
|
21148
|
+
return this.finishToken(types$1.backQuote)
|
|
21149
21149
|
|
|
21150
21150
|
case 48: // '0'
|
|
21151
21151
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21168,7 +21168,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21168
21168
|
// often referred to. `finishOp` simply skips the amount of
|
|
21169
21169
|
// characters it is given as second argument, and returns a token
|
|
21170
21170
|
// of the type given by its first argument.
|
|
21171
|
-
|
|
21172
21171
|
case 47: // '/'
|
|
21173
21172
|
return this.readToken_slash()
|
|
21174
21173
|
|
|
@@ -21194,22 +21193,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21194
21193
|
return this.readToken_question()
|
|
21195
21194
|
|
|
21196
21195
|
case 126: // '~'
|
|
21197
|
-
return this.finishOp(types.prefix, 1)
|
|
21196
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21198
21197
|
|
|
21199
21198
|
case 35: // '#'
|
|
21200
21199
|
return this.readToken_numberSign()
|
|
21201
21200
|
}
|
|
21202
21201
|
|
|
21203
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21202
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21204
21203
|
};
|
|
21205
21204
|
|
|
21206
|
-
pp
|
|
21205
|
+
pp.finishOp = function(type, size) {
|
|
21207
21206
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21208
21207
|
this.pos += size;
|
|
21209
21208
|
return this.finishToken(type, str)
|
|
21210
21209
|
};
|
|
21211
21210
|
|
|
21212
|
-
pp
|
|
21211
|
+
pp.readRegexp = function() {
|
|
21213
21212
|
var escaped, inClass, start = this.pos;
|
|
21214
21213
|
for (;;) {
|
|
21215
21214
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21244,14 +21243,14 @@ pp$9.readRegexp = function() {
|
|
|
21244
21243
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21245
21244
|
}
|
|
21246
21245
|
|
|
21247
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21246
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21248
21247
|
};
|
|
21249
21248
|
|
|
21250
21249
|
// Read an integer in the given radix. Return null if zero digits
|
|
21251
21250
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21252
21251
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21253
21252
|
|
|
21254
|
-
pp
|
|
21253
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21255
21254
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21256
21255
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21257
21256
|
|
|
@@ -21305,7 +21304,7 @@ function stringToBigInt(str) {
|
|
|
21305
21304
|
return BigInt(str.replace(/_/g, ""))
|
|
21306
21305
|
}
|
|
21307
21306
|
|
|
21308
|
-
pp
|
|
21307
|
+
pp.readRadixNumber = function(radix) {
|
|
21309
21308
|
var start = this.pos;
|
|
21310
21309
|
this.pos += 2; // 0x
|
|
21311
21310
|
var val = this.readInt(radix);
|
|
@@ -21314,12 +21313,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21314
21313
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21315
21314
|
++this.pos;
|
|
21316
21315
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21317
|
-
return this.finishToken(types.num, val)
|
|
21316
|
+
return this.finishToken(types$1.num, val)
|
|
21318
21317
|
};
|
|
21319
21318
|
|
|
21320
21319
|
// Read an integer, octal integer, or floating-point number.
|
|
21321
21320
|
|
|
21322
|
-
pp
|
|
21321
|
+
pp.readNumber = function(startsWithDot) {
|
|
21323
21322
|
var start = this.pos;
|
|
21324
21323
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21325
21324
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21329,7 +21328,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21329
21328
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21330
21329
|
++this.pos;
|
|
21331
21330
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21332
|
-
return this.finishToken(types.num, val$1)
|
|
21331
|
+
return this.finishToken(types$1.num, val$1)
|
|
21333
21332
|
}
|
|
21334
21333
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21335
21334
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21345,12 +21344,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21345
21344
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21346
21345
|
|
|
21347
21346
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21348
|
-
return this.finishToken(types.num, val)
|
|
21347
|
+
return this.finishToken(types$1.num, val)
|
|
21349
21348
|
};
|
|
21350
21349
|
|
|
21351
21350
|
// Read a string value, interpreting backslash-escapes.
|
|
21352
21351
|
|
|
21353
|
-
pp
|
|
21352
|
+
pp.readCodePoint = function() {
|
|
21354
21353
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21355
21354
|
|
|
21356
21355
|
if (ch === 123) { // '{'
|
|
@@ -21365,14 +21364,14 @@ pp$9.readCodePoint = function() {
|
|
|
21365
21364
|
return code
|
|
21366
21365
|
};
|
|
21367
21366
|
|
|
21368
|
-
function codePointToString
|
|
21367
|
+
function codePointToString(code) {
|
|
21369
21368
|
// UTF-16 Decoding
|
|
21370
21369
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21371
21370
|
code -= 0x10000;
|
|
21372
21371
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21373
21372
|
}
|
|
21374
21373
|
|
|
21375
|
-
pp
|
|
21374
|
+
pp.readString = function(quote) {
|
|
21376
21375
|
var out = "", chunkStart = ++this.pos;
|
|
21377
21376
|
for (;;) {
|
|
21378
21377
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21395,14 +21394,14 @@ pp$9.readString = function(quote) {
|
|
|
21395
21394
|
}
|
|
21396
21395
|
}
|
|
21397
21396
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21398
|
-
return this.finishToken(types.string, out)
|
|
21397
|
+
return this.finishToken(types$1.string, out)
|
|
21399
21398
|
};
|
|
21400
21399
|
|
|
21401
21400
|
// Reads template string tokens.
|
|
21402
21401
|
|
|
21403
21402
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21404
21403
|
|
|
21405
|
-
pp
|
|
21404
|
+
pp.tryReadTemplateToken = function() {
|
|
21406
21405
|
this.inTemplateElement = true;
|
|
21407
21406
|
try {
|
|
21408
21407
|
this.readTmplToken();
|
|
@@ -21417,7 +21416,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21417
21416
|
this.inTemplateElement = false;
|
|
21418
21417
|
};
|
|
21419
21418
|
|
|
21420
|
-
pp
|
|
21419
|
+
pp.invalidStringToken = function(position, message) {
|
|
21421
21420
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21422
21421
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21423
21422
|
} else {
|
|
@@ -21425,23 +21424,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21425
21424
|
}
|
|
21426
21425
|
};
|
|
21427
21426
|
|
|
21428
|
-
pp
|
|
21427
|
+
pp.readTmplToken = function() {
|
|
21429
21428
|
var out = "", chunkStart = this.pos;
|
|
21430
21429
|
for (;;) {
|
|
21431
21430
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21432
21431
|
var ch = this.input.charCodeAt(this.pos);
|
|
21433
21432
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
21434
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
21433
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21435
21434
|
if (ch === 36) {
|
|
21436
21435
|
this.pos += 2;
|
|
21437
|
-
return this.finishToken(types.dollarBraceL)
|
|
21436
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21438
21437
|
} else {
|
|
21439
21438
|
++this.pos;
|
|
21440
|
-
return this.finishToken(types.backQuote)
|
|
21439
|
+
return this.finishToken(types$1.backQuote)
|
|
21441
21440
|
}
|
|
21442
21441
|
}
|
|
21443
21442
|
out += this.input.slice(chunkStart, this.pos);
|
|
21444
|
-
return this.finishToken(types.template, out)
|
|
21443
|
+
return this.finishToken(types$1.template, out)
|
|
21445
21444
|
}
|
|
21446
21445
|
if (ch === 92) { // '\'
|
|
21447
21446
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21472,7 +21471,7 @@ pp$9.readTmplToken = function() {
|
|
|
21472
21471
|
};
|
|
21473
21472
|
|
|
21474
21473
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21475
|
-
pp
|
|
21474
|
+
pp.readInvalidTemplateToken = function() {
|
|
21476
21475
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21477
21476
|
switch (this.input[this.pos]) {
|
|
21478
21477
|
case "\\":
|
|
@@ -21483,10 +21482,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21483
21482
|
if (this.input[this.pos + 1] !== "{") {
|
|
21484
21483
|
break
|
|
21485
21484
|
}
|
|
21486
|
-
// falls through
|
|
21487
21485
|
|
|
21486
|
+
// falls through
|
|
21488
21487
|
case "`":
|
|
21489
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21488
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21490
21489
|
|
|
21491
21490
|
// no default
|
|
21492
21491
|
}
|
|
@@ -21496,14 +21495,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21496
21495
|
|
|
21497
21496
|
// Used to read escaped characters
|
|
21498
21497
|
|
|
21499
|
-
pp
|
|
21498
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21500
21499
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21501
21500
|
++this.pos;
|
|
21502
21501
|
switch (ch) {
|
|
21503
21502
|
case 110: return "\n" // 'n' -> '\n'
|
|
21504
21503
|
case 114: return "\r" // 'r' -> '\r'
|
|
21505
21504
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21506
|
-
case 117: return codePointToString
|
|
21505
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21507
21506
|
case 116: return "\t" // 't' -> '\t'
|
|
21508
21507
|
case 98: return "\b" // 'b' -> '\b'
|
|
21509
21508
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21561,7 +21560,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21561
21560
|
|
|
21562
21561
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21563
21562
|
|
|
21564
|
-
pp
|
|
21563
|
+
pp.readHexChar = function(len) {
|
|
21565
21564
|
var codePos = this.pos;
|
|
21566
21565
|
var n = this.readInt(16, len);
|
|
21567
21566
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21574,7 +21573,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21574
21573
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21575
21574
|
// as a micro-optimization.
|
|
21576
21575
|
|
|
21577
|
-
pp
|
|
21576
|
+
pp.readWord1 = function() {
|
|
21578
21577
|
this.containsEsc = false;
|
|
21579
21578
|
var word = "", first = true, chunkStart = this.pos;
|
|
21580
21579
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21592,7 +21591,7 @@ pp$9.readWord1 = function() {
|
|
|
21592
21591
|
var esc = this.readCodePoint();
|
|
21593
21592
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21594
21593
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21595
|
-
word += codePointToString
|
|
21594
|
+
word += codePointToString(esc);
|
|
21596
21595
|
chunkStart = this.pos;
|
|
21597
21596
|
} else {
|
|
21598
21597
|
break
|
|
@@ -21605,18 +21604,18 @@ pp$9.readWord1 = function() {
|
|
|
21605
21604
|
// Read an identifier or keyword token. Will check for reserved
|
|
21606
21605
|
// words when necessary.
|
|
21607
21606
|
|
|
21608
|
-
pp
|
|
21607
|
+
pp.readWord = function() {
|
|
21609
21608
|
var word = this.readWord1();
|
|
21610
|
-
var type = types.name;
|
|
21609
|
+
var type = types$1.name;
|
|
21611
21610
|
if (this.keywords.test(word)) {
|
|
21612
|
-
type = keywords
|
|
21611
|
+
type = keywords[word];
|
|
21613
21612
|
}
|
|
21614
21613
|
return this.finishToken(type, word)
|
|
21615
21614
|
};
|
|
21616
21615
|
|
|
21617
21616
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21618
21617
|
|
|
21619
|
-
var version = "8.
|
|
21618
|
+
var version = "8.6.0";
|
|
21620
21619
|
|
|
21621
21620
|
Parser.acorn = {
|
|
21622
21621
|
Parser: Parser,
|
|
@@ -21627,10 +21626,10 @@ Parser.acorn = {
|
|
|
21627
21626
|
getLineInfo: getLineInfo,
|
|
21628
21627
|
Node: Node,
|
|
21629
21628
|
TokenType: TokenType,
|
|
21630
|
-
tokTypes: types,
|
|
21631
|
-
keywordTypes: keywords
|
|
21629
|
+
tokTypes: types$1,
|
|
21630
|
+
keywordTypes: keywords,
|
|
21632
21631
|
TokContext: TokContext,
|
|
21633
|
-
tokContexts: types
|
|
21632
|
+
tokContexts: types,
|
|
21634
21633
|
isIdentifierChar: isIdentifierChar,
|
|
21635
21634
|
isIdentifierStart: isIdentifierStart,
|
|
21636
21635
|
Token: Token,
|
|
@@ -21643,20 +21642,7 @@ Parser.acorn = {
|
|
|
21643
21642
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21644
21643
|
function mkdirpath(path) {
|
|
21645
21644
|
const dir = path$2.dirname(path);
|
|
21646
|
-
|
|
21647
|
-
fs.readdirSync(dir);
|
|
21648
|
-
}
|
|
21649
|
-
catch (_a) {
|
|
21650
|
-
mkdirpath(dir);
|
|
21651
|
-
try {
|
|
21652
|
-
fs.mkdirSync(dir);
|
|
21653
|
-
}
|
|
21654
|
-
catch (err) {
|
|
21655
|
-
if (err.code !== 'EEXIST') {
|
|
21656
|
-
throw err;
|
|
21657
|
-
}
|
|
21658
|
-
}
|
|
21659
|
-
}
|
|
21645
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21660
21646
|
}
|
|
21661
21647
|
function writeFile(dest, data) {
|
|
21662
21648
|
return new Promise((fulfil, reject) => {
|
|
@@ -22021,6 +22007,7 @@ class ModuleLoader {
|
|
|
22021
22007
|
this.implicitEntryModules = new Set();
|
|
22022
22008
|
this.indexedEntryModules = [];
|
|
22023
22009
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
22010
|
+
this.moduleLoadPromises = new Map();
|
|
22024
22011
|
this.nextEntryModuleIndex = 0;
|
|
22025
22012
|
this.readQueue = new Queue();
|
|
22026
22013
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
@@ -22082,6 +22069,9 @@ class ModuleLoader {
|
|
|
22082
22069
|
}
|
|
22083
22070
|
return module;
|
|
22084
22071
|
}
|
|
22072
|
+
preloadModule(resolvedId) {
|
|
22073
|
+
return this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true).then(module => module.info);
|
|
22074
|
+
}
|
|
22085
22075
|
addDefaultsToResolvedId(resolvedId) {
|
|
22086
22076
|
var _a, _b;
|
|
22087
22077
|
if (!resolvedId) {
|
|
@@ -22182,39 +22172,45 @@ class ModuleLoader {
|
|
|
22182
22172
|
}
|
|
22183
22173
|
}
|
|
22184
22174
|
}
|
|
22185
|
-
|
|
22175
|
+
// If this is a preload, then this method always waits for the dependencies of the module to be resolved.
|
|
22176
|
+
// Otherwise if the module does not exist, it waits for the module and all its dependencies to be loaded.
|
|
22177
|
+
// Otherwise it returns immediately.
|
|
22178
|
+
async fetchModule({ id, meta, moduleSideEffects, syntheticNamedExports }, importer, isEntry, isPreload) {
|
|
22186
22179
|
const existingModule = this.modulesById.get(id);
|
|
22187
22180
|
if (existingModule instanceof Module) {
|
|
22188
|
-
|
|
22189
|
-
existingModule.info.isEntry = true;
|
|
22190
|
-
this.implicitEntryModules.delete(existingModule);
|
|
22191
|
-
for (const dependant of existingModule.implicitlyLoadedAfter) {
|
|
22192
|
-
dependant.implicitlyLoadedBefore.delete(existingModule);
|
|
22193
|
-
}
|
|
22194
|
-
existingModule.implicitlyLoadedAfter.clear();
|
|
22195
|
-
}
|
|
22181
|
+
await this.handleExistingModule(existingModule, isEntry, isPreload);
|
|
22196
22182
|
return existingModule;
|
|
22197
22183
|
}
|
|
22198
22184
|
const module = new Module(this.graph, id, this.options, isEntry, moduleSideEffects, syntheticNamedExports, meta);
|
|
22199
22185
|
this.modulesById.set(id, module);
|
|
22200
22186
|
this.graph.watchFiles[id] = true;
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
...resolveDynamicImportPromises
|
|
22207
|
-
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
/* rejections thrown here are also handled within PluginDriver - they are safe to ignore */
|
|
22187
|
+
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22188
|
+
this.getResolveStaticDependencyPromises(module),
|
|
22189
|
+
this.getResolveDynamicImportPromises(module)
|
|
22190
|
+
]);
|
|
22191
|
+
const loadAndResolveDependenciesPromise = loadPromise
|
|
22192
|
+
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
22193
|
+
.then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
|
|
22194
|
+
loadAndResolveDependenciesPromise.catch(() => {
|
|
22195
|
+
/* avoid unhandled promise rejections */
|
|
22211
22196
|
});
|
|
22197
|
+
if (isPreload) {
|
|
22198
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22199
|
+
await loadPromise;
|
|
22200
|
+
}
|
|
22201
|
+
else {
|
|
22202
|
+
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22203
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22204
|
+
await loadAndResolveDependenciesPromise;
|
|
22205
|
+
}
|
|
22206
|
+
return module;
|
|
22207
|
+
}
|
|
22208
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22212
22209
|
await Promise.all([
|
|
22213
22210
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22214
|
-
this.fetchDynamicDependencies(module,
|
|
22211
|
+
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22215
22212
|
]);
|
|
22216
22213
|
module.linkImports();
|
|
22217
|
-
return module;
|
|
22218
22214
|
}
|
|
22219
22215
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22220
22216
|
if (resolvedId.external) {
|
|
@@ -22229,7 +22225,7 @@ class ModuleLoader {
|
|
|
22229
22225
|
return Promise.resolve(externalModule);
|
|
22230
22226
|
}
|
|
22231
22227
|
else {
|
|
22232
|
-
return this.fetchModule(resolvedId, importer, false);
|
|
22228
|
+
return this.fetchModule(resolvedId, importer, false, false);
|
|
22233
22229
|
}
|
|
22234
22230
|
}
|
|
22235
22231
|
async fetchStaticDependencies(module, resolveStaticDependencyPromises) {
|
|
@@ -22300,6 +22296,26 @@ class ModuleLoader {
|
|
|
22300
22296
|
this.handleResolveId(await this.resolveId(source, module.id, EMPTY_OBJECT, false), source, module.id))
|
|
22301
22297
|
]);
|
|
22302
22298
|
}
|
|
22299
|
+
async handleExistingModule(module, isEntry, isPreload) {
|
|
22300
|
+
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22301
|
+
if (isPreload) {
|
|
22302
|
+
await loadPromise;
|
|
22303
|
+
return;
|
|
22304
|
+
}
|
|
22305
|
+
if (isEntry) {
|
|
22306
|
+
module.info.isEntry = true;
|
|
22307
|
+
this.implicitEntryModules.delete(module);
|
|
22308
|
+
for (const dependant of module.implicitlyLoadedAfter) {
|
|
22309
|
+
dependant.implicitlyLoadedBefore.delete(module);
|
|
22310
|
+
}
|
|
22311
|
+
module.implicitlyLoadedAfter.clear();
|
|
22312
|
+
}
|
|
22313
|
+
if (loadPromise) {
|
|
22314
|
+
this.moduleLoadPromises.delete(module);
|
|
22315
|
+
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22316
|
+
}
|
|
22317
|
+
return;
|
|
22318
|
+
}
|
|
22303
22319
|
handleResolveId(resolvedId, source, importer) {
|
|
22304
22320
|
if (resolvedId === null) {
|
|
22305
22321
|
if (isRelative(source)) {
|
|
@@ -22336,7 +22352,7 @@ class ModuleLoader {
|
|
|
22336
22352
|
}
|
|
22337
22353
|
return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
|
|
22338
22354
|
? resolveIdResult
|
|
22339
|
-
: { id: resolveIdResult }), undefined, isEntry);
|
|
22355
|
+
: { id: resolveIdResult }), undefined, isEntry, false);
|
|
22340
22356
|
}
|
|
22341
22357
|
async resolveDynamicImport(module, specifier, importer) {
|
|
22342
22358
|
const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
|
|
@@ -22464,12 +22480,16 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22464
22480
|
getModuleInfo: graph.getModuleInfo,
|
|
22465
22481
|
getWatchFiles: () => Object.keys(graph.watchFiles),
|
|
22466
22482
|
isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
|
|
22483
|
+
load(resolvedId) {
|
|
22484
|
+
return graph.moduleLoader.preloadModule(resolvedId);
|
|
22485
|
+
},
|
|
22467
22486
|
meta: {
|
|
22468
22487
|
rollupVersion: version$1,
|
|
22469
22488
|
watchMode: graph.watchMode
|
|
22470
22489
|
},
|
|
22471
22490
|
get moduleIds() {
|
|
22472
22491
|
function* wrappedModuleIds() {
|
|
22492
|
+
// We are wrapping this in a generator to only show the message once we are actually iterating
|
|
22473
22493
|
warnDeprecation({
|
|
22474
22494
|
message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
|
|
22475
22495
|
plugin: plugin.name
|
|
@@ -23090,12 +23110,15 @@ const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules) =
|
|
|
23090
23110
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
23091
23111
|
};
|
|
23092
23112
|
|
|
23113
|
+
// https://datatracker.ietf.org/doc/html/rfc2396
|
|
23114
|
+
// eslint-disable-next-line no-control-regex
|
|
23115
|
+
const INVALID_CHAR_RE = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
23093
23116
|
function sanitizeFileName(name) {
|
|
23094
23117
|
const match = /^[a-z]:/i.exec(name);
|
|
23095
23118
|
const driveLetter = match ? match[0] : '';
|
|
23096
23119
|
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
23097
23120
|
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
23098
|
-
return driveLetter + name.substr(driveLetter.length).replace(
|
|
23121
|
+
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_RE, '_');
|
|
23099
23122
|
}
|
|
23100
23123
|
|
|
23101
23124
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
@@ -23563,10 +23586,8 @@ exports.defaultOnWarn = defaultOnWarn;
|
|
|
23563
23586
|
exports.defineConfig = defineConfig;
|
|
23564
23587
|
exports.ensureArray = ensureArray$1;
|
|
23565
23588
|
exports.error = error;
|
|
23566
|
-
exports.fseventsImporter = fseventsImporter;
|
|
23567
23589
|
exports.generatedCodePresets = generatedCodePresets;
|
|
23568
23590
|
exports.getAliasName = getAliasName;
|
|
23569
|
-
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
23570
23591
|
exports.getOrCreate = getOrCreate;
|
|
23571
23592
|
exports.loadFsEvents = loadFsEvents;
|
|
23572
23593
|
exports.objectifyOptionWithPresets = objectifyOptionWithPresets;
|