rollup 2.60.1 → 2.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -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 +724 -690
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +3 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +1 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +96 -37
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +724 -690
- package/dist/shared/watch-cli.js +36 -13
- package/dist/shared/watch.js +2 -2
- package/package.json +22 -22
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.62.0
|
|
4
|
+
Fri, 24 Dec 2021 06:27:02 GMT - commit 81ce56f87de5fae51c00c4a0a977830ee93c5987
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -26,7 +26,7 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
var version$1 = "2.
|
|
29
|
+
var version$1 = "2.62.0";
|
|
30
30
|
|
|
31
31
|
function ensureArray$1(items) {
|
|
32
32
|
if (Array.isArray(items)) {
|
|
@@ -582,15 +582,14 @@ const getHashFromObjectOption = (optionName) => optionName.split('.').join('').t
|
|
|
582
582
|
|
|
583
583
|
let fsEvents;
|
|
584
584
|
let fsEventsImportError;
|
|
585
|
-
function loadFsEvents() {
|
|
585
|
+
async function loadFsEvents() {
|
|
586
586
|
const moduleName = 'fsevents';
|
|
587
|
-
|
|
588
|
-
.then(
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
.catch(err => {
|
|
587
|
+
try {
|
|
588
|
+
({ default: fsEvents } = await Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefault(require(moduleName))));
|
|
589
|
+
}
|
|
590
|
+
catch (err) {
|
|
592
591
|
fsEventsImportError = err;
|
|
593
|
-
}
|
|
592
|
+
}
|
|
594
593
|
}
|
|
595
594
|
// A call to this function will be injected into the chokidar code
|
|
596
595
|
function getFsEvents() {
|
|
@@ -2252,20 +2251,70 @@ const BLANK = Object.freeze(Object.create(null));
|
|
|
2252
2251
|
const EMPTY_OBJECT = Object.freeze({});
|
|
2253
2252
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
2254
2253
|
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2257
|
-
|
|
2254
|
+
const RESERVED_NAMES = new Set([
|
|
2255
|
+
'await',
|
|
2256
|
+
'break',
|
|
2257
|
+
'case',
|
|
2258
|
+
'catch',
|
|
2259
|
+
'class',
|
|
2260
|
+
'const',
|
|
2261
|
+
'continue',
|
|
2262
|
+
'debugger',
|
|
2263
|
+
'default',
|
|
2264
|
+
'delete',
|
|
2265
|
+
'do',
|
|
2266
|
+
'else',
|
|
2267
|
+
'enum',
|
|
2268
|
+
'eval',
|
|
2269
|
+
'export',
|
|
2270
|
+
'extends',
|
|
2271
|
+
'false',
|
|
2272
|
+
'finally',
|
|
2273
|
+
'for',
|
|
2274
|
+
'function',
|
|
2275
|
+
'if',
|
|
2276
|
+
'implements',
|
|
2277
|
+
'import',
|
|
2278
|
+
'in',
|
|
2279
|
+
'instanceof',
|
|
2280
|
+
'interface',
|
|
2281
|
+
'let',
|
|
2282
|
+
'NaN',
|
|
2283
|
+
'new',
|
|
2284
|
+
'null',
|
|
2285
|
+
'package',
|
|
2286
|
+
'private',
|
|
2287
|
+
'protected',
|
|
2288
|
+
'public',
|
|
2289
|
+
'return',
|
|
2290
|
+
'static',
|
|
2291
|
+
'super',
|
|
2292
|
+
'switch',
|
|
2293
|
+
'this',
|
|
2294
|
+
'throw',
|
|
2295
|
+
'true',
|
|
2296
|
+
'try',
|
|
2297
|
+
'typeof',
|
|
2298
|
+
'undefined',
|
|
2299
|
+
'var',
|
|
2300
|
+
'void',
|
|
2301
|
+
'while',
|
|
2302
|
+
'with',
|
|
2303
|
+
'yield'
|
|
2304
|
+
]);
|
|
2305
|
+
const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
2306
|
+
|
|
2258
2307
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
2259
2308
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
2260
2309
|
function isLegal(str) {
|
|
2261
|
-
if (startsWithDigit(str) ||
|
|
2310
|
+
if (startsWithDigit(str) || RESERVED_NAMES$1.has(str)) {
|
|
2262
2311
|
return false;
|
|
2263
2312
|
}
|
|
2264
2313
|
return !illegalCharacters.test(str);
|
|
2265
2314
|
}
|
|
2266
2315
|
function makeLegal(str) {
|
|
2267
2316
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
2268
|
-
if (startsWithDigit(str) ||
|
|
2317
|
+
if (startsWithDigit(str) || RESERVED_NAMES$1.has(str))
|
|
2269
2318
|
str = `_${str}`;
|
|
2270
2319
|
return str || '_';
|
|
2271
2320
|
}
|
|
@@ -2307,6 +2356,7 @@ class ExternalModule {
|
|
|
2307
2356
|
},
|
|
2308
2357
|
isEntry: false,
|
|
2309
2358
|
isExternal: true,
|
|
2359
|
+
isIncluded: null,
|
|
2310
2360
|
meta,
|
|
2311
2361
|
syntheticNamedExports: false
|
|
2312
2362
|
};
|
|
@@ -5549,8 +5599,6 @@ const knownGlobals = {
|
|
|
5549
5599
|
__proto__: null,
|
|
5550
5600
|
[ValueProperties]: PURE,
|
|
5551
5601
|
create: PF,
|
|
5552
|
-
getNotifier: PF,
|
|
5553
|
-
getOwn: PF,
|
|
5554
5602
|
getOwnPropertyDescriptor: PF,
|
|
5555
5603
|
getOwnPropertyNames: PF,
|
|
5556
5604
|
getOwnPropertySymbols: PF,
|
|
@@ -6592,62 +6640,10 @@ function toBase64(num) {
|
|
|
6592
6640
|
return outStr;
|
|
6593
6641
|
}
|
|
6594
6642
|
|
|
6595
|
-
const RESERVED_NAMES = {
|
|
6596
|
-
__proto__: null,
|
|
6597
|
-
await: true,
|
|
6598
|
-
break: true,
|
|
6599
|
-
case: true,
|
|
6600
|
-
catch: true,
|
|
6601
|
-
class: true,
|
|
6602
|
-
const: true,
|
|
6603
|
-
continue: true,
|
|
6604
|
-
debugger: true,
|
|
6605
|
-
default: true,
|
|
6606
|
-
delete: true,
|
|
6607
|
-
do: true,
|
|
6608
|
-
else: true,
|
|
6609
|
-
enum: true,
|
|
6610
|
-
eval: true,
|
|
6611
|
-
export: true,
|
|
6612
|
-
extends: true,
|
|
6613
|
-
false: true,
|
|
6614
|
-
finally: true,
|
|
6615
|
-
for: true,
|
|
6616
|
-
function: true,
|
|
6617
|
-
if: true,
|
|
6618
|
-
implements: true,
|
|
6619
|
-
import: true,
|
|
6620
|
-
in: true,
|
|
6621
|
-
instanceof: true,
|
|
6622
|
-
interface: true,
|
|
6623
|
-
let: true,
|
|
6624
|
-
new: true,
|
|
6625
|
-
null: true,
|
|
6626
|
-
package: true,
|
|
6627
|
-
private: true,
|
|
6628
|
-
protected: true,
|
|
6629
|
-
public: true,
|
|
6630
|
-
return: true,
|
|
6631
|
-
static: true,
|
|
6632
|
-
super: true,
|
|
6633
|
-
switch: true,
|
|
6634
|
-
this: true,
|
|
6635
|
-
throw: true,
|
|
6636
|
-
true: true,
|
|
6637
|
-
try: true,
|
|
6638
|
-
typeof: true,
|
|
6639
|
-
undefined: true,
|
|
6640
|
-
var: true,
|
|
6641
|
-
void: true,
|
|
6642
|
-
while: true,
|
|
6643
|
-
with: true,
|
|
6644
|
-
yield: true
|
|
6645
|
-
};
|
|
6646
|
-
|
|
6647
6643
|
function getSafeName(baseName, usedNames) {
|
|
6648
6644
|
let safeName = baseName;
|
|
6649
6645
|
let count = 1;
|
|
6650
|
-
while (usedNames.has(safeName) || RESERVED_NAMES
|
|
6646
|
+
while (usedNames.has(safeName) || RESERVED_NAMES$1.has(safeName)) {
|
|
6651
6647
|
safeName = `${baseName}$${toBase64(count++)}`;
|
|
6652
6648
|
}
|
|
6653
6649
|
usedNames.add(safeName);
|
|
@@ -6758,16 +6754,27 @@ const literalNumberMembers = assembleMemberDescriptions({
|
|
|
6758
6754
|
valueOf: returnsNumber
|
|
6759
6755
|
}, objectMembers);
|
|
6760
6756
|
const literalStringMembers = assembleMemberDescriptions({
|
|
6757
|
+
anchor: returnsString,
|
|
6758
|
+
at: returnsUnknown,
|
|
6759
|
+
big: returnsString,
|
|
6760
|
+
blink: returnsString,
|
|
6761
|
+
bold: returnsString,
|
|
6761
6762
|
charAt: returnsString,
|
|
6762
6763
|
charCodeAt: returnsNumber,
|
|
6763
|
-
codePointAt:
|
|
6764
|
+
codePointAt: returnsUnknown,
|
|
6764
6765
|
concat: returnsString,
|
|
6765
6766
|
endsWith: returnsBoolean,
|
|
6767
|
+
fixed: returnsString,
|
|
6768
|
+
fontcolor: returnsString,
|
|
6769
|
+
fontsize: returnsString,
|
|
6766
6770
|
includes: returnsBoolean,
|
|
6767
6771
|
indexOf: returnsNumber,
|
|
6772
|
+
italics: returnsString,
|
|
6768
6773
|
lastIndexOf: returnsNumber,
|
|
6774
|
+
link: returnsString,
|
|
6769
6775
|
localeCompare: returnsNumber,
|
|
6770
|
-
match:
|
|
6776
|
+
match: returnsUnknown,
|
|
6777
|
+
matchAll: returnsUnknown,
|
|
6771
6778
|
normalize: returnsString,
|
|
6772
6779
|
padEnd: returnsString,
|
|
6773
6780
|
padStart: returnsString,
|
|
@@ -6778,17 +6785,32 @@ const literalStringMembers = assembleMemberDescriptions({
|
|
|
6778
6785
|
returns: UNKNOWN_LITERAL_STRING
|
|
6779
6786
|
}
|
|
6780
6787
|
},
|
|
6788
|
+
replaceAll: {
|
|
6789
|
+
value: {
|
|
6790
|
+
callsArgs: [1],
|
|
6791
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
6792
|
+
}
|
|
6793
|
+
},
|
|
6781
6794
|
search: returnsNumber,
|
|
6782
6795
|
slice: returnsString,
|
|
6796
|
+
small: returnsString,
|
|
6783
6797
|
split: returnsUnknown,
|
|
6784
6798
|
startsWith: returnsBoolean,
|
|
6799
|
+
strike: returnsString,
|
|
6800
|
+
sub: returnsString,
|
|
6785
6801
|
substr: returnsString,
|
|
6786
6802
|
substring: returnsString,
|
|
6803
|
+
sup: returnsString,
|
|
6787
6804
|
toLocaleLowerCase: returnsString,
|
|
6788
6805
|
toLocaleUpperCase: returnsString,
|
|
6789
6806
|
toLowerCase: returnsString,
|
|
6807
|
+
toString: returnsString,
|
|
6790
6808
|
toUpperCase: returnsString,
|
|
6791
6809
|
trim: returnsString,
|
|
6810
|
+
trimEnd: returnsString,
|
|
6811
|
+
trimLeft: returnsString,
|
|
6812
|
+
trimRight: returnsString,
|
|
6813
|
+
trimStart: returnsString,
|
|
6792
6814
|
valueOf: returnsString
|
|
6793
6815
|
}, objectMembers);
|
|
6794
6816
|
function getLiteralMembersForValue(value) {
|
|
@@ -8604,6 +8626,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8604
8626
|
filter: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8605
8627
|
find: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8606
8628
|
findIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8629
|
+
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8630
|
+
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8607
8631
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8608
8632
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
8609
8633
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
@@ -8621,6 +8645,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8621
8645
|
some: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN,
|
|
8622
8646
|
sort: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF,
|
|
8623
8647
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
8648
|
+
toLocaleString: METHOD_RETURNS_STRING,
|
|
8649
|
+
toString: METHOD_RETURNS_STRING,
|
|
8624
8650
|
unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
|
|
8625
8651
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
8626
8652
|
}, OBJECT_PROTOTYPE, true);
|
|
@@ -12073,13 +12099,19 @@ class SyntheticNamedExportVariable extends Variable {
|
|
|
12073
12099
|
}
|
|
12074
12100
|
}
|
|
12075
12101
|
|
|
12102
|
+
var BuildPhase;
|
|
12103
|
+
(function (BuildPhase) {
|
|
12104
|
+
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
12105
|
+
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
12106
|
+
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
12107
|
+
})(BuildPhase || (BuildPhase = {}));
|
|
12108
|
+
|
|
12076
12109
|
function getId(m) {
|
|
12077
12110
|
return m.id;
|
|
12078
12111
|
}
|
|
12079
12112
|
|
|
12080
12113
|
function getOriginalLocation(sourcemapChain, location) {
|
|
12081
|
-
|
|
12082
|
-
const filteredSourcemapChain = sourcemapChain.filter(sourcemap => sourcemap.mappings);
|
|
12114
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
12083
12115
|
while (filteredSourcemapChain.length > 0) {
|
|
12084
12116
|
const sourcemap = filteredSourcemapChain.pop();
|
|
12085
12117
|
const line = sourcemap.mappings[location.line - 1];
|
|
@@ -12352,10 +12384,10 @@ class Module {
|
|
|
12352
12384
|
hasModuleSideEffects,
|
|
12353
12385
|
id,
|
|
12354
12386
|
get implicitlyLoadedAfterOneOf() {
|
|
12355
|
-
return Array.from(module.implicitlyLoadedAfter, getId);
|
|
12387
|
+
return Array.from(module.implicitlyLoadedAfter, getId).sort();
|
|
12356
12388
|
},
|
|
12357
12389
|
get implicitlyLoadedBefore() {
|
|
12358
|
-
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12390
|
+
return Array.from(module.implicitlyLoadedBefore, getId).sort();
|
|
12359
12391
|
},
|
|
12360
12392
|
get importedIds() {
|
|
12361
12393
|
return Array.from(module.sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
@@ -12365,6 +12397,12 @@ class Module {
|
|
|
12365
12397
|
},
|
|
12366
12398
|
isEntry,
|
|
12367
12399
|
isExternal: false,
|
|
12400
|
+
get isIncluded() {
|
|
12401
|
+
if (module.graph.phase !== BuildPhase.GENERATE) {
|
|
12402
|
+
return null;
|
|
12403
|
+
}
|
|
12404
|
+
return module.isIncluded();
|
|
12405
|
+
},
|
|
12368
12406
|
meta,
|
|
12369
12407
|
syntheticNamedExports
|
|
12370
12408
|
};
|
|
@@ -14155,7 +14193,7 @@ function escapeId(id) {
|
|
|
14155
14193
|
function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
|
|
14156
14194
|
let nameIndex = 0;
|
|
14157
14195
|
for (const variable of exports) {
|
|
14158
|
-
let exportName = variable.name
|
|
14196
|
+
let [exportName] = variable.name;
|
|
14159
14197
|
if (exportsByName[exportName]) {
|
|
14160
14198
|
do {
|
|
14161
14199
|
exportName = toBase64(++nameIndex);
|
|
@@ -14164,7 +14202,7 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14164
14202
|
nameIndex += 9 * 64 ** (exportName.length - 1);
|
|
14165
14203
|
exportName = toBase64(nameIndex);
|
|
14166
14204
|
}
|
|
14167
|
-
} while (RESERVED_NAMES
|
|
14205
|
+
} while (RESERVED_NAMES$1.has(exportName) || exportsByName[exportName]);
|
|
14168
14206
|
}
|
|
14169
14207
|
exportsByName[exportName] = variable;
|
|
14170
14208
|
exportNamesByVariable.set(variable, [exportName]);
|
|
@@ -14979,11 +15017,11 @@ class Chunk {
|
|
|
14979
15017
|
continue;
|
|
14980
15018
|
}
|
|
14981
15019
|
const renderedResolution = resolution instanceof Module
|
|
14982
|
-
? `'${this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions)}'`
|
|
15020
|
+
? `'${escapeId(this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions))}'`
|
|
14983
15021
|
: resolution instanceof ExternalModule
|
|
14984
|
-
? `'${resolution.renormalizeRenderPath
|
|
15022
|
+
? `'${escapeId(resolution.renormalizeRenderPath
|
|
14985
15023
|
? this.getRelativePath(resolution.renderPath, stripKnownJsExtensions)
|
|
14986
|
-
: resolution.renderPath}'`
|
|
15024
|
+
: resolution.renderPath)}'`
|
|
14987
15025
|
: resolution;
|
|
14988
15026
|
node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
|
|
14989
15027
|
!(facadeChunk === null || facadeChunk === void 0 ? void 0 : facadeChunk.strictFacade) &&
|
|
@@ -15382,13 +15420,6 @@ function getChunkNameFromModule(module) {
|
|
|
15382
15420
|
return module.chunkName || getAliasName(module.id);
|
|
15383
15421
|
}
|
|
15384
15422
|
|
|
15385
|
-
var BuildPhase;
|
|
15386
|
-
(function (BuildPhase) {
|
|
15387
|
-
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
15388
|
-
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
15389
|
-
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
15390
|
-
})(BuildPhase || (BuildPhase = {}));
|
|
15391
|
-
|
|
15392
15423
|
function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
15393
15424
|
const emittedName = outputOptions.sanitizeFileName(name || 'asset');
|
|
15394
15425
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
@@ -15899,7 +15930,7 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
|
|
|
15899
15930
|
];
|
|
15900
15931
|
const isValidPropName = reservedNamesAsProps
|
|
15901
15932
|
? (name) => validPropName.test(name)
|
|
15902
|
-
: (name) => !RESERVED_NAMES
|
|
15933
|
+
: (name) => !RESERVED_NAMES$1.has(name) && validPropName.test(name);
|
|
15903
15934
|
return {
|
|
15904
15935
|
_,
|
|
15905
15936
|
cnst,
|
|
@@ -16124,7 +16155,7 @@ function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
|
|
|
16124
16155
|
onWarn(errInvalidOption('output.amd.id', 'outputamd', 'this option is only properly supported for single-file builds. Use "output.amd.autoId" and "output.amd.basePath" instead'));
|
|
16125
16156
|
}
|
|
16126
16157
|
function getIncludedModules(modulesById) {
|
|
16127
|
-
return [...modulesById.values()].filter(module => module instanceof Module &&
|
|
16158
|
+
return [...modulesById.values()].filter((module) => module instanceof Module &&
|
|
16128
16159
|
(module.isIncluded() || module.info.isEntry || module.includedDynamicImporters.length > 0));
|
|
16129
16160
|
}
|
|
16130
16161
|
function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
@@ -16149,7 +16180,7 @@ var reservedWords = {
|
|
|
16149
16180
|
|
|
16150
16181
|
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
|
|
16151
16182
|
|
|
16152
|
-
var keywords = {
|
|
16183
|
+
var keywords$1 = {
|
|
16153
16184
|
5: ecma5AndLessKeywords,
|
|
16154
16185
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16155
16186
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16268,17 +16299,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16268
16299
|
|
|
16269
16300
|
// Map keyword names to token types.
|
|
16270
16301
|
|
|
16271
|
-
var keywords
|
|
16302
|
+
var keywords = {};
|
|
16272
16303
|
|
|
16273
16304
|
// Succinct definitions of keyword token types
|
|
16274
16305
|
function kw(name, options) {
|
|
16275
16306
|
if ( options === void 0 ) options = {};
|
|
16276
16307
|
|
|
16277
16308
|
options.keyword = name;
|
|
16278
|
-
return keywords
|
|
16309
|
+
return keywords[name] = new TokenType(name, options)
|
|
16279
16310
|
}
|
|
16280
16311
|
|
|
16281
|
-
var types = {
|
|
16312
|
+
var types$1 = {
|
|
16282
16313
|
num: new TokenType("num", startsExpr),
|
|
16283
16314
|
regexp: new TokenType("regexp", startsExpr),
|
|
16284
16315
|
string: new TokenType("string", startsExpr),
|
|
@@ -16620,7 +16651,7 @@ var
|
|
|
16620
16651
|
var Parser = function Parser(options, input, startPos) {
|
|
16621
16652
|
this.options = options = getOptions(options);
|
|
16622
16653
|
this.sourceFile = options.sourceFile;
|
|
16623
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16654
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16624
16655
|
var reserved = "";
|
|
16625
16656
|
if (options.allowReserved !== true) {
|
|
16626
16657
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16651,7 +16682,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16651
16682
|
|
|
16652
16683
|
// Properties of the current token:
|
|
16653
16684
|
// Its type
|
|
16654
|
-
this.type = types.eof;
|
|
16685
|
+
this.type = types$1.eof;
|
|
16655
16686
|
// For tokens that include more information than their type, the value
|
|
16656
16687
|
this.value = null;
|
|
16657
16688
|
// Its start and end offset
|
|
@@ -16711,8 +16742,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16711
16742
|
};
|
|
16712
16743
|
|
|
16713
16744
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16745
|
+
|
|
16714
16746
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16747
|
+
|
|
16715
16748
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16749
|
+
|
|
16716
16750
|
prototypeAccessors.canAwait.get = function () {
|
|
16717
16751
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16718
16752
|
var scope = this.scopeStack[i];
|
|
@@ -16721,20 +16755,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16721
16755
|
}
|
|
16722
16756
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16723
16757
|
};
|
|
16758
|
+
|
|
16724
16759
|
prototypeAccessors.allowSuper.get = function () {
|
|
16725
16760
|
var ref = this.currentThisScope();
|
|
16726
16761
|
var flags = ref.flags;
|
|
16727
16762
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16728
16763
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16729
16764
|
};
|
|
16765
|
+
|
|
16730
16766
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16767
|
+
|
|
16731
16768
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16769
|
+
|
|
16732
16770
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16733
16771
|
var ref = this.currentThisScope();
|
|
16734
16772
|
var flags = ref.flags;
|
|
16735
16773
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16736
16774
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16737
16775
|
};
|
|
16776
|
+
|
|
16738
16777
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16739
16778
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16740
16779
|
};
|
|
@@ -16764,12 +16803,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16764
16803
|
|
|
16765
16804
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16766
16805
|
|
|
16767
|
-
var pp = Parser.prototype;
|
|
16806
|
+
var pp$9 = Parser.prototype;
|
|
16768
16807
|
|
|
16769
16808
|
// ## Parser utilities
|
|
16770
16809
|
|
|
16771
16810
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16772
|
-
pp.strictDirective = function(start) {
|
|
16811
|
+
pp$9.strictDirective = function(start) {
|
|
16773
16812
|
for (;;) {
|
|
16774
16813
|
// Try to find string literal.
|
|
16775
16814
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16797,7 +16836,7 @@ pp.strictDirective = function(start) {
|
|
|
16797
16836
|
// Predicate that tests whether the next token is of the given
|
|
16798
16837
|
// type, and if yes, consumes it as a side effect.
|
|
16799
16838
|
|
|
16800
|
-
pp.eat = function(type) {
|
|
16839
|
+
pp$9.eat = function(type) {
|
|
16801
16840
|
if (this.type === type) {
|
|
16802
16841
|
this.next();
|
|
16803
16842
|
return true
|
|
@@ -16808,13 +16847,13 @@ pp.eat = function(type) {
|
|
|
16808
16847
|
|
|
16809
16848
|
// Tests whether parsed token is a contextual keyword.
|
|
16810
16849
|
|
|
16811
|
-
pp.isContextual = function(name) {
|
|
16812
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16850
|
+
pp$9.isContextual = function(name) {
|
|
16851
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16813
16852
|
};
|
|
16814
16853
|
|
|
16815
16854
|
// Consumes contextual keyword if possible.
|
|
16816
16855
|
|
|
16817
|
-
pp.eatContextual = function(name) {
|
|
16856
|
+
pp$9.eatContextual = function(name) {
|
|
16818
16857
|
if (!this.isContextual(name)) { return false }
|
|
16819
16858
|
this.next();
|
|
16820
16859
|
return true
|
|
@@ -16822,19 +16861,19 @@ pp.eatContextual = function(name) {
|
|
|
16822
16861
|
|
|
16823
16862
|
// Asserts that following token is given contextual keyword.
|
|
16824
16863
|
|
|
16825
|
-
pp.expectContextual = function(name) {
|
|
16864
|
+
pp$9.expectContextual = function(name) {
|
|
16826
16865
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16827
16866
|
};
|
|
16828
16867
|
|
|
16829
16868
|
// Test whether a semicolon can be inserted at the current position.
|
|
16830
16869
|
|
|
16831
|
-
pp.canInsertSemicolon = function() {
|
|
16832
|
-
return this.type === types.eof ||
|
|
16833
|
-
this.type === types.braceR ||
|
|
16870
|
+
pp$9.canInsertSemicolon = function() {
|
|
16871
|
+
return this.type === types$1.eof ||
|
|
16872
|
+
this.type === types$1.braceR ||
|
|
16834
16873
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16835
16874
|
};
|
|
16836
16875
|
|
|
16837
|
-
pp.insertSemicolon = function() {
|
|
16876
|
+
pp$9.insertSemicolon = function() {
|
|
16838
16877
|
if (this.canInsertSemicolon()) {
|
|
16839
16878
|
if (this.options.onInsertedSemicolon)
|
|
16840
16879
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16845,11 +16884,11 @@ pp.insertSemicolon = function() {
|
|
|
16845
16884
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16846
16885
|
// pretend that there is a semicolon at this position.
|
|
16847
16886
|
|
|
16848
|
-
pp.semicolon = function() {
|
|
16849
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16887
|
+
pp$9.semicolon = function() {
|
|
16888
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16850
16889
|
};
|
|
16851
16890
|
|
|
16852
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16891
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16853
16892
|
if (this.type === tokType) {
|
|
16854
16893
|
if (this.options.onTrailingComma)
|
|
16855
16894
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16862,13 +16901,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16862
16901
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16863
16902
|
// raise an unexpected token error.
|
|
16864
16903
|
|
|
16865
|
-
pp.expect = function(type) {
|
|
16904
|
+
pp$9.expect = function(type) {
|
|
16866
16905
|
this.eat(type) || this.unexpected();
|
|
16867
16906
|
};
|
|
16868
16907
|
|
|
16869
16908
|
// Raise an unexpected token error.
|
|
16870
16909
|
|
|
16871
|
-
pp.unexpected = function(pos) {
|
|
16910
|
+
pp$9.unexpected = function(pos) {
|
|
16872
16911
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16873
16912
|
};
|
|
16874
16913
|
|
|
@@ -16881,7 +16920,7 @@ function DestructuringErrors() {
|
|
|
16881
16920
|
-1;
|
|
16882
16921
|
}
|
|
16883
16922
|
|
|
16884
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16923
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16885
16924
|
if (!refDestructuringErrors) { return }
|
|
16886
16925
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16887
16926
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16889,7 +16928,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16889
16928
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16890
16929
|
};
|
|
16891
16930
|
|
|
16892
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16931
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16893
16932
|
if (!refDestructuringErrors) { return false }
|
|
16894
16933
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16895
16934
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16900,20 +16939,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16900
16939
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16901
16940
|
};
|
|
16902
16941
|
|
|
16903
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16942
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16904
16943
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16905
16944
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16906
16945
|
if (this.awaitPos)
|
|
16907
16946
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16908
16947
|
};
|
|
16909
16948
|
|
|
16910
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16949
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16911
16950
|
if (expr.type === "ParenthesizedExpression")
|
|
16912
16951
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16913
16952
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16914
16953
|
};
|
|
16915
16954
|
|
|
16916
|
-
var pp$
|
|
16955
|
+
var pp$8 = Parser.prototype;
|
|
16917
16956
|
|
|
16918
16957
|
// ### Statement parsing
|
|
16919
16958
|
|
|
@@ -16922,10 +16961,10 @@ var pp$1 = Parser.prototype;
|
|
|
16922
16961
|
// `program` argument. If present, the statements will be appended
|
|
16923
16962
|
// to its body instead of creating a new node.
|
|
16924
16963
|
|
|
16925
|
-
pp$
|
|
16964
|
+
pp$8.parseTopLevel = function(node) {
|
|
16926
16965
|
var exports = Object.create(null);
|
|
16927
16966
|
if (!node.body) { node.body = []; }
|
|
16928
|
-
while (this.type !== types.eof) {
|
|
16967
|
+
while (this.type !== types$1.eof) {
|
|
16929
16968
|
var stmt = this.parseStatement(null, true, exports);
|
|
16930
16969
|
node.body.push(stmt);
|
|
16931
16970
|
}
|
|
@@ -16944,7 +16983,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16944
16983
|
|
|
16945
16984
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16946
16985
|
|
|
16947
|
-
pp$
|
|
16986
|
+
pp$8.isLet = function(context) {
|
|
16948
16987
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16949
16988
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16950
16989
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16970,7 +17009,7 @@ pp$1.isLet = function(context) {
|
|
|
16970
17009
|
// check 'async [no LineTerminator here] function'
|
|
16971
17010
|
// - 'async /*foo*/ function' is OK.
|
|
16972
17011
|
// - 'async /*\n*/ function' is invalid.
|
|
16973
|
-
pp$
|
|
17012
|
+
pp$8.isAsyncFunction = function() {
|
|
16974
17013
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16975
17014
|
{ return false }
|
|
16976
17015
|
|
|
@@ -16990,11 +17029,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16990
17029
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16991
17030
|
// does not help.
|
|
16992
17031
|
|
|
16993
|
-
pp$
|
|
17032
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16994
17033
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16995
17034
|
|
|
16996
17035
|
if (this.isLet(context)) {
|
|
16997
|
-
starttype = types._var;
|
|
17036
|
+
starttype = types$1._var;
|
|
16998
17037
|
kind = "let";
|
|
16999
17038
|
}
|
|
17000
17039
|
|
|
@@ -17003,35 +17042,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17003
17042
|
// complexity.
|
|
17004
17043
|
|
|
17005
17044
|
switch (starttype) {
|
|
17006
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
17007
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
17008
|
-
case types._do: return this.parseDoStatement(node)
|
|
17009
|
-
case types._for: return this.parseForStatement(node)
|
|
17010
|
-
case types._function:
|
|
17045
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
17046
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
17047
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
17048
|
+
case types$1._for: return this.parseForStatement(node)
|
|
17049
|
+
case types$1._function:
|
|
17011
17050
|
// Function as sole body of either an if statement or a labeled statement
|
|
17012
17051
|
// works, but not when it is part of a labeled statement that is the sole
|
|
17013
17052
|
// body of an if statement.
|
|
17014
17053
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
17015
17054
|
return this.parseFunctionStatement(node, false, !context)
|
|
17016
|
-
case types._class:
|
|
17055
|
+
case types$1._class:
|
|
17017
17056
|
if (context) { this.unexpected(); }
|
|
17018
17057
|
return this.parseClass(node, true)
|
|
17019
|
-
case types._if: return this.parseIfStatement(node)
|
|
17020
|
-
case types._return: return this.parseReturnStatement(node)
|
|
17021
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
17022
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
17023
|
-
case types._try: return this.parseTryStatement(node)
|
|
17024
|
-
case types._const: case types._var:
|
|
17058
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
17059
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
17060
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
17061
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
17062
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
17063
|
+
case types$1._const: case types$1._var:
|
|
17025
17064
|
kind = kind || this.value;
|
|
17026
17065
|
if (context && kind !== "var") { this.unexpected(); }
|
|
17027
17066
|
return this.parseVarStatement(node, kind)
|
|
17028
|
-
case types._while: return this.parseWhileStatement(node)
|
|
17029
|
-
case types._with: return this.parseWithStatement(node)
|
|
17030
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
17031
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
17032
|
-
case types._export:
|
|
17033
|
-
case types._import:
|
|
17034
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
17067
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
17068
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
17069
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
17070
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
17071
|
+
case types$1._export:
|
|
17072
|
+
case types$1._import:
|
|
17073
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
17035
17074
|
skipWhiteSpace.lastIndex = this.pos;
|
|
17036
17075
|
var skip = skipWhiteSpace.exec(this.input);
|
|
17037
17076
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -17045,7 +17084,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17045
17084
|
if (!this.inModule)
|
|
17046
17085
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
17047
17086
|
}
|
|
17048
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
17087
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
17049
17088
|
|
|
17050
17089
|
// If the statement does not start with a statement keyword or a
|
|
17051
17090
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -17060,17 +17099,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
17060
17099
|
}
|
|
17061
17100
|
|
|
17062
17101
|
var maybeName = this.value, expr = this.parseExpression();
|
|
17063
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
17102
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
17064
17103
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
17065
17104
|
else { return this.parseExpressionStatement(node, expr) }
|
|
17066
17105
|
}
|
|
17067
17106
|
};
|
|
17068
17107
|
|
|
17069
|
-
pp$
|
|
17108
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
17070
17109
|
var isBreak = keyword === "break";
|
|
17071
17110
|
this.next();
|
|
17072
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
17073
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
17111
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
17112
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
17074
17113
|
else {
|
|
17075
17114
|
node.label = this.parseIdent();
|
|
17076
17115
|
this.semicolon();
|
|
@@ -17090,21 +17129,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
17090
17129
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
17091
17130
|
};
|
|
17092
17131
|
|
|
17093
|
-
pp$
|
|
17132
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
17094
17133
|
this.next();
|
|
17095
17134
|
this.semicolon();
|
|
17096
17135
|
return this.finishNode(node, "DebuggerStatement")
|
|
17097
17136
|
};
|
|
17098
17137
|
|
|
17099
|
-
pp$
|
|
17138
|
+
pp$8.parseDoStatement = function(node) {
|
|
17100
17139
|
this.next();
|
|
17101
17140
|
this.labels.push(loopLabel);
|
|
17102
17141
|
node.body = this.parseStatement("do");
|
|
17103
17142
|
this.labels.pop();
|
|
17104
|
-
this.expect(types._while);
|
|
17143
|
+
this.expect(types$1._while);
|
|
17105
17144
|
node.test = this.parseParenExpression();
|
|
17106
17145
|
if (this.options.ecmaVersion >= 6)
|
|
17107
|
-
{ this.eat(types.semi); }
|
|
17146
|
+
{ this.eat(types$1.semi); }
|
|
17108
17147
|
else
|
|
17109
17148
|
{ this.semicolon(); }
|
|
17110
17149
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -17118,25 +17157,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
17118
17157
|
// part (semicolon immediately after the opening parenthesis), it
|
|
17119
17158
|
// is a regular `for` loop.
|
|
17120
17159
|
|
|
17121
|
-
pp$
|
|
17160
|
+
pp$8.parseForStatement = function(node) {
|
|
17122
17161
|
this.next();
|
|
17123
17162
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
17124
17163
|
this.labels.push(loopLabel);
|
|
17125
17164
|
this.enterScope(0);
|
|
17126
|
-
this.expect(types.parenL);
|
|
17127
|
-
if (this.type === types.semi) {
|
|
17165
|
+
this.expect(types$1.parenL);
|
|
17166
|
+
if (this.type === types$1.semi) {
|
|
17128
17167
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17129
17168
|
return this.parseFor(node, null)
|
|
17130
17169
|
}
|
|
17131
17170
|
var isLet = this.isLet();
|
|
17132
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
17171
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
17133
17172
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
17134
17173
|
this.next();
|
|
17135
17174
|
this.parseVar(init$1, true, kind);
|
|
17136
17175
|
this.finishNode(init$1, "VariableDeclaration");
|
|
17137
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17176
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17138
17177
|
if (this.options.ecmaVersion >= 9) {
|
|
17139
|
-
if (this.type === types._in) {
|
|
17178
|
+
if (this.type === types$1._in) {
|
|
17140
17179
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17141
17180
|
} else { node.await = awaitAt > -1; }
|
|
17142
17181
|
}
|
|
@@ -17148,9 +17187,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17148
17187
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17149
17188
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17150
17189
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17151
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17190
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17152
17191
|
if (this.options.ecmaVersion >= 9) {
|
|
17153
|
-
if (this.type === types._in) {
|
|
17192
|
+
if (this.type === types$1._in) {
|
|
17154
17193
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17155
17194
|
} else { node.await = awaitAt > -1; }
|
|
17156
17195
|
}
|
|
@@ -17165,21 +17204,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17165
17204
|
return this.parseFor(node, init)
|
|
17166
17205
|
};
|
|
17167
17206
|
|
|
17168
|
-
pp$
|
|
17207
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17169
17208
|
this.next();
|
|
17170
17209
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17171
17210
|
};
|
|
17172
17211
|
|
|
17173
|
-
pp$
|
|
17212
|
+
pp$8.parseIfStatement = function(node) {
|
|
17174
17213
|
this.next();
|
|
17175
17214
|
node.test = this.parseParenExpression();
|
|
17176
17215
|
// allow function declarations in branches, but only in non-strict mode
|
|
17177
17216
|
node.consequent = this.parseStatement("if");
|
|
17178
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17217
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17179
17218
|
return this.finishNode(node, "IfStatement")
|
|
17180
17219
|
};
|
|
17181
17220
|
|
|
17182
|
-
pp$
|
|
17221
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17183
17222
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17184
17223
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17185
17224
|
this.next();
|
|
@@ -17188,16 +17227,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17188
17227
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17189
17228
|
// possibility to insert one.
|
|
17190
17229
|
|
|
17191
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17230
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17192
17231
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17193
17232
|
return this.finishNode(node, "ReturnStatement")
|
|
17194
17233
|
};
|
|
17195
17234
|
|
|
17196
|
-
pp$
|
|
17235
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17197
17236
|
this.next();
|
|
17198
17237
|
node.discriminant = this.parseParenExpression();
|
|
17199
17238
|
node.cases = [];
|
|
17200
|
-
this.expect(types.braceL);
|
|
17239
|
+
this.expect(types$1.braceL);
|
|
17201
17240
|
this.labels.push(switchLabel);
|
|
17202
17241
|
this.enterScope(0);
|
|
17203
17242
|
|
|
@@ -17206,9 +17245,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17206
17245
|
// adding statements to.
|
|
17207
17246
|
|
|
17208
17247
|
var cur;
|
|
17209
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
17210
|
-
if (this.type === types._case || this.type === types._default) {
|
|
17211
|
-
var isCase = this.type === types._case;
|
|
17248
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17249
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17250
|
+
var isCase = this.type === types$1._case;
|
|
17212
17251
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17213
17252
|
node.cases.push(cur = this.startNode());
|
|
17214
17253
|
cur.consequent = [];
|
|
@@ -17220,7 +17259,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17220
17259
|
sawDefault = true;
|
|
17221
17260
|
cur.test = null;
|
|
17222
17261
|
}
|
|
17223
|
-
this.expect(types.colon);
|
|
17262
|
+
this.expect(types$1.colon);
|
|
17224
17263
|
} else {
|
|
17225
17264
|
if (!cur) { this.unexpected(); }
|
|
17226
17265
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17233,7 +17272,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17233
17272
|
return this.finishNode(node, "SwitchStatement")
|
|
17234
17273
|
};
|
|
17235
17274
|
|
|
17236
|
-
pp$
|
|
17275
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17237
17276
|
this.next();
|
|
17238
17277
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17239
17278
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17244,21 +17283,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17244
17283
|
|
|
17245
17284
|
// Reused empty array added for node fields that are always empty.
|
|
17246
17285
|
|
|
17247
|
-
var empty = [];
|
|
17286
|
+
var empty$1 = [];
|
|
17248
17287
|
|
|
17249
|
-
pp$
|
|
17288
|
+
pp$8.parseTryStatement = function(node) {
|
|
17250
17289
|
this.next();
|
|
17251
17290
|
node.block = this.parseBlock();
|
|
17252
17291
|
node.handler = null;
|
|
17253
|
-
if (this.type === types._catch) {
|
|
17292
|
+
if (this.type === types$1._catch) {
|
|
17254
17293
|
var clause = this.startNode();
|
|
17255
17294
|
this.next();
|
|
17256
|
-
if (this.eat(types.parenL)) {
|
|
17295
|
+
if (this.eat(types$1.parenL)) {
|
|
17257
17296
|
clause.param = this.parseBindingAtom();
|
|
17258
17297
|
var simple = clause.param.type === "Identifier";
|
|
17259
17298
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17260
17299
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17261
|
-
this.expect(types.parenR);
|
|
17300
|
+
this.expect(types$1.parenR);
|
|
17262
17301
|
} else {
|
|
17263
17302
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17264
17303
|
clause.param = null;
|
|
@@ -17268,20 +17307,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17268
17307
|
this.exitScope();
|
|
17269
17308
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17270
17309
|
}
|
|
17271
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17310
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17272
17311
|
if (!node.handler && !node.finalizer)
|
|
17273
17312
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17274
17313
|
return this.finishNode(node, "TryStatement")
|
|
17275
17314
|
};
|
|
17276
17315
|
|
|
17277
|
-
pp$
|
|
17316
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17278
17317
|
this.next();
|
|
17279
17318
|
this.parseVar(node, false, kind);
|
|
17280
17319
|
this.semicolon();
|
|
17281
17320
|
return this.finishNode(node, "VariableDeclaration")
|
|
17282
17321
|
};
|
|
17283
17322
|
|
|
17284
|
-
pp$
|
|
17323
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17285
17324
|
this.next();
|
|
17286
17325
|
node.test = this.parseParenExpression();
|
|
17287
17326
|
this.labels.push(loopLabel);
|
|
@@ -17290,7 +17329,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17290
17329
|
return this.finishNode(node, "WhileStatement")
|
|
17291
17330
|
};
|
|
17292
17331
|
|
|
17293
|
-
pp$
|
|
17332
|
+
pp$8.parseWithStatement = function(node) {
|
|
17294
17333
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17295
17334
|
this.next();
|
|
17296
17335
|
node.object = this.parseParenExpression();
|
|
@@ -17298,12 +17337,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17298
17337
|
return this.finishNode(node, "WithStatement")
|
|
17299
17338
|
};
|
|
17300
17339
|
|
|
17301
|
-
pp$
|
|
17340
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17302
17341
|
this.next();
|
|
17303
17342
|
return this.finishNode(node, "EmptyStatement")
|
|
17304
17343
|
};
|
|
17305
17344
|
|
|
17306
|
-
pp$
|
|
17345
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17307
17346
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17308
17347
|
{
|
|
17309
17348
|
var label = list[i$1];
|
|
@@ -17311,7 +17350,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17311
17350
|
if (label.name === maybeName)
|
|
17312
17351
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17313
17352
|
} }
|
|
17314
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17353
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17315
17354
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17316
17355
|
var label$1 = this.labels[i];
|
|
17317
17356
|
if (label$1.statementStart === node.start) {
|
|
@@ -17327,7 +17366,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17327
17366
|
return this.finishNode(node, "LabeledStatement")
|
|
17328
17367
|
};
|
|
17329
17368
|
|
|
17330
|
-
pp$
|
|
17369
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17331
17370
|
node.expression = expr;
|
|
17332
17371
|
this.semicolon();
|
|
17333
17372
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17337,14 +17376,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17337
17376
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17338
17377
|
// function bodies).
|
|
17339
17378
|
|
|
17340
|
-
pp$
|
|
17379
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17341
17380
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17342
17381
|
if ( node === void 0 ) node = this.startNode();
|
|
17343
17382
|
|
|
17344
17383
|
node.body = [];
|
|
17345
|
-
this.expect(types.braceL);
|
|
17384
|
+
this.expect(types$1.braceL);
|
|
17346
17385
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17347
|
-
while (this.type !== types.braceR) {
|
|
17386
|
+
while (this.type !== types$1.braceR) {
|
|
17348
17387
|
var stmt = this.parseStatement(null);
|
|
17349
17388
|
node.body.push(stmt);
|
|
17350
17389
|
}
|
|
@@ -17358,13 +17397,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17358
17397
|
// `parseStatement` will already have parsed the init statement or
|
|
17359
17398
|
// expression.
|
|
17360
17399
|
|
|
17361
|
-
pp$
|
|
17400
|
+
pp$8.parseFor = function(node, init) {
|
|
17362
17401
|
node.init = init;
|
|
17363
|
-
this.expect(types.semi);
|
|
17364
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
17365
|
-
this.expect(types.semi);
|
|
17366
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
17367
|
-
this.expect(types.parenR);
|
|
17402
|
+
this.expect(types$1.semi);
|
|
17403
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17404
|
+
this.expect(types$1.semi);
|
|
17405
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17406
|
+
this.expect(types$1.parenR);
|
|
17368
17407
|
node.body = this.parseStatement("for");
|
|
17369
17408
|
this.exitScope();
|
|
17370
17409
|
this.labels.pop();
|
|
@@ -17374,8 +17413,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17374
17413
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17375
17414
|
// same from parser's perspective.
|
|
17376
17415
|
|
|
17377
|
-
pp$
|
|
17378
|
-
var isForIn = this.type === types._in;
|
|
17416
|
+
pp$8.parseForIn = function(node, init) {
|
|
17417
|
+
var isForIn = this.type === types$1._in;
|
|
17379
17418
|
this.next();
|
|
17380
17419
|
|
|
17381
17420
|
if (
|
|
@@ -17396,7 +17435,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17396
17435
|
}
|
|
17397
17436
|
node.left = init;
|
|
17398
17437
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17399
|
-
this.expect(types.parenR);
|
|
17438
|
+
this.expect(types$1.parenR);
|
|
17400
17439
|
node.body = this.parseStatement("for");
|
|
17401
17440
|
this.exitScope();
|
|
17402
17441
|
this.labels.pop();
|
|
@@ -17405,28 +17444,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17405
17444
|
|
|
17406
17445
|
// Parse a list of variable declarations.
|
|
17407
17446
|
|
|
17408
|
-
pp$
|
|
17447
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17409
17448
|
node.declarations = [];
|
|
17410
17449
|
node.kind = kind;
|
|
17411
17450
|
for (;;) {
|
|
17412
17451
|
var decl = this.startNode();
|
|
17413
17452
|
this.parseVarId(decl, kind);
|
|
17414
|
-
if (this.eat(types.eq)) {
|
|
17453
|
+
if (this.eat(types$1.eq)) {
|
|
17415
17454
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17416
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17455
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17417
17456
|
this.unexpected();
|
|
17418
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17457
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17419
17458
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17420
17459
|
} else {
|
|
17421
17460
|
decl.init = null;
|
|
17422
17461
|
}
|
|
17423
17462
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17424
|
-
if (!this.eat(types.comma)) { break }
|
|
17463
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17425
17464
|
}
|
|
17426
17465
|
return node
|
|
17427
17466
|
};
|
|
17428
17467
|
|
|
17429
|
-
pp$
|
|
17468
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17430
17469
|
decl.id = this.parseBindingAtom();
|
|
17431
17470
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17432
17471
|
};
|
|
@@ -17437,18 +17476,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17437
17476
|
// `statement & FUNC_STATEMENT`).
|
|
17438
17477
|
|
|
17439
17478
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17440
|
-
pp$
|
|
17479
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17441
17480
|
this.initFunction(node);
|
|
17442
17481
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17443
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17482
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17444
17483
|
{ this.unexpected(); }
|
|
17445
|
-
node.generator = this.eat(types.star);
|
|
17484
|
+
node.generator = this.eat(types$1.star);
|
|
17446
17485
|
}
|
|
17447
17486
|
if (this.options.ecmaVersion >= 8)
|
|
17448
17487
|
{ node.async = !!isAsync; }
|
|
17449
17488
|
|
|
17450
17489
|
if (statement & FUNC_STATEMENT) {
|
|
17451
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17490
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17452
17491
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17453
17492
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17454
17493
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17464,7 +17503,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17464
17503
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17465
17504
|
|
|
17466
17505
|
if (!(statement & FUNC_STATEMENT))
|
|
17467
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17506
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17468
17507
|
|
|
17469
17508
|
this.parseFunctionParams(node);
|
|
17470
17509
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17475,16 +17514,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17475
17514
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17476
17515
|
};
|
|
17477
17516
|
|
|
17478
|
-
pp$
|
|
17479
|
-
this.expect(types.parenL);
|
|
17480
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17517
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17518
|
+
this.expect(types$1.parenL);
|
|
17519
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17481
17520
|
this.checkYieldAwaitInDefaultParams();
|
|
17482
17521
|
};
|
|
17483
17522
|
|
|
17484
17523
|
// Parse a class declaration or literal (depending on the
|
|
17485
17524
|
// `isStatement` parameter).
|
|
17486
17525
|
|
|
17487
|
-
pp$
|
|
17526
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17488
17527
|
this.next();
|
|
17489
17528
|
|
|
17490
17529
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17498,8 +17537,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17498
17537
|
var classBody = this.startNode();
|
|
17499
17538
|
var hadConstructor = false;
|
|
17500
17539
|
classBody.body = [];
|
|
17501
|
-
this.expect(types.braceL);
|
|
17502
|
-
while (this.type !== types.braceR) {
|
|
17540
|
+
this.expect(types$1.braceL);
|
|
17541
|
+
while (this.type !== types$1.braceR) {
|
|
17503
17542
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17504
17543
|
if (element) {
|
|
17505
17544
|
classBody.body.push(element);
|
|
@@ -17518,8 +17557,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17518
17557
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17519
17558
|
};
|
|
17520
17559
|
|
|
17521
|
-
pp$
|
|
17522
|
-
if (this.eat(types.semi)) { return null }
|
|
17560
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17561
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17523
17562
|
|
|
17524
17563
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17525
17564
|
var node = this.startNode();
|
|
@@ -17531,11 +17570,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17531
17570
|
|
|
17532
17571
|
if (this.eatContextual("static")) {
|
|
17533
17572
|
// Parse static init block
|
|
17534
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17573
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17535
17574
|
this.parseClassStaticBlock(node);
|
|
17536
17575
|
return node
|
|
17537
17576
|
}
|
|
17538
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17577
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17539
17578
|
isStatic = true;
|
|
17540
17579
|
} else {
|
|
17541
17580
|
keyName = "static";
|
|
@@ -17543,13 +17582,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17543
17582
|
}
|
|
17544
17583
|
node.static = isStatic;
|
|
17545
17584
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17546
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17585
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17547
17586
|
isAsync = true;
|
|
17548
17587
|
} else {
|
|
17549
17588
|
keyName = "async";
|
|
17550
17589
|
}
|
|
17551
17590
|
}
|
|
17552
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17591
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17553
17592
|
isGenerator = true;
|
|
17554
17593
|
}
|
|
17555
17594
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17576,7 +17615,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17576
17615
|
}
|
|
17577
17616
|
|
|
17578
17617
|
// Parse element value
|
|
17579
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17618
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17580
17619
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17581
17620
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17582
17621
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17590,19 +17629,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17590
17629
|
return node
|
|
17591
17630
|
};
|
|
17592
17631
|
|
|
17593
|
-
pp$
|
|
17632
|
+
pp$8.isClassElementNameStart = function() {
|
|
17594
17633
|
return (
|
|
17595
|
-
this.type === types.name ||
|
|
17596
|
-
this.type === types.privateId ||
|
|
17597
|
-
this.type === types.num ||
|
|
17598
|
-
this.type === types.string ||
|
|
17599
|
-
this.type === types.bracketL ||
|
|
17634
|
+
this.type === types$1.name ||
|
|
17635
|
+
this.type === types$1.privateId ||
|
|
17636
|
+
this.type === types$1.num ||
|
|
17637
|
+
this.type === types$1.string ||
|
|
17638
|
+
this.type === types$1.bracketL ||
|
|
17600
17639
|
this.type.keyword
|
|
17601
17640
|
)
|
|
17602
17641
|
};
|
|
17603
17642
|
|
|
17604
|
-
pp$
|
|
17605
|
-
if (this.type === types.privateId) {
|
|
17643
|
+
pp$8.parseClassElementName = function(element) {
|
|
17644
|
+
if (this.type === types$1.privateId) {
|
|
17606
17645
|
if (this.value === "constructor") {
|
|
17607
17646
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17608
17647
|
}
|
|
@@ -17613,7 +17652,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17613
17652
|
}
|
|
17614
17653
|
};
|
|
17615
17654
|
|
|
17616
|
-
pp$
|
|
17655
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17617
17656
|
// Check key and flags
|
|
17618
17657
|
var key = method.key;
|
|
17619
17658
|
if (method.kind === "constructor") {
|
|
@@ -17637,14 +17676,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17637
17676
|
return this.finishNode(method, "MethodDefinition")
|
|
17638
17677
|
};
|
|
17639
17678
|
|
|
17640
|
-
pp$
|
|
17679
|
+
pp$8.parseClassField = function(field) {
|
|
17641
17680
|
if (checkKeyName(field, "constructor")) {
|
|
17642
17681
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17643
17682
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17644
17683
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17645
17684
|
}
|
|
17646
17685
|
|
|
17647
|
-
if (this.eat(types.eq)) {
|
|
17686
|
+
if (this.eat(types$1.eq)) {
|
|
17648
17687
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17649
17688
|
var scope = this.currentThisScope();
|
|
17650
17689
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17659,13 +17698,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17659
17698
|
return this.finishNode(field, "PropertyDefinition")
|
|
17660
17699
|
};
|
|
17661
17700
|
|
|
17662
|
-
pp$
|
|
17701
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17663
17702
|
node.body = [];
|
|
17664
17703
|
|
|
17665
17704
|
var oldLabels = this.labels;
|
|
17666
17705
|
this.labels = [];
|
|
17667
17706
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17668
|
-
while (this.type !== types.braceR) {
|
|
17707
|
+
while (this.type !== types$1.braceR) {
|
|
17669
17708
|
var stmt = this.parseStatement(null);
|
|
17670
17709
|
node.body.push(stmt);
|
|
17671
17710
|
}
|
|
@@ -17676,8 +17715,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17676
17715
|
return this.finishNode(node, "StaticBlock")
|
|
17677
17716
|
};
|
|
17678
17717
|
|
|
17679
|
-
pp$
|
|
17680
|
-
if (this.type === types.name) {
|
|
17718
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17719
|
+
if (this.type === types$1.name) {
|
|
17681
17720
|
node.id = this.parseIdent();
|
|
17682
17721
|
if (isStatement)
|
|
17683
17722
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17688,17 +17727,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17688
17727
|
}
|
|
17689
17728
|
};
|
|
17690
17729
|
|
|
17691
|
-
pp$
|
|
17692
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17730
|
+
pp$8.parseClassSuper = function(node) {
|
|
17731
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17693
17732
|
};
|
|
17694
17733
|
|
|
17695
|
-
pp$
|
|
17734
|
+
pp$8.enterClassBody = function() {
|
|
17696
17735
|
var element = {declared: Object.create(null), used: []};
|
|
17697
17736
|
this.privateNameStack.push(element);
|
|
17698
17737
|
return element.declared
|
|
17699
17738
|
};
|
|
17700
17739
|
|
|
17701
|
-
pp$
|
|
17740
|
+
pp$8.exitClassBody = function() {
|
|
17702
17741
|
var ref = this.privateNameStack.pop();
|
|
17703
17742
|
var declared = ref.declared;
|
|
17704
17743
|
var used = ref.used;
|
|
@@ -17753,10 +17792,10 @@ function checkKeyName(node, name) {
|
|
|
17753
17792
|
|
|
17754
17793
|
// Parses module export declaration.
|
|
17755
17794
|
|
|
17756
|
-
pp$
|
|
17795
|
+
pp$8.parseExport = function(node, exports) {
|
|
17757
17796
|
this.next();
|
|
17758
17797
|
// export * from '...'
|
|
17759
|
-
if (this.eat(types.star)) {
|
|
17798
|
+
if (this.eat(types$1.star)) {
|
|
17760
17799
|
if (this.options.ecmaVersion >= 11) {
|
|
17761
17800
|
if (this.eatContextual("as")) {
|
|
17762
17801
|
node.exported = this.parseIdent(true);
|
|
@@ -17766,20 +17805,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17766
17805
|
}
|
|
17767
17806
|
}
|
|
17768
17807
|
this.expectContextual("from");
|
|
17769
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17808
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17770
17809
|
node.source = this.parseExprAtom();
|
|
17771
17810
|
this.semicolon();
|
|
17772
17811
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17773
17812
|
}
|
|
17774
|
-
if (this.eat(types._default)) { // export default ...
|
|
17813
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17775
17814
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17776
17815
|
var isAsync;
|
|
17777
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17816
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17778
17817
|
var fNode = this.startNode();
|
|
17779
17818
|
this.next();
|
|
17780
17819
|
if (isAsync) { this.next(); }
|
|
17781
17820
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17782
|
-
} else if (this.type === types._class) {
|
|
17821
|
+
} else if (this.type === types$1._class) {
|
|
17783
17822
|
var cNode = this.startNode();
|
|
17784
17823
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17785
17824
|
} else {
|
|
@@ -17801,7 +17840,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17801
17840
|
node.declaration = null;
|
|
17802
17841
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17803
17842
|
if (this.eatContextual("from")) {
|
|
17804
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17843
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17805
17844
|
node.source = this.parseExprAtom();
|
|
17806
17845
|
} else {
|
|
17807
17846
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17820,14 +17859,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17820
17859
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17821
17860
|
};
|
|
17822
17861
|
|
|
17823
|
-
pp$
|
|
17862
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17824
17863
|
if (!exports) { return }
|
|
17825
17864
|
if (has(exports, name))
|
|
17826
17865
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17827
17866
|
exports[name] = true;
|
|
17828
17867
|
};
|
|
17829
17868
|
|
|
17830
|
-
pp$
|
|
17869
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17831
17870
|
var type = pat.type;
|
|
17832
17871
|
if (type === "Identifier")
|
|
17833
17872
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17854,7 +17893,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17854
17893
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17855
17894
|
};
|
|
17856
17895
|
|
|
17857
|
-
pp$
|
|
17896
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17858
17897
|
if (!exports) { return }
|
|
17859
17898
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17860
17899
|
{
|
|
@@ -17864,7 +17903,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17864
17903
|
}
|
|
17865
17904
|
};
|
|
17866
17905
|
|
|
17867
|
-
pp$
|
|
17906
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17868
17907
|
return this.type.keyword === "var" ||
|
|
17869
17908
|
this.type.keyword === "const" ||
|
|
17870
17909
|
this.type.keyword === "class" ||
|
|
@@ -17875,14 +17914,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17875
17914
|
|
|
17876
17915
|
// Parses a comma-separated list of module exports.
|
|
17877
17916
|
|
|
17878
|
-
pp$
|
|
17917
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17879
17918
|
var nodes = [], first = true;
|
|
17880
17919
|
// export { x, y as z } [from '...']
|
|
17881
|
-
this.expect(types.braceL);
|
|
17882
|
-
while (!this.eat(types.braceR)) {
|
|
17920
|
+
this.expect(types$1.braceL);
|
|
17921
|
+
while (!this.eat(types$1.braceR)) {
|
|
17883
17922
|
if (!first) {
|
|
17884
|
-
this.expect(types.comma);
|
|
17885
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17923
|
+
this.expect(types$1.comma);
|
|
17924
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17886
17925
|
} else { first = false; }
|
|
17887
17926
|
|
|
17888
17927
|
var node = this.startNode();
|
|
@@ -17896,16 +17935,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17896
17935
|
|
|
17897
17936
|
// Parses import declaration.
|
|
17898
17937
|
|
|
17899
|
-
pp$
|
|
17938
|
+
pp$8.parseImport = function(node) {
|
|
17900
17939
|
this.next();
|
|
17901
17940
|
// import '...'
|
|
17902
|
-
if (this.type === types.string) {
|
|
17903
|
-
node.specifiers = empty;
|
|
17941
|
+
if (this.type === types$1.string) {
|
|
17942
|
+
node.specifiers = empty$1;
|
|
17904
17943
|
node.source = this.parseExprAtom();
|
|
17905
17944
|
} else {
|
|
17906
17945
|
node.specifiers = this.parseImportSpecifiers();
|
|
17907
17946
|
this.expectContextual("from");
|
|
17908
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17947
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17909
17948
|
}
|
|
17910
17949
|
this.semicolon();
|
|
17911
17950
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17913,17 +17952,17 @@ pp$1.parseImport = function(node) {
|
|
|
17913
17952
|
|
|
17914
17953
|
// Parses a comma-separated list of module imports.
|
|
17915
17954
|
|
|
17916
|
-
pp$
|
|
17955
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17917
17956
|
var nodes = [], first = true;
|
|
17918
|
-
if (this.type === types.name) {
|
|
17957
|
+
if (this.type === types$1.name) {
|
|
17919
17958
|
// import defaultObj, { x, y as z } from '...'
|
|
17920
17959
|
var node = this.startNode();
|
|
17921
17960
|
node.local = this.parseIdent();
|
|
17922
17961
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17923
17962
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17924
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17963
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17925
17964
|
}
|
|
17926
|
-
if (this.type === types.star) {
|
|
17965
|
+
if (this.type === types$1.star) {
|
|
17927
17966
|
var node$1 = this.startNode();
|
|
17928
17967
|
this.next();
|
|
17929
17968
|
this.expectContextual("as");
|
|
@@ -17932,11 +17971,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17932
17971
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17933
17972
|
return nodes
|
|
17934
17973
|
}
|
|
17935
|
-
this.expect(types.braceL);
|
|
17936
|
-
while (!this.eat(types.braceR)) {
|
|
17974
|
+
this.expect(types$1.braceL);
|
|
17975
|
+
while (!this.eat(types$1.braceR)) {
|
|
17937
17976
|
if (!first) {
|
|
17938
|
-
this.expect(types.comma);
|
|
17939
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17977
|
+
this.expect(types$1.comma);
|
|
17978
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17940
17979
|
} else { first = false; }
|
|
17941
17980
|
|
|
17942
17981
|
var node$2 = this.startNode();
|
|
@@ -17954,12 +17993,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17954
17993
|
};
|
|
17955
17994
|
|
|
17956
17995
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17957
|
-
pp$
|
|
17996
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17958
17997
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17959
17998
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17960
17999
|
}
|
|
17961
18000
|
};
|
|
17962
|
-
pp$
|
|
18001
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17963
18002
|
return (
|
|
17964
18003
|
statement.type === "ExpressionStatement" &&
|
|
17965
18004
|
statement.expression.type === "Literal" &&
|
|
@@ -17969,12 +18008,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17969
18008
|
)
|
|
17970
18009
|
};
|
|
17971
18010
|
|
|
17972
|
-
var pp$
|
|
18011
|
+
var pp$7 = Parser.prototype;
|
|
17973
18012
|
|
|
17974
18013
|
// Convert existing expression atom to assignable pattern
|
|
17975
18014
|
// if possible.
|
|
17976
18015
|
|
|
17977
|
-
pp$
|
|
18016
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17978
18017
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17979
18018
|
switch (node.type) {
|
|
17980
18019
|
case "Identifier":
|
|
@@ -18055,7 +18094,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
18055
18094
|
|
|
18056
18095
|
// Convert list of expression atoms to binding list.
|
|
18057
18096
|
|
|
18058
|
-
pp$
|
|
18097
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
18059
18098
|
var end = exprList.length;
|
|
18060
18099
|
for (var i = 0; i < end; i++) {
|
|
18061
18100
|
var elt = exprList[i];
|
|
@@ -18071,19 +18110,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
18071
18110
|
|
|
18072
18111
|
// Parses spread element.
|
|
18073
18112
|
|
|
18074
|
-
pp$
|
|
18113
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
18075
18114
|
var node = this.startNode();
|
|
18076
18115
|
this.next();
|
|
18077
18116
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
18078
18117
|
return this.finishNode(node, "SpreadElement")
|
|
18079
18118
|
};
|
|
18080
18119
|
|
|
18081
|
-
pp$
|
|
18120
|
+
pp$7.parseRestBinding = function() {
|
|
18082
18121
|
var node = this.startNode();
|
|
18083
18122
|
this.next();
|
|
18084
18123
|
|
|
18085
18124
|
// RestElement inside of a function parameter must be an identifier
|
|
18086
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
18125
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
18087
18126
|
{ this.unexpected(); }
|
|
18088
18127
|
|
|
18089
18128
|
node.argument = this.parseBindingAtom();
|
|
@@ -18093,36 +18132,36 @@ pp$2.parseRestBinding = function() {
|
|
|
18093
18132
|
|
|
18094
18133
|
// Parses lvalue (assignable) atom.
|
|
18095
18134
|
|
|
18096
|
-
pp$
|
|
18135
|
+
pp$7.parseBindingAtom = function() {
|
|
18097
18136
|
if (this.options.ecmaVersion >= 6) {
|
|
18098
18137
|
switch (this.type) {
|
|
18099
|
-
case types.bracketL:
|
|
18138
|
+
case types$1.bracketL:
|
|
18100
18139
|
var node = this.startNode();
|
|
18101
18140
|
this.next();
|
|
18102
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
18141
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
18103
18142
|
return this.finishNode(node, "ArrayPattern")
|
|
18104
18143
|
|
|
18105
|
-
case types.braceL:
|
|
18144
|
+
case types$1.braceL:
|
|
18106
18145
|
return this.parseObj(true)
|
|
18107
18146
|
}
|
|
18108
18147
|
}
|
|
18109
18148
|
return this.parseIdent()
|
|
18110
18149
|
};
|
|
18111
18150
|
|
|
18112
|
-
pp$
|
|
18151
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
18113
18152
|
var elts = [], first = true;
|
|
18114
18153
|
while (!this.eat(close)) {
|
|
18115
18154
|
if (first) { first = false; }
|
|
18116
|
-
else { this.expect(types.comma); }
|
|
18117
|
-
if (allowEmpty && this.type === types.comma) {
|
|
18155
|
+
else { this.expect(types$1.comma); }
|
|
18156
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
18118
18157
|
elts.push(null);
|
|
18119
18158
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
18120
18159
|
break
|
|
18121
|
-
} else if (this.type === types.ellipsis) {
|
|
18160
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18122
18161
|
var rest = this.parseRestBinding();
|
|
18123
18162
|
this.parseBindingListItem(rest);
|
|
18124
18163
|
elts.push(rest);
|
|
18125
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18164
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18126
18165
|
this.expect(close);
|
|
18127
18166
|
break
|
|
18128
18167
|
} else {
|
|
@@ -18134,15 +18173,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
18134
18173
|
return elts
|
|
18135
18174
|
};
|
|
18136
18175
|
|
|
18137
|
-
pp$
|
|
18176
|
+
pp$7.parseBindingListItem = function(param) {
|
|
18138
18177
|
return param
|
|
18139
18178
|
};
|
|
18140
18179
|
|
|
18141
18180
|
// Parses assignment pattern around given atom if possible.
|
|
18142
18181
|
|
|
18143
|
-
pp$
|
|
18182
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18144
18183
|
left = left || this.parseBindingAtom();
|
|
18145
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18184
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18146
18185
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18147
18186
|
node.left = left;
|
|
18148
18187
|
node.right = this.parseMaybeAssign();
|
|
@@ -18213,7 +18252,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18213
18252
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18214
18253
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18215
18254
|
|
|
18216
|
-
pp$
|
|
18255
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18217
18256
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18218
18257
|
|
|
18219
18258
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18251,7 +18290,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18251
18290
|
}
|
|
18252
18291
|
};
|
|
18253
18292
|
|
|
18254
|
-
pp$
|
|
18293
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18255
18294
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18256
18295
|
|
|
18257
18296
|
switch (expr.type) {
|
|
@@ -18276,7 +18315,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18276
18315
|
}
|
|
18277
18316
|
};
|
|
18278
18317
|
|
|
18279
|
-
pp$
|
|
18318
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18280
18319
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18281
18320
|
|
|
18282
18321
|
switch (expr.type) {
|
|
@@ -18308,7 +18347,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18308
18347
|
this.generator = !!generator;
|
|
18309
18348
|
};
|
|
18310
18349
|
|
|
18311
|
-
var types
|
|
18350
|
+
var types = {
|
|
18312
18351
|
b_stat: new TokContext("{", false),
|
|
18313
18352
|
b_expr: new TokContext("{", true),
|
|
18314
18353
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18321,38 +18360,38 @@ var types$1 = {
|
|
|
18321
18360
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18322
18361
|
};
|
|
18323
18362
|
|
|
18324
|
-
var pp$
|
|
18363
|
+
var pp$6 = Parser.prototype;
|
|
18325
18364
|
|
|
18326
|
-
pp$
|
|
18327
|
-
return [types
|
|
18365
|
+
pp$6.initialContext = function() {
|
|
18366
|
+
return [types.b_stat]
|
|
18328
18367
|
};
|
|
18329
18368
|
|
|
18330
|
-
pp$
|
|
18369
|
+
pp$6.curContext = function() {
|
|
18331
18370
|
return this.context[this.context.length - 1]
|
|
18332
18371
|
};
|
|
18333
18372
|
|
|
18334
|
-
pp$
|
|
18373
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18335
18374
|
var parent = this.curContext();
|
|
18336
|
-
if (parent === types
|
|
18375
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18337
18376
|
{ return true }
|
|
18338
|
-
if (prevType === types.colon && (parent === types
|
|
18377
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18339
18378
|
{ return !parent.isExpr }
|
|
18340
18379
|
|
|
18341
18380
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18342
18381
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18343
18382
|
// `tt.name`.
|
|
18344
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18383
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18345
18384
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
18346
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
18385
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18347
18386
|
{ return true }
|
|
18348
|
-
if (prevType === types.braceL)
|
|
18349
|
-
{ return parent === types
|
|
18350
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18387
|
+
if (prevType === types$1.braceL)
|
|
18388
|
+
{ return parent === types.b_stat }
|
|
18389
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18351
18390
|
{ return false }
|
|
18352
18391
|
return !this.exprAllowed
|
|
18353
18392
|
};
|
|
18354
18393
|
|
|
18355
|
-
pp$
|
|
18394
|
+
pp$6.inGeneratorContext = function() {
|
|
18356
18395
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18357
18396
|
var context = this.context[i];
|
|
18358
18397
|
if (context.token === "function")
|
|
@@ -18361,9 +18400,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18361
18400
|
return false
|
|
18362
18401
|
};
|
|
18363
18402
|
|
|
18364
|
-
pp$
|
|
18403
|
+
pp$6.updateContext = function(prevType) {
|
|
18365
18404
|
var update, type = this.type;
|
|
18366
|
-
if (type.keyword && prevType === types.dot)
|
|
18405
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18367
18406
|
{ this.exprAllowed = false; }
|
|
18368
18407
|
else if (update = type.updateContext)
|
|
18369
18408
|
{ update.call(this, prevType); }
|
|
@@ -18372,7 +18411,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18372
18411
|
};
|
|
18373
18412
|
|
|
18374
18413
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18375
|
-
pp$
|
|
18414
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18376
18415
|
if (this.curContext() !== tokenCtx) {
|
|
18377
18416
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18378
18417
|
}
|
|
@@ -18380,71 +18419,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18380
18419
|
|
|
18381
18420
|
// Token-specific context update code
|
|
18382
18421
|
|
|
18383
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18422
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18384
18423
|
if (this.context.length === 1) {
|
|
18385
18424
|
this.exprAllowed = true;
|
|
18386
18425
|
return
|
|
18387
18426
|
}
|
|
18388
18427
|
var out = this.context.pop();
|
|
18389
|
-
if (out === types
|
|
18428
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18390
18429
|
out = this.context.pop();
|
|
18391
18430
|
}
|
|
18392
18431
|
this.exprAllowed = !out.isExpr;
|
|
18393
18432
|
};
|
|
18394
18433
|
|
|
18395
|
-
types.braceL.updateContext = function(prevType) {
|
|
18396
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18434
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18435
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18397
18436
|
this.exprAllowed = true;
|
|
18398
18437
|
};
|
|
18399
18438
|
|
|
18400
|
-
types.dollarBraceL.updateContext = function() {
|
|
18401
|
-
this.context.push(types
|
|
18439
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18440
|
+
this.context.push(types.b_tmpl);
|
|
18402
18441
|
this.exprAllowed = true;
|
|
18403
18442
|
};
|
|
18404
18443
|
|
|
18405
|
-
types.parenL.updateContext = function(prevType) {
|
|
18406
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
18407
|
-
this.context.push(statementParens ? types
|
|
18444
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18445
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18446
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18408
18447
|
this.exprAllowed = true;
|
|
18409
18448
|
};
|
|
18410
18449
|
|
|
18411
|
-
types.incDec.updateContext = function() {
|
|
18450
|
+
types$1.incDec.updateContext = function() {
|
|
18412
18451
|
// tokExprAllowed stays unchanged
|
|
18413
18452
|
};
|
|
18414
18453
|
|
|
18415
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
18416
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
18417
|
-
!(prevType === types.semi && this.curContext() !== types
|
|
18418
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18419
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types
|
|
18420
|
-
{ this.context.push(types
|
|
18454
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18455
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18456
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18457
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18458
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18459
|
+
{ this.context.push(types.f_expr); }
|
|
18421
18460
|
else
|
|
18422
|
-
{ this.context.push(types
|
|
18461
|
+
{ this.context.push(types.f_stat); }
|
|
18423
18462
|
this.exprAllowed = false;
|
|
18424
18463
|
};
|
|
18425
18464
|
|
|
18426
|
-
types.backQuote.updateContext = function() {
|
|
18427
|
-
if (this.curContext() === types
|
|
18465
|
+
types$1.backQuote.updateContext = function() {
|
|
18466
|
+
if (this.curContext() === types.q_tmpl)
|
|
18428
18467
|
{ this.context.pop(); }
|
|
18429
18468
|
else
|
|
18430
|
-
{ this.context.push(types
|
|
18469
|
+
{ this.context.push(types.q_tmpl); }
|
|
18431
18470
|
this.exprAllowed = false;
|
|
18432
18471
|
};
|
|
18433
18472
|
|
|
18434
|
-
types.star.updateContext = function(prevType) {
|
|
18435
|
-
if (prevType === types._function) {
|
|
18473
|
+
types$1.star.updateContext = function(prevType) {
|
|
18474
|
+
if (prevType === types$1._function) {
|
|
18436
18475
|
var index = this.context.length - 1;
|
|
18437
|
-
if (this.context[index] === types
|
|
18438
|
-
{ this.context[index] = types
|
|
18476
|
+
if (this.context[index] === types.f_expr)
|
|
18477
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18439
18478
|
else
|
|
18440
|
-
{ this.context[index] = types
|
|
18479
|
+
{ this.context[index] = types.f_gen; }
|
|
18441
18480
|
}
|
|
18442
18481
|
this.exprAllowed = true;
|
|
18443
18482
|
};
|
|
18444
18483
|
|
|
18445
|
-
types.name.updateContext = function(prevType) {
|
|
18484
|
+
types$1.name.updateContext = function(prevType) {
|
|
18446
18485
|
var allowed = false;
|
|
18447
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18486
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18448
18487
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18449
18488
|
this.value === "yield" && this.inGeneratorContext())
|
|
18450
18489
|
{ allowed = true; }
|
|
@@ -18454,14 +18493,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18454
18493
|
|
|
18455
18494
|
// A recursive descent parser operates by defining functions for all
|
|
18456
18495
|
|
|
18457
|
-
var pp$
|
|
18496
|
+
var pp$5 = Parser.prototype;
|
|
18458
18497
|
|
|
18459
18498
|
// Check if property name clashes with already added.
|
|
18460
18499
|
// Object/class getters and setters are not allowed to clash —
|
|
18461
18500
|
// either with each other or with an init property — and in
|
|
18462
18501
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18463
18502
|
|
|
18464
|
-
pp$
|
|
18503
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18465
18504
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18466
18505
|
{ return }
|
|
18467
18506
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18478,10 +18517,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18478
18517
|
if (name === "__proto__" && kind === "init") {
|
|
18479
18518
|
if (propHash.proto) {
|
|
18480
18519
|
if (refDestructuringErrors) {
|
|
18481
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
} else {
|
|
18520
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18521
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18522
|
+
}
|
|
18523
|
+
} else {
|
|
18524
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18525
|
+
}
|
|
18485
18526
|
}
|
|
18486
18527
|
propHash.proto = true;
|
|
18487
18528
|
}
|
|
@@ -18523,13 +18564,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18523
18564
|
// and object pattern might appear (so it's possible to raise
|
|
18524
18565
|
// delayed syntax error at correct position).
|
|
18525
18566
|
|
|
18526
|
-
pp$
|
|
18567
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18527
18568
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18528
18569
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18529
|
-
if (this.type === types.comma) {
|
|
18570
|
+
if (this.type === types$1.comma) {
|
|
18530
18571
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18531
18572
|
node.expressions = [expr];
|
|
18532
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18573
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18533
18574
|
return this.finishNode(node, "SequenceExpression")
|
|
18534
18575
|
}
|
|
18535
18576
|
return expr
|
|
@@ -18538,7 +18579,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18538
18579
|
// Parse an assignment expression. This includes applications of
|
|
18539
18580
|
// operators like `+=`.
|
|
18540
18581
|
|
|
18541
|
-
pp$
|
|
18582
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18542
18583
|
if (this.isContextual("yield")) {
|
|
18543
18584
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18544
18585
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18546,10 +18587,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18546
18587
|
else { this.exprAllowed = false; }
|
|
18547
18588
|
}
|
|
18548
18589
|
|
|
18549
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18590
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18550
18591
|
if (refDestructuringErrors) {
|
|
18551
18592
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18552
18593
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18594
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18553
18595
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18554
18596
|
} else {
|
|
18555
18597
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18557,7 +18599,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18557
18599
|
}
|
|
18558
18600
|
|
|
18559
18601
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18560
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18602
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18561
18603
|
this.potentialArrowAt = this.start;
|
|
18562
18604
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18563
18605
|
}
|
|
@@ -18566,20 +18608,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18566
18608
|
if (this.type.isAssign) {
|
|
18567
18609
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18568
18610
|
node.operator = this.value;
|
|
18569
|
-
if (this.type === types.eq)
|
|
18611
|
+
if (this.type === types$1.eq)
|
|
18570
18612
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18571
18613
|
if (!ownDestructuringErrors) {
|
|
18572
18614
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18573
18615
|
}
|
|
18574
18616
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18575
18617
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18576
|
-
if (this.type === types.eq)
|
|
18618
|
+
if (this.type === types$1.eq)
|
|
18577
18619
|
{ this.checkLValPattern(left); }
|
|
18578
18620
|
else
|
|
18579
18621
|
{ this.checkLValSimple(left); }
|
|
18580
18622
|
node.left = left;
|
|
18581
18623
|
this.next();
|
|
18582
18624
|
node.right = this.parseMaybeAssign(forInit);
|
|
18625
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18583
18626
|
return this.finishNode(node, "AssignmentExpression")
|
|
18584
18627
|
} else {
|
|
18585
18628
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18591,15 +18634,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18591
18634
|
|
|
18592
18635
|
// Parse a ternary conditional (`?:`) operator.
|
|
18593
18636
|
|
|
18594
|
-
pp$
|
|
18637
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18595
18638
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18596
18639
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18597
18640
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18598
|
-
if (this.eat(types.question)) {
|
|
18641
|
+
if (this.eat(types$1.question)) {
|
|
18599
18642
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18600
18643
|
node.test = expr;
|
|
18601
18644
|
node.consequent = this.parseMaybeAssign();
|
|
18602
|
-
this.expect(types.colon);
|
|
18645
|
+
this.expect(types$1.colon);
|
|
18603
18646
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18604
18647
|
return this.finishNode(node, "ConditionalExpression")
|
|
18605
18648
|
}
|
|
@@ -18608,7 +18651,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18608
18651
|
|
|
18609
18652
|
// Start the precedence parser.
|
|
18610
18653
|
|
|
18611
|
-
pp$
|
|
18654
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18612
18655
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18613
18656
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18614
18657
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18621,23 +18664,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18621
18664
|
// defer further parser to one of its callers when it encounters an
|
|
18622
18665
|
// operator that has a lower precedence than the set it is parsing.
|
|
18623
18666
|
|
|
18624
|
-
pp$
|
|
18667
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18625
18668
|
var prec = this.type.binop;
|
|
18626
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18669
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18627
18670
|
if (prec > minPrec) {
|
|
18628
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18629
|
-
var coalesce = this.type === types.coalesce;
|
|
18671
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18672
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18630
18673
|
if (coalesce) {
|
|
18631
18674
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18632
18675
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18633
|
-
prec = types.logicalAND.binop;
|
|
18676
|
+
prec = types$1.logicalAND.binop;
|
|
18634
18677
|
}
|
|
18635
18678
|
var op = this.value;
|
|
18636
18679
|
this.next();
|
|
18637
18680
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18638
18681
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18639
18682
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
18640
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
18683
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18641
18684
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18642
18685
|
}
|
|
18643
18686
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18646,7 +18689,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18646
18689
|
return left
|
|
18647
18690
|
};
|
|
18648
18691
|
|
|
18649
|
-
pp$
|
|
18692
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18693
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18650
18694
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18651
18695
|
node.left = left;
|
|
18652
18696
|
node.operator = op;
|
|
@@ -18656,13 +18700,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18656
18700
|
|
|
18657
18701
|
// Parse unary operators, both prefix and postfix.
|
|
18658
18702
|
|
|
18659
|
-
pp$
|
|
18703
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18660
18704
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18661
18705
|
if (this.isContextual("await") && this.canAwait) {
|
|
18662
18706
|
expr = this.parseAwait(forInit);
|
|
18663
18707
|
sawUnary = true;
|
|
18664
18708
|
} else if (this.type.prefix) {
|
|
18665
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18709
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18666
18710
|
node.operator = this.value;
|
|
18667
18711
|
node.prefix = true;
|
|
18668
18712
|
this.next();
|
|
@@ -18676,6 +18720,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18676
18720
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18677
18721
|
else { sawUnary = true; }
|
|
18678
18722
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18723
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18724
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18725
|
+
expr = this.parsePrivateIdent();
|
|
18726
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18727
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18679
18728
|
} else {
|
|
18680
18729
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18681
18730
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18690,7 +18739,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18690
18739
|
}
|
|
18691
18740
|
}
|
|
18692
18741
|
|
|
18693
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18742
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18694
18743
|
if (sawUnary)
|
|
18695
18744
|
{ this.unexpected(this.lastTokStart); }
|
|
18696
18745
|
else
|
|
@@ -18709,7 +18758,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18709
18758
|
|
|
18710
18759
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18711
18760
|
|
|
18712
|
-
pp$
|
|
18761
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18713
18762
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18714
18763
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18715
18764
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18723,7 +18772,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18723
18772
|
return result
|
|
18724
18773
|
};
|
|
18725
18774
|
|
|
18726
|
-
pp$
|
|
18775
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18727
18776
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18728
18777
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18729
18778
|
this.potentialArrowAt === base.start;
|
|
@@ -18746,19 +18795,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18746
18795
|
}
|
|
18747
18796
|
};
|
|
18748
18797
|
|
|
18749
|
-
pp$
|
|
18798
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18750
18799
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18751
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18800
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18752
18801
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18753
18802
|
|
|
18754
|
-
var computed = this.eat(types.bracketL);
|
|
18755
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18803
|
+
var computed = this.eat(types$1.bracketL);
|
|
18804
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18756
18805
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18757
18806
|
node.object = base;
|
|
18758
18807
|
if (computed) {
|
|
18759
18808
|
node.property = this.parseExpression();
|
|
18760
|
-
this.expect(types.bracketR);
|
|
18761
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18809
|
+
this.expect(types$1.bracketR);
|
|
18810
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18762
18811
|
node.property = this.parsePrivateIdent();
|
|
18763
18812
|
} else {
|
|
18764
18813
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18768,13 +18817,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18768
18817
|
node.optional = optional;
|
|
18769
18818
|
}
|
|
18770
18819
|
base = this.finishNode(node, "MemberExpression");
|
|
18771
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18820
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18772
18821
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18773
18822
|
this.yieldPos = 0;
|
|
18774
18823
|
this.awaitPos = 0;
|
|
18775
18824
|
this.awaitIdentPos = 0;
|
|
18776
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18777
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18825
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18826
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18778
18827
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18779
18828
|
this.checkYieldAwaitInDefaultParams();
|
|
18780
18829
|
if (this.awaitIdentPos > 0)
|
|
@@ -18795,7 +18844,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18795
18844
|
node$1.optional = optional;
|
|
18796
18845
|
}
|
|
18797
18846
|
base = this.finishNode(node$1, "CallExpression");
|
|
18798
|
-
} else if (this.type === types.backQuote) {
|
|
18847
|
+
} else if (this.type === types$1.backQuote) {
|
|
18799
18848
|
if (optional || optionalChained) {
|
|
18800
18849
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18801
18850
|
}
|
|
@@ -18812,19 +18861,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18812
18861
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18813
18862
|
// or `{}`.
|
|
18814
18863
|
|
|
18815
|
-
pp$
|
|
18864
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18816
18865
|
// If a division operator appears in an expression position, the
|
|
18817
18866
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18818
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18867
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18819
18868
|
|
|
18820
18869
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18821
18870
|
switch (this.type) {
|
|
18822
|
-
case types._super:
|
|
18871
|
+
case types$1._super:
|
|
18823
18872
|
if (!this.allowSuper)
|
|
18824
18873
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18825
18874
|
node = this.startNode();
|
|
18826
18875
|
this.next();
|
|
18827
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18876
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18828
18877
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18829
18878
|
// The `super` keyword can appear at below:
|
|
18830
18879
|
// SuperProperty:
|
|
@@ -18832,52 +18881,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18832
18881
|
// super . IdentifierName
|
|
18833
18882
|
// SuperCall:
|
|
18834
18883
|
// super ( Arguments )
|
|
18835
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18884
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18836
18885
|
{ this.unexpected(); }
|
|
18837
18886
|
return this.finishNode(node, "Super")
|
|
18838
18887
|
|
|
18839
|
-
case types._this:
|
|
18888
|
+
case types$1._this:
|
|
18840
18889
|
node = this.startNode();
|
|
18841
18890
|
this.next();
|
|
18842
18891
|
return this.finishNode(node, "ThisExpression")
|
|
18843
18892
|
|
|
18844
|
-
case types.name:
|
|
18893
|
+
case types$1.name:
|
|
18845
18894
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18846
18895
|
var id = this.parseIdent(false);
|
|
18847
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
|
|
18848
|
-
this.overrideContext(types
|
|
18896
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18897
|
+
this.overrideContext(types.f_expr);
|
|
18849
18898
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18850
18899
|
}
|
|
18851
18900
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18852
|
-
if (this.eat(types.arrow))
|
|
18901
|
+
if (this.eat(types$1.arrow))
|
|
18853
18902
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18854
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18903
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18855
18904
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18856
18905
|
id = this.parseIdent(false);
|
|
18857
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18906
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18858
18907
|
{ this.unexpected(); }
|
|
18859
18908
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18860
18909
|
}
|
|
18861
18910
|
}
|
|
18862
18911
|
return id
|
|
18863
18912
|
|
|
18864
|
-
case types.regexp:
|
|
18913
|
+
case types$1.regexp:
|
|
18865
18914
|
var value = this.value;
|
|
18866
18915
|
node = this.parseLiteral(value.value);
|
|
18867
18916
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18868
18917
|
return node
|
|
18869
18918
|
|
|
18870
|
-
case types.num: case types.string:
|
|
18919
|
+
case types$1.num: case types$1.string:
|
|
18871
18920
|
return this.parseLiteral(this.value)
|
|
18872
18921
|
|
|
18873
|
-
case types._null: case types._true: case types._false:
|
|
18922
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18874
18923
|
node = this.startNode();
|
|
18875
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18924
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18876
18925
|
node.raw = this.type.keyword;
|
|
18877
18926
|
this.next();
|
|
18878
18927
|
return this.finishNode(node, "Literal")
|
|
18879
18928
|
|
|
18880
|
-
case types.parenL:
|
|
18929
|
+
case types$1.parenL:
|
|
18881
18930
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18882
18931
|
if (refDestructuringErrors) {
|
|
18883
18932
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18887,31 +18936,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18887
18936
|
}
|
|
18888
18937
|
return expr
|
|
18889
18938
|
|
|
18890
|
-
case types.bracketL:
|
|
18939
|
+
case types$1.bracketL:
|
|
18891
18940
|
node = this.startNode();
|
|
18892
18941
|
this.next();
|
|
18893
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18942
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18894
18943
|
return this.finishNode(node, "ArrayExpression")
|
|
18895
18944
|
|
|
18896
|
-
case types.braceL:
|
|
18897
|
-
this.overrideContext(types
|
|
18945
|
+
case types$1.braceL:
|
|
18946
|
+
this.overrideContext(types.b_expr);
|
|
18898
18947
|
return this.parseObj(false, refDestructuringErrors)
|
|
18899
18948
|
|
|
18900
|
-
case types._function:
|
|
18949
|
+
case types$1._function:
|
|
18901
18950
|
node = this.startNode();
|
|
18902
18951
|
this.next();
|
|
18903
18952
|
return this.parseFunction(node, 0)
|
|
18904
18953
|
|
|
18905
|
-
case types._class:
|
|
18954
|
+
case types$1._class:
|
|
18906
18955
|
return this.parseClass(this.startNode(), false)
|
|
18907
18956
|
|
|
18908
|
-
case types._new:
|
|
18957
|
+
case types$1._new:
|
|
18909
18958
|
return this.parseNew()
|
|
18910
18959
|
|
|
18911
|
-
case types.backQuote:
|
|
18960
|
+
case types$1.backQuote:
|
|
18912
18961
|
return this.parseTemplate()
|
|
18913
18962
|
|
|
18914
|
-
case types._import:
|
|
18963
|
+
case types$1._import:
|
|
18915
18964
|
if (this.options.ecmaVersion >= 11) {
|
|
18916
18965
|
return this.parseExprImport()
|
|
18917
18966
|
} else {
|
|
@@ -18923,7 +18972,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18923
18972
|
}
|
|
18924
18973
|
};
|
|
18925
18974
|
|
|
18926
|
-
pp$
|
|
18975
|
+
pp$5.parseExprImport = function() {
|
|
18927
18976
|
var node = this.startNode();
|
|
18928
18977
|
|
|
18929
18978
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18932,9 +18981,9 @@ pp$4.parseExprImport = function() {
|
|
|
18932
18981
|
var meta = this.parseIdent(true);
|
|
18933
18982
|
|
|
18934
18983
|
switch (this.type) {
|
|
18935
|
-
case types.parenL:
|
|
18984
|
+
case types$1.parenL:
|
|
18936
18985
|
return this.parseDynamicImport(node)
|
|
18937
|
-
case types.dot:
|
|
18986
|
+
case types$1.dot:
|
|
18938
18987
|
node.meta = meta;
|
|
18939
18988
|
return this.parseImportMeta(node)
|
|
18940
18989
|
default:
|
|
@@ -18942,16 +18991,16 @@ pp$4.parseExprImport = function() {
|
|
|
18942
18991
|
}
|
|
18943
18992
|
};
|
|
18944
18993
|
|
|
18945
|
-
pp$
|
|
18994
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18946
18995
|
this.next(); // skip `(`
|
|
18947
18996
|
|
|
18948
18997
|
// Parse node.source.
|
|
18949
18998
|
node.source = this.parseMaybeAssign();
|
|
18950
18999
|
|
|
18951
19000
|
// Verify ending.
|
|
18952
|
-
if (!this.eat(types.parenR)) {
|
|
19001
|
+
if (!this.eat(types$1.parenR)) {
|
|
18953
19002
|
var errorPos = this.start;
|
|
18954
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
19003
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18955
19004
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18956
19005
|
} else {
|
|
18957
19006
|
this.unexpected(errorPos);
|
|
@@ -18961,7 +19010,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18961
19010
|
return this.finishNode(node, "ImportExpression")
|
|
18962
19011
|
};
|
|
18963
19012
|
|
|
18964
|
-
pp$
|
|
19013
|
+
pp$5.parseImportMeta = function(node) {
|
|
18965
19014
|
this.next(); // skip `.`
|
|
18966
19015
|
|
|
18967
19016
|
var containsEsc = this.containsEsc;
|
|
@@ -18977,7 +19026,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18977
19026
|
return this.finishNode(node, "MetaProperty")
|
|
18978
19027
|
};
|
|
18979
19028
|
|
|
18980
|
-
pp$
|
|
19029
|
+
pp$5.parseLiteral = function(value) {
|
|
18981
19030
|
var node = this.startNode();
|
|
18982
19031
|
node.value = value;
|
|
18983
19032
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18986,14 +19035,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18986
19035
|
return this.finishNode(node, "Literal")
|
|
18987
19036
|
};
|
|
18988
19037
|
|
|
18989
|
-
pp$
|
|
18990
|
-
this.expect(types.parenL);
|
|
19038
|
+
pp$5.parseParenExpression = function() {
|
|
19039
|
+
this.expect(types$1.parenL);
|
|
18991
19040
|
var val = this.parseExpression();
|
|
18992
|
-
this.expect(types.parenR);
|
|
19041
|
+
this.expect(types$1.parenR);
|
|
18993
19042
|
return val
|
|
18994
19043
|
};
|
|
18995
19044
|
|
|
18996
|
-
pp$
|
|
19045
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18997
19046
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18998
19047
|
if (this.options.ecmaVersion >= 6) {
|
|
18999
19048
|
this.next();
|
|
@@ -19004,24 +19053,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
19004
19053
|
this.yieldPos = 0;
|
|
19005
19054
|
this.awaitPos = 0;
|
|
19006
19055
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
19007
|
-
while (this.type !== types.parenR) {
|
|
19008
|
-
first ? first = false : this.expect(types.comma);
|
|
19009
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
19056
|
+
while (this.type !== types$1.parenR) {
|
|
19057
|
+
first ? first = false : this.expect(types$1.comma);
|
|
19058
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
19010
19059
|
lastIsComma = true;
|
|
19011
19060
|
break
|
|
19012
|
-
} else if (this.type === types.ellipsis) {
|
|
19061
|
+
} else if (this.type === types$1.ellipsis) {
|
|
19013
19062
|
spreadStart = this.start;
|
|
19014
19063
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
19015
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
19064
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
19016
19065
|
break
|
|
19017
19066
|
} else {
|
|
19018
19067
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
19019
19068
|
}
|
|
19020
19069
|
}
|
|
19021
19070
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
19022
|
-
this.expect(types.parenR);
|
|
19071
|
+
this.expect(types$1.parenR);
|
|
19023
19072
|
|
|
19024
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
19073
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
19025
19074
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
19026
19075
|
this.checkYieldAwaitInDefaultParams();
|
|
19027
19076
|
this.yieldPos = oldYieldPos;
|
|
@@ -19055,12 +19104,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
19055
19104
|
}
|
|
19056
19105
|
};
|
|
19057
19106
|
|
|
19058
|
-
pp$
|
|
19107
|
+
pp$5.parseParenItem = function(item) {
|
|
19059
19108
|
return item
|
|
19060
19109
|
};
|
|
19061
19110
|
|
|
19062
|
-
pp$
|
|
19063
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
19111
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
19112
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
19064
19113
|
};
|
|
19065
19114
|
|
|
19066
19115
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -19069,13 +19118,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
19069
19118
|
// argument to parseSubscripts to prevent it from consuming the
|
|
19070
19119
|
// argument list.
|
|
19071
19120
|
|
|
19072
|
-
var empty
|
|
19121
|
+
var empty = [];
|
|
19073
19122
|
|
|
19074
|
-
pp$
|
|
19123
|
+
pp$5.parseNew = function() {
|
|
19075
19124
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
19076
19125
|
var node = this.startNode();
|
|
19077
19126
|
var meta = this.parseIdent(true);
|
|
19078
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
19127
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
19079
19128
|
node.meta = meta;
|
|
19080
19129
|
var containsEsc = this.containsEsc;
|
|
19081
19130
|
node.property = this.parseIdent(true);
|
|
@@ -19087,23 +19136,23 @@ pp$4.parseNew = function() {
|
|
|
19087
19136
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
19088
19137
|
return this.finishNode(node, "MetaProperty")
|
|
19089
19138
|
}
|
|
19090
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
19139
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
19091
19140
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
19092
19141
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
19093
19142
|
this.raise(startPos, "Cannot use new with import()");
|
|
19094
19143
|
}
|
|
19095
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19096
|
-
else { node.arguments = empty
|
|
19144
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19145
|
+
else { node.arguments = empty; }
|
|
19097
19146
|
return this.finishNode(node, "NewExpression")
|
|
19098
19147
|
};
|
|
19099
19148
|
|
|
19100
19149
|
// Parse template expression.
|
|
19101
19150
|
|
|
19102
|
-
pp$
|
|
19151
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
19103
19152
|
var isTagged = ref.isTagged;
|
|
19104
19153
|
|
|
19105
19154
|
var elem = this.startNode();
|
|
19106
|
-
if (this.type === types.invalidTemplate) {
|
|
19155
|
+
if (this.type === types$1.invalidTemplate) {
|
|
19107
19156
|
if (!isTagged) {
|
|
19108
19157
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
19109
19158
|
}
|
|
@@ -19118,11 +19167,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
19118
19167
|
};
|
|
19119
19168
|
}
|
|
19120
19169
|
this.next();
|
|
19121
|
-
elem.tail = this.type === types.backQuote;
|
|
19170
|
+
elem.tail = this.type === types$1.backQuote;
|
|
19122
19171
|
return this.finishNode(elem, "TemplateElement")
|
|
19123
19172
|
};
|
|
19124
19173
|
|
|
19125
|
-
pp$
|
|
19174
|
+
pp$5.parseTemplate = function(ref) {
|
|
19126
19175
|
if ( ref === void 0 ) ref = {};
|
|
19127
19176
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
19128
19177
|
|
|
@@ -19132,32 +19181,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
19132
19181
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
19133
19182
|
node.quasis = [curElt];
|
|
19134
19183
|
while (!curElt.tail) {
|
|
19135
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19136
|
-
this.expect(types.dollarBraceL);
|
|
19184
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19185
|
+
this.expect(types$1.dollarBraceL);
|
|
19137
19186
|
node.expressions.push(this.parseExpression());
|
|
19138
|
-
this.expect(types.braceR);
|
|
19187
|
+
this.expect(types$1.braceR);
|
|
19139
19188
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19140
19189
|
}
|
|
19141
19190
|
this.next();
|
|
19142
19191
|
return this.finishNode(node, "TemplateLiteral")
|
|
19143
19192
|
};
|
|
19144
19193
|
|
|
19145
|
-
pp$
|
|
19194
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19146
19195
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
19147
|
-
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
|
|
19196
|
+
(this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
|
|
19148
19197
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19149
19198
|
};
|
|
19150
19199
|
|
|
19151
19200
|
// Parse an object literal or binding pattern.
|
|
19152
19201
|
|
|
19153
|
-
pp$
|
|
19202
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19154
19203
|
var node = this.startNode(), first = true, propHash = {};
|
|
19155
19204
|
node.properties = [];
|
|
19156
19205
|
this.next();
|
|
19157
|
-
while (!this.eat(types.braceR)) {
|
|
19206
|
+
while (!this.eat(types$1.braceR)) {
|
|
19158
19207
|
if (!first) {
|
|
19159
|
-
this.expect(types.comma);
|
|
19160
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19208
|
+
this.expect(types$1.comma);
|
|
19209
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19161
19210
|
} else { first = false; }
|
|
19162
19211
|
|
|
19163
19212
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19167,18 +19216,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19167
19216
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19168
19217
|
};
|
|
19169
19218
|
|
|
19170
|
-
pp$
|
|
19219
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19171
19220
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19172
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19221
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19173
19222
|
if (isPattern) {
|
|
19174
19223
|
prop.argument = this.parseIdent(false);
|
|
19175
|
-
if (this.type === types.comma) {
|
|
19224
|
+
if (this.type === types$1.comma) {
|
|
19176
19225
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19177
19226
|
}
|
|
19178
19227
|
return this.finishNode(prop, "RestElement")
|
|
19179
19228
|
}
|
|
19180
19229
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19181
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19230
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19182
19231
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19183
19232
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19184
19233
|
}
|
|
@@ -19189,7 +19238,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19189
19238
|
// Parse argument.
|
|
19190
19239
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19191
19240
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19192
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19241
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19193
19242
|
refDestructuringErrors.trailingComma = this.start;
|
|
19194
19243
|
}
|
|
19195
19244
|
// Finish
|
|
@@ -19203,13 +19252,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19203
19252
|
startLoc = this.startLoc;
|
|
19204
19253
|
}
|
|
19205
19254
|
if (!isPattern)
|
|
19206
|
-
{ isGenerator = this.eat(types.star); }
|
|
19255
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19207
19256
|
}
|
|
19208
19257
|
var containsEsc = this.containsEsc;
|
|
19209
19258
|
this.parsePropertyName(prop);
|
|
19210
19259
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19211
19260
|
isAsync = true;
|
|
19212
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19261
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19213
19262
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19214
19263
|
} else {
|
|
19215
19264
|
isAsync = false;
|
|
@@ -19218,14 +19267,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19218
19267
|
return this.finishNode(prop, "Property")
|
|
19219
19268
|
};
|
|
19220
19269
|
|
|
19221
|
-
pp$
|
|
19222
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19270
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19271
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19223
19272
|
{ this.unexpected(); }
|
|
19224
19273
|
|
|
19225
|
-
if (this.eat(types.colon)) {
|
|
19274
|
+
if (this.eat(types$1.colon)) {
|
|
19226
19275
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19227
19276
|
prop.kind = "init";
|
|
19228
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19277
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19229
19278
|
if (isPattern) { this.unexpected(); }
|
|
19230
19279
|
prop.kind = "init";
|
|
19231
19280
|
prop.method = true;
|
|
@@ -19233,7 +19282,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19233
19282
|
} else if (!isPattern && !containsEsc &&
|
|
19234
19283
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19235
19284
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19236
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19285
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19237
19286
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19238
19287
|
prop.kind = prop.key.name;
|
|
19239
19288
|
this.parsePropertyName(prop);
|
|
@@ -19257,7 +19306,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19257
19306
|
prop.kind = "init";
|
|
19258
19307
|
if (isPattern) {
|
|
19259
19308
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19260
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19309
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19261
19310
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19262
19311
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19263
19312
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19268,23 +19317,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19268
19317
|
} else { this.unexpected(); }
|
|
19269
19318
|
};
|
|
19270
19319
|
|
|
19271
|
-
pp$
|
|
19320
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19272
19321
|
if (this.options.ecmaVersion >= 6) {
|
|
19273
|
-
if (this.eat(types.bracketL)) {
|
|
19322
|
+
if (this.eat(types$1.bracketL)) {
|
|
19274
19323
|
prop.computed = true;
|
|
19275
19324
|
prop.key = this.parseMaybeAssign();
|
|
19276
|
-
this.expect(types.bracketR);
|
|
19325
|
+
this.expect(types$1.bracketR);
|
|
19277
19326
|
return prop.key
|
|
19278
19327
|
} else {
|
|
19279
19328
|
prop.computed = false;
|
|
19280
19329
|
}
|
|
19281
19330
|
}
|
|
19282
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19331
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19283
19332
|
};
|
|
19284
19333
|
|
|
19285
19334
|
// Initialize empty function node.
|
|
19286
19335
|
|
|
19287
|
-
pp$
|
|
19336
|
+
pp$5.initFunction = function(node) {
|
|
19288
19337
|
node.id = null;
|
|
19289
19338
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19290
19339
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19292,7 +19341,7 @@ pp$4.initFunction = function(node) {
|
|
|
19292
19341
|
|
|
19293
19342
|
// Parse object or class method.
|
|
19294
19343
|
|
|
19295
|
-
pp$
|
|
19344
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19296
19345
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19297
19346
|
|
|
19298
19347
|
this.initFunction(node);
|
|
@@ -19306,8 +19355,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19306
19355
|
this.awaitIdentPos = 0;
|
|
19307
19356
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19308
19357
|
|
|
19309
|
-
this.expect(types.parenL);
|
|
19310
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19358
|
+
this.expect(types$1.parenL);
|
|
19359
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19311
19360
|
this.checkYieldAwaitInDefaultParams();
|
|
19312
19361
|
this.parseFunctionBody(node, false, true, false);
|
|
19313
19362
|
|
|
@@ -19319,7 +19368,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19319
19368
|
|
|
19320
19369
|
// Parse arrow function expression with given parameters.
|
|
19321
19370
|
|
|
19322
|
-
pp$
|
|
19371
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19323
19372
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19324
19373
|
|
|
19325
19374
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19341,8 +19390,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19341
19390
|
|
|
19342
19391
|
// Parse function body and check parameters.
|
|
19343
19392
|
|
|
19344
|
-
pp$
|
|
19345
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19393
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19394
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19346
19395
|
var oldStrict = this.strict, useStrict = false;
|
|
19347
19396
|
|
|
19348
19397
|
if (isExpression) {
|
|
@@ -19378,7 +19427,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19378
19427
|
this.exitScope();
|
|
19379
19428
|
};
|
|
19380
19429
|
|
|
19381
|
-
pp$
|
|
19430
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19382
19431
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19383
19432
|
{
|
|
19384
19433
|
var param = list[i];
|
|
@@ -19391,7 +19440,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19391
19440
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19392
19441
|
// or "arguments" and duplicate parameters.
|
|
19393
19442
|
|
|
19394
|
-
pp$
|
|
19443
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19395
19444
|
var nameHash = Object.create(null);
|
|
19396
19445
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19397
19446
|
{
|
|
@@ -19407,20 +19456,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19407
19456
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19408
19457
|
// for array literals).
|
|
19409
19458
|
|
|
19410
|
-
pp$
|
|
19459
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19411
19460
|
var elts = [], first = true;
|
|
19412
19461
|
while (!this.eat(close)) {
|
|
19413
19462
|
if (!first) {
|
|
19414
|
-
this.expect(types.comma);
|
|
19463
|
+
this.expect(types$1.comma);
|
|
19415
19464
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19416
19465
|
} else { first = false; }
|
|
19417
19466
|
|
|
19418
19467
|
var elt = (void 0);
|
|
19419
|
-
if (allowEmpty && this.type === types.comma)
|
|
19468
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19420
19469
|
{ elt = null; }
|
|
19421
|
-
else if (this.type === types.ellipsis) {
|
|
19470
|
+
else if (this.type === types$1.ellipsis) {
|
|
19422
19471
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19423
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19472
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19424
19473
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19425
19474
|
} else {
|
|
19426
19475
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19430,7 +19479,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19430
19479
|
return elts
|
|
19431
19480
|
};
|
|
19432
19481
|
|
|
19433
|
-
pp$
|
|
19482
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19434
19483
|
var start = ref.start;
|
|
19435
19484
|
var end = ref.end;
|
|
19436
19485
|
var name = ref.name;
|
|
@@ -19459,9 +19508,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19459
19508
|
// when parsing properties), it will also convert keywords into
|
|
19460
19509
|
// identifiers.
|
|
19461
19510
|
|
|
19462
|
-
pp$
|
|
19511
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19463
19512
|
var node = this.startNode();
|
|
19464
|
-
if (this.type === types.name) {
|
|
19513
|
+
if (this.type === types$1.name) {
|
|
19465
19514
|
node.name = this.value;
|
|
19466
19515
|
} else if (this.type.keyword) {
|
|
19467
19516
|
node.name = this.type.keyword;
|
|
@@ -19487,9 +19536,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19487
19536
|
return node
|
|
19488
19537
|
};
|
|
19489
19538
|
|
|
19490
|
-
pp$
|
|
19539
|
+
pp$5.parsePrivateIdent = function() {
|
|
19491
19540
|
var node = this.startNode();
|
|
19492
|
-
if (this.type === types.privateId) {
|
|
19541
|
+
if (this.type === types$1.privateId) {
|
|
19493
19542
|
node.name = this.value;
|
|
19494
19543
|
} else {
|
|
19495
19544
|
this.unexpected();
|
|
@@ -19509,22 +19558,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19509
19558
|
|
|
19510
19559
|
// Parses yield expression inside generator.
|
|
19511
19560
|
|
|
19512
|
-
pp$
|
|
19561
|
+
pp$5.parseYield = function(forInit) {
|
|
19513
19562
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19514
19563
|
|
|
19515
19564
|
var node = this.startNode();
|
|
19516
19565
|
this.next();
|
|
19517
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19566
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19518
19567
|
node.delegate = false;
|
|
19519
19568
|
node.argument = null;
|
|
19520
19569
|
} else {
|
|
19521
|
-
node.delegate = this.eat(types.star);
|
|
19570
|
+
node.delegate = this.eat(types$1.star);
|
|
19522
19571
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19523
19572
|
}
|
|
19524
19573
|
return this.finishNode(node, "YieldExpression")
|
|
19525
19574
|
};
|
|
19526
19575
|
|
|
19527
|
-
pp$
|
|
19576
|
+
pp$5.parseAwait = function(forInit) {
|
|
19528
19577
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19529
19578
|
|
|
19530
19579
|
var node = this.startNode();
|
|
@@ -19533,7 +19582,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19533
19582
|
return this.finishNode(node, "AwaitExpression")
|
|
19534
19583
|
};
|
|
19535
19584
|
|
|
19536
|
-
var pp$
|
|
19585
|
+
var pp$4 = Parser.prototype;
|
|
19537
19586
|
|
|
19538
19587
|
// This function is used to raise exceptions on parse errors. It
|
|
19539
19588
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19541,7 +19590,7 @@ var pp$5 = Parser.prototype;
|
|
|
19541
19590
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19542
19591
|
// message.
|
|
19543
19592
|
|
|
19544
|
-
pp$
|
|
19593
|
+
pp$4.raise = function(pos, message) {
|
|
19545
19594
|
var loc = getLineInfo(this.input, pos);
|
|
19546
19595
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19547
19596
|
var err = new SyntaxError(message);
|
|
@@ -19549,15 +19598,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19549
19598
|
throw err
|
|
19550
19599
|
};
|
|
19551
19600
|
|
|
19552
|
-
pp$
|
|
19601
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19553
19602
|
|
|
19554
|
-
pp$
|
|
19603
|
+
pp$4.curPosition = function() {
|
|
19555
19604
|
if (this.options.locations) {
|
|
19556
19605
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19557
19606
|
}
|
|
19558
19607
|
};
|
|
19559
19608
|
|
|
19560
|
-
var pp$
|
|
19609
|
+
var pp$3 = Parser.prototype;
|
|
19561
19610
|
|
|
19562
19611
|
var Scope = function Scope(flags) {
|
|
19563
19612
|
this.flags = flags;
|
|
@@ -19573,22 +19622,22 @@ var Scope = function Scope(flags) {
|
|
|
19573
19622
|
|
|
19574
19623
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19575
19624
|
|
|
19576
|
-
pp$
|
|
19625
|
+
pp$3.enterScope = function(flags) {
|
|
19577
19626
|
this.scopeStack.push(new Scope(flags));
|
|
19578
19627
|
};
|
|
19579
19628
|
|
|
19580
|
-
pp$
|
|
19629
|
+
pp$3.exitScope = function() {
|
|
19581
19630
|
this.scopeStack.pop();
|
|
19582
19631
|
};
|
|
19583
19632
|
|
|
19584
19633
|
// The spec says:
|
|
19585
19634
|
// > At the top level of a function, or script, function declarations are
|
|
19586
19635
|
// > treated like var declarations rather than like lexical declarations.
|
|
19587
|
-
pp$
|
|
19636
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19588
19637
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19589
19638
|
};
|
|
19590
19639
|
|
|
19591
|
-
pp$
|
|
19640
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19592
19641
|
var redeclared = false;
|
|
19593
19642
|
if (bindingType === BIND_LEXICAL) {
|
|
19594
19643
|
var scope = this.currentScope();
|
|
@@ -19623,7 +19672,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19623
19672
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19624
19673
|
};
|
|
19625
19674
|
|
|
19626
|
-
pp$
|
|
19675
|
+
pp$3.checkLocalExport = function(id) {
|
|
19627
19676
|
// scope.functions must be empty as Module code is always strict.
|
|
19628
19677
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19629
19678
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19631,11 +19680,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19631
19680
|
}
|
|
19632
19681
|
};
|
|
19633
19682
|
|
|
19634
|
-
pp$
|
|
19683
|
+
pp$3.currentScope = function() {
|
|
19635
19684
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19636
19685
|
};
|
|
19637
19686
|
|
|
19638
|
-
pp$
|
|
19687
|
+
pp$3.currentVarScope = function() {
|
|
19639
19688
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19640
19689
|
var scope = this.scopeStack[i];
|
|
19641
19690
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19643,7 +19692,7 @@ pp$6.currentVarScope = function() {
|
|
|
19643
19692
|
};
|
|
19644
19693
|
|
|
19645
19694
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19646
|
-
pp$
|
|
19695
|
+
pp$3.currentThisScope = function() {
|
|
19647
19696
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19648
19697
|
var scope = this.scopeStack[i];
|
|
19649
19698
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19664,13 +19713,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19664
19713
|
|
|
19665
19714
|
// Start an AST node, attaching a start offset.
|
|
19666
19715
|
|
|
19667
|
-
var pp$
|
|
19716
|
+
var pp$2 = Parser.prototype;
|
|
19668
19717
|
|
|
19669
|
-
pp$
|
|
19718
|
+
pp$2.startNode = function() {
|
|
19670
19719
|
return new Node(this, this.start, this.startLoc)
|
|
19671
19720
|
};
|
|
19672
19721
|
|
|
19673
|
-
pp$
|
|
19722
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19674
19723
|
return new Node(this, pos, loc)
|
|
19675
19724
|
};
|
|
19676
19725
|
|
|
@@ -19686,17 +19735,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19686
19735
|
return node
|
|
19687
19736
|
}
|
|
19688
19737
|
|
|
19689
|
-
pp$
|
|
19738
|
+
pp$2.finishNode = function(node, type) {
|
|
19690
19739
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19691
19740
|
};
|
|
19692
19741
|
|
|
19693
19742
|
// Finish node at given position
|
|
19694
19743
|
|
|
19695
|
-
pp$
|
|
19744
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19696
19745
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19697
19746
|
};
|
|
19698
19747
|
|
|
19699
|
-
pp$
|
|
19748
|
+
pp$2.copyNode = function(node) {
|
|
19700
19749
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19701
19750
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19702
19751
|
return newNode
|
|
@@ -19753,7 +19802,7 @@ buildUnicodeData(10);
|
|
|
19753
19802
|
buildUnicodeData(11);
|
|
19754
19803
|
buildUnicodeData(12);
|
|
19755
19804
|
|
|
19756
|
-
var pp$
|
|
19805
|
+
var pp$1 = Parser.prototype;
|
|
19757
19806
|
|
|
19758
19807
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19759
19808
|
this.parser = parser;
|
|
@@ -19849,7 +19898,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19849
19898
|
return false
|
|
19850
19899
|
};
|
|
19851
19900
|
|
|
19852
|
-
function codePointToString(ch) {
|
|
19901
|
+
function codePointToString$1(ch) {
|
|
19853
19902
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19854
19903
|
ch -= 0x10000;
|
|
19855
19904
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19861,7 +19910,7 @@ function codePointToString(ch) {
|
|
|
19861
19910
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19862
19911
|
* @returns {void}
|
|
19863
19912
|
*/
|
|
19864
|
-
pp$
|
|
19913
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19865
19914
|
var validFlags = state.validFlags;
|
|
19866
19915
|
var flags = state.flags;
|
|
19867
19916
|
|
|
@@ -19882,7 +19931,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19882
19931
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19883
19932
|
* @returns {void}
|
|
19884
19933
|
*/
|
|
19885
|
-
pp$
|
|
19934
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19886
19935
|
this.regexp_pattern(state);
|
|
19887
19936
|
|
|
19888
19937
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19897,7 +19946,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19897
19946
|
};
|
|
19898
19947
|
|
|
19899
19948
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19900
|
-
pp$
|
|
19949
|
+
pp$1.regexp_pattern = function(state) {
|
|
19901
19950
|
state.pos = 0;
|
|
19902
19951
|
state.lastIntValue = 0;
|
|
19903
19952
|
state.lastStringValue = "";
|
|
@@ -19931,7 +19980,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19931
19980
|
};
|
|
19932
19981
|
|
|
19933
19982
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19934
|
-
pp$
|
|
19983
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19935
19984
|
this.regexp_alternative(state);
|
|
19936
19985
|
while (state.eat(0x7C /* | */)) {
|
|
19937
19986
|
this.regexp_alternative(state);
|
|
@@ -19947,13 +19996,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19947
19996
|
};
|
|
19948
19997
|
|
|
19949
19998
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19950
|
-
pp$
|
|
19999
|
+
pp$1.regexp_alternative = function(state) {
|
|
19951
20000
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19952
20001
|
{ }
|
|
19953
20002
|
};
|
|
19954
20003
|
|
|
19955
20004
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19956
|
-
pp$
|
|
20005
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19957
20006
|
if (this.regexp_eatAssertion(state)) {
|
|
19958
20007
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19959
20008
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19976,7 +20025,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19976
20025
|
};
|
|
19977
20026
|
|
|
19978
20027
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19979
|
-
pp$
|
|
20028
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19980
20029
|
var start = state.pos;
|
|
19981
20030
|
state.lastAssertionIsQuantifiable = false;
|
|
19982
20031
|
|
|
@@ -20014,7 +20063,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
20014
20063
|
};
|
|
20015
20064
|
|
|
20016
20065
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
20017
|
-
pp$
|
|
20066
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
20018
20067
|
if ( noError === void 0 ) noError = false;
|
|
20019
20068
|
|
|
20020
20069
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -20025,7 +20074,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
20025
20074
|
};
|
|
20026
20075
|
|
|
20027
20076
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
20028
|
-
pp$
|
|
20077
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
20029
20078
|
return (
|
|
20030
20079
|
state.eat(0x2A /* * */) ||
|
|
20031
20080
|
state.eat(0x2B /* + */) ||
|
|
@@ -20033,7 +20082,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
20033
20082
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
20034
20083
|
)
|
|
20035
20084
|
};
|
|
20036
|
-
pp$
|
|
20085
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
20037
20086
|
var start = state.pos;
|
|
20038
20087
|
if (state.eat(0x7B /* { */)) {
|
|
20039
20088
|
var min = 0, max = -1;
|
|
@@ -20059,7 +20108,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
20059
20108
|
};
|
|
20060
20109
|
|
|
20061
20110
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
20062
|
-
pp$
|
|
20111
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
20063
20112
|
return (
|
|
20064
20113
|
this.regexp_eatPatternCharacters(state) ||
|
|
20065
20114
|
state.eat(0x2E /* . */) ||
|
|
@@ -20069,7 +20118,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
20069
20118
|
this.regexp_eatCapturingGroup(state)
|
|
20070
20119
|
)
|
|
20071
20120
|
};
|
|
20072
|
-
pp$
|
|
20121
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
20073
20122
|
var start = state.pos;
|
|
20074
20123
|
if (state.eat(0x5C /* \ */)) {
|
|
20075
20124
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -20079,7 +20128,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
20079
20128
|
}
|
|
20080
20129
|
return false
|
|
20081
20130
|
};
|
|
20082
|
-
pp$
|
|
20131
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
20083
20132
|
var start = state.pos;
|
|
20084
20133
|
if (state.eat(0x28 /* ( */)) {
|
|
20085
20134
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -20093,7 +20142,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
20093
20142
|
}
|
|
20094
20143
|
return false
|
|
20095
20144
|
};
|
|
20096
|
-
pp$
|
|
20145
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
20097
20146
|
if (state.eat(0x28 /* ( */)) {
|
|
20098
20147
|
if (this.options.ecmaVersion >= 9) {
|
|
20099
20148
|
this.regexp_groupSpecifier(state);
|
|
@@ -20111,7 +20160,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
20111
20160
|
};
|
|
20112
20161
|
|
|
20113
20162
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
20114
|
-
pp$
|
|
20163
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
20115
20164
|
return (
|
|
20116
20165
|
state.eat(0x2E /* . */) ||
|
|
20117
20166
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -20124,7 +20173,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
20124
20173
|
};
|
|
20125
20174
|
|
|
20126
20175
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
20127
|
-
pp$
|
|
20176
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
20128
20177
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
20129
20178
|
state.raise("Nothing to repeat");
|
|
20130
20179
|
}
|
|
@@ -20132,7 +20181,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
20132
20181
|
};
|
|
20133
20182
|
|
|
20134
20183
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
20135
|
-
pp$
|
|
20184
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
20136
20185
|
var ch = state.current();
|
|
20137
20186
|
if (isSyntaxCharacter(ch)) {
|
|
20138
20187
|
state.lastIntValue = ch;
|
|
@@ -20154,7 +20203,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20154
20203
|
|
|
20155
20204
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20156
20205
|
// But eat eager.
|
|
20157
|
-
pp$
|
|
20206
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20158
20207
|
var start = state.pos;
|
|
20159
20208
|
var ch = 0;
|
|
20160
20209
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20164,7 +20213,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20164
20213
|
};
|
|
20165
20214
|
|
|
20166
20215
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20167
|
-
pp$
|
|
20216
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20168
20217
|
var ch = state.current();
|
|
20169
20218
|
if (
|
|
20170
20219
|
ch !== -1 &&
|
|
@@ -20185,7 +20234,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20185
20234
|
// GroupSpecifier ::
|
|
20186
20235
|
// [empty]
|
|
20187
20236
|
// `?` GroupName
|
|
20188
|
-
pp$
|
|
20237
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20189
20238
|
if (state.eat(0x3F /* ? */)) {
|
|
20190
20239
|
if (this.regexp_eatGroupName(state)) {
|
|
20191
20240
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20201,7 +20250,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20201
20250
|
// GroupName ::
|
|
20202
20251
|
// `<` RegExpIdentifierName `>`
|
|
20203
20252
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20204
|
-
pp$
|
|
20253
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20205
20254
|
state.lastStringValue = "";
|
|
20206
20255
|
if (state.eat(0x3C /* < */)) {
|
|
20207
20256
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20216,12 +20265,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20216
20265
|
// RegExpIdentifierStart
|
|
20217
20266
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20218
20267
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20219
|
-
pp$
|
|
20268
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20220
20269
|
state.lastStringValue = "";
|
|
20221
20270
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20222
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20271
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20223
20272
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20224
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20273
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20225
20274
|
}
|
|
20226
20275
|
return true
|
|
20227
20276
|
}
|
|
@@ -20233,7 +20282,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20233
20282
|
// `$`
|
|
20234
20283
|
// `_`
|
|
20235
20284
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20236
|
-
pp$
|
|
20285
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20237
20286
|
var start = state.pos;
|
|
20238
20287
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20239
20288
|
var ch = state.current(forceU);
|
|
@@ -20261,7 +20310,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20261
20310
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20262
20311
|
// <ZWNJ>
|
|
20263
20312
|
// <ZWJ>
|
|
20264
|
-
pp$
|
|
20313
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20265
20314
|
var start = state.pos;
|
|
20266
20315
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20267
20316
|
var ch = state.current(forceU);
|
|
@@ -20283,7 +20332,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20283
20332
|
}
|
|
20284
20333
|
|
|
20285
20334
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20286
|
-
pp$
|
|
20335
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20287
20336
|
if (
|
|
20288
20337
|
this.regexp_eatBackReference(state) ||
|
|
20289
20338
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20301,7 +20350,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20301
20350
|
}
|
|
20302
20351
|
return false
|
|
20303
20352
|
};
|
|
20304
|
-
pp$
|
|
20353
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20305
20354
|
var start = state.pos;
|
|
20306
20355
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20307
20356
|
var n = state.lastIntValue;
|
|
@@ -20319,7 +20368,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20319
20368
|
}
|
|
20320
20369
|
return false
|
|
20321
20370
|
};
|
|
20322
|
-
pp$
|
|
20371
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20323
20372
|
if (state.eat(0x6B /* k */)) {
|
|
20324
20373
|
if (this.regexp_eatGroupName(state)) {
|
|
20325
20374
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20331,7 +20380,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20331
20380
|
};
|
|
20332
20381
|
|
|
20333
20382
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20334
|
-
pp$
|
|
20383
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20335
20384
|
return (
|
|
20336
20385
|
this.regexp_eatControlEscape(state) ||
|
|
20337
20386
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20342,7 +20391,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20342
20391
|
this.regexp_eatIdentityEscape(state)
|
|
20343
20392
|
)
|
|
20344
20393
|
};
|
|
20345
|
-
pp$
|
|
20394
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20346
20395
|
var start = state.pos;
|
|
20347
20396
|
if (state.eat(0x63 /* c */)) {
|
|
20348
20397
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20352,7 +20401,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20352
20401
|
}
|
|
20353
20402
|
return false
|
|
20354
20403
|
};
|
|
20355
|
-
pp$
|
|
20404
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20356
20405
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20357
20406
|
state.lastIntValue = 0;
|
|
20358
20407
|
state.advance();
|
|
@@ -20362,7 +20411,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20362
20411
|
};
|
|
20363
20412
|
|
|
20364
20413
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20365
|
-
pp$
|
|
20414
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20366
20415
|
var ch = state.current();
|
|
20367
20416
|
if (ch === 0x74 /* t */) {
|
|
20368
20417
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20393,7 +20442,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20393
20442
|
};
|
|
20394
20443
|
|
|
20395
20444
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20396
|
-
pp$
|
|
20445
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20397
20446
|
var ch = state.current();
|
|
20398
20447
|
if (isControlLetter(ch)) {
|
|
20399
20448
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20410,7 +20459,7 @@ function isControlLetter(ch) {
|
|
|
20410
20459
|
}
|
|
20411
20460
|
|
|
20412
20461
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20413
|
-
pp$
|
|
20462
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20414
20463
|
if ( forceU === void 0 ) forceU = false;
|
|
20415
20464
|
|
|
20416
20465
|
var start = state.pos;
|
|
@@ -20455,7 +20504,7 @@ function isValidUnicode(ch) {
|
|
|
20455
20504
|
}
|
|
20456
20505
|
|
|
20457
20506
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20458
|
-
pp$
|
|
20507
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20459
20508
|
if (state.switchU) {
|
|
20460
20509
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20461
20510
|
return true
|
|
@@ -20478,7 +20527,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20478
20527
|
};
|
|
20479
20528
|
|
|
20480
20529
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20481
|
-
pp$
|
|
20530
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20482
20531
|
state.lastIntValue = 0;
|
|
20483
20532
|
var ch = state.current();
|
|
20484
20533
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20492,7 +20541,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20492
20541
|
};
|
|
20493
20542
|
|
|
20494
20543
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20495
|
-
pp$
|
|
20544
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20496
20545
|
var ch = state.current();
|
|
20497
20546
|
|
|
20498
20547
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20534,7 +20583,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20534
20583
|
// UnicodePropertyValueExpression ::
|
|
20535
20584
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20536
20585
|
// LoneUnicodePropertyNameOrValue
|
|
20537
|
-
pp$
|
|
20586
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20538
20587
|
var start = state.pos;
|
|
20539
20588
|
|
|
20540
20589
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20556,24 +20605,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20556
20605
|
}
|
|
20557
20606
|
return false
|
|
20558
20607
|
};
|
|
20559
|
-
pp$
|
|
20608
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20560
20609
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20561
20610
|
{ state.raise("Invalid property name"); }
|
|
20562
20611
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20563
20612
|
{ state.raise("Invalid property value"); }
|
|
20564
20613
|
};
|
|
20565
|
-
pp$
|
|
20614
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20566
20615
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20567
20616
|
{ state.raise("Invalid property name"); }
|
|
20568
20617
|
};
|
|
20569
20618
|
|
|
20570
20619
|
// UnicodePropertyName ::
|
|
20571
20620
|
// UnicodePropertyNameCharacters
|
|
20572
|
-
pp$
|
|
20621
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20573
20622
|
var ch = 0;
|
|
20574
20623
|
state.lastStringValue = "";
|
|
20575
20624
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20576
|
-
state.lastStringValue += codePointToString(ch);
|
|
20625
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20577
20626
|
state.advance();
|
|
20578
20627
|
}
|
|
20579
20628
|
return state.lastStringValue !== ""
|
|
@@ -20584,11 +20633,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20584
20633
|
|
|
20585
20634
|
// UnicodePropertyValue ::
|
|
20586
20635
|
// UnicodePropertyValueCharacters
|
|
20587
|
-
pp$
|
|
20636
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20588
20637
|
var ch = 0;
|
|
20589
20638
|
state.lastStringValue = "";
|
|
20590
20639
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20591
|
-
state.lastStringValue += codePointToString(ch);
|
|
20640
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20592
20641
|
state.advance();
|
|
20593
20642
|
}
|
|
20594
20643
|
return state.lastStringValue !== ""
|
|
@@ -20599,12 +20648,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20599
20648
|
|
|
20600
20649
|
// LoneUnicodePropertyNameOrValue ::
|
|
20601
20650
|
// UnicodePropertyValueCharacters
|
|
20602
|
-
pp$
|
|
20651
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20603
20652
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20604
20653
|
};
|
|
20605
20654
|
|
|
20606
20655
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20607
|
-
pp$
|
|
20656
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20608
20657
|
if (state.eat(0x5B /* [ */)) {
|
|
20609
20658
|
state.eat(0x5E /* ^ */);
|
|
20610
20659
|
this.regexp_classRanges(state);
|
|
@@ -20620,7 +20669,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20620
20669
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20621
20670
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20622
20671
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20623
|
-
pp$
|
|
20672
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20624
20673
|
while (this.regexp_eatClassAtom(state)) {
|
|
20625
20674
|
var left = state.lastIntValue;
|
|
20626
20675
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20637,7 +20686,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20637
20686
|
|
|
20638
20687
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20639
20688
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20640
|
-
pp$
|
|
20689
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20641
20690
|
var start = state.pos;
|
|
20642
20691
|
|
|
20643
20692
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20666,7 +20715,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20666
20715
|
};
|
|
20667
20716
|
|
|
20668
20717
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20669
|
-
pp$
|
|
20718
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20670
20719
|
var start = state.pos;
|
|
20671
20720
|
|
|
20672
20721
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20693,7 +20742,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20693
20742
|
};
|
|
20694
20743
|
|
|
20695
20744
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20696
|
-
pp$
|
|
20745
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20697
20746
|
var ch = state.current();
|
|
20698
20747
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20699
20748
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20704,7 +20753,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20704
20753
|
};
|
|
20705
20754
|
|
|
20706
20755
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20707
|
-
pp$
|
|
20756
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20708
20757
|
var start = state.pos;
|
|
20709
20758
|
if (state.eat(0x78 /* x */)) {
|
|
20710
20759
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20719,7 +20768,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20719
20768
|
};
|
|
20720
20769
|
|
|
20721
20770
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20722
|
-
pp$
|
|
20771
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20723
20772
|
var start = state.pos;
|
|
20724
20773
|
var ch = 0;
|
|
20725
20774
|
state.lastIntValue = 0;
|
|
@@ -20734,7 +20783,7 @@ function isDecimalDigit(ch) {
|
|
|
20734
20783
|
}
|
|
20735
20784
|
|
|
20736
20785
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20737
|
-
pp$
|
|
20786
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20738
20787
|
var start = state.pos;
|
|
20739
20788
|
var ch = 0;
|
|
20740
20789
|
state.lastIntValue = 0;
|
|
@@ -20763,7 +20812,7 @@ function hexToInt(ch) {
|
|
|
20763
20812
|
|
|
20764
20813
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20765
20814
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20766
|
-
pp$
|
|
20815
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20767
20816
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20768
20817
|
var n1 = state.lastIntValue;
|
|
20769
20818
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20782,7 +20831,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20782
20831
|
};
|
|
20783
20832
|
|
|
20784
20833
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20785
|
-
pp$
|
|
20834
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20786
20835
|
var ch = state.current();
|
|
20787
20836
|
if (isOctalDigit(ch)) {
|
|
20788
20837
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20799,7 +20848,7 @@ function isOctalDigit(ch) {
|
|
|
20799
20848
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20800
20849
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20801
20850
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20802
|
-
pp$
|
|
20851
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20803
20852
|
var start = state.pos;
|
|
20804
20853
|
state.lastIntValue = 0;
|
|
20805
20854
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20831,11 +20880,11 @@ var Token = function Token(p) {
|
|
|
20831
20880
|
|
|
20832
20881
|
// ## Tokenizer
|
|
20833
20882
|
|
|
20834
|
-
var pp
|
|
20883
|
+
var pp = Parser.prototype;
|
|
20835
20884
|
|
|
20836
20885
|
// Move to the next token
|
|
20837
20886
|
|
|
20838
|
-
pp
|
|
20887
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20839
20888
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20840
20889
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20841
20890
|
if (this.options.onToken)
|
|
@@ -20848,21 +20897,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20848
20897
|
this.nextToken();
|
|
20849
20898
|
};
|
|
20850
20899
|
|
|
20851
|
-
pp
|
|
20900
|
+
pp.getToken = function() {
|
|
20852
20901
|
this.next();
|
|
20853
20902
|
return new Token(this)
|
|
20854
20903
|
};
|
|
20855
20904
|
|
|
20856
20905
|
// If we're in an ES6 environment, make parsers iterable
|
|
20857
20906
|
if (typeof Symbol !== "undefined")
|
|
20858
|
-
{ pp
|
|
20907
|
+
{ pp[Symbol.iterator] = function() {
|
|
20859
20908
|
var this$1$1 = this;
|
|
20860
20909
|
|
|
20861
20910
|
return {
|
|
20862
20911
|
next: function () {
|
|
20863
20912
|
var token = this$1$1.getToken();
|
|
20864
20913
|
return {
|
|
20865
|
-
done: token.type === types.eof,
|
|
20914
|
+
done: token.type === types$1.eof,
|
|
20866
20915
|
value: token
|
|
20867
20916
|
}
|
|
20868
20917
|
}
|
|
@@ -20875,19 +20924,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20875
20924
|
// Read a single token, updating the parser object's token-related
|
|
20876
20925
|
// properties.
|
|
20877
20926
|
|
|
20878
|
-
pp
|
|
20927
|
+
pp.nextToken = function() {
|
|
20879
20928
|
var curContext = this.curContext();
|
|
20880
20929
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20881
20930
|
|
|
20882
20931
|
this.start = this.pos;
|
|
20883
20932
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20884
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20933
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20885
20934
|
|
|
20886
20935
|
if (curContext.override) { return curContext.override(this) }
|
|
20887
20936
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20888
20937
|
};
|
|
20889
20938
|
|
|
20890
|
-
pp
|
|
20939
|
+
pp.readToken = function(code) {
|
|
20891
20940
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20892
20941
|
// identifiers, so '\' also dispatches to that.
|
|
20893
20942
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20896,14 +20945,14 @@ pp$9.readToken = function(code) {
|
|
|
20896
20945
|
return this.getTokenFromCode(code)
|
|
20897
20946
|
};
|
|
20898
20947
|
|
|
20899
|
-
pp
|
|
20948
|
+
pp.fullCharCodeAtPos = function() {
|
|
20900
20949
|
var code = this.input.charCodeAt(this.pos);
|
|
20901
20950
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20902
20951
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20903
20952
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20904
20953
|
};
|
|
20905
20954
|
|
|
20906
|
-
pp
|
|
20955
|
+
pp.skipBlockComment = function() {
|
|
20907
20956
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20908
20957
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20909
20958
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20921,7 +20970,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20921
20970
|
startLoc, this.curPosition()); }
|
|
20922
20971
|
};
|
|
20923
20972
|
|
|
20924
|
-
pp
|
|
20973
|
+
pp.skipLineComment = function(startSkip) {
|
|
20925
20974
|
var start = this.pos;
|
|
20926
20975
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20927
20976
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20936,7 +20985,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20936
20985
|
// Called at the start of the parse and after every token. Skips
|
|
20937
20986
|
// whitespace and comments, and.
|
|
20938
20987
|
|
|
20939
|
-
pp
|
|
20988
|
+
pp.skipSpace = function() {
|
|
20940
20989
|
loop: while (this.pos < this.input.length) {
|
|
20941
20990
|
var ch = this.input.charCodeAt(this.pos);
|
|
20942
20991
|
switch (ch) {
|
|
@@ -20981,7 +21030,7 @@ pp$9.skipSpace = function() {
|
|
|
20981
21030
|
// the token, so that the next one's `start` will point at the
|
|
20982
21031
|
// right position.
|
|
20983
21032
|
|
|
20984
|
-
pp
|
|
21033
|
+
pp.finishToken = function(type, val) {
|
|
20985
21034
|
this.end = this.pos;
|
|
20986
21035
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20987
21036
|
var prevType = this.type;
|
|
@@ -21000,62 +21049,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
21000
21049
|
//
|
|
21001
21050
|
// All in the name of speed.
|
|
21002
21051
|
//
|
|
21003
|
-
pp
|
|
21052
|
+
pp.readToken_dot = function() {
|
|
21004
21053
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21005
21054
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
21006
21055
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21007
21056
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
21008
21057
|
this.pos += 3;
|
|
21009
|
-
return this.finishToken(types.ellipsis)
|
|
21058
|
+
return this.finishToken(types$1.ellipsis)
|
|
21010
21059
|
} else {
|
|
21011
21060
|
++this.pos;
|
|
21012
|
-
return this.finishToken(types.dot)
|
|
21061
|
+
return this.finishToken(types$1.dot)
|
|
21013
21062
|
}
|
|
21014
21063
|
};
|
|
21015
21064
|
|
|
21016
|
-
pp
|
|
21065
|
+
pp.readToken_slash = function() { // '/'
|
|
21017
21066
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21018
21067
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
21019
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21020
|
-
return this.finishOp(types.slash, 1)
|
|
21068
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21069
|
+
return this.finishOp(types$1.slash, 1)
|
|
21021
21070
|
};
|
|
21022
21071
|
|
|
21023
|
-
pp
|
|
21072
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
21024
21073
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21025
21074
|
var size = 1;
|
|
21026
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
21075
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
21027
21076
|
|
|
21028
21077
|
// exponentiation operator ** and **=
|
|
21029
21078
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
21030
21079
|
++size;
|
|
21031
|
-
tokentype = types.starstar;
|
|
21080
|
+
tokentype = types$1.starstar;
|
|
21032
21081
|
next = this.input.charCodeAt(this.pos + 2);
|
|
21033
21082
|
}
|
|
21034
21083
|
|
|
21035
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
21084
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21036
21085
|
return this.finishOp(tokentype, size)
|
|
21037
21086
|
};
|
|
21038
21087
|
|
|
21039
|
-
pp
|
|
21088
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
21040
21089
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21041
21090
|
if (next === code) {
|
|
21042
21091
|
if (this.options.ecmaVersion >= 12) {
|
|
21043
21092
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21044
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
21093
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
21045
21094
|
}
|
|
21046
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
21095
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
21047
21096
|
}
|
|
21048
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21049
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
21097
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21098
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
21050
21099
|
};
|
|
21051
21100
|
|
|
21052
|
-
pp
|
|
21101
|
+
pp.readToken_caret = function() { // '^'
|
|
21053
21102
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21054
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21055
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
21103
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21104
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
21056
21105
|
};
|
|
21057
21106
|
|
|
21058
|
-
pp
|
|
21107
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
21059
21108
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21060
21109
|
if (next === code) {
|
|
21061
21110
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -21065,19 +21114,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
21065
21114
|
this.skipSpace();
|
|
21066
21115
|
return this.nextToken()
|
|
21067
21116
|
}
|
|
21068
|
-
return this.finishOp(types.incDec, 2)
|
|
21117
|
+
return this.finishOp(types$1.incDec, 2)
|
|
21069
21118
|
}
|
|
21070
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
21071
|
-
return this.finishOp(types.plusMin, 1)
|
|
21119
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
21120
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
21072
21121
|
};
|
|
21073
21122
|
|
|
21074
|
-
pp
|
|
21123
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
21075
21124
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21076
21125
|
var size = 1;
|
|
21077
21126
|
if (next === code) {
|
|
21078
21127
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
21079
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
21080
|
-
return this.finishOp(types.bitShift, size)
|
|
21128
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21129
|
+
return this.finishOp(types$1.bitShift, size)
|
|
21081
21130
|
}
|
|
21082
21131
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
21083
21132
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -21087,53 +21136,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
21087
21136
|
return this.nextToken()
|
|
21088
21137
|
}
|
|
21089
21138
|
if (next === 61) { size = 2; }
|
|
21090
|
-
return this.finishOp(types.relational, size)
|
|
21139
|
+
return this.finishOp(types$1.relational, size)
|
|
21091
21140
|
};
|
|
21092
21141
|
|
|
21093
|
-
pp
|
|
21142
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
21094
21143
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21095
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21144
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21096
21145
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
21097
21146
|
this.pos += 2;
|
|
21098
|
-
return this.finishToken(types.arrow)
|
|
21147
|
+
return this.finishToken(types$1.arrow)
|
|
21099
21148
|
}
|
|
21100
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
21149
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
21101
21150
|
};
|
|
21102
21151
|
|
|
21103
|
-
pp
|
|
21152
|
+
pp.readToken_question = function() { // '?'
|
|
21104
21153
|
var ecmaVersion = this.options.ecmaVersion;
|
|
21105
21154
|
if (ecmaVersion >= 11) {
|
|
21106
21155
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
21107
21156
|
if (next === 46) {
|
|
21108
21157
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
21109
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
21158
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
21110
21159
|
}
|
|
21111
21160
|
if (next === 63) {
|
|
21112
21161
|
if (ecmaVersion >= 12) {
|
|
21113
21162
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
21114
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
21163
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
21115
21164
|
}
|
|
21116
|
-
return this.finishOp(types.coalesce, 2)
|
|
21165
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
21117
21166
|
}
|
|
21118
21167
|
}
|
|
21119
|
-
return this.finishOp(types.question, 1)
|
|
21168
|
+
return this.finishOp(types$1.question, 1)
|
|
21120
21169
|
};
|
|
21121
21170
|
|
|
21122
|
-
pp
|
|
21171
|
+
pp.readToken_numberSign = function() { // '#'
|
|
21123
21172
|
var ecmaVersion = this.options.ecmaVersion;
|
|
21124
21173
|
var code = 35; // '#'
|
|
21125
21174
|
if (ecmaVersion >= 13) {
|
|
21126
21175
|
++this.pos;
|
|
21127
21176
|
code = this.fullCharCodeAtPos();
|
|
21128
21177
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
21129
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21178
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
21130
21179
|
}
|
|
21131
21180
|
}
|
|
21132
21181
|
|
|
21133
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21182
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21134
21183
|
};
|
|
21135
21184
|
|
|
21136
|
-
pp
|
|
21185
|
+
pp.getTokenFromCode = function(code) {
|
|
21137
21186
|
switch (code) {
|
|
21138
21187
|
// The interpretation of a dot depends on whether it is followed
|
|
21139
21188
|
// by a digit or another two dots.
|
|
@@ -21141,20 +21190,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21141
21190
|
return this.readToken_dot()
|
|
21142
21191
|
|
|
21143
21192
|
// Punctuation tokens.
|
|
21144
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
21145
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
21146
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
21147
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
21148
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
21149
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
21150
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
21151
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
21152
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
21193
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21194
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21195
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21196
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21197
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21198
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21199
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21200
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21201
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21153
21202
|
|
|
21154
21203
|
case 96: // '`'
|
|
21155
21204
|
if (this.options.ecmaVersion < 6) { break }
|
|
21156
21205
|
++this.pos;
|
|
21157
|
-
return this.finishToken(types.backQuote)
|
|
21206
|
+
return this.finishToken(types$1.backQuote)
|
|
21158
21207
|
|
|
21159
21208
|
case 48: // '0'
|
|
21160
21209
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21177,7 +21226,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21177
21226
|
// often referred to. `finishOp` simply skips the amount of
|
|
21178
21227
|
// characters it is given as second argument, and returns a token
|
|
21179
21228
|
// of the type given by its first argument.
|
|
21180
|
-
|
|
21181
21229
|
case 47: // '/'
|
|
21182
21230
|
return this.readToken_slash()
|
|
21183
21231
|
|
|
@@ -21203,22 +21251,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21203
21251
|
return this.readToken_question()
|
|
21204
21252
|
|
|
21205
21253
|
case 126: // '~'
|
|
21206
|
-
return this.finishOp(types.prefix, 1)
|
|
21254
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21207
21255
|
|
|
21208
21256
|
case 35: // '#'
|
|
21209
21257
|
return this.readToken_numberSign()
|
|
21210
21258
|
}
|
|
21211
21259
|
|
|
21212
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21260
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21213
21261
|
};
|
|
21214
21262
|
|
|
21215
|
-
pp
|
|
21263
|
+
pp.finishOp = function(type, size) {
|
|
21216
21264
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21217
21265
|
this.pos += size;
|
|
21218
21266
|
return this.finishToken(type, str)
|
|
21219
21267
|
};
|
|
21220
21268
|
|
|
21221
|
-
pp
|
|
21269
|
+
pp.readRegexp = function() {
|
|
21222
21270
|
var escaped, inClass, start = this.pos;
|
|
21223
21271
|
for (;;) {
|
|
21224
21272
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21253,14 +21301,14 @@ pp$9.readRegexp = function() {
|
|
|
21253
21301
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21254
21302
|
}
|
|
21255
21303
|
|
|
21256
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21304
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21257
21305
|
};
|
|
21258
21306
|
|
|
21259
21307
|
// Read an integer in the given radix. Return null if zero digits
|
|
21260
21308
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21261
21309
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21262
21310
|
|
|
21263
|
-
pp
|
|
21311
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21264
21312
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21265
21313
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21266
21314
|
|
|
@@ -21314,7 +21362,7 @@ function stringToBigInt(str) {
|
|
|
21314
21362
|
return BigInt(str.replace(/_/g, ""))
|
|
21315
21363
|
}
|
|
21316
21364
|
|
|
21317
|
-
pp
|
|
21365
|
+
pp.readRadixNumber = function(radix) {
|
|
21318
21366
|
var start = this.pos;
|
|
21319
21367
|
this.pos += 2; // 0x
|
|
21320
21368
|
var val = this.readInt(radix);
|
|
@@ -21323,12 +21371,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21323
21371
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21324
21372
|
++this.pos;
|
|
21325
21373
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21326
|
-
return this.finishToken(types.num, val)
|
|
21374
|
+
return this.finishToken(types$1.num, val)
|
|
21327
21375
|
};
|
|
21328
21376
|
|
|
21329
21377
|
// Read an integer, octal integer, or floating-point number.
|
|
21330
21378
|
|
|
21331
|
-
pp
|
|
21379
|
+
pp.readNumber = function(startsWithDot) {
|
|
21332
21380
|
var start = this.pos;
|
|
21333
21381
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21334
21382
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21338,7 +21386,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21338
21386
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21339
21387
|
++this.pos;
|
|
21340
21388
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21341
|
-
return this.finishToken(types.num, val$1)
|
|
21389
|
+
return this.finishToken(types$1.num, val$1)
|
|
21342
21390
|
}
|
|
21343
21391
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21344
21392
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21354,12 +21402,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21354
21402
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21355
21403
|
|
|
21356
21404
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21357
|
-
return this.finishToken(types.num, val)
|
|
21405
|
+
return this.finishToken(types$1.num, val)
|
|
21358
21406
|
};
|
|
21359
21407
|
|
|
21360
21408
|
// Read a string value, interpreting backslash-escapes.
|
|
21361
21409
|
|
|
21362
|
-
pp
|
|
21410
|
+
pp.readCodePoint = function() {
|
|
21363
21411
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21364
21412
|
|
|
21365
21413
|
if (ch === 123) { // '{'
|
|
@@ -21374,14 +21422,14 @@ pp$9.readCodePoint = function() {
|
|
|
21374
21422
|
return code
|
|
21375
21423
|
};
|
|
21376
21424
|
|
|
21377
|
-
function codePointToString
|
|
21425
|
+
function codePointToString(code) {
|
|
21378
21426
|
// UTF-16 Decoding
|
|
21379
21427
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21380
21428
|
code -= 0x10000;
|
|
21381
21429
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21382
21430
|
}
|
|
21383
21431
|
|
|
21384
|
-
pp
|
|
21432
|
+
pp.readString = function(quote) {
|
|
21385
21433
|
var out = "", chunkStart = ++this.pos;
|
|
21386
21434
|
for (;;) {
|
|
21387
21435
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21404,14 +21452,14 @@ pp$9.readString = function(quote) {
|
|
|
21404
21452
|
}
|
|
21405
21453
|
}
|
|
21406
21454
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21407
|
-
return this.finishToken(types.string, out)
|
|
21455
|
+
return this.finishToken(types$1.string, out)
|
|
21408
21456
|
};
|
|
21409
21457
|
|
|
21410
21458
|
// Reads template string tokens.
|
|
21411
21459
|
|
|
21412
21460
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21413
21461
|
|
|
21414
|
-
pp
|
|
21462
|
+
pp.tryReadTemplateToken = function() {
|
|
21415
21463
|
this.inTemplateElement = true;
|
|
21416
21464
|
try {
|
|
21417
21465
|
this.readTmplToken();
|
|
@@ -21426,7 +21474,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21426
21474
|
this.inTemplateElement = false;
|
|
21427
21475
|
};
|
|
21428
21476
|
|
|
21429
|
-
pp
|
|
21477
|
+
pp.invalidStringToken = function(position, message) {
|
|
21430
21478
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21431
21479
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21432
21480
|
} else {
|
|
@@ -21434,23 +21482,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21434
21482
|
}
|
|
21435
21483
|
};
|
|
21436
21484
|
|
|
21437
|
-
pp
|
|
21485
|
+
pp.readTmplToken = function() {
|
|
21438
21486
|
var out = "", chunkStart = this.pos;
|
|
21439
21487
|
for (;;) {
|
|
21440
21488
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21441
21489
|
var ch = this.input.charCodeAt(this.pos);
|
|
21442
21490
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
21443
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
21491
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21444
21492
|
if (ch === 36) {
|
|
21445
21493
|
this.pos += 2;
|
|
21446
|
-
return this.finishToken(types.dollarBraceL)
|
|
21494
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21447
21495
|
} else {
|
|
21448
21496
|
++this.pos;
|
|
21449
|
-
return this.finishToken(types.backQuote)
|
|
21497
|
+
return this.finishToken(types$1.backQuote)
|
|
21450
21498
|
}
|
|
21451
21499
|
}
|
|
21452
21500
|
out += this.input.slice(chunkStart, this.pos);
|
|
21453
|
-
return this.finishToken(types.template, out)
|
|
21501
|
+
return this.finishToken(types$1.template, out)
|
|
21454
21502
|
}
|
|
21455
21503
|
if (ch === 92) { // '\'
|
|
21456
21504
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21481,7 +21529,7 @@ pp$9.readTmplToken = function() {
|
|
|
21481
21529
|
};
|
|
21482
21530
|
|
|
21483
21531
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21484
|
-
pp
|
|
21532
|
+
pp.readInvalidTemplateToken = function() {
|
|
21485
21533
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21486
21534
|
switch (this.input[this.pos]) {
|
|
21487
21535
|
case "\\":
|
|
@@ -21492,10 +21540,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21492
21540
|
if (this.input[this.pos + 1] !== "{") {
|
|
21493
21541
|
break
|
|
21494
21542
|
}
|
|
21495
|
-
// falls through
|
|
21496
21543
|
|
|
21544
|
+
// falls through
|
|
21497
21545
|
case "`":
|
|
21498
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21546
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21499
21547
|
|
|
21500
21548
|
// no default
|
|
21501
21549
|
}
|
|
@@ -21505,14 +21553,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21505
21553
|
|
|
21506
21554
|
// Used to read escaped characters
|
|
21507
21555
|
|
|
21508
|
-
pp
|
|
21556
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21509
21557
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21510
21558
|
++this.pos;
|
|
21511
21559
|
switch (ch) {
|
|
21512
21560
|
case 110: return "\n" // 'n' -> '\n'
|
|
21513
21561
|
case 114: return "\r" // 'r' -> '\r'
|
|
21514
21562
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21515
|
-
case 117: return codePointToString
|
|
21563
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21516
21564
|
case 116: return "\t" // 't' -> '\t'
|
|
21517
21565
|
case 98: return "\b" // 'b' -> '\b'
|
|
21518
21566
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21570,7 +21618,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21570
21618
|
|
|
21571
21619
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21572
21620
|
|
|
21573
|
-
pp
|
|
21621
|
+
pp.readHexChar = function(len) {
|
|
21574
21622
|
var codePos = this.pos;
|
|
21575
21623
|
var n = this.readInt(16, len);
|
|
21576
21624
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21583,7 +21631,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21583
21631
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21584
21632
|
// as a micro-optimization.
|
|
21585
21633
|
|
|
21586
|
-
pp
|
|
21634
|
+
pp.readWord1 = function() {
|
|
21587
21635
|
this.containsEsc = false;
|
|
21588
21636
|
var word = "", first = true, chunkStart = this.pos;
|
|
21589
21637
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21601,7 +21649,7 @@ pp$9.readWord1 = function() {
|
|
|
21601
21649
|
var esc = this.readCodePoint();
|
|
21602
21650
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21603
21651
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21604
|
-
word += codePointToString
|
|
21652
|
+
word += codePointToString(esc);
|
|
21605
21653
|
chunkStart = this.pos;
|
|
21606
21654
|
} else {
|
|
21607
21655
|
break
|
|
@@ -21614,18 +21662,18 @@ pp$9.readWord1 = function() {
|
|
|
21614
21662
|
// Read an identifier or keyword token. Will check for reserved
|
|
21615
21663
|
// words when necessary.
|
|
21616
21664
|
|
|
21617
|
-
pp
|
|
21665
|
+
pp.readWord = function() {
|
|
21618
21666
|
var word = this.readWord1();
|
|
21619
|
-
var type = types.name;
|
|
21667
|
+
var type = types$1.name;
|
|
21620
21668
|
if (this.keywords.test(word)) {
|
|
21621
|
-
type = keywords
|
|
21669
|
+
type = keywords[word];
|
|
21622
21670
|
}
|
|
21623
21671
|
return this.finishToken(type, word)
|
|
21624
21672
|
};
|
|
21625
21673
|
|
|
21626
21674
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21627
21675
|
|
|
21628
|
-
var version = "8.
|
|
21676
|
+
var version = "8.6.0";
|
|
21629
21677
|
|
|
21630
21678
|
Parser.acorn = {
|
|
21631
21679
|
Parser: Parser,
|
|
@@ -21636,10 +21684,10 @@ Parser.acorn = {
|
|
|
21636
21684
|
getLineInfo: getLineInfo,
|
|
21637
21685
|
Node: Node,
|
|
21638
21686
|
TokenType: TokenType,
|
|
21639
|
-
tokTypes: types,
|
|
21640
|
-
keywordTypes: keywords
|
|
21687
|
+
tokTypes: types$1,
|
|
21688
|
+
keywordTypes: keywords,
|
|
21641
21689
|
TokContext: TokContext,
|
|
21642
|
-
tokContexts: types
|
|
21690
|
+
tokContexts: types,
|
|
21643
21691
|
isIdentifierChar: isIdentifierChar,
|
|
21644
21692
|
isIdentifierStart: isIdentifierStart,
|
|
21645
21693
|
Token: Token,
|
|
@@ -21652,20 +21700,7 @@ Parser.acorn = {
|
|
|
21652
21700
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21653
21701
|
function mkdirpath(path) {
|
|
21654
21702
|
const dir = path$2.dirname(path);
|
|
21655
|
-
|
|
21656
|
-
fs.readdirSync(dir);
|
|
21657
|
-
}
|
|
21658
|
-
catch (_a) {
|
|
21659
|
-
mkdirpath(dir);
|
|
21660
|
-
try {
|
|
21661
|
-
fs.mkdirSync(dir);
|
|
21662
|
-
}
|
|
21663
|
-
catch (err) {
|
|
21664
|
-
if (err.code !== 'EEXIST') {
|
|
21665
|
-
throw err;
|
|
21666
|
-
}
|
|
21667
|
-
}
|
|
21668
|
-
}
|
|
21703
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21669
21704
|
}
|
|
21670
21705
|
function writeFile(dest, data) {
|
|
21671
21706
|
return new Promise((fulfil, reject) => {
|
|
@@ -22031,6 +22066,7 @@ class ModuleLoader {
|
|
|
22031
22066
|
this.indexedEntryModules = [];
|
|
22032
22067
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
22033
22068
|
this.moduleLoadPromises = new Map();
|
|
22069
|
+
this.modulesWithLoadedDependencies = new Set();
|
|
22034
22070
|
this.nextEntryModuleIndex = 0;
|
|
22035
22071
|
this.readQueue = new Queue();
|
|
22036
22072
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
@@ -22209,7 +22245,8 @@ class ModuleLoader {
|
|
|
22209
22245
|
this.graph.watchFiles[id] = true;
|
|
22210
22246
|
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22211
22247
|
this.getResolveStaticDependencyPromises(module),
|
|
22212
|
-
this.getResolveDynamicImportPromises(module)
|
|
22248
|
+
this.getResolveDynamicImportPromises(module),
|
|
22249
|
+
loadAndResolveDependenciesPromise
|
|
22213
22250
|
]);
|
|
22214
22251
|
const loadAndResolveDependenciesPromise = loadPromise
|
|
22215
22252
|
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
@@ -22217,23 +22254,25 @@ class ModuleLoader {
|
|
|
22217
22254
|
loadAndResolveDependenciesPromise.catch(() => {
|
|
22218
22255
|
/* avoid unhandled promise rejections */
|
|
22219
22256
|
});
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
|
|
22223
|
-
|
|
22224
|
-
else {
|
|
22225
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22226
|
-
// To handle errors when resolving dependencies or in moduleParsed
|
|
22227
|
-
await loadAndResolveDependenciesPromise;
|
|
22257
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22258
|
+
const resolveDependencyPromises = await loadPromise;
|
|
22259
|
+
if (!isPreload) {
|
|
22260
|
+
await this.fetchModuleDependencies(module, ...resolveDependencyPromises);
|
|
22228
22261
|
}
|
|
22229
22262
|
return module;
|
|
22230
22263
|
}
|
|
22231
|
-
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22264
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises, loadAndResolveDependenciesPromise) {
|
|
22265
|
+
if (this.modulesWithLoadedDependencies.has(module)) {
|
|
22266
|
+
return;
|
|
22267
|
+
}
|
|
22268
|
+
this.modulesWithLoadedDependencies.add(module);
|
|
22232
22269
|
await Promise.all([
|
|
22233
22270
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22234
22271
|
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22235
22272
|
]);
|
|
22236
22273
|
module.linkImports();
|
|
22274
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22275
|
+
await loadAndResolveDependenciesPromise;
|
|
22237
22276
|
}
|
|
22238
22277
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22239
22278
|
if (resolvedId.external) {
|
|
@@ -22322,8 +22361,7 @@ class ModuleLoader {
|
|
|
22322
22361
|
async handleExistingModule(module, isEntry, isPreload) {
|
|
22323
22362
|
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22324
22363
|
if (isPreload) {
|
|
22325
|
-
|
|
22326
|
-
return;
|
|
22364
|
+
return loadPromise;
|
|
22327
22365
|
}
|
|
22328
22366
|
if (isEntry) {
|
|
22329
22367
|
module.info.isEntry = true;
|
|
@@ -22333,11 +22371,7 @@ class ModuleLoader {
|
|
|
22333
22371
|
}
|
|
22334
22372
|
module.implicitlyLoadedAfter.clear();
|
|
22335
22373
|
}
|
|
22336
|
-
|
|
22337
|
-
this.moduleLoadPromises.delete(module);
|
|
22338
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22339
|
-
}
|
|
22340
|
-
return;
|
|
22374
|
+
return this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22341
22375
|
}
|
|
22342
22376
|
handleResolveId(resolvedId, source, importer) {
|
|
22343
22377
|
if (resolvedId === null) {
|