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