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