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