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/es/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
|
|
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version$1 = "2.
|
|
16
|
+
var version$1 = "2.63.0";
|
|
17
17
|
|
|
18
18
|
var charToInteger = {};
|
|
19
19
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1645,20 +1645,70 @@ const BLANK = Object.freeze(Object.create(null));
|
|
|
1645
1645
|
const EMPTY_OBJECT = Object.freeze({});
|
|
1646
1646
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
1647
1647
|
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1650
|
-
|
|
1648
|
+
const RESERVED_NAMES = new Set([
|
|
1649
|
+
'await',
|
|
1650
|
+
'break',
|
|
1651
|
+
'case',
|
|
1652
|
+
'catch',
|
|
1653
|
+
'class',
|
|
1654
|
+
'const',
|
|
1655
|
+
'continue',
|
|
1656
|
+
'debugger',
|
|
1657
|
+
'default',
|
|
1658
|
+
'delete',
|
|
1659
|
+
'do',
|
|
1660
|
+
'else',
|
|
1661
|
+
'enum',
|
|
1662
|
+
'eval',
|
|
1663
|
+
'export',
|
|
1664
|
+
'extends',
|
|
1665
|
+
'false',
|
|
1666
|
+
'finally',
|
|
1667
|
+
'for',
|
|
1668
|
+
'function',
|
|
1669
|
+
'if',
|
|
1670
|
+
'implements',
|
|
1671
|
+
'import',
|
|
1672
|
+
'in',
|
|
1673
|
+
'instanceof',
|
|
1674
|
+
'interface',
|
|
1675
|
+
'let',
|
|
1676
|
+
'NaN',
|
|
1677
|
+
'new',
|
|
1678
|
+
'null',
|
|
1679
|
+
'package',
|
|
1680
|
+
'private',
|
|
1681
|
+
'protected',
|
|
1682
|
+
'public',
|
|
1683
|
+
'return',
|
|
1684
|
+
'static',
|
|
1685
|
+
'super',
|
|
1686
|
+
'switch',
|
|
1687
|
+
'this',
|
|
1688
|
+
'throw',
|
|
1689
|
+
'true',
|
|
1690
|
+
'try',
|
|
1691
|
+
'typeof',
|
|
1692
|
+
'undefined',
|
|
1693
|
+
'var',
|
|
1694
|
+
'void',
|
|
1695
|
+
'while',
|
|
1696
|
+
'with',
|
|
1697
|
+
'yield'
|
|
1698
|
+
]);
|
|
1699
|
+
const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
1700
|
+
|
|
1651
1701
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
1652
1702
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
1653
1703
|
function isLegal(str) {
|
|
1654
|
-
if (startsWithDigit(str) ||
|
|
1704
|
+
if (startsWithDigit(str) || RESERVED_NAMES$1.has(str)) {
|
|
1655
1705
|
return false;
|
|
1656
1706
|
}
|
|
1657
1707
|
return !illegalCharacters.test(str);
|
|
1658
1708
|
}
|
|
1659
1709
|
function makeLegal(str) {
|
|
1660
1710
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
1661
|
-
if (startsWithDigit(str) ||
|
|
1711
|
+
if (startsWithDigit(str) || RESERVED_NAMES$1.has(str))
|
|
1662
1712
|
str = `_${str}`;
|
|
1663
1713
|
return str || '_';
|
|
1664
1714
|
}
|
|
@@ -1740,6 +1790,7 @@ class ExternalModule {
|
|
|
1740
1790
|
},
|
|
1741
1791
|
isEntry: false,
|
|
1742
1792
|
isExternal: true,
|
|
1793
|
+
isIncluded: null,
|
|
1743
1794
|
meta,
|
|
1744
1795
|
syntheticNamedExports: false
|
|
1745
1796
|
};
|
|
@@ -5038,8 +5089,6 @@ const knownGlobals = {
|
|
|
5038
5089
|
__proto__: null,
|
|
5039
5090
|
[ValueProperties]: PURE,
|
|
5040
5091
|
create: PF,
|
|
5041
|
-
getNotifier: PF,
|
|
5042
|
-
getOwn: PF,
|
|
5043
5092
|
getOwnPropertyDescriptor: PF,
|
|
5044
5093
|
getOwnPropertyNames: PF,
|
|
5045
5094
|
getOwnPropertySymbols: PF,
|
|
@@ -6081,62 +6130,10 @@ function toBase64(num) {
|
|
|
6081
6130
|
return outStr;
|
|
6082
6131
|
}
|
|
6083
6132
|
|
|
6084
|
-
const RESERVED_NAMES = {
|
|
6085
|
-
__proto__: null,
|
|
6086
|
-
await: true,
|
|
6087
|
-
break: true,
|
|
6088
|
-
case: true,
|
|
6089
|
-
catch: true,
|
|
6090
|
-
class: true,
|
|
6091
|
-
const: true,
|
|
6092
|
-
continue: true,
|
|
6093
|
-
debugger: true,
|
|
6094
|
-
default: true,
|
|
6095
|
-
delete: true,
|
|
6096
|
-
do: true,
|
|
6097
|
-
else: true,
|
|
6098
|
-
enum: true,
|
|
6099
|
-
eval: true,
|
|
6100
|
-
export: true,
|
|
6101
|
-
extends: true,
|
|
6102
|
-
false: true,
|
|
6103
|
-
finally: true,
|
|
6104
|
-
for: true,
|
|
6105
|
-
function: true,
|
|
6106
|
-
if: true,
|
|
6107
|
-
implements: true,
|
|
6108
|
-
import: true,
|
|
6109
|
-
in: true,
|
|
6110
|
-
instanceof: true,
|
|
6111
|
-
interface: true,
|
|
6112
|
-
let: true,
|
|
6113
|
-
new: true,
|
|
6114
|
-
null: true,
|
|
6115
|
-
package: true,
|
|
6116
|
-
private: true,
|
|
6117
|
-
protected: true,
|
|
6118
|
-
public: true,
|
|
6119
|
-
return: true,
|
|
6120
|
-
static: true,
|
|
6121
|
-
super: true,
|
|
6122
|
-
switch: true,
|
|
6123
|
-
this: true,
|
|
6124
|
-
throw: true,
|
|
6125
|
-
true: true,
|
|
6126
|
-
try: true,
|
|
6127
|
-
typeof: true,
|
|
6128
|
-
undefined: true,
|
|
6129
|
-
var: true,
|
|
6130
|
-
void: true,
|
|
6131
|
-
while: true,
|
|
6132
|
-
with: true,
|
|
6133
|
-
yield: true
|
|
6134
|
-
};
|
|
6135
|
-
|
|
6136
6133
|
function getSafeName(baseName, usedNames) {
|
|
6137
6134
|
let safeName = baseName;
|
|
6138
6135
|
let count = 1;
|
|
6139
|
-
while (usedNames.has(safeName) || RESERVED_NAMES
|
|
6136
|
+
while (usedNames.has(safeName) || RESERVED_NAMES$1.has(safeName)) {
|
|
6140
6137
|
safeName = `${baseName}$${toBase64(count++)}`;
|
|
6141
6138
|
}
|
|
6142
6139
|
usedNames.add(safeName);
|
|
@@ -6247,16 +6244,27 @@ const literalNumberMembers = assembleMemberDescriptions({
|
|
|
6247
6244
|
valueOf: returnsNumber
|
|
6248
6245
|
}, objectMembers);
|
|
6249
6246
|
const literalStringMembers = assembleMemberDescriptions({
|
|
6247
|
+
anchor: returnsString,
|
|
6248
|
+
at: returnsUnknown,
|
|
6249
|
+
big: returnsString,
|
|
6250
|
+
blink: returnsString,
|
|
6251
|
+
bold: returnsString,
|
|
6250
6252
|
charAt: returnsString,
|
|
6251
6253
|
charCodeAt: returnsNumber,
|
|
6252
|
-
codePointAt:
|
|
6254
|
+
codePointAt: returnsUnknown,
|
|
6253
6255
|
concat: returnsString,
|
|
6254
6256
|
endsWith: returnsBoolean,
|
|
6257
|
+
fixed: returnsString,
|
|
6258
|
+
fontcolor: returnsString,
|
|
6259
|
+
fontsize: returnsString,
|
|
6255
6260
|
includes: returnsBoolean,
|
|
6256
6261
|
indexOf: returnsNumber,
|
|
6262
|
+
italics: returnsString,
|
|
6257
6263
|
lastIndexOf: returnsNumber,
|
|
6264
|
+
link: returnsString,
|
|
6258
6265
|
localeCompare: returnsNumber,
|
|
6259
|
-
match:
|
|
6266
|
+
match: returnsUnknown,
|
|
6267
|
+
matchAll: returnsUnknown,
|
|
6260
6268
|
normalize: returnsString,
|
|
6261
6269
|
padEnd: returnsString,
|
|
6262
6270
|
padStart: returnsString,
|
|
@@ -6267,17 +6275,32 @@ const literalStringMembers = assembleMemberDescriptions({
|
|
|
6267
6275
|
returns: UNKNOWN_LITERAL_STRING
|
|
6268
6276
|
}
|
|
6269
6277
|
},
|
|
6278
|
+
replaceAll: {
|
|
6279
|
+
value: {
|
|
6280
|
+
callsArgs: [1],
|
|
6281
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
6282
|
+
}
|
|
6283
|
+
},
|
|
6270
6284
|
search: returnsNumber,
|
|
6271
6285
|
slice: returnsString,
|
|
6286
|
+
small: returnsString,
|
|
6272
6287
|
split: returnsUnknown,
|
|
6273
6288
|
startsWith: returnsBoolean,
|
|
6289
|
+
strike: returnsString,
|
|
6290
|
+
sub: returnsString,
|
|
6274
6291
|
substr: returnsString,
|
|
6275
6292
|
substring: returnsString,
|
|
6293
|
+
sup: returnsString,
|
|
6276
6294
|
toLocaleLowerCase: returnsString,
|
|
6277
6295
|
toLocaleUpperCase: returnsString,
|
|
6278
6296
|
toLowerCase: returnsString,
|
|
6297
|
+
toString: returnsString,
|
|
6279
6298
|
toUpperCase: returnsString,
|
|
6280
6299
|
trim: returnsString,
|
|
6300
|
+
trimEnd: returnsString,
|
|
6301
|
+
trimLeft: returnsString,
|
|
6302
|
+
trimRight: returnsString,
|
|
6303
|
+
trimStart: returnsString,
|
|
6281
6304
|
valueOf: returnsString
|
|
6282
6305
|
}, objectMembers);
|
|
6283
6306
|
function getLiteralMembersForValue(value) {
|
|
@@ -8093,6 +8116,10 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8093
8116
|
filter: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8094
8117
|
find: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8095
8118
|
findIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8119
|
+
findLast: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8120
|
+
findLastIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
|
|
8121
|
+
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8122
|
+
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8096
8123
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8097
8124
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
8098
8125
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
@@ -8110,6 +8137,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8110
8137
|
some: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN,
|
|
8111
8138
|
sort: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF,
|
|
8112
8139
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
8140
|
+
toLocaleString: METHOD_RETURNS_STRING,
|
|
8141
|
+
toString: METHOD_RETURNS_STRING,
|
|
8113
8142
|
unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
|
|
8114
8143
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
8115
8144
|
}, OBJECT_PROTOTYPE, true);
|
|
@@ -11942,13 +11971,19 @@ class SyntheticNamedExportVariable extends Variable {
|
|
|
11942
11971
|
}
|
|
11943
11972
|
}
|
|
11944
11973
|
|
|
11974
|
+
var BuildPhase;
|
|
11975
|
+
(function (BuildPhase) {
|
|
11976
|
+
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
11977
|
+
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
11978
|
+
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
11979
|
+
})(BuildPhase || (BuildPhase = {}));
|
|
11980
|
+
|
|
11945
11981
|
function getId(m) {
|
|
11946
11982
|
return m.id;
|
|
11947
11983
|
}
|
|
11948
11984
|
|
|
11949
11985
|
function getOriginalLocation(sourcemapChain, location) {
|
|
11950
|
-
|
|
11951
|
-
const filteredSourcemapChain = sourcemapChain.filter(sourcemap => sourcemap.mappings);
|
|
11986
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
11952
11987
|
while (filteredSourcemapChain.length > 0) {
|
|
11953
11988
|
const sourcemap = filteredSourcemapChain.pop();
|
|
11954
11989
|
const line = sourcemap.mappings[location.line - 1];
|
|
@@ -12221,10 +12256,10 @@ class Module {
|
|
|
12221
12256
|
hasModuleSideEffects,
|
|
12222
12257
|
id,
|
|
12223
12258
|
get implicitlyLoadedAfterOneOf() {
|
|
12224
|
-
return Array.from(module.implicitlyLoadedAfter, getId);
|
|
12259
|
+
return Array.from(module.implicitlyLoadedAfter, getId).sort();
|
|
12225
12260
|
},
|
|
12226
12261
|
get implicitlyLoadedBefore() {
|
|
12227
|
-
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12262
|
+
return Array.from(module.implicitlyLoadedBefore, getId).sort();
|
|
12228
12263
|
},
|
|
12229
12264
|
get importedIds() {
|
|
12230
12265
|
return Array.from(module.sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
@@ -12234,6 +12269,12 @@ class Module {
|
|
|
12234
12269
|
},
|
|
12235
12270
|
isEntry,
|
|
12236
12271
|
isExternal: false,
|
|
12272
|
+
get isIncluded() {
|
|
12273
|
+
if (module.graph.phase !== BuildPhase.GENERATE) {
|
|
12274
|
+
return null;
|
|
12275
|
+
}
|
|
12276
|
+
return module.isIncluded();
|
|
12277
|
+
},
|
|
12237
12278
|
meta,
|
|
12238
12279
|
syntheticNamedExports
|
|
12239
12280
|
};
|
|
@@ -12666,7 +12707,7 @@ class Module {
|
|
|
12666
12707
|
this.info.syntheticNamedExports = syntheticNamedExports;
|
|
12667
12708
|
}
|
|
12668
12709
|
if (meta != null) {
|
|
12669
|
-
|
|
12710
|
+
Object.assign(this.info.meta, meta);
|
|
12670
12711
|
}
|
|
12671
12712
|
}
|
|
12672
12713
|
warn(props, pos) {
|
|
@@ -14024,7 +14065,7 @@ function escapeId(id) {
|
|
|
14024
14065
|
function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
|
|
14025
14066
|
let nameIndex = 0;
|
|
14026
14067
|
for (const variable of exports) {
|
|
14027
|
-
let exportName = variable.name
|
|
14068
|
+
let [exportName] = variable.name;
|
|
14028
14069
|
if (exportsByName[exportName]) {
|
|
14029
14070
|
do {
|
|
14030
14071
|
exportName = toBase64(++nameIndex);
|
|
@@ -14033,7 +14074,7 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14033
14074
|
nameIndex += 9 * 64 ** (exportName.length - 1);
|
|
14034
14075
|
exportName = toBase64(nameIndex);
|
|
14035
14076
|
}
|
|
14036
|
-
} while (RESERVED_NAMES
|
|
14077
|
+
} while (RESERVED_NAMES$1.has(exportName) || exportsByName[exportName]);
|
|
14037
14078
|
}
|
|
14038
14079
|
exportsByName[exportName] = variable;
|
|
14039
14080
|
exportNamesByVariable.set(variable, [exportName]);
|
|
@@ -15251,13 +15292,6 @@ function getChunkNameFromModule(module) {
|
|
|
15251
15292
|
return module.chunkName || getAliasName(module.id);
|
|
15252
15293
|
}
|
|
15253
15294
|
|
|
15254
|
-
var BuildPhase;
|
|
15255
|
-
(function (BuildPhase) {
|
|
15256
|
-
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
15257
|
-
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
15258
|
-
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
15259
|
-
})(BuildPhase || (BuildPhase = {}));
|
|
15260
|
-
|
|
15261
15295
|
function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
15262
15296
|
const emittedName = outputOptions.sanitizeFileName(name || 'asset');
|
|
15263
15297
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
@@ -15768,7 +15802,7 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
|
|
|
15768
15802
|
];
|
|
15769
15803
|
const isValidPropName = reservedNamesAsProps
|
|
15770
15804
|
? (name) => validPropName.test(name)
|
|
15771
|
-
: (name) => !RESERVED_NAMES
|
|
15805
|
+
: (name) => !RESERVED_NAMES$1.has(name) && validPropName.test(name);
|
|
15772
15806
|
return {
|
|
15773
15807
|
_,
|
|
15774
15808
|
cnst,
|
|
@@ -15993,7 +16027,7 @@ function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
|
|
|
15993
16027
|
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'));
|
|
15994
16028
|
}
|
|
15995
16029
|
function getIncludedModules(modulesById) {
|
|
15996
|
-
return [...modulesById.values()].filter(module => module instanceof Module &&
|
|
16030
|
+
return [...modulesById.values()].filter((module) => module instanceof Module &&
|
|
15997
16031
|
(module.isIncluded() || module.info.isEntry || module.includedDynamicImporters.length > 0));
|
|
15998
16032
|
}
|
|
15999
16033
|
function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
@@ -16018,7 +16052,7 @@ var reservedWords = {
|
|
|
16018
16052
|
|
|
16019
16053
|
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";
|
|
16020
16054
|
|
|
16021
|
-
var keywords = {
|
|
16055
|
+
var keywords$1 = {
|
|
16022
16056
|
5: ecma5AndLessKeywords,
|
|
16023
16057
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16024
16058
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16137,17 +16171,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16137
16171
|
|
|
16138
16172
|
// Map keyword names to token types.
|
|
16139
16173
|
|
|
16140
|
-
var keywords
|
|
16174
|
+
var keywords = {};
|
|
16141
16175
|
|
|
16142
16176
|
// Succinct definitions of keyword token types
|
|
16143
16177
|
function kw(name, options) {
|
|
16144
16178
|
if ( options === void 0 ) options = {};
|
|
16145
16179
|
|
|
16146
16180
|
options.keyword = name;
|
|
16147
|
-
return keywords
|
|
16181
|
+
return keywords[name] = new TokenType(name, options)
|
|
16148
16182
|
}
|
|
16149
16183
|
|
|
16150
|
-
var types = {
|
|
16184
|
+
var types$1 = {
|
|
16151
16185
|
num: new TokenType("num", startsExpr),
|
|
16152
16186
|
regexp: new TokenType("regexp", startsExpr),
|
|
16153
16187
|
string: new TokenType("string", startsExpr),
|
|
@@ -16489,7 +16523,7 @@ var
|
|
|
16489
16523
|
var Parser = function Parser(options, input, startPos) {
|
|
16490
16524
|
this.options = options = getOptions(options);
|
|
16491
16525
|
this.sourceFile = options.sourceFile;
|
|
16492
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16526
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16493
16527
|
var reserved = "";
|
|
16494
16528
|
if (options.allowReserved !== true) {
|
|
16495
16529
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16520,7 +16554,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16520
16554
|
|
|
16521
16555
|
// Properties of the current token:
|
|
16522
16556
|
// Its type
|
|
16523
|
-
this.type = types.eof;
|
|
16557
|
+
this.type = types$1.eof;
|
|
16524
16558
|
// For tokens that include more information than their type, the value
|
|
16525
16559
|
this.value = null;
|
|
16526
16560
|
// Its start and end offset
|
|
@@ -16580,8 +16614,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16580
16614
|
};
|
|
16581
16615
|
|
|
16582
16616
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16617
|
+
|
|
16583
16618
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16619
|
+
|
|
16584
16620
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16621
|
+
|
|
16585
16622
|
prototypeAccessors.canAwait.get = function () {
|
|
16586
16623
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16587
16624
|
var scope = this.scopeStack[i];
|
|
@@ -16590,20 +16627,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16590
16627
|
}
|
|
16591
16628
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16592
16629
|
};
|
|
16630
|
+
|
|
16593
16631
|
prototypeAccessors.allowSuper.get = function () {
|
|
16594
16632
|
var ref = this.currentThisScope();
|
|
16595
16633
|
var flags = ref.flags;
|
|
16596
16634
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16597
16635
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16598
16636
|
};
|
|
16637
|
+
|
|
16599
16638
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16639
|
+
|
|
16600
16640
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16641
|
+
|
|
16601
16642
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16602
16643
|
var ref = this.currentThisScope();
|
|
16603
16644
|
var flags = ref.flags;
|
|
16604
16645
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16605
16646
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16606
16647
|
};
|
|
16648
|
+
|
|
16607
16649
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16608
16650
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16609
16651
|
};
|
|
@@ -16633,12 +16675,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16633
16675
|
|
|
16634
16676
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16635
16677
|
|
|
16636
|
-
var pp = Parser.prototype;
|
|
16678
|
+
var pp$9 = Parser.prototype;
|
|
16637
16679
|
|
|
16638
16680
|
// ## Parser utilities
|
|
16639
16681
|
|
|
16640
16682
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16641
|
-
pp.strictDirective = function(start) {
|
|
16683
|
+
pp$9.strictDirective = function(start) {
|
|
16642
16684
|
for (;;) {
|
|
16643
16685
|
// Try to find string literal.
|
|
16644
16686
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16666,7 +16708,7 @@ pp.strictDirective = function(start) {
|
|
|
16666
16708
|
// Predicate that tests whether the next token is of the given
|
|
16667
16709
|
// type, and if yes, consumes it as a side effect.
|
|
16668
16710
|
|
|
16669
|
-
pp.eat = function(type) {
|
|
16711
|
+
pp$9.eat = function(type) {
|
|
16670
16712
|
if (this.type === type) {
|
|
16671
16713
|
this.next();
|
|
16672
16714
|
return true
|
|
@@ -16677,13 +16719,13 @@ pp.eat = function(type) {
|
|
|
16677
16719
|
|
|
16678
16720
|
// Tests whether parsed token is a contextual keyword.
|
|
16679
16721
|
|
|
16680
|
-
pp.isContextual = function(name) {
|
|
16681
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16722
|
+
pp$9.isContextual = function(name) {
|
|
16723
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16682
16724
|
};
|
|
16683
16725
|
|
|
16684
16726
|
// Consumes contextual keyword if possible.
|
|
16685
16727
|
|
|
16686
|
-
pp.eatContextual = function(name) {
|
|
16728
|
+
pp$9.eatContextual = function(name) {
|
|
16687
16729
|
if (!this.isContextual(name)) { return false }
|
|
16688
16730
|
this.next();
|
|
16689
16731
|
return true
|
|
@@ -16691,19 +16733,19 @@ pp.eatContextual = function(name) {
|
|
|
16691
16733
|
|
|
16692
16734
|
// Asserts that following token is given contextual keyword.
|
|
16693
16735
|
|
|
16694
|
-
pp.expectContextual = function(name) {
|
|
16736
|
+
pp$9.expectContextual = function(name) {
|
|
16695
16737
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16696
16738
|
};
|
|
16697
16739
|
|
|
16698
16740
|
// Test whether a semicolon can be inserted at the current position.
|
|
16699
16741
|
|
|
16700
|
-
pp.canInsertSemicolon = function() {
|
|
16701
|
-
return this.type === types.eof ||
|
|
16702
|
-
this.type === types.braceR ||
|
|
16742
|
+
pp$9.canInsertSemicolon = function() {
|
|
16743
|
+
return this.type === types$1.eof ||
|
|
16744
|
+
this.type === types$1.braceR ||
|
|
16703
16745
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16704
16746
|
};
|
|
16705
16747
|
|
|
16706
|
-
pp.insertSemicolon = function() {
|
|
16748
|
+
pp$9.insertSemicolon = function() {
|
|
16707
16749
|
if (this.canInsertSemicolon()) {
|
|
16708
16750
|
if (this.options.onInsertedSemicolon)
|
|
16709
16751
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16714,11 +16756,11 @@ pp.insertSemicolon = function() {
|
|
|
16714
16756
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16715
16757
|
// pretend that there is a semicolon at this position.
|
|
16716
16758
|
|
|
16717
|
-
pp.semicolon = function() {
|
|
16718
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16759
|
+
pp$9.semicolon = function() {
|
|
16760
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16719
16761
|
};
|
|
16720
16762
|
|
|
16721
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16763
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16722
16764
|
if (this.type === tokType) {
|
|
16723
16765
|
if (this.options.onTrailingComma)
|
|
16724
16766
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16731,13 +16773,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16731
16773
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16732
16774
|
// raise an unexpected token error.
|
|
16733
16775
|
|
|
16734
|
-
pp.expect = function(type) {
|
|
16776
|
+
pp$9.expect = function(type) {
|
|
16735
16777
|
this.eat(type) || this.unexpected();
|
|
16736
16778
|
};
|
|
16737
16779
|
|
|
16738
16780
|
// Raise an unexpected token error.
|
|
16739
16781
|
|
|
16740
|
-
pp.unexpected = function(pos) {
|
|
16782
|
+
pp$9.unexpected = function(pos) {
|
|
16741
16783
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16742
16784
|
};
|
|
16743
16785
|
|
|
@@ -16750,7 +16792,7 @@ function DestructuringErrors() {
|
|
|
16750
16792
|
-1;
|
|
16751
16793
|
}
|
|
16752
16794
|
|
|
16753
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16795
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16754
16796
|
if (!refDestructuringErrors) { return }
|
|
16755
16797
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16756
16798
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16758,7 +16800,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16758
16800
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16759
16801
|
};
|
|
16760
16802
|
|
|
16761
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16803
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16762
16804
|
if (!refDestructuringErrors) { return false }
|
|
16763
16805
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16764
16806
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16769,20 +16811,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16769
16811
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16770
16812
|
};
|
|
16771
16813
|
|
|
16772
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16814
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16773
16815
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16774
16816
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16775
16817
|
if (this.awaitPos)
|
|
16776
16818
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16777
16819
|
};
|
|
16778
16820
|
|
|
16779
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16821
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16780
16822
|
if (expr.type === "ParenthesizedExpression")
|
|
16781
16823
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16782
16824
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16783
16825
|
};
|
|
16784
16826
|
|
|
16785
|
-
var pp$
|
|
16827
|
+
var pp$8 = Parser.prototype;
|
|
16786
16828
|
|
|
16787
16829
|
// ### Statement parsing
|
|
16788
16830
|
|
|
@@ -16791,10 +16833,10 @@ var pp$1 = Parser.prototype;
|
|
|
16791
16833
|
// `program` argument. If present, the statements will be appended
|
|
16792
16834
|
// to its body instead of creating a new node.
|
|
16793
16835
|
|
|
16794
|
-
pp$
|
|
16836
|
+
pp$8.parseTopLevel = function(node) {
|
|
16795
16837
|
var exports = Object.create(null);
|
|
16796
16838
|
if (!node.body) { node.body = []; }
|
|
16797
|
-
while (this.type !== types.eof) {
|
|
16839
|
+
while (this.type !== types$1.eof) {
|
|
16798
16840
|
var stmt = this.parseStatement(null, true, exports);
|
|
16799
16841
|
node.body.push(stmt);
|
|
16800
16842
|
}
|
|
@@ -16813,7 +16855,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16813
16855
|
|
|
16814
16856
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16815
16857
|
|
|
16816
|
-
pp$
|
|
16858
|
+
pp$8.isLet = function(context) {
|
|
16817
16859
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16818
16860
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16819
16861
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16839,7 +16881,7 @@ pp$1.isLet = function(context) {
|
|
|
16839
16881
|
// check 'async [no LineTerminator here] function'
|
|
16840
16882
|
// - 'async /*foo*/ function' is OK.
|
|
16841
16883
|
// - 'async /*\n*/ function' is invalid.
|
|
16842
|
-
pp$
|
|
16884
|
+
pp$8.isAsyncFunction = function() {
|
|
16843
16885
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16844
16886
|
{ return false }
|
|
16845
16887
|
|
|
@@ -16859,11 +16901,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16859
16901
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16860
16902
|
// does not help.
|
|
16861
16903
|
|
|
16862
|
-
pp$
|
|
16904
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16863
16905
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16864
16906
|
|
|
16865
16907
|
if (this.isLet(context)) {
|
|
16866
|
-
starttype = types._var;
|
|
16908
|
+
starttype = types$1._var;
|
|
16867
16909
|
kind = "let";
|
|
16868
16910
|
}
|
|
16869
16911
|
|
|
@@ -16872,35 +16914,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16872
16914
|
// complexity.
|
|
16873
16915
|
|
|
16874
16916
|
switch (starttype) {
|
|
16875
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16876
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
16877
|
-
case types._do: return this.parseDoStatement(node)
|
|
16878
|
-
case types._for: return this.parseForStatement(node)
|
|
16879
|
-
case types._function:
|
|
16917
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16918
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
16919
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
16920
|
+
case types$1._for: return this.parseForStatement(node)
|
|
16921
|
+
case types$1._function:
|
|
16880
16922
|
// Function as sole body of either an if statement or a labeled statement
|
|
16881
16923
|
// works, but not when it is part of a labeled statement that is the sole
|
|
16882
16924
|
// body of an if statement.
|
|
16883
16925
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
16884
16926
|
return this.parseFunctionStatement(node, false, !context)
|
|
16885
|
-
case types._class:
|
|
16927
|
+
case types$1._class:
|
|
16886
16928
|
if (context) { this.unexpected(); }
|
|
16887
16929
|
return this.parseClass(node, true)
|
|
16888
|
-
case types._if: return this.parseIfStatement(node)
|
|
16889
|
-
case types._return: return this.parseReturnStatement(node)
|
|
16890
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
16891
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
16892
|
-
case types._try: return this.parseTryStatement(node)
|
|
16893
|
-
case types._const: case types._var:
|
|
16930
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
16931
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
16932
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
16933
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
16934
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
16935
|
+
case types$1._const: case types$1._var:
|
|
16894
16936
|
kind = kind || this.value;
|
|
16895
16937
|
if (context && kind !== "var") { this.unexpected(); }
|
|
16896
16938
|
return this.parseVarStatement(node, kind)
|
|
16897
|
-
case types._while: return this.parseWhileStatement(node)
|
|
16898
|
-
case types._with: return this.parseWithStatement(node)
|
|
16899
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
16900
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
16901
|
-
case types._export:
|
|
16902
|
-
case types._import:
|
|
16903
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
16939
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
16940
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
16941
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
16942
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
16943
|
+
case types$1._export:
|
|
16944
|
+
case types$1._import:
|
|
16945
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
16904
16946
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16905
16947
|
var skip = skipWhiteSpace.exec(this.input);
|
|
16906
16948
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -16914,7 +16956,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16914
16956
|
if (!this.inModule)
|
|
16915
16957
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
16916
16958
|
}
|
|
16917
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16959
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16918
16960
|
|
|
16919
16961
|
// If the statement does not start with a statement keyword or a
|
|
16920
16962
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -16929,17 +16971,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16929
16971
|
}
|
|
16930
16972
|
|
|
16931
16973
|
var maybeName = this.value, expr = this.parseExpression();
|
|
16932
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
16974
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
16933
16975
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
16934
16976
|
else { return this.parseExpressionStatement(node, expr) }
|
|
16935
16977
|
}
|
|
16936
16978
|
};
|
|
16937
16979
|
|
|
16938
|
-
pp$
|
|
16980
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
16939
16981
|
var isBreak = keyword === "break";
|
|
16940
16982
|
this.next();
|
|
16941
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16942
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
16983
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16984
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
16943
16985
|
else {
|
|
16944
16986
|
node.label = this.parseIdent();
|
|
16945
16987
|
this.semicolon();
|
|
@@ -16959,21 +17001,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
16959
17001
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
16960
17002
|
};
|
|
16961
17003
|
|
|
16962
|
-
pp$
|
|
17004
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
16963
17005
|
this.next();
|
|
16964
17006
|
this.semicolon();
|
|
16965
17007
|
return this.finishNode(node, "DebuggerStatement")
|
|
16966
17008
|
};
|
|
16967
17009
|
|
|
16968
|
-
pp$
|
|
17010
|
+
pp$8.parseDoStatement = function(node) {
|
|
16969
17011
|
this.next();
|
|
16970
17012
|
this.labels.push(loopLabel);
|
|
16971
17013
|
node.body = this.parseStatement("do");
|
|
16972
17014
|
this.labels.pop();
|
|
16973
|
-
this.expect(types._while);
|
|
17015
|
+
this.expect(types$1._while);
|
|
16974
17016
|
node.test = this.parseParenExpression();
|
|
16975
17017
|
if (this.options.ecmaVersion >= 6)
|
|
16976
|
-
{ this.eat(types.semi); }
|
|
17018
|
+
{ this.eat(types$1.semi); }
|
|
16977
17019
|
else
|
|
16978
17020
|
{ this.semicolon(); }
|
|
16979
17021
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -16987,25 +17029,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
16987
17029
|
// part (semicolon immediately after the opening parenthesis), it
|
|
16988
17030
|
// is a regular `for` loop.
|
|
16989
17031
|
|
|
16990
|
-
pp$
|
|
17032
|
+
pp$8.parseForStatement = function(node) {
|
|
16991
17033
|
this.next();
|
|
16992
17034
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
16993
17035
|
this.labels.push(loopLabel);
|
|
16994
17036
|
this.enterScope(0);
|
|
16995
|
-
this.expect(types.parenL);
|
|
16996
|
-
if (this.type === types.semi) {
|
|
17037
|
+
this.expect(types$1.parenL);
|
|
17038
|
+
if (this.type === types$1.semi) {
|
|
16997
17039
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
16998
17040
|
return this.parseFor(node, null)
|
|
16999
17041
|
}
|
|
17000
17042
|
var isLet = this.isLet();
|
|
17001
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
17043
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
17002
17044
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
17003
17045
|
this.next();
|
|
17004
17046
|
this.parseVar(init$1, true, kind);
|
|
17005
17047
|
this.finishNode(init$1, "VariableDeclaration");
|
|
17006
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17048
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17007
17049
|
if (this.options.ecmaVersion >= 9) {
|
|
17008
|
-
if (this.type === types._in) {
|
|
17050
|
+
if (this.type === types$1._in) {
|
|
17009
17051
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17010
17052
|
} else { node.await = awaitAt > -1; }
|
|
17011
17053
|
}
|
|
@@ -17017,9 +17059,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17017
17059
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17018
17060
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17019
17061
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17020
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17062
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17021
17063
|
if (this.options.ecmaVersion >= 9) {
|
|
17022
|
-
if (this.type === types._in) {
|
|
17064
|
+
if (this.type === types$1._in) {
|
|
17023
17065
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17024
17066
|
} else { node.await = awaitAt > -1; }
|
|
17025
17067
|
}
|
|
@@ -17034,21 +17076,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17034
17076
|
return this.parseFor(node, init)
|
|
17035
17077
|
};
|
|
17036
17078
|
|
|
17037
|
-
pp$
|
|
17079
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17038
17080
|
this.next();
|
|
17039
17081
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17040
17082
|
};
|
|
17041
17083
|
|
|
17042
|
-
pp$
|
|
17084
|
+
pp$8.parseIfStatement = function(node) {
|
|
17043
17085
|
this.next();
|
|
17044
17086
|
node.test = this.parseParenExpression();
|
|
17045
17087
|
// allow function declarations in branches, but only in non-strict mode
|
|
17046
17088
|
node.consequent = this.parseStatement("if");
|
|
17047
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17089
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17048
17090
|
return this.finishNode(node, "IfStatement")
|
|
17049
17091
|
};
|
|
17050
17092
|
|
|
17051
|
-
pp$
|
|
17093
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17052
17094
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17053
17095
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17054
17096
|
this.next();
|
|
@@ -17057,16 +17099,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17057
17099
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17058
17100
|
// possibility to insert one.
|
|
17059
17101
|
|
|
17060
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17102
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17061
17103
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17062
17104
|
return this.finishNode(node, "ReturnStatement")
|
|
17063
17105
|
};
|
|
17064
17106
|
|
|
17065
|
-
pp$
|
|
17107
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17066
17108
|
this.next();
|
|
17067
17109
|
node.discriminant = this.parseParenExpression();
|
|
17068
17110
|
node.cases = [];
|
|
17069
|
-
this.expect(types.braceL);
|
|
17111
|
+
this.expect(types$1.braceL);
|
|
17070
17112
|
this.labels.push(switchLabel);
|
|
17071
17113
|
this.enterScope(0);
|
|
17072
17114
|
|
|
@@ -17075,9 +17117,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17075
17117
|
// adding statements to.
|
|
17076
17118
|
|
|
17077
17119
|
var cur;
|
|
17078
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
17079
|
-
if (this.type === types._case || this.type === types._default) {
|
|
17080
|
-
var isCase = this.type === types._case;
|
|
17120
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17121
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17122
|
+
var isCase = this.type === types$1._case;
|
|
17081
17123
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17082
17124
|
node.cases.push(cur = this.startNode());
|
|
17083
17125
|
cur.consequent = [];
|
|
@@ -17089,7 +17131,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17089
17131
|
sawDefault = true;
|
|
17090
17132
|
cur.test = null;
|
|
17091
17133
|
}
|
|
17092
|
-
this.expect(types.colon);
|
|
17134
|
+
this.expect(types$1.colon);
|
|
17093
17135
|
} else {
|
|
17094
17136
|
if (!cur) { this.unexpected(); }
|
|
17095
17137
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17102,7 +17144,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17102
17144
|
return this.finishNode(node, "SwitchStatement")
|
|
17103
17145
|
};
|
|
17104
17146
|
|
|
17105
|
-
pp$
|
|
17147
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17106
17148
|
this.next();
|
|
17107
17149
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17108
17150
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17113,21 +17155,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17113
17155
|
|
|
17114
17156
|
// Reused empty array added for node fields that are always empty.
|
|
17115
17157
|
|
|
17116
|
-
var empty = [];
|
|
17158
|
+
var empty$1 = [];
|
|
17117
17159
|
|
|
17118
|
-
pp$
|
|
17160
|
+
pp$8.parseTryStatement = function(node) {
|
|
17119
17161
|
this.next();
|
|
17120
17162
|
node.block = this.parseBlock();
|
|
17121
17163
|
node.handler = null;
|
|
17122
|
-
if (this.type === types._catch) {
|
|
17164
|
+
if (this.type === types$1._catch) {
|
|
17123
17165
|
var clause = this.startNode();
|
|
17124
17166
|
this.next();
|
|
17125
|
-
if (this.eat(types.parenL)) {
|
|
17167
|
+
if (this.eat(types$1.parenL)) {
|
|
17126
17168
|
clause.param = this.parseBindingAtom();
|
|
17127
17169
|
var simple = clause.param.type === "Identifier";
|
|
17128
17170
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17129
17171
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17130
|
-
this.expect(types.parenR);
|
|
17172
|
+
this.expect(types$1.parenR);
|
|
17131
17173
|
} else {
|
|
17132
17174
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17133
17175
|
clause.param = null;
|
|
@@ -17137,20 +17179,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17137
17179
|
this.exitScope();
|
|
17138
17180
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17139
17181
|
}
|
|
17140
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17182
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17141
17183
|
if (!node.handler && !node.finalizer)
|
|
17142
17184
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17143
17185
|
return this.finishNode(node, "TryStatement")
|
|
17144
17186
|
};
|
|
17145
17187
|
|
|
17146
|
-
pp$
|
|
17188
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17147
17189
|
this.next();
|
|
17148
17190
|
this.parseVar(node, false, kind);
|
|
17149
17191
|
this.semicolon();
|
|
17150
17192
|
return this.finishNode(node, "VariableDeclaration")
|
|
17151
17193
|
};
|
|
17152
17194
|
|
|
17153
|
-
pp$
|
|
17195
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17154
17196
|
this.next();
|
|
17155
17197
|
node.test = this.parseParenExpression();
|
|
17156
17198
|
this.labels.push(loopLabel);
|
|
@@ -17159,7 +17201,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17159
17201
|
return this.finishNode(node, "WhileStatement")
|
|
17160
17202
|
};
|
|
17161
17203
|
|
|
17162
|
-
pp$
|
|
17204
|
+
pp$8.parseWithStatement = function(node) {
|
|
17163
17205
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17164
17206
|
this.next();
|
|
17165
17207
|
node.object = this.parseParenExpression();
|
|
@@ -17167,12 +17209,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17167
17209
|
return this.finishNode(node, "WithStatement")
|
|
17168
17210
|
};
|
|
17169
17211
|
|
|
17170
|
-
pp$
|
|
17212
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17171
17213
|
this.next();
|
|
17172
17214
|
return this.finishNode(node, "EmptyStatement")
|
|
17173
17215
|
};
|
|
17174
17216
|
|
|
17175
|
-
pp$
|
|
17217
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17176
17218
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17177
17219
|
{
|
|
17178
17220
|
var label = list[i$1];
|
|
@@ -17180,7 +17222,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17180
17222
|
if (label.name === maybeName)
|
|
17181
17223
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17182
17224
|
} }
|
|
17183
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17225
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17184
17226
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17185
17227
|
var label$1 = this.labels[i];
|
|
17186
17228
|
if (label$1.statementStart === node.start) {
|
|
@@ -17196,7 +17238,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17196
17238
|
return this.finishNode(node, "LabeledStatement")
|
|
17197
17239
|
};
|
|
17198
17240
|
|
|
17199
|
-
pp$
|
|
17241
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17200
17242
|
node.expression = expr;
|
|
17201
17243
|
this.semicolon();
|
|
17202
17244
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17206,14 +17248,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17206
17248
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17207
17249
|
// function bodies).
|
|
17208
17250
|
|
|
17209
|
-
pp$
|
|
17251
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17210
17252
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17211
17253
|
if ( node === void 0 ) node = this.startNode();
|
|
17212
17254
|
|
|
17213
17255
|
node.body = [];
|
|
17214
|
-
this.expect(types.braceL);
|
|
17256
|
+
this.expect(types$1.braceL);
|
|
17215
17257
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17216
|
-
while (this.type !== types.braceR) {
|
|
17258
|
+
while (this.type !== types$1.braceR) {
|
|
17217
17259
|
var stmt = this.parseStatement(null);
|
|
17218
17260
|
node.body.push(stmt);
|
|
17219
17261
|
}
|
|
@@ -17227,13 +17269,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17227
17269
|
// `parseStatement` will already have parsed the init statement or
|
|
17228
17270
|
// expression.
|
|
17229
17271
|
|
|
17230
|
-
pp$
|
|
17272
|
+
pp$8.parseFor = function(node, init) {
|
|
17231
17273
|
node.init = init;
|
|
17232
|
-
this.expect(types.semi);
|
|
17233
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
17234
|
-
this.expect(types.semi);
|
|
17235
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
17236
|
-
this.expect(types.parenR);
|
|
17274
|
+
this.expect(types$1.semi);
|
|
17275
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17276
|
+
this.expect(types$1.semi);
|
|
17277
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17278
|
+
this.expect(types$1.parenR);
|
|
17237
17279
|
node.body = this.parseStatement("for");
|
|
17238
17280
|
this.exitScope();
|
|
17239
17281
|
this.labels.pop();
|
|
@@ -17243,8 +17285,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17243
17285
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17244
17286
|
// same from parser's perspective.
|
|
17245
17287
|
|
|
17246
|
-
pp$
|
|
17247
|
-
var isForIn = this.type === types._in;
|
|
17288
|
+
pp$8.parseForIn = function(node, init) {
|
|
17289
|
+
var isForIn = this.type === types$1._in;
|
|
17248
17290
|
this.next();
|
|
17249
17291
|
|
|
17250
17292
|
if (
|
|
@@ -17265,7 +17307,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17265
17307
|
}
|
|
17266
17308
|
node.left = init;
|
|
17267
17309
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17268
|
-
this.expect(types.parenR);
|
|
17310
|
+
this.expect(types$1.parenR);
|
|
17269
17311
|
node.body = this.parseStatement("for");
|
|
17270
17312
|
this.exitScope();
|
|
17271
17313
|
this.labels.pop();
|
|
@@ -17274,28 +17316,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17274
17316
|
|
|
17275
17317
|
// Parse a list of variable declarations.
|
|
17276
17318
|
|
|
17277
|
-
pp$
|
|
17319
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17278
17320
|
node.declarations = [];
|
|
17279
17321
|
node.kind = kind;
|
|
17280
17322
|
for (;;) {
|
|
17281
17323
|
var decl = this.startNode();
|
|
17282
17324
|
this.parseVarId(decl, kind);
|
|
17283
|
-
if (this.eat(types.eq)) {
|
|
17325
|
+
if (this.eat(types$1.eq)) {
|
|
17284
17326
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17285
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17327
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17286
17328
|
this.unexpected();
|
|
17287
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17329
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17288
17330
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17289
17331
|
} else {
|
|
17290
17332
|
decl.init = null;
|
|
17291
17333
|
}
|
|
17292
17334
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17293
|
-
if (!this.eat(types.comma)) { break }
|
|
17335
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17294
17336
|
}
|
|
17295
17337
|
return node
|
|
17296
17338
|
};
|
|
17297
17339
|
|
|
17298
|
-
pp$
|
|
17340
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17299
17341
|
decl.id = this.parseBindingAtom();
|
|
17300
17342
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17301
17343
|
};
|
|
@@ -17306,18 +17348,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17306
17348
|
// `statement & FUNC_STATEMENT`).
|
|
17307
17349
|
|
|
17308
17350
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17309
|
-
pp$
|
|
17351
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17310
17352
|
this.initFunction(node);
|
|
17311
17353
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17312
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17354
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17313
17355
|
{ this.unexpected(); }
|
|
17314
|
-
node.generator = this.eat(types.star);
|
|
17356
|
+
node.generator = this.eat(types$1.star);
|
|
17315
17357
|
}
|
|
17316
17358
|
if (this.options.ecmaVersion >= 8)
|
|
17317
17359
|
{ node.async = !!isAsync; }
|
|
17318
17360
|
|
|
17319
17361
|
if (statement & FUNC_STATEMENT) {
|
|
17320
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17362
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17321
17363
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17322
17364
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17323
17365
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17333,7 +17375,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17333
17375
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17334
17376
|
|
|
17335
17377
|
if (!(statement & FUNC_STATEMENT))
|
|
17336
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17378
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17337
17379
|
|
|
17338
17380
|
this.parseFunctionParams(node);
|
|
17339
17381
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17344,16 +17386,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17344
17386
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17345
17387
|
};
|
|
17346
17388
|
|
|
17347
|
-
pp$
|
|
17348
|
-
this.expect(types.parenL);
|
|
17349
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17389
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17390
|
+
this.expect(types$1.parenL);
|
|
17391
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17350
17392
|
this.checkYieldAwaitInDefaultParams();
|
|
17351
17393
|
};
|
|
17352
17394
|
|
|
17353
17395
|
// Parse a class declaration or literal (depending on the
|
|
17354
17396
|
// `isStatement` parameter).
|
|
17355
17397
|
|
|
17356
|
-
pp$
|
|
17398
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17357
17399
|
this.next();
|
|
17358
17400
|
|
|
17359
17401
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17367,8 +17409,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17367
17409
|
var classBody = this.startNode();
|
|
17368
17410
|
var hadConstructor = false;
|
|
17369
17411
|
classBody.body = [];
|
|
17370
|
-
this.expect(types.braceL);
|
|
17371
|
-
while (this.type !== types.braceR) {
|
|
17412
|
+
this.expect(types$1.braceL);
|
|
17413
|
+
while (this.type !== types$1.braceR) {
|
|
17372
17414
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17373
17415
|
if (element) {
|
|
17374
17416
|
classBody.body.push(element);
|
|
@@ -17387,8 +17429,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17387
17429
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17388
17430
|
};
|
|
17389
17431
|
|
|
17390
|
-
pp$
|
|
17391
|
-
if (this.eat(types.semi)) { return null }
|
|
17432
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17433
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17392
17434
|
|
|
17393
17435
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17394
17436
|
var node = this.startNode();
|
|
@@ -17400,11 +17442,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17400
17442
|
|
|
17401
17443
|
if (this.eatContextual("static")) {
|
|
17402
17444
|
// Parse static init block
|
|
17403
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17445
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17404
17446
|
this.parseClassStaticBlock(node);
|
|
17405
17447
|
return node
|
|
17406
17448
|
}
|
|
17407
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17449
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17408
17450
|
isStatic = true;
|
|
17409
17451
|
} else {
|
|
17410
17452
|
keyName = "static";
|
|
@@ -17412,13 +17454,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17412
17454
|
}
|
|
17413
17455
|
node.static = isStatic;
|
|
17414
17456
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17415
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17457
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17416
17458
|
isAsync = true;
|
|
17417
17459
|
} else {
|
|
17418
17460
|
keyName = "async";
|
|
17419
17461
|
}
|
|
17420
17462
|
}
|
|
17421
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17463
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17422
17464
|
isGenerator = true;
|
|
17423
17465
|
}
|
|
17424
17466
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17445,7 +17487,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17445
17487
|
}
|
|
17446
17488
|
|
|
17447
17489
|
// Parse element value
|
|
17448
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17490
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17449
17491
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17450
17492
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17451
17493
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17459,19 +17501,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17459
17501
|
return node
|
|
17460
17502
|
};
|
|
17461
17503
|
|
|
17462
|
-
pp$
|
|
17504
|
+
pp$8.isClassElementNameStart = function() {
|
|
17463
17505
|
return (
|
|
17464
|
-
this.type === types.name ||
|
|
17465
|
-
this.type === types.privateId ||
|
|
17466
|
-
this.type === types.num ||
|
|
17467
|
-
this.type === types.string ||
|
|
17468
|
-
this.type === types.bracketL ||
|
|
17506
|
+
this.type === types$1.name ||
|
|
17507
|
+
this.type === types$1.privateId ||
|
|
17508
|
+
this.type === types$1.num ||
|
|
17509
|
+
this.type === types$1.string ||
|
|
17510
|
+
this.type === types$1.bracketL ||
|
|
17469
17511
|
this.type.keyword
|
|
17470
17512
|
)
|
|
17471
17513
|
};
|
|
17472
17514
|
|
|
17473
|
-
pp$
|
|
17474
|
-
if (this.type === types.privateId) {
|
|
17515
|
+
pp$8.parseClassElementName = function(element) {
|
|
17516
|
+
if (this.type === types$1.privateId) {
|
|
17475
17517
|
if (this.value === "constructor") {
|
|
17476
17518
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17477
17519
|
}
|
|
@@ -17482,7 +17524,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17482
17524
|
}
|
|
17483
17525
|
};
|
|
17484
17526
|
|
|
17485
|
-
pp$
|
|
17527
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17486
17528
|
// Check key and flags
|
|
17487
17529
|
var key = method.key;
|
|
17488
17530
|
if (method.kind === "constructor") {
|
|
@@ -17506,14 +17548,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17506
17548
|
return this.finishNode(method, "MethodDefinition")
|
|
17507
17549
|
};
|
|
17508
17550
|
|
|
17509
|
-
pp$
|
|
17551
|
+
pp$8.parseClassField = function(field) {
|
|
17510
17552
|
if (checkKeyName(field, "constructor")) {
|
|
17511
17553
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17512
17554
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17513
17555
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17514
17556
|
}
|
|
17515
17557
|
|
|
17516
|
-
if (this.eat(types.eq)) {
|
|
17558
|
+
if (this.eat(types$1.eq)) {
|
|
17517
17559
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17518
17560
|
var scope = this.currentThisScope();
|
|
17519
17561
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17528,13 +17570,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17528
17570
|
return this.finishNode(field, "PropertyDefinition")
|
|
17529
17571
|
};
|
|
17530
17572
|
|
|
17531
|
-
pp$
|
|
17573
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17532
17574
|
node.body = [];
|
|
17533
17575
|
|
|
17534
17576
|
var oldLabels = this.labels;
|
|
17535
17577
|
this.labels = [];
|
|
17536
17578
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17537
|
-
while (this.type !== types.braceR) {
|
|
17579
|
+
while (this.type !== types$1.braceR) {
|
|
17538
17580
|
var stmt = this.parseStatement(null);
|
|
17539
17581
|
node.body.push(stmt);
|
|
17540
17582
|
}
|
|
@@ -17545,8 +17587,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17545
17587
|
return this.finishNode(node, "StaticBlock")
|
|
17546
17588
|
};
|
|
17547
17589
|
|
|
17548
|
-
pp$
|
|
17549
|
-
if (this.type === types.name) {
|
|
17590
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17591
|
+
if (this.type === types$1.name) {
|
|
17550
17592
|
node.id = this.parseIdent();
|
|
17551
17593
|
if (isStatement)
|
|
17552
17594
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17557,17 +17599,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17557
17599
|
}
|
|
17558
17600
|
};
|
|
17559
17601
|
|
|
17560
|
-
pp$
|
|
17561
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17602
|
+
pp$8.parseClassSuper = function(node) {
|
|
17603
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17562
17604
|
};
|
|
17563
17605
|
|
|
17564
|
-
pp$
|
|
17606
|
+
pp$8.enterClassBody = function() {
|
|
17565
17607
|
var element = {declared: Object.create(null), used: []};
|
|
17566
17608
|
this.privateNameStack.push(element);
|
|
17567
17609
|
return element.declared
|
|
17568
17610
|
};
|
|
17569
17611
|
|
|
17570
|
-
pp$
|
|
17612
|
+
pp$8.exitClassBody = function() {
|
|
17571
17613
|
var ref = this.privateNameStack.pop();
|
|
17572
17614
|
var declared = ref.declared;
|
|
17573
17615
|
var used = ref.used;
|
|
@@ -17622,10 +17664,10 @@ function checkKeyName(node, name) {
|
|
|
17622
17664
|
|
|
17623
17665
|
// Parses module export declaration.
|
|
17624
17666
|
|
|
17625
|
-
pp$
|
|
17667
|
+
pp$8.parseExport = function(node, exports) {
|
|
17626
17668
|
this.next();
|
|
17627
17669
|
// export * from '...'
|
|
17628
|
-
if (this.eat(types.star)) {
|
|
17670
|
+
if (this.eat(types$1.star)) {
|
|
17629
17671
|
if (this.options.ecmaVersion >= 11) {
|
|
17630
17672
|
if (this.eatContextual("as")) {
|
|
17631
17673
|
node.exported = this.parseIdent(true);
|
|
@@ -17635,20 +17677,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17635
17677
|
}
|
|
17636
17678
|
}
|
|
17637
17679
|
this.expectContextual("from");
|
|
17638
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17680
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17639
17681
|
node.source = this.parseExprAtom();
|
|
17640
17682
|
this.semicolon();
|
|
17641
17683
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17642
17684
|
}
|
|
17643
|
-
if (this.eat(types._default)) { // export default ...
|
|
17685
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17644
17686
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17645
17687
|
var isAsync;
|
|
17646
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17688
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17647
17689
|
var fNode = this.startNode();
|
|
17648
17690
|
this.next();
|
|
17649
17691
|
if (isAsync) { this.next(); }
|
|
17650
17692
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17651
|
-
} else if (this.type === types._class) {
|
|
17693
|
+
} else if (this.type === types$1._class) {
|
|
17652
17694
|
var cNode = this.startNode();
|
|
17653
17695
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17654
17696
|
} else {
|
|
@@ -17670,7 +17712,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17670
17712
|
node.declaration = null;
|
|
17671
17713
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17672
17714
|
if (this.eatContextual("from")) {
|
|
17673
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17715
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17674
17716
|
node.source = this.parseExprAtom();
|
|
17675
17717
|
} else {
|
|
17676
17718
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17689,14 +17731,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17689
17731
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17690
17732
|
};
|
|
17691
17733
|
|
|
17692
|
-
pp$
|
|
17734
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17693
17735
|
if (!exports) { return }
|
|
17694
17736
|
if (has(exports, name))
|
|
17695
17737
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17696
17738
|
exports[name] = true;
|
|
17697
17739
|
};
|
|
17698
17740
|
|
|
17699
|
-
pp$
|
|
17741
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17700
17742
|
var type = pat.type;
|
|
17701
17743
|
if (type === "Identifier")
|
|
17702
17744
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17723,7 +17765,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17723
17765
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17724
17766
|
};
|
|
17725
17767
|
|
|
17726
|
-
pp$
|
|
17768
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17727
17769
|
if (!exports) { return }
|
|
17728
17770
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17729
17771
|
{
|
|
@@ -17733,7 +17775,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17733
17775
|
}
|
|
17734
17776
|
};
|
|
17735
17777
|
|
|
17736
|
-
pp$
|
|
17778
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17737
17779
|
return this.type.keyword === "var" ||
|
|
17738
17780
|
this.type.keyword === "const" ||
|
|
17739
17781
|
this.type.keyword === "class" ||
|
|
@@ -17744,14 +17786,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17744
17786
|
|
|
17745
17787
|
// Parses a comma-separated list of module exports.
|
|
17746
17788
|
|
|
17747
|
-
pp$
|
|
17789
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17748
17790
|
var nodes = [], first = true;
|
|
17749
17791
|
// export { x, y as z } [from '...']
|
|
17750
|
-
this.expect(types.braceL);
|
|
17751
|
-
while (!this.eat(types.braceR)) {
|
|
17792
|
+
this.expect(types$1.braceL);
|
|
17793
|
+
while (!this.eat(types$1.braceR)) {
|
|
17752
17794
|
if (!first) {
|
|
17753
|
-
this.expect(types.comma);
|
|
17754
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17795
|
+
this.expect(types$1.comma);
|
|
17796
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17755
17797
|
} else { first = false; }
|
|
17756
17798
|
|
|
17757
17799
|
var node = this.startNode();
|
|
@@ -17765,16 +17807,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17765
17807
|
|
|
17766
17808
|
// Parses import declaration.
|
|
17767
17809
|
|
|
17768
|
-
pp$
|
|
17810
|
+
pp$8.parseImport = function(node) {
|
|
17769
17811
|
this.next();
|
|
17770
17812
|
// import '...'
|
|
17771
|
-
if (this.type === types.string) {
|
|
17772
|
-
node.specifiers = empty;
|
|
17813
|
+
if (this.type === types$1.string) {
|
|
17814
|
+
node.specifiers = empty$1;
|
|
17773
17815
|
node.source = this.parseExprAtom();
|
|
17774
17816
|
} else {
|
|
17775
17817
|
node.specifiers = this.parseImportSpecifiers();
|
|
17776
17818
|
this.expectContextual("from");
|
|
17777
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17819
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17778
17820
|
}
|
|
17779
17821
|
this.semicolon();
|
|
17780
17822
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17782,17 +17824,17 @@ pp$1.parseImport = function(node) {
|
|
|
17782
17824
|
|
|
17783
17825
|
// Parses a comma-separated list of module imports.
|
|
17784
17826
|
|
|
17785
|
-
pp$
|
|
17827
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17786
17828
|
var nodes = [], first = true;
|
|
17787
|
-
if (this.type === types.name) {
|
|
17829
|
+
if (this.type === types$1.name) {
|
|
17788
17830
|
// import defaultObj, { x, y as z } from '...'
|
|
17789
17831
|
var node = this.startNode();
|
|
17790
17832
|
node.local = this.parseIdent();
|
|
17791
17833
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17792
17834
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17793
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17835
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17794
17836
|
}
|
|
17795
|
-
if (this.type === types.star) {
|
|
17837
|
+
if (this.type === types$1.star) {
|
|
17796
17838
|
var node$1 = this.startNode();
|
|
17797
17839
|
this.next();
|
|
17798
17840
|
this.expectContextual("as");
|
|
@@ -17801,11 +17843,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17801
17843
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17802
17844
|
return nodes
|
|
17803
17845
|
}
|
|
17804
|
-
this.expect(types.braceL);
|
|
17805
|
-
while (!this.eat(types.braceR)) {
|
|
17846
|
+
this.expect(types$1.braceL);
|
|
17847
|
+
while (!this.eat(types$1.braceR)) {
|
|
17806
17848
|
if (!first) {
|
|
17807
|
-
this.expect(types.comma);
|
|
17808
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17849
|
+
this.expect(types$1.comma);
|
|
17850
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17809
17851
|
} else { first = false; }
|
|
17810
17852
|
|
|
17811
17853
|
var node$2 = this.startNode();
|
|
@@ -17823,12 +17865,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17823
17865
|
};
|
|
17824
17866
|
|
|
17825
17867
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17826
|
-
pp$
|
|
17868
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17827
17869
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17828
17870
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17829
17871
|
}
|
|
17830
17872
|
};
|
|
17831
|
-
pp$
|
|
17873
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17832
17874
|
return (
|
|
17833
17875
|
statement.type === "ExpressionStatement" &&
|
|
17834
17876
|
statement.expression.type === "Literal" &&
|
|
@@ -17838,12 +17880,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17838
17880
|
)
|
|
17839
17881
|
};
|
|
17840
17882
|
|
|
17841
|
-
var pp$
|
|
17883
|
+
var pp$7 = Parser.prototype;
|
|
17842
17884
|
|
|
17843
17885
|
// Convert existing expression atom to assignable pattern
|
|
17844
17886
|
// if possible.
|
|
17845
17887
|
|
|
17846
|
-
pp$
|
|
17888
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17847
17889
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17848
17890
|
switch (node.type) {
|
|
17849
17891
|
case "Identifier":
|
|
@@ -17924,7 +17966,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
17924
17966
|
|
|
17925
17967
|
// Convert list of expression atoms to binding list.
|
|
17926
17968
|
|
|
17927
|
-
pp$
|
|
17969
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
17928
17970
|
var end = exprList.length;
|
|
17929
17971
|
for (var i = 0; i < end; i++) {
|
|
17930
17972
|
var elt = exprList[i];
|
|
@@ -17940,19 +17982,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
17940
17982
|
|
|
17941
17983
|
// Parses spread element.
|
|
17942
17984
|
|
|
17943
|
-
pp$
|
|
17985
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
17944
17986
|
var node = this.startNode();
|
|
17945
17987
|
this.next();
|
|
17946
17988
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
17947
17989
|
return this.finishNode(node, "SpreadElement")
|
|
17948
17990
|
};
|
|
17949
17991
|
|
|
17950
|
-
pp$
|
|
17992
|
+
pp$7.parseRestBinding = function() {
|
|
17951
17993
|
var node = this.startNode();
|
|
17952
17994
|
this.next();
|
|
17953
17995
|
|
|
17954
17996
|
// RestElement inside of a function parameter must be an identifier
|
|
17955
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
17997
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
17956
17998
|
{ this.unexpected(); }
|
|
17957
17999
|
|
|
17958
18000
|
node.argument = this.parseBindingAtom();
|
|
@@ -17962,36 +18004,36 @@ pp$2.parseRestBinding = function() {
|
|
|
17962
18004
|
|
|
17963
18005
|
// Parses lvalue (assignable) atom.
|
|
17964
18006
|
|
|
17965
|
-
pp$
|
|
18007
|
+
pp$7.parseBindingAtom = function() {
|
|
17966
18008
|
if (this.options.ecmaVersion >= 6) {
|
|
17967
18009
|
switch (this.type) {
|
|
17968
|
-
case types.bracketL:
|
|
18010
|
+
case types$1.bracketL:
|
|
17969
18011
|
var node = this.startNode();
|
|
17970
18012
|
this.next();
|
|
17971
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
18013
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
17972
18014
|
return this.finishNode(node, "ArrayPattern")
|
|
17973
18015
|
|
|
17974
|
-
case types.braceL:
|
|
18016
|
+
case types$1.braceL:
|
|
17975
18017
|
return this.parseObj(true)
|
|
17976
18018
|
}
|
|
17977
18019
|
}
|
|
17978
18020
|
return this.parseIdent()
|
|
17979
18021
|
};
|
|
17980
18022
|
|
|
17981
|
-
pp$
|
|
18023
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
17982
18024
|
var elts = [], first = true;
|
|
17983
18025
|
while (!this.eat(close)) {
|
|
17984
18026
|
if (first) { first = false; }
|
|
17985
|
-
else { this.expect(types.comma); }
|
|
17986
|
-
if (allowEmpty && this.type === types.comma) {
|
|
18027
|
+
else { this.expect(types$1.comma); }
|
|
18028
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
17987
18029
|
elts.push(null);
|
|
17988
18030
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
17989
18031
|
break
|
|
17990
|
-
} else if (this.type === types.ellipsis) {
|
|
18032
|
+
} else if (this.type === types$1.ellipsis) {
|
|
17991
18033
|
var rest = this.parseRestBinding();
|
|
17992
18034
|
this.parseBindingListItem(rest);
|
|
17993
18035
|
elts.push(rest);
|
|
17994
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18036
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
17995
18037
|
this.expect(close);
|
|
17996
18038
|
break
|
|
17997
18039
|
} else {
|
|
@@ -18003,15 +18045,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
18003
18045
|
return elts
|
|
18004
18046
|
};
|
|
18005
18047
|
|
|
18006
|
-
pp$
|
|
18048
|
+
pp$7.parseBindingListItem = function(param) {
|
|
18007
18049
|
return param
|
|
18008
18050
|
};
|
|
18009
18051
|
|
|
18010
18052
|
// Parses assignment pattern around given atom if possible.
|
|
18011
18053
|
|
|
18012
|
-
pp$
|
|
18054
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18013
18055
|
left = left || this.parseBindingAtom();
|
|
18014
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18056
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18015
18057
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18016
18058
|
node.left = left;
|
|
18017
18059
|
node.right = this.parseMaybeAssign();
|
|
@@ -18082,7 +18124,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18082
18124
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18083
18125
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18084
18126
|
|
|
18085
|
-
pp$
|
|
18127
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18086
18128
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18087
18129
|
|
|
18088
18130
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18120,7 +18162,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18120
18162
|
}
|
|
18121
18163
|
};
|
|
18122
18164
|
|
|
18123
|
-
pp$
|
|
18165
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18124
18166
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18125
18167
|
|
|
18126
18168
|
switch (expr.type) {
|
|
@@ -18145,7 +18187,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18145
18187
|
}
|
|
18146
18188
|
};
|
|
18147
18189
|
|
|
18148
|
-
pp$
|
|
18190
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18149
18191
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18150
18192
|
|
|
18151
18193
|
switch (expr.type) {
|
|
@@ -18177,7 +18219,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18177
18219
|
this.generator = !!generator;
|
|
18178
18220
|
};
|
|
18179
18221
|
|
|
18180
|
-
var types
|
|
18222
|
+
var types = {
|
|
18181
18223
|
b_stat: new TokContext("{", false),
|
|
18182
18224
|
b_expr: new TokContext("{", true),
|
|
18183
18225
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18190,38 +18232,38 @@ var types$1 = {
|
|
|
18190
18232
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18191
18233
|
};
|
|
18192
18234
|
|
|
18193
|
-
var pp$
|
|
18235
|
+
var pp$6 = Parser.prototype;
|
|
18194
18236
|
|
|
18195
|
-
pp$
|
|
18196
|
-
return [types
|
|
18237
|
+
pp$6.initialContext = function() {
|
|
18238
|
+
return [types.b_stat]
|
|
18197
18239
|
};
|
|
18198
18240
|
|
|
18199
|
-
pp$
|
|
18241
|
+
pp$6.curContext = function() {
|
|
18200
18242
|
return this.context[this.context.length - 1]
|
|
18201
18243
|
};
|
|
18202
18244
|
|
|
18203
|
-
pp$
|
|
18245
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18204
18246
|
var parent = this.curContext();
|
|
18205
|
-
if (parent === types
|
|
18247
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18206
18248
|
{ return true }
|
|
18207
|
-
if (prevType === types.colon && (parent === types
|
|
18249
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18208
18250
|
{ return !parent.isExpr }
|
|
18209
18251
|
|
|
18210
18252
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18211
18253
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18212
18254
|
// `tt.name`.
|
|
18213
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18255
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18214
18256
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
18215
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
18257
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18216
18258
|
{ return true }
|
|
18217
|
-
if (prevType === types.braceL)
|
|
18218
|
-
{ return parent === types
|
|
18219
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18259
|
+
if (prevType === types$1.braceL)
|
|
18260
|
+
{ return parent === types.b_stat }
|
|
18261
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18220
18262
|
{ return false }
|
|
18221
18263
|
return !this.exprAllowed
|
|
18222
18264
|
};
|
|
18223
18265
|
|
|
18224
|
-
pp$
|
|
18266
|
+
pp$6.inGeneratorContext = function() {
|
|
18225
18267
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18226
18268
|
var context = this.context[i];
|
|
18227
18269
|
if (context.token === "function")
|
|
@@ -18230,9 +18272,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18230
18272
|
return false
|
|
18231
18273
|
};
|
|
18232
18274
|
|
|
18233
|
-
pp$
|
|
18275
|
+
pp$6.updateContext = function(prevType) {
|
|
18234
18276
|
var update, type = this.type;
|
|
18235
|
-
if (type.keyword && prevType === types.dot)
|
|
18277
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18236
18278
|
{ this.exprAllowed = false; }
|
|
18237
18279
|
else if (update = type.updateContext)
|
|
18238
18280
|
{ update.call(this, prevType); }
|
|
@@ -18241,7 +18283,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18241
18283
|
};
|
|
18242
18284
|
|
|
18243
18285
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18244
|
-
pp$
|
|
18286
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18245
18287
|
if (this.curContext() !== tokenCtx) {
|
|
18246
18288
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18247
18289
|
}
|
|
@@ -18249,71 +18291,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18249
18291
|
|
|
18250
18292
|
// Token-specific context update code
|
|
18251
18293
|
|
|
18252
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18294
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18253
18295
|
if (this.context.length === 1) {
|
|
18254
18296
|
this.exprAllowed = true;
|
|
18255
18297
|
return
|
|
18256
18298
|
}
|
|
18257
18299
|
var out = this.context.pop();
|
|
18258
|
-
if (out === types
|
|
18300
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18259
18301
|
out = this.context.pop();
|
|
18260
18302
|
}
|
|
18261
18303
|
this.exprAllowed = !out.isExpr;
|
|
18262
18304
|
};
|
|
18263
18305
|
|
|
18264
|
-
types.braceL.updateContext = function(prevType) {
|
|
18265
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18306
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18307
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18266
18308
|
this.exprAllowed = true;
|
|
18267
18309
|
};
|
|
18268
18310
|
|
|
18269
|
-
types.dollarBraceL.updateContext = function() {
|
|
18270
|
-
this.context.push(types
|
|
18311
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18312
|
+
this.context.push(types.b_tmpl);
|
|
18271
18313
|
this.exprAllowed = true;
|
|
18272
18314
|
};
|
|
18273
18315
|
|
|
18274
|
-
types.parenL.updateContext = function(prevType) {
|
|
18275
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
18276
|
-
this.context.push(statementParens ? types
|
|
18316
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18317
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18318
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18277
18319
|
this.exprAllowed = true;
|
|
18278
18320
|
};
|
|
18279
18321
|
|
|
18280
|
-
types.incDec.updateContext = function() {
|
|
18322
|
+
types$1.incDec.updateContext = function() {
|
|
18281
18323
|
// tokExprAllowed stays unchanged
|
|
18282
18324
|
};
|
|
18283
18325
|
|
|
18284
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
18285
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
18286
|
-
!(prevType === types.semi && this.curContext() !== types
|
|
18287
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18288
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types
|
|
18289
|
-
{ this.context.push(types
|
|
18326
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18327
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18328
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18329
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18330
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18331
|
+
{ this.context.push(types.f_expr); }
|
|
18290
18332
|
else
|
|
18291
|
-
{ this.context.push(types
|
|
18333
|
+
{ this.context.push(types.f_stat); }
|
|
18292
18334
|
this.exprAllowed = false;
|
|
18293
18335
|
};
|
|
18294
18336
|
|
|
18295
|
-
types.backQuote.updateContext = function() {
|
|
18296
|
-
if (this.curContext() === types
|
|
18337
|
+
types$1.backQuote.updateContext = function() {
|
|
18338
|
+
if (this.curContext() === types.q_tmpl)
|
|
18297
18339
|
{ this.context.pop(); }
|
|
18298
18340
|
else
|
|
18299
|
-
{ this.context.push(types
|
|
18341
|
+
{ this.context.push(types.q_tmpl); }
|
|
18300
18342
|
this.exprAllowed = false;
|
|
18301
18343
|
};
|
|
18302
18344
|
|
|
18303
|
-
types.star.updateContext = function(prevType) {
|
|
18304
|
-
if (prevType === types._function) {
|
|
18345
|
+
types$1.star.updateContext = function(prevType) {
|
|
18346
|
+
if (prevType === types$1._function) {
|
|
18305
18347
|
var index = this.context.length - 1;
|
|
18306
|
-
if (this.context[index] === types
|
|
18307
|
-
{ this.context[index] = types
|
|
18348
|
+
if (this.context[index] === types.f_expr)
|
|
18349
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18308
18350
|
else
|
|
18309
|
-
{ this.context[index] = types
|
|
18351
|
+
{ this.context[index] = types.f_gen; }
|
|
18310
18352
|
}
|
|
18311
18353
|
this.exprAllowed = true;
|
|
18312
18354
|
};
|
|
18313
18355
|
|
|
18314
|
-
types.name.updateContext = function(prevType) {
|
|
18356
|
+
types$1.name.updateContext = function(prevType) {
|
|
18315
18357
|
var allowed = false;
|
|
18316
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18358
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18317
18359
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18318
18360
|
this.value === "yield" && this.inGeneratorContext())
|
|
18319
18361
|
{ allowed = true; }
|
|
@@ -18323,14 +18365,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18323
18365
|
|
|
18324
18366
|
// A recursive descent parser operates by defining functions for all
|
|
18325
18367
|
|
|
18326
|
-
var pp$
|
|
18368
|
+
var pp$5 = Parser.prototype;
|
|
18327
18369
|
|
|
18328
18370
|
// Check if property name clashes with already added.
|
|
18329
18371
|
// Object/class getters and setters are not allowed to clash —
|
|
18330
18372
|
// either with each other or with an init property — and in
|
|
18331
18373
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18332
18374
|
|
|
18333
|
-
pp$
|
|
18375
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18334
18376
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18335
18377
|
{ return }
|
|
18336
18378
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18347,10 +18389,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18347
18389
|
if (name === "__proto__" && kind === "init") {
|
|
18348
18390
|
if (propHash.proto) {
|
|
18349
18391
|
if (refDestructuringErrors) {
|
|
18350
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
} else {
|
|
18392
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18393
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18394
|
+
}
|
|
18395
|
+
} else {
|
|
18396
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18397
|
+
}
|
|
18354
18398
|
}
|
|
18355
18399
|
propHash.proto = true;
|
|
18356
18400
|
}
|
|
@@ -18392,13 +18436,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18392
18436
|
// and object pattern might appear (so it's possible to raise
|
|
18393
18437
|
// delayed syntax error at correct position).
|
|
18394
18438
|
|
|
18395
|
-
pp$
|
|
18439
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18396
18440
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18397
18441
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18398
|
-
if (this.type === types.comma) {
|
|
18442
|
+
if (this.type === types$1.comma) {
|
|
18399
18443
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18400
18444
|
node.expressions = [expr];
|
|
18401
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18445
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18402
18446
|
return this.finishNode(node, "SequenceExpression")
|
|
18403
18447
|
}
|
|
18404
18448
|
return expr
|
|
@@ -18407,7 +18451,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18407
18451
|
// Parse an assignment expression. This includes applications of
|
|
18408
18452
|
// operators like `+=`.
|
|
18409
18453
|
|
|
18410
|
-
pp$
|
|
18454
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18411
18455
|
if (this.isContextual("yield")) {
|
|
18412
18456
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18413
18457
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18415,10 +18459,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18415
18459
|
else { this.exprAllowed = false; }
|
|
18416
18460
|
}
|
|
18417
18461
|
|
|
18418
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18462
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18419
18463
|
if (refDestructuringErrors) {
|
|
18420
18464
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18421
18465
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18466
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18422
18467
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18423
18468
|
} else {
|
|
18424
18469
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18426,7 +18471,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18426
18471
|
}
|
|
18427
18472
|
|
|
18428
18473
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18429
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18474
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18430
18475
|
this.potentialArrowAt = this.start;
|
|
18431
18476
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18432
18477
|
}
|
|
@@ -18435,20 +18480,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18435
18480
|
if (this.type.isAssign) {
|
|
18436
18481
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18437
18482
|
node.operator = this.value;
|
|
18438
|
-
if (this.type === types.eq)
|
|
18483
|
+
if (this.type === types$1.eq)
|
|
18439
18484
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18440
18485
|
if (!ownDestructuringErrors) {
|
|
18441
18486
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18442
18487
|
}
|
|
18443
18488
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18444
18489
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18445
|
-
if (this.type === types.eq)
|
|
18490
|
+
if (this.type === types$1.eq)
|
|
18446
18491
|
{ this.checkLValPattern(left); }
|
|
18447
18492
|
else
|
|
18448
18493
|
{ this.checkLValSimple(left); }
|
|
18449
18494
|
node.left = left;
|
|
18450
18495
|
this.next();
|
|
18451
18496
|
node.right = this.parseMaybeAssign(forInit);
|
|
18497
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18452
18498
|
return this.finishNode(node, "AssignmentExpression")
|
|
18453
18499
|
} else {
|
|
18454
18500
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18460,15 +18506,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18460
18506
|
|
|
18461
18507
|
// Parse a ternary conditional (`?:`) operator.
|
|
18462
18508
|
|
|
18463
|
-
pp$
|
|
18509
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18464
18510
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18465
18511
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18466
18512
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18467
|
-
if (this.eat(types.question)) {
|
|
18513
|
+
if (this.eat(types$1.question)) {
|
|
18468
18514
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18469
18515
|
node.test = expr;
|
|
18470
18516
|
node.consequent = this.parseMaybeAssign();
|
|
18471
|
-
this.expect(types.colon);
|
|
18517
|
+
this.expect(types$1.colon);
|
|
18472
18518
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18473
18519
|
return this.finishNode(node, "ConditionalExpression")
|
|
18474
18520
|
}
|
|
@@ -18477,7 +18523,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18477
18523
|
|
|
18478
18524
|
// Start the precedence parser.
|
|
18479
18525
|
|
|
18480
|
-
pp$
|
|
18526
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18481
18527
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18482
18528
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18483
18529
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18490,23 +18536,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18490
18536
|
// defer further parser to one of its callers when it encounters an
|
|
18491
18537
|
// operator that has a lower precedence than the set it is parsing.
|
|
18492
18538
|
|
|
18493
|
-
pp$
|
|
18539
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18494
18540
|
var prec = this.type.binop;
|
|
18495
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18541
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18496
18542
|
if (prec > minPrec) {
|
|
18497
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18498
|
-
var coalesce = this.type === types.coalesce;
|
|
18543
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18544
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18499
18545
|
if (coalesce) {
|
|
18500
18546
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18501
18547
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18502
|
-
prec = types.logicalAND.binop;
|
|
18548
|
+
prec = types$1.logicalAND.binop;
|
|
18503
18549
|
}
|
|
18504
18550
|
var op = this.value;
|
|
18505
18551
|
this.next();
|
|
18506
18552
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18507
18553
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18508
18554
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
18509
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
18555
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18510
18556
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18511
18557
|
}
|
|
18512
18558
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18515,7 +18561,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18515
18561
|
return left
|
|
18516
18562
|
};
|
|
18517
18563
|
|
|
18518
|
-
pp$
|
|
18564
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18565
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18519
18566
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18520
18567
|
node.left = left;
|
|
18521
18568
|
node.operator = op;
|
|
@@ -18525,13 +18572,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18525
18572
|
|
|
18526
18573
|
// Parse unary operators, both prefix and postfix.
|
|
18527
18574
|
|
|
18528
|
-
pp$
|
|
18575
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18529
18576
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18530
18577
|
if (this.isContextual("await") && this.canAwait) {
|
|
18531
18578
|
expr = this.parseAwait(forInit);
|
|
18532
18579
|
sawUnary = true;
|
|
18533
18580
|
} else if (this.type.prefix) {
|
|
18534
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18581
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18535
18582
|
node.operator = this.value;
|
|
18536
18583
|
node.prefix = true;
|
|
18537
18584
|
this.next();
|
|
@@ -18545,6 +18592,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18545
18592
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18546
18593
|
else { sawUnary = true; }
|
|
18547
18594
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18595
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18596
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18597
|
+
expr = this.parsePrivateIdent();
|
|
18598
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18599
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18548
18600
|
} else {
|
|
18549
18601
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18550
18602
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18559,7 +18611,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18559
18611
|
}
|
|
18560
18612
|
}
|
|
18561
18613
|
|
|
18562
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18614
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18563
18615
|
if (sawUnary)
|
|
18564
18616
|
{ this.unexpected(this.lastTokStart); }
|
|
18565
18617
|
else
|
|
@@ -18578,7 +18630,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18578
18630
|
|
|
18579
18631
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18580
18632
|
|
|
18581
|
-
pp$
|
|
18633
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18582
18634
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18583
18635
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18584
18636
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18592,7 +18644,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18592
18644
|
return result
|
|
18593
18645
|
};
|
|
18594
18646
|
|
|
18595
|
-
pp$
|
|
18647
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18596
18648
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18597
18649
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18598
18650
|
this.potentialArrowAt === base.start;
|
|
@@ -18615,19 +18667,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18615
18667
|
}
|
|
18616
18668
|
};
|
|
18617
18669
|
|
|
18618
|
-
pp$
|
|
18670
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18619
18671
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18620
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18672
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18621
18673
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18622
18674
|
|
|
18623
|
-
var computed = this.eat(types.bracketL);
|
|
18624
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18675
|
+
var computed = this.eat(types$1.bracketL);
|
|
18676
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18625
18677
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18626
18678
|
node.object = base;
|
|
18627
18679
|
if (computed) {
|
|
18628
18680
|
node.property = this.parseExpression();
|
|
18629
|
-
this.expect(types.bracketR);
|
|
18630
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18681
|
+
this.expect(types$1.bracketR);
|
|
18682
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18631
18683
|
node.property = this.parsePrivateIdent();
|
|
18632
18684
|
} else {
|
|
18633
18685
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18637,13 +18689,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18637
18689
|
node.optional = optional;
|
|
18638
18690
|
}
|
|
18639
18691
|
base = this.finishNode(node, "MemberExpression");
|
|
18640
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18692
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18641
18693
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18642
18694
|
this.yieldPos = 0;
|
|
18643
18695
|
this.awaitPos = 0;
|
|
18644
18696
|
this.awaitIdentPos = 0;
|
|
18645
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18646
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18697
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18698
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18647
18699
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18648
18700
|
this.checkYieldAwaitInDefaultParams();
|
|
18649
18701
|
if (this.awaitIdentPos > 0)
|
|
@@ -18664,7 +18716,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18664
18716
|
node$1.optional = optional;
|
|
18665
18717
|
}
|
|
18666
18718
|
base = this.finishNode(node$1, "CallExpression");
|
|
18667
|
-
} else if (this.type === types.backQuote) {
|
|
18719
|
+
} else if (this.type === types$1.backQuote) {
|
|
18668
18720
|
if (optional || optionalChained) {
|
|
18669
18721
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18670
18722
|
}
|
|
@@ -18681,19 +18733,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18681
18733
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18682
18734
|
// or `{}`.
|
|
18683
18735
|
|
|
18684
|
-
pp$
|
|
18736
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18685
18737
|
// If a division operator appears in an expression position, the
|
|
18686
18738
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18687
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18739
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18688
18740
|
|
|
18689
18741
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18690
18742
|
switch (this.type) {
|
|
18691
|
-
case types._super:
|
|
18743
|
+
case types$1._super:
|
|
18692
18744
|
if (!this.allowSuper)
|
|
18693
18745
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18694
18746
|
node = this.startNode();
|
|
18695
18747
|
this.next();
|
|
18696
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18748
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18697
18749
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18698
18750
|
// The `super` keyword can appear at below:
|
|
18699
18751
|
// SuperProperty:
|
|
@@ -18701,52 +18753,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18701
18753
|
// super . IdentifierName
|
|
18702
18754
|
// SuperCall:
|
|
18703
18755
|
// super ( Arguments )
|
|
18704
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18756
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18705
18757
|
{ this.unexpected(); }
|
|
18706
18758
|
return this.finishNode(node, "Super")
|
|
18707
18759
|
|
|
18708
|
-
case types._this:
|
|
18760
|
+
case types$1._this:
|
|
18709
18761
|
node = this.startNode();
|
|
18710
18762
|
this.next();
|
|
18711
18763
|
return this.finishNode(node, "ThisExpression")
|
|
18712
18764
|
|
|
18713
|
-
case types.name:
|
|
18765
|
+
case types$1.name:
|
|
18714
18766
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18715
18767
|
var id = this.parseIdent(false);
|
|
18716
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
|
|
18717
|
-
this.overrideContext(types
|
|
18768
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18769
|
+
this.overrideContext(types.f_expr);
|
|
18718
18770
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18719
18771
|
}
|
|
18720
18772
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18721
|
-
if (this.eat(types.arrow))
|
|
18773
|
+
if (this.eat(types$1.arrow))
|
|
18722
18774
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18723
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18775
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18724
18776
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18725
18777
|
id = this.parseIdent(false);
|
|
18726
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18778
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18727
18779
|
{ this.unexpected(); }
|
|
18728
18780
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18729
18781
|
}
|
|
18730
18782
|
}
|
|
18731
18783
|
return id
|
|
18732
18784
|
|
|
18733
|
-
case types.regexp:
|
|
18785
|
+
case types$1.regexp:
|
|
18734
18786
|
var value = this.value;
|
|
18735
18787
|
node = this.parseLiteral(value.value);
|
|
18736
18788
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18737
18789
|
return node
|
|
18738
18790
|
|
|
18739
|
-
case types.num: case types.string:
|
|
18791
|
+
case types$1.num: case types$1.string:
|
|
18740
18792
|
return this.parseLiteral(this.value)
|
|
18741
18793
|
|
|
18742
|
-
case types._null: case types._true: case types._false:
|
|
18794
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18743
18795
|
node = this.startNode();
|
|
18744
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18796
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18745
18797
|
node.raw = this.type.keyword;
|
|
18746
18798
|
this.next();
|
|
18747
18799
|
return this.finishNode(node, "Literal")
|
|
18748
18800
|
|
|
18749
|
-
case types.parenL:
|
|
18801
|
+
case types$1.parenL:
|
|
18750
18802
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18751
18803
|
if (refDestructuringErrors) {
|
|
18752
18804
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18756,31 +18808,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18756
18808
|
}
|
|
18757
18809
|
return expr
|
|
18758
18810
|
|
|
18759
|
-
case types.bracketL:
|
|
18811
|
+
case types$1.bracketL:
|
|
18760
18812
|
node = this.startNode();
|
|
18761
18813
|
this.next();
|
|
18762
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18814
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18763
18815
|
return this.finishNode(node, "ArrayExpression")
|
|
18764
18816
|
|
|
18765
|
-
case types.braceL:
|
|
18766
|
-
this.overrideContext(types
|
|
18817
|
+
case types$1.braceL:
|
|
18818
|
+
this.overrideContext(types.b_expr);
|
|
18767
18819
|
return this.parseObj(false, refDestructuringErrors)
|
|
18768
18820
|
|
|
18769
|
-
case types._function:
|
|
18821
|
+
case types$1._function:
|
|
18770
18822
|
node = this.startNode();
|
|
18771
18823
|
this.next();
|
|
18772
18824
|
return this.parseFunction(node, 0)
|
|
18773
18825
|
|
|
18774
|
-
case types._class:
|
|
18826
|
+
case types$1._class:
|
|
18775
18827
|
return this.parseClass(this.startNode(), false)
|
|
18776
18828
|
|
|
18777
|
-
case types._new:
|
|
18829
|
+
case types$1._new:
|
|
18778
18830
|
return this.parseNew()
|
|
18779
18831
|
|
|
18780
|
-
case types.backQuote:
|
|
18832
|
+
case types$1.backQuote:
|
|
18781
18833
|
return this.parseTemplate()
|
|
18782
18834
|
|
|
18783
|
-
case types._import:
|
|
18835
|
+
case types$1._import:
|
|
18784
18836
|
if (this.options.ecmaVersion >= 11) {
|
|
18785
18837
|
return this.parseExprImport()
|
|
18786
18838
|
} else {
|
|
@@ -18792,7 +18844,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18792
18844
|
}
|
|
18793
18845
|
};
|
|
18794
18846
|
|
|
18795
|
-
pp$
|
|
18847
|
+
pp$5.parseExprImport = function() {
|
|
18796
18848
|
var node = this.startNode();
|
|
18797
18849
|
|
|
18798
18850
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18801,9 +18853,9 @@ pp$4.parseExprImport = function() {
|
|
|
18801
18853
|
var meta = this.parseIdent(true);
|
|
18802
18854
|
|
|
18803
18855
|
switch (this.type) {
|
|
18804
|
-
case types.parenL:
|
|
18856
|
+
case types$1.parenL:
|
|
18805
18857
|
return this.parseDynamicImport(node)
|
|
18806
|
-
case types.dot:
|
|
18858
|
+
case types$1.dot:
|
|
18807
18859
|
node.meta = meta;
|
|
18808
18860
|
return this.parseImportMeta(node)
|
|
18809
18861
|
default:
|
|
@@ -18811,16 +18863,16 @@ pp$4.parseExprImport = function() {
|
|
|
18811
18863
|
}
|
|
18812
18864
|
};
|
|
18813
18865
|
|
|
18814
|
-
pp$
|
|
18866
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18815
18867
|
this.next(); // skip `(`
|
|
18816
18868
|
|
|
18817
18869
|
// Parse node.source.
|
|
18818
18870
|
node.source = this.parseMaybeAssign();
|
|
18819
18871
|
|
|
18820
18872
|
// Verify ending.
|
|
18821
|
-
if (!this.eat(types.parenR)) {
|
|
18873
|
+
if (!this.eat(types$1.parenR)) {
|
|
18822
18874
|
var errorPos = this.start;
|
|
18823
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
18875
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18824
18876
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18825
18877
|
} else {
|
|
18826
18878
|
this.unexpected(errorPos);
|
|
@@ -18830,7 +18882,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18830
18882
|
return this.finishNode(node, "ImportExpression")
|
|
18831
18883
|
};
|
|
18832
18884
|
|
|
18833
|
-
pp$
|
|
18885
|
+
pp$5.parseImportMeta = function(node) {
|
|
18834
18886
|
this.next(); // skip `.`
|
|
18835
18887
|
|
|
18836
18888
|
var containsEsc = this.containsEsc;
|
|
@@ -18846,7 +18898,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18846
18898
|
return this.finishNode(node, "MetaProperty")
|
|
18847
18899
|
};
|
|
18848
18900
|
|
|
18849
|
-
pp$
|
|
18901
|
+
pp$5.parseLiteral = function(value) {
|
|
18850
18902
|
var node = this.startNode();
|
|
18851
18903
|
node.value = value;
|
|
18852
18904
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18855,14 +18907,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18855
18907
|
return this.finishNode(node, "Literal")
|
|
18856
18908
|
};
|
|
18857
18909
|
|
|
18858
|
-
pp$
|
|
18859
|
-
this.expect(types.parenL);
|
|
18910
|
+
pp$5.parseParenExpression = function() {
|
|
18911
|
+
this.expect(types$1.parenL);
|
|
18860
18912
|
var val = this.parseExpression();
|
|
18861
|
-
this.expect(types.parenR);
|
|
18913
|
+
this.expect(types$1.parenR);
|
|
18862
18914
|
return val
|
|
18863
18915
|
};
|
|
18864
18916
|
|
|
18865
|
-
pp$
|
|
18917
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18866
18918
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18867
18919
|
if (this.options.ecmaVersion >= 6) {
|
|
18868
18920
|
this.next();
|
|
@@ -18873,24 +18925,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18873
18925
|
this.yieldPos = 0;
|
|
18874
18926
|
this.awaitPos = 0;
|
|
18875
18927
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
18876
|
-
while (this.type !== types.parenR) {
|
|
18877
|
-
first ? first = false : this.expect(types.comma);
|
|
18878
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
18928
|
+
while (this.type !== types$1.parenR) {
|
|
18929
|
+
first ? first = false : this.expect(types$1.comma);
|
|
18930
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
18879
18931
|
lastIsComma = true;
|
|
18880
18932
|
break
|
|
18881
|
-
} else if (this.type === types.ellipsis) {
|
|
18933
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18882
18934
|
spreadStart = this.start;
|
|
18883
18935
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
18884
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18936
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18885
18937
|
break
|
|
18886
18938
|
} else {
|
|
18887
18939
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
18888
18940
|
}
|
|
18889
18941
|
}
|
|
18890
18942
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
18891
|
-
this.expect(types.parenR);
|
|
18943
|
+
this.expect(types$1.parenR);
|
|
18892
18944
|
|
|
18893
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18945
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18894
18946
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18895
18947
|
this.checkYieldAwaitInDefaultParams();
|
|
18896
18948
|
this.yieldPos = oldYieldPos;
|
|
@@ -18924,12 +18976,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18924
18976
|
}
|
|
18925
18977
|
};
|
|
18926
18978
|
|
|
18927
|
-
pp$
|
|
18979
|
+
pp$5.parseParenItem = function(item) {
|
|
18928
18980
|
return item
|
|
18929
18981
|
};
|
|
18930
18982
|
|
|
18931
|
-
pp$
|
|
18932
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
18983
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
18984
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
18933
18985
|
};
|
|
18934
18986
|
|
|
18935
18987
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -18938,13 +18990,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
18938
18990
|
// argument to parseSubscripts to prevent it from consuming the
|
|
18939
18991
|
// argument list.
|
|
18940
18992
|
|
|
18941
|
-
var empty
|
|
18993
|
+
var empty = [];
|
|
18942
18994
|
|
|
18943
|
-
pp$
|
|
18995
|
+
pp$5.parseNew = function() {
|
|
18944
18996
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
18945
18997
|
var node = this.startNode();
|
|
18946
18998
|
var meta = this.parseIdent(true);
|
|
18947
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
18999
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
18948
19000
|
node.meta = meta;
|
|
18949
19001
|
var containsEsc = this.containsEsc;
|
|
18950
19002
|
node.property = this.parseIdent(true);
|
|
@@ -18956,23 +19008,23 @@ pp$4.parseNew = function() {
|
|
|
18956
19008
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
18957
19009
|
return this.finishNode(node, "MetaProperty")
|
|
18958
19010
|
}
|
|
18959
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
19011
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
18960
19012
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
18961
19013
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
18962
19014
|
this.raise(startPos, "Cannot use new with import()");
|
|
18963
19015
|
}
|
|
18964
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
18965
|
-
else { node.arguments = empty
|
|
19016
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19017
|
+
else { node.arguments = empty; }
|
|
18966
19018
|
return this.finishNode(node, "NewExpression")
|
|
18967
19019
|
};
|
|
18968
19020
|
|
|
18969
19021
|
// Parse template expression.
|
|
18970
19022
|
|
|
18971
|
-
pp$
|
|
19023
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
18972
19024
|
var isTagged = ref.isTagged;
|
|
18973
19025
|
|
|
18974
19026
|
var elem = this.startNode();
|
|
18975
|
-
if (this.type === types.invalidTemplate) {
|
|
19027
|
+
if (this.type === types$1.invalidTemplate) {
|
|
18976
19028
|
if (!isTagged) {
|
|
18977
19029
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
18978
19030
|
}
|
|
@@ -18987,11 +19039,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
18987
19039
|
};
|
|
18988
19040
|
}
|
|
18989
19041
|
this.next();
|
|
18990
|
-
elem.tail = this.type === types.backQuote;
|
|
19042
|
+
elem.tail = this.type === types$1.backQuote;
|
|
18991
19043
|
return this.finishNode(elem, "TemplateElement")
|
|
18992
19044
|
};
|
|
18993
19045
|
|
|
18994
|
-
pp$
|
|
19046
|
+
pp$5.parseTemplate = function(ref) {
|
|
18995
19047
|
if ( ref === void 0 ) ref = {};
|
|
18996
19048
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
18997
19049
|
|
|
@@ -19001,32 +19053,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
19001
19053
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
19002
19054
|
node.quasis = [curElt];
|
|
19003
19055
|
while (!curElt.tail) {
|
|
19004
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19005
|
-
this.expect(types.dollarBraceL);
|
|
19056
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19057
|
+
this.expect(types$1.dollarBraceL);
|
|
19006
19058
|
node.expressions.push(this.parseExpression());
|
|
19007
|
-
this.expect(types.braceR);
|
|
19059
|
+
this.expect(types$1.braceR);
|
|
19008
19060
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19009
19061
|
}
|
|
19010
19062
|
this.next();
|
|
19011
19063
|
return this.finishNode(node, "TemplateLiteral")
|
|
19012
19064
|
};
|
|
19013
19065
|
|
|
19014
|
-
pp$
|
|
19066
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19015
19067
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
19016
|
-
(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)) &&
|
|
19068
|
+
(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)) &&
|
|
19017
19069
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19018
19070
|
};
|
|
19019
19071
|
|
|
19020
19072
|
// Parse an object literal or binding pattern.
|
|
19021
19073
|
|
|
19022
|
-
pp$
|
|
19074
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19023
19075
|
var node = this.startNode(), first = true, propHash = {};
|
|
19024
19076
|
node.properties = [];
|
|
19025
19077
|
this.next();
|
|
19026
|
-
while (!this.eat(types.braceR)) {
|
|
19078
|
+
while (!this.eat(types$1.braceR)) {
|
|
19027
19079
|
if (!first) {
|
|
19028
|
-
this.expect(types.comma);
|
|
19029
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19080
|
+
this.expect(types$1.comma);
|
|
19081
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19030
19082
|
} else { first = false; }
|
|
19031
19083
|
|
|
19032
19084
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19036,18 +19088,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19036
19088
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19037
19089
|
};
|
|
19038
19090
|
|
|
19039
|
-
pp$
|
|
19091
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19040
19092
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19041
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19093
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19042
19094
|
if (isPattern) {
|
|
19043
19095
|
prop.argument = this.parseIdent(false);
|
|
19044
|
-
if (this.type === types.comma) {
|
|
19096
|
+
if (this.type === types$1.comma) {
|
|
19045
19097
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19046
19098
|
}
|
|
19047
19099
|
return this.finishNode(prop, "RestElement")
|
|
19048
19100
|
}
|
|
19049
19101
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19050
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19102
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19051
19103
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19052
19104
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19053
19105
|
}
|
|
@@ -19058,7 +19110,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19058
19110
|
// Parse argument.
|
|
19059
19111
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19060
19112
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19061
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19113
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19062
19114
|
refDestructuringErrors.trailingComma = this.start;
|
|
19063
19115
|
}
|
|
19064
19116
|
// Finish
|
|
@@ -19072,13 +19124,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19072
19124
|
startLoc = this.startLoc;
|
|
19073
19125
|
}
|
|
19074
19126
|
if (!isPattern)
|
|
19075
|
-
{ isGenerator = this.eat(types.star); }
|
|
19127
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19076
19128
|
}
|
|
19077
19129
|
var containsEsc = this.containsEsc;
|
|
19078
19130
|
this.parsePropertyName(prop);
|
|
19079
19131
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19080
19132
|
isAsync = true;
|
|
19081
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19133
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19082
19134
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19083
19135
|
} else {
|
|
19084
19136
|
isAsync = false;
|
|
@@ -19087,14 +19139,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19087
19139
|
return this.finishNode(prop, "Property")
|
|
19088
19140
|
};
|
|
19089
19141
|
|
|
19090
|
-
pp$
|
|
19091
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19142
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19143
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19092
19144
|
{ this.unexpected(); }
|
|
19093
19145
|
|
|
19094
|
-
if (this.eat(types.colon)) {
|
|
19146
|
+
if (this.eat(types$1.colon)) {
|
|
19095
19147
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19096
19148
|
prop.kind = "init";
|
|
19097
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19149
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19098
19150
|
if (isPattern) { this.unexpected(); }
|
|
19099
19151
|
prop.kind = "init";
|
|
19100
19152
|
prop.method = true;
|
|
@@ -19102,7 +19154,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19102
19154
|
} else if (!isPattern && !containsEsc &&
|
|
19103
19155
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19104
19156
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19105
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19157
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19106
19158
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19107
19159
|
prop.kind = prop.key.name;
|
|
19108
19160
|
this.parsePropertyName(prop);
|
|
@@ -19126,7 +19178,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19126
19178
|
prop.kind = "init";
|
|
19127
19179
|
if (isPattern) {
|
|
19128
19180
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19129
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19181
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19130
19182
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19131
19183
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19132
19184
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19137,23 +19189,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19137
19189
|
} else { this.unexpected(); }
|
|
19138
19190
|
};
|
|
19139
19191
|
|
|
19140
|
-
pp$
|
|
19192
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19141
19193
|
if (this.options.ecmaVersion >= 6) {
|
|
19142
|
-
if (this.eat(types.bracketL)) {
|
|
19194
|
+
if (this.eat(types$1.bracketL)) {
|
|
19143
19195
|
prop.computed = true;
|
|
19144
19196
|
prop.key = this.parseMaybeAssign();
|
|
19145
|
-
this.expect(types.bracketR);
|
|
19197
|
+
this.expect(types$1.bracketR);
|
|
19146
19198
|
return prop.key
|
|
19147
19199
|
} else {
|
|
19148
19200
|
prop.computed = false;
|
|
19149
19201
|
}
|
|
19150
19202
|
}
|
|
19151
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19203
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19152
19204
|
};
|
|
19153
19205
|
|
|
19154
19206
|
// Initialize empty function node.
|
|
19155
19207
|
|
|
19156
|
-
pp$
|
|
19208
|
+
pp$5.initFunction = function(node) {
|
|
19157
19209
|
node.id = null;
|
|
19158
19210
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19159
19211
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19161,7 +19213,7 @@ pp$4.initFunction = function(node) {
|
|
|
19161
19213
|
|
|
19162
19214
|
// Parse object or class method.
|
|
19163
19215
|
|
|
19164
|
-
pp$
|
|
19216
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19165
19217
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19166
19218
|
|
|
19167
19219
|
this.initFunction(node);
|
|
@@ -19175,8 +19227,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19175
19227
|
this.awaitIdentPos = 0;
|
|
19176
19228
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19177
19229
|
|
|
19178
|
-
this.expect(types.parenL);
|
|
19179
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19230
|
+
this.expect(types$1.parenL);
|
|
19231
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19180
19232
|
this.checkYieldAwaitInDefaultParams();
|
|
19181
19233
|
this.parseFunctionBody(node, false, true, false);
|
|
19182
19234
|
|
|
@@ -19188,7 +19240,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19188
19240
|
|
|
19189
19241
|
// Parse arrow function expression with given parameters.
|
|
19190
19242
|
|
|
19191
|
-
pp$
|
|
19243
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19192
19244
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19193
19245
|
|
|
19194
19246
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19210,8 +19262,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19210
19262
|
|
|
19211
19263
|
// Parse function body and check parameters.
|
|
19212
19264
|
|
|
19213
|
-
pp$
|
|
19214
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19265
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19266
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19215
19267
|
var oldStrict = this.strict, useStrict = false;
|
|
19216
19268
|
|
|
19217
19269
|
if (isExpression) {
|
|
@@ -19247,7 +19299,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19247
19299
|
this.exitScope();
|
|
19248
19300
|
};
|
|
19249
19301
|
|
|
19250
|
-
pp$
|
|
19302
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19251
19303
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19252
19304
|
{
|
|
19253
19305
|
var param = list[i];
|
|
@@ -19260,7 +19312,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19260
19312
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19261
19313
|
// or "arguments" and duplicate parameters.
|
|
19262
19314
|
|
|
19263
|
-
pp$
|
|
19315
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19264
19316
|
var nameHash = Object.create(null);
|
|
19265
19317
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19266
19318
|
{
|
|
@@ -19276,20 +19328,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19276
19328
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19277
19329
|
// for array literals).
|
|
19278
19330
|
|
|
19279
|
-
pp$
|
|
19331
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19280
19332
|
var elts = [], first = true;
|
|
19281
19333
|
while (!this.eat(close)) {
|
|
19282
19334
|
if (!first) {
|
|
19283
|
-
this.expect(types.comma);
|
|
19335
|
+
this.expect(types$1.comma);
|
|
19284
19336
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19285
19337
|
} else { first = false; }
|
|
19286
19338
|
|
|
19287
19339
|
var elt = (void 0);
|
|
19288
|
-
if (allowEmpty && this.type === types.comma)
|
|
19340
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19289
19341
|
{ elt = null; }
|
|
19290
|
-
else if (this.type === types.ellipsis) {
|
|
19342
|
+
else if (this.type === types$1.ellipsis) {
|
|
19291
19343
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19292
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19344
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19293
19345
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19294
19346
|
} else {
|
|
19295
19347
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19299,7 +19351,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19299
19351
|
return elts
|
|
19300
19352
|
};
|
|
19301
19353
|
|
|
19302
|
-
pp$
|
|
19354
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19303
19355
|
var start = ref.start;
|
|
19304
19356
|
var end = ref.end;
|
|
19305
19357
|
var name = ref.name;
|
|
@@ -19328,9 +19380,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19328
19380
|
// when parsing properties), it will also convert keywords into
|
|
19329
19381
|
// identifiers.
|
|
19330
19382
|
|
|
19331
|
-
pp$
|
|
19383
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19332
19384
|
var node = this.startNode();
|
|
19333
|
-
if (this.type === types.name) {
|
|
19385
|
+
if (this.type === types$1.name) {
|
|
19334
19386
|
node.name = this.value;
|
|
19335
19387
|
} else if (this.type.keyword) {
|
|
19336
19388
|
node.name = this.type.keyword;
|
|
@@ -19356,9 +19408,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19356
19408
|
return node
|
|
19357
19409
|
};
|
|
19358
19410
|
|
|
19359
|
-
pp$
|
|
19411
|
+
pp$5.parsePrivateIdent = function() {
|
|
19360
19412
|
var node = this.startNode();
|
|
19361
|
-
if (this.type === types.privateId) {
|
|
19413
|
+
if (this.type === types$1.privateId) {
|
|
19362
19414
|
node.name = this.value;
|
|
19363
19415
|
} else {
|
|
19364
19416
|
this.unexpected();
|
|
@@ -19378,22 +19430,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19378
19430
|
|
|
19379
19431
|
// Parses yield expression inside generator.
|
|
19380
19432
|
|
|
19381
|
-
pp$
|
|
19433
|
+
pp$5.parseYield = function(forInit) {
|
|
19382
19434
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19383
19435
|
|
|
19384
19436
|
var node = this.startNode();
|
|
19385
19437
|
this.next();
|
|
19386
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19438
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19387
19439
|
node.delegate = false;
|
|
19388
19440
|
node.argument = null;
|
|
19389
19441
|
} else {
|
|
19390
|
-
node.delegate = this.eat(types.star);
|
|
19442
|
+
node.delegate = this.eat(types$1.star);
|
|
19391
19443
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19392
19444
|
}
|
|
19393
19445
|
return this.finishNode(node, "YieldExpression")
|
|
19394
19446
|
};
|
|
19395
19447
|
|
|
19396
|
-
pp$
|
|
19448
|
+
pp$5.parseAwait = function(forInit) {
|
|
19397
19449
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19398
19450
|
|
|
19399
19451
|
var node = this.startNode();
|
|
@@ -19402,7 +19454,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19402
19454
|
return this.finishNode(node, "AwaitExpression")
|
|
19403
19455
|
};
|
|
19404
19456
|
|
|
19405
|
-
var pp$
|
|
19457
|
+
var pp$4 = Parser.prototype;
|
|
19406
19458
|
|
|
19407
19459
|
// This function is used to raise exceptions on parse errors. It
|
|
19408
19460
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19410,7 +19462,7 @@ var pp$5 = Parser.prototype;
|
|
|
19410
19462
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19411
19463
|
// message.
|
|
19412
19464
|
|
|
19413
|
-
pp$
|
|
19465
|
+
pp$4.raise = function(pos, message) {
|
|
19414
19466
|
var loc = getLineInfo(this.input, pos);
|
|
19415
19467
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19416
19468
|
var err = new SyntaxError(message);
|
|
@@ -19418,15 +19470,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19418
19470
|
throw err
|
|
19419
19471
|
};
|
|
19420
19472
|
|
|
19421
|
-
pp$
|
|
19473
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19422
19474
|
|
|
19423
|
-
pp$
|
|
19475
|
+
pp$4.curPosition = function() {
|
|
19424
19476
|
if (this.options.locations) {
|
|
19425
19477
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19426
19478
|
}
|
|
19427
19479
|
};
|
|
19428
19480
|
|
|
19429
|
-
var pp$
|
|
19481
|
+
var pp$3 = Parser.prototype;
|
|
19430
19482
|
|
|
19431
19483
|
var Scope = function Scope(flags) {
|
|
19432
19484
|
this.flags = flags;
|
|
@@ -19442,22 +19494,22 @@ var Scope = function Scope(flags) {
|
|
|
19442
19494
|
|
|
19443
19495
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19444
19496
|
|
|
19445
|
-
pp$
|
|
19497
|
+
pp$3.enterScope = function(flags) {
|
|
19446
19498
|
this.scopeStack.push(new Scope(flags));
|
|
19447
19499
|
};
|
|
19448
19500
|
|
|
19449
|
-
pp$
|
|
19501
|
+
pp$3.exitScope = function() {
|
|
19450
19502
|
this.scopeStack.pop();
|
|
19451
19503
|
};
|
|
19452
19504
|
|
|
19453
19505
|
// The spec says:
|
|
19454
19506
|
// > At the top level of a function, or script, function declarations are
|
|
19455
19507
|
// > treated like var declarations rather than like lexical declarations.
|
|
19456
|
-
pp$
|
|
19508
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19457
19509
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19458
19510
|
};
|
|
19459
19511
|
|
|
19460
|
-
pp$
|
|
19512
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19461
19513
|
var redeclared = false;
|
|
19462
19514
|
if (bindingType === BIND_LEXICAL) {
|
|
19463
19515
|
var scope = this.currentScope();
|
|
@@ -19492,7 +19544,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19492
19544
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19493
19545
|
};
|
|
19494
19546
|
|
|
19495
|
-
pp$
|
|
19547
|
+
pp$3.checkLocalExport = function(id) {
|
|
19496
19548
|
// scope.functions must be empty as Module code is always strict.
|
|
19497
19549
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19498
19550
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19500,11 +19552,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19500
19552
|
}
|
|
19501
19553
|
};
|
|
19502
19554
|
|
|
19503
|
-
pp$
|
|
19555
|
+
pp$3.currentScope = function() {
|
|
19504
19556
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19505
19557
|
};
|
|
19506
19558
|
|
|
19507
|
-
pp$
|
|
19559
|
+
pp$3.currentVarScope = function() {
|
|
19508
19560
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19509
19561
|
var scope = this.scopeStack[i];
|
|
19510
19562
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19512,7 +19564,7 @@ pp$6.currentVarScope = function() {
|
|
|
19512
19564
|
};
|
|
19513
19565
|
|
|
19514
19566
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19515
|
-
pp$
|
|
19567
|
+
pp$3.currentThisScope = function() {
|
|
19516
19568
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19517
19569
|
var scope = this.scopeStack[i];
|
|
19518
19570
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19533,13 +19585,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19533
19585
|
|
|
19534
19586
|
// Start an AST node, attaching a start offset.
|
|
19535
19587
|
|
|
19536
|
-
var pp$
|
|
19588
|
+
var pp$2 = Parser.prototype;
|
|
19537
19589
|
|
|
19538
|
-
pp$
|
|
19590
|
+
pp$2.startNode = function() {
|
|
19539
19591
|
return new Node(this, this.start, this.startLoc)
|
|
19540
19592
|
};
|
|
19541
19593
|
|
|
19542
|
-
pp$
|
|
19594
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19543
19595
|
return new Node(this, pos, loc)
|
|
19544
19596
|
};
|
|
19545
19597
|
|
|
@@ -19555,17 +19607,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19555
19607
|
return node
|
|
19556
19608
|
}
|
|
19557
19609
|
|
|
19558
|
-
pp$
|
|
19610
|
+
pp$2.finishNode = function(node, type) {
|
|
19559
19611
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19560
19612
|
};
|
|
19561
19613
|
|
|
19562
19614
|
// Finish node at given position
|
|
19563
19615
|
|
|
19564
|
-
pp$
|
|
19616
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19565
19617
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19566
19618
|
};
|
|
19567
19619
|
|
|
19568
|
-
pp$
|
|
19620
|
+
pp$2.copyNode = function(node) {
|
|
19569
19621
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19570
19622
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19571
19623
|
return newNode
|
|
@@ -19622,7 +19674,7 @@ buildUnicodeData(10);
|
|
|
19622
19674
|
buildUnicodeData(11);
|
|
19623
19675
|
buildUnicodeData(12);
|
|
19624
19676
|
|
|
19625
|
-
var pp$
|
|
19677
|
+
var pp$1 = Parser.prototype;
|
|
19626
19678
|
|
|
19627
19679
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19628
19680
|
this.parser = parser;
|
|
@@ -19718,7 +19770,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19718
19770
|
return false
|
|
19719
19771
|
};
|
|
19720
19772
|
|
|
19721
|
-
function codePointToString(ch) {
|
|
19773
|
+
function codePointToString$1(ch) {
|
|
19722
19774
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19723
19775
|
ch -= 0x10000;
|
|
19724
19776
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19730,7 +19782,7 @@ function codePointToString(ch) {
|
|
|
19730
19782
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19731
19783
|
* @returns {void}
|
|
19732
19784
|
*/
|
|
19733
|
-
pp$
|
|
19785
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19734
19786
|
var validFlags = state.validFlags;
|
|
19735
19787
|
var flags = state.flags;
|
|
19736
19788
|
|
|
@@ -19751,7 +19803,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19751
19803
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19752
19804
|
* @returns {void}
|
|
19753
19805
|
*/
|
|
19754
|
-
pp$
|
|
19806
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19755
19807
|
this.regexp_pattern(state);
|
|
19756
19808
|
|
|
19757
19809
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19766,7 +19818,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19766
19818
|
};
|
|
19767
19819
|
|
|
19768
19820
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19769
|
-
pp$
|
|
19821
|
+
pp$1.regexp_pattern = function(state) {
|
|
19770
19822
|
state.pos = 0;
|
|
19771
19823
|
state.lastIntValue = 0;
|
|
19772
19824
|
state.lastStringValue = "";
|
|
@@ -19800,7 +19852,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19800
19852
|
};
|
|
19801
19853
|
|
|
19802
19854
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19803
|
-
pp$
|
|
19855
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19804
19856
|
this.regexp_alternative(state);
|
|
19805
19857
|
while (state.eat(0x7C /* | */)) {
|
|
19806
19858
|
this.regexp_alternative(state);
|
|
@@ -19816,13 +19868,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19816
19868
|
};
|
|
19817
19869
|
|
|
19818
19870
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19819
|
-
pp$
|
|
19871
|
+
pp$1.regexp_alternative = function(state) {
|
|
19820
19872
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19821
19873
|
{ }
|
|
19822
19874
|
};
|
|
19823
19875
|
|
|
19824
19876
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19825
|
-
pp$
|
|
19877
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19826
19878
|
if (this.regexp_eatAssertion(state)) {
|
|
19827
19879
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19828
19880
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19845,7 +19897,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19845
19897
|
};
|
|
19846
19898
|
|
|
19847
19899
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19848
|
-
pp$
|
|
19900
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19849
19901
|
var start = state.pos;
|
|
19850
19902
|
state.lastAssertionIsQuantifiable = false;
|
|
19851
19903
|
|
|
@@ -19883,7 +19935,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
19883
19935
|
};
|
|
19884
19936
|
|
|
19885
19937
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
19886
|
-
pp$
|
|
19938
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
19887
19939
|
if ( noError === void 0 ) noError = false;
|
|
19888
19940
|
|
|
19889
19941
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -19894,7 +19946,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
19894
19946
|
};
|
|
19895
19947
|
|
|
19896
19948
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
19897
|
-
pp$
|
|
19949
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
19898
19950
|
return (
|
|
19899
19951
|
state.eat(0x2A /* * */) ||
|
|
19900
19952
|
state.eat(0x2B /* + */) ||
|
|
@@ -19902,7 +19954,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
19902
19954
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
19903
19955
|
)
|
|
19904
19956
|
};
|
|
19905
|
-
pp$
|
|
19957
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
19906
19958
|
var start = state.pos;
|
|
19907
19959
|
if (state.eat(0x7B /* { */)) {
|
|
19908
19960
|
var min = 0, max = -1;
|
|
@@ -19928,7 +19980,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
19928
19980
|
};
|
|
19929
19981
|
|
|
19930
19982
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
19931
|
-
pp$
|
|
19983
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
19932
19984
|
return (
|
|
19933
19985
|
this.regexp_eatPatternCharacters(state) ||
|
|
19934
19986
|
state.eat(0x2E /* . */) ||
|
|
@@ -19938,7 +19990,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
19938
19990
|
this.regexp_eatCapturingGroup(state)
|
|
19939
19991
|
)
|
|
19940
19992
|
};
|
|
19941
|
-
pp$
|
|
19993
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
19942
19994
|
var start = state.pos;
|
|
19943
19995
|
if (state.eat(0x5C /* \ */)) {
|
|
19944
19996
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -19948,7 +20000,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
19948
20000
|
}
|
|
19949
20001
|
return false
|
|
19950
20002
|
};
|
|
19951
|
-
pp$
|
|
20003
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
19952
20004
|
var start = state.pos;
|
|
19953
20005
|
if (state.eat(0x28 /* ( */)) {
|
|
19954
20006
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -19962,7 +20014,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
19962
20014
|
}
|
|
19963
20015
|
return false
|
|
19964
20016
|
};
|
|
19965
|
-
pp$
|
|
20017
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
19966
20018
|
if (state.eat(0x28 /* ( */)) {
|
|
19967
20019
|
if (this.options.ecmaVersion >= 9) {
|
|
19968
20020
|
this.regexp_groupSpecifier(state);
|
|
@@ -19980,7 +20032,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
19980
20032
|
};
|
|
19981
20033
|
|
|
19982
20034
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
19983
|
-
pp$
|
|
20035
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
19984
20036
|
return (
|
|
19985
20037
|
state.eat(0x2E /* . */) ||
|
|
19986
20038
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -19993,7 +20045,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
19993
20045
|
};
|
|
19994
20046
|
|
|
19995
20047
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
19996
|
-
pp$
|
|
20048
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
19997
20049
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
19998
20050
|
state.raise("Nothing to repeat");
|
|
19999
20051
|
}
|
|
@@ -20001,7 +20053,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
20001
20053
|
};
|
|
20002
20054
|
|
|
20003
20055
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
20004
|
-
pp$
|
|
20056
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
20005
20057
|
var ch = state.current();
|
|
20006
20058
|
if (isSyntaxCharacter(ch)) {
|
|
20007
20059
|
state.lastIntValue = ch;
|
|
@@ -20023,7 +20075,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20023
20075
|
|
|
20024
20076
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20025
20077
|
// But eat eager.
|
|
20026
|
-
pp$
|
|
20078
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20027
20079
|
var start = state.pos;
|
|
20028
20080
|
var ch = 0;
|
|
20029
20081
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20033,7 +20085,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20033
20085
|
};
|
|
20034
20086
|
|
|
20035
20087
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20036
|
-
pp$
|
|
20088
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20037
20089
|
var ch = state.current();
|
|
20038
20090
|
if (
|
|
20039
20091
|
ch !== -1 &&
|
|
@@ -20054,7 +20106,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20054
20106
|
// GroupSpecifier ::
|
|
20055
20107
|
// [empty]
|
|
20056
20108
|
// `?` GroupName
|
|
20057
|
-
pp$
|
|
20109
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20058
20110
|
if (state.eat(0x3F /* ? */)) {
|
|
20059
20111
|
if (this.regexp_eatGroupName(state)) {
|
|
20060
20112
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20070,7 +20122,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20070
20122
|
// GroupName ::
|
|
20071
20123
|
// `<` RegExpIdentifierName `>`
|
|
20072
20124
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20073
|
-
pp$
|
|
20125
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20074
20126
|
state.lastStringValue = "";
|
|
20075
20127
|
if (state.eat(0x3C /* < */)) {
|
|
20076
20128
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20085,12 +20137,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20085
20137
|
// RegExpIdentifierStart
|
|
20086
20138
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20087
20139
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20088
|
-
pp$
|
|
20140
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20089
20141
|
state.lastStringValue = "";
|
|
20090
20142
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20091
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20143
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20092
20144
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20093
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20145
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20094
20146
|
}
|
|
20095
20147
|
return true
|
|
20096
20148
|
}
|
|
@@ -20102,7 +20154,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20102
20154
|
// `$`
|
|
20103
20155
|
// `_`
|
|
20104
20156
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20105
|
-
pp$
|
|
20157
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20106
20158
|
var start = state.pos;
|
|
20107
20159
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20108
20160
|
var ch = state.current(forceU);
|
|
@@ -20130,7 +20182,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20130
20182
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20131
20183
|
// <ZWNJ>
|
|
20132
20184
|
// <ZWJ>
|
|
20133
|
-
pp$
|
|
20185
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20134
20186
|
var start = state.pos;
|
|
20135
20187
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20136
20188
|
var ch = state.current(forceU);
|
|
@@ -20152,7 +20204,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20152
20204
|
}
|
|
20153
20205
|
|
|
20154
20206
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20155
|
-
pp$
|
|
20207
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20156
20208
|
if (
|
|
20157
20209
|
this.regexp_eatBackReference(state) ||
|
|
20158
20210
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20170,7 +20222,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20170
20222
|
}
|
|
20171
20223
|
return false
|
|
20172
20224
|
};
|
|
20173
|
-
pp$
|
|
20225
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20174
20226
|
var start = state.pos;
|
|
20175
20227
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20176
20228
|
var n = state.lastIntValue;
|
|
@@ -20188,7 +20240,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20188
20240
|
}
|
|
20189
20241
|
return false
|
|
20190
20242
|
};
|
|
20191
|
-
pp$
|
|
20243
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20192
20244
|
if (state.eat(0x6B /* k */)) {
|
|
20193
20245
|
if (this.regexp_eatGroupName(state)) {
|
|
20194
20246
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20200,7 +20252,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20200
20252
|
};
|
|
20201
20253
|
|
|
20202
20254
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20203
|
-
pp$
|
|
20255
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20204
20256
|
return (
|
|
20205
20257
|
this.regexp_eatControlEscape(state) ||
|
|
20206
20258
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20211,7 +20263,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20211
20263
|
this.regexp_eatIdentityEscape(state)
|
|
20212
20264
|
)
|
|
20213
20265
|
};
|
|
20214
|
-
pp$
|
|
20266
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20215
20267
|
var start = state.pos;
|
|
20216
20268
|
if (state.eat(0x63 /* c */)) {
|
|
20217
20269
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20221,7 +20273,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20221
20273
|
}
|
|
20222
20274
|
return false
|
|
20223
20275
|
};
|
|
20224
|
-
pp$
|
|
20276
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20225
20277
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20226
20278
|
state.lastIntValue = 0;
|
|
20227
20279
|
state.advance();
|
|
@@ -20231,7 +20283,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20231
20283
|
};
|
|
20232
20284
|
|
|
20233
20285
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20234
|
-
pp$
|
|
20286
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20235
20287
|
var ch = state.current();
|
|
20236
20288
|
if (ch === 0x74 /* t */) {
|
|
20237
20289
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20262,7 +20314,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20262
20314
|
};
|
|
20263
20315
|
|
|
20264
20316
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20265
|
-
pp$
|
|
20317
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20266
20318
|
var ch = state.current();
|
|
20267
20319
|
if (isControlLetter(ch)) {
|
|
20268
20320
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20279,7 +20331,7 @@ function isControlLetter(ch) {
|
|
|
20279
20331
|
}
|
|
20280
20332
|
|
|
20281
20333
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20282
|
-
pp$
|
|
20334
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20283
20335
|
if ( forceU === void 0 ) forceU = false;
|
|
20284
20336
|
|
|
20285
20337
|
var start = state.pos;
|
|
@@ -20324,7 +20376,7 @@ function isValidUnicode(ch) {
|
|
|
20324
20376
|
}
|
|
20325
20377
|
|
|
20326
20378
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20327
|
-
pp$
|
|
20379
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20328
20380
|
if (state.switchU) {
|
|
20329
20381
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20330
20382
|
return true
|
|
@@ -20347,7 +20399,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20347
20399
|
};
|
|
20348
20400
|
|
|
20349
20401
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20350
|
-
pp$
|
|
20402
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20351
20403
|
state.lastIntValue = 0;
|
|
20352
20404
|
var ch = state.current();
|
|
20353
20405
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20361,7 +20413,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20361
20413
|
};
|
|
20362
20414
|
|
|
20363
20415
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20364
|
-
pp$
|
|
20416
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20365
20417
|
var ch = state.current();
|
|
20366
20418
|
|
|
20367
20419
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20403,7 +20455,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20403
20455
|
// UnicodePropertyValueExpression ::
|
|
20404
20456
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20405
20457
|
// LoneUnicodePropertyNameOrValue
|
|
20406
|
-
pp$
|
|
20458
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20407
20459
|
var start = state.pos;
|
|
20408
20460
|
|
|
20409
20461
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20425,24 +20477,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20425
20477
|
}
|
|
20426
20478
|
return false
|
|
20427
20479
|
};
|
|
20428
|
-
pp$
|
|
20480
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20429
20481
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20430
20482
|
{ state.raise("Invalid property name"); }
|
|
20431
20483
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20432
20484
|
{ state.raise("Invalid property value"); }
|
|
20433
20485
|
};
|
|
20434
|
-
pp$
|
|
20486
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20435
20487
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20436
20488
|
{ state.raise("Invalid property name"); }
|
|
20437
20489
|
};
|
|
20438
20490
|
|
|
20439
20491
|
// UnicodePropertyName ::
|
|
20440
20492
|
// UnicodePropertyNameCharacters
|
|
20441
|
-
pp$
|
|
20493
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20442
20494
|
var ch = 0;
|
|
20443
20495
|
state.lastStringValue = "";
|
|
20444
20496
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20445
|
-
state.lastStringValue += codePointToString(ch);
|
|
20497
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20446
20498
|
state.advance();
|
|
20447
20499
|
}
|
|
20448
20500
|
return state.lastStringValue !== ""
|
|
@@ -20453,11 +20505,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20453
20505
|
|
|
20454
20506
|
// UnicodePropertyValue ::
|
|
20455
20507
|
// UnicodePropertyValueCharacters
|
|
20456
|
-
pp$
|
|
20508
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20457
20509
|
var ch = 0;
|
|
20458
20510
|
state.lastStringValue = "";
|
|
20459
20511
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20460
|
-
state.lastStringValue += codePointToString(ch);
|
|
20512
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20461
20513
|
state.advance();
|
|
20462
20514
|
}
|
|
20463
20515
|
return state.lastStringValue !== ""
|
|
@@ -20468,12 +20520,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20468
20520
|
|
|
20469
20521
|
// LoneUnicodePropertyNameOrValue ::
|
|
20470
20522
|
// UnicodePropertyValueCharacters
|
|
20471
|
-
pp$
|
|
20523
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20472
20524
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20473
20525
|
};
|
|
20474
20526
|
|
|
20475
20527
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20476
|
-
pp$
|
|
20528
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20477
20529
|
if (state.eat(0x5B /* [ */)) {
|
|
20478
20530
|
state.eat(0x5E /* ^ */);
|
|
20479
20531
|
this.regexp_classRanges(state);
|
|
@@ -20489,7 +20541,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20489
20541
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20490
20542
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20491
20543
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20492
|
-
pp$
|
|
20544
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20493
20545
|
while (this.regexp_eatClassAtom(state)) {
|
|
20494
20546
|
var left = state.lastIntValue;
|
|
20495
20547
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20506,7 +20558,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20506
20558
|
|
|
20507
20559
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20508
20560
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20509
|
-
pp$
|
|
20561
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20510
20562
|
var start = state.pos;
|
|
20511
20563
|
|
|
20512
20564
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20535,7 +20587,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20535
20587
|
};
|
|
20536
20588
|
|
|
20537
20589
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20538
|
-
pp$
|
|
20590
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20539
20591
|
var start = state.pos;
|
|
20540
20592
|
|
|
20541
20593
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20562,7 +20614,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20562
20614
|
};
|
|
20563
20615
|
|
|
20564
20616
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20565
|
-
pp$
|
|
20617
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20566
20618
|
var ch = state.current();
|
|
20567
20619
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20568
20620
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20573,7 +20625,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20573
20625
|
};
|
|
20574
20626
|
|
|
20575
20627
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20576
|
-
pp$
|
|
20628
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20577
20629
|
var start = state.pos;
|
|
20578
20630
|
if (state.eat(0x78 /* x */)) {
|
|
20579
20631
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20588,7 +20640,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20588
20640
|
};
|
|
20589
20641
|
|
|
20590
20642
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20591
|
-
pp$
|
|
20643
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20592
20644
|
var start = state.pos;
|
|
20593
20645
|
var ch = 0;
|
|
20594
20646
|
state.lastIntValue = 0;
|
|
@@ -20603,7 +20655,7 @@ function isDecimalDigit(ch) {
|
|
|
20603
20655
|
}
|
|
20604
20656
|
|
|
20605
20657
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20606
|
-
pp$
|
|
20658
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20607
20659
|
var start = state.pos;
|
|
20608
20660
|
var ch = 0;
|
|
20609
20661
|
state.lastIntValue = 0;
|
|
@@ -20632,7 +20684,7 @@ function hexToInt(ch) {
|
|
|
20632
20684
|
|
|
20633
20685
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20634
20686
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20635
|
-
pp$
|
|
20687
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20636
20688
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20637
20689
|
var n1 = state.lastIntValue;
|
|
20638
20690
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20651,7 +20703,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20651
20703
|
};
|
|
20652
20704
|
|
|
20653
20705
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20654
|
-
pp$
|
|
20706
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20655
20707
|
var ch = state.current();
|
|
20656
20708
|
if (isOctalDigit(ch)) {
|
|
20657
20709
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20668,7 +20720,7 @@ function isOctalDigit(ch) {
|
|
|
20668
20720
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20669
20721
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20670
20722
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20671
|
-
pp$
|
|
20723
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20672
20724
|
var start = state.pos;
|
|
20673
20725
|
state.lastIntValue = 0;
|
|
20674
20726
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20700,11 +20752,11 @@ var Token = function Token(p) {
|
|
|
20700
20752
|
|
|
20701
20753
|
// ## Tokenizer
|
|
20702
20754
|
|
|
20703
|
-
var pp
|
|
20755
|
+
var pp = Parser.prototype;
|
|
20704
20756
|
|
|
20705
20757
|
// Move to the next token
|
|
20706
20758
|
|
|
20707
|
-
pp
|
|
20759
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20708
20760
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20709
20761
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20710
20762
|
if (this.options.onToken)
|
|
@@ -20717,21 +20769,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20717
20769
|
this.nextToken();
|
|
20718
20770
|
};
|
|
20719
20771
|
|
|
20720
|
-
pp
|
|
20772
|
+
pp.getToken = function() {
|
|
20721
20773
|
this.next();
|
|
20722
20774
|
return new Token(this)
|
|
20723
20775
|
};
|
|
20724
20776
|
|
|
20725
20777
|
// If we're in an ES6 environment, make parsers iterable
|
|
20726
20778
|
if (typeof Symbol !== "undefined")
|
|
20727
|
-
{ pp
|
|
20779
|
+
{ pp[Symbol.iterator] = function() {
|
|
20728
20780
|
var this$1$1 = this;
|
|
20729
20781
|
|
|
20730
20782
|
return {
|
|
20731
20783
|
next: function () {
|
|
20732
20784
|
var token = this$1$1.getToken();
|
|
20733
20785
|
return {
|
|
20734
|
-
done: token.type === types.eof,
|
|
20786
|
+
done: token.type === types$1.eof,
|
|
20735
20787
|
value: token
|
|
20736
20788
|
}
|
|
20737
20789
|
}
|
|
@@ -20744,19 +20796,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20744
20796
|
// Read a single token, updating the parser object's token-related
|
|
20745
20797
|
// properties.
|
|
20746
20798
|
|
|
20747
|
-
pp
|
|
20799
|
+
pp.nextToken = function() {
|
|
20748
20800
|
var curContext = this.curContext();
|
|
20749
20801
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20750
20802
|
|
|
20751
20803
|
this.start = this.pos;
|
|
20752
20804
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20753
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20805
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20754
20806
|
|
|
20755
20807
|
if (curContext.override) { return curContext.override(this) }
|
|
20756
20808
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20757
20809
|
};
|
|
20758
20810
|
|
|
20759
|
-
pp
|
|
20811
|
+
pp.readToken = function(code) {
|
|
20760
20812
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20761
20813
|
// identifiers, so '\' also dispatches to that.
|
|
20762
20814
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20765,14 +20817,14 @@ pp$9.readToken = function(code) {
|
|
|
20765
20817
|
return this.getTokenFromCode(code)
|
|
20766
20818
|
};
|
|
20767
20819
|
|
|
20768
|
-
pp
|
|
20820
|
+
pp.fullCharCodeAtPos = function() {
|
|
20769
20821
|
var code = this.input.charCodeAt(this.pos);
|
|
20770
20822
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20771
20823
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20772
20824
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20773
20825
|
};
|
|
20774
20826
|
|
|
20775
|
-
pp
|
|
20827
|
+
pp.skipBlockComment = function() {
|
|
20776
20828
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20777
20829
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20778
20830
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20790,7 +20842,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20790
20842
|
startLoc, this.curPosition()); }
|
|
20791
20843
|
};
|
|
20792
20844
|
|
|
20793
|
-
pp
|
|
20845
|
+
pp.skipLineComment = function(startSkip) {
|
|
20794
20846
|
var start = this.pos;
|
|
20795
20847
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20796
20848
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20805,7 +20857,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20805
20857
|
// Called at the start of the parse and after every token. Skips
|
|
20806
20858
|
// whitespace and comments, and.
|
|
20807
20859
|
|
|
20808
|
-
pp
|
|
20860
|
+
pp.skipSpace = function() {
|
|
20809
20861
|
loop: while (this.pos < this.input.length) {
|
|
20810
20862
|
var ch = this.input.charCodeAt(this.pos);
|
|
20811
20863
|
switch (ch) {
|
|
@@ -20850,7 +20902,7 @@ pp$9.skipSpace = function() {
|
|
|
20850
20902
|
// the token, so that the next one's `start` will point at the
|
|
20851
20903
|
// right position.
|
|
20852
20904
|
|
|
20853
|
-
pp
|
|
20905
|
+
pp.finishToken = function(type, val) {
|
|
20854
20906
|
this.end = this.pos;
|
|
20855
20907
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20856
20908
|
var prevType = this.type;
|
|
@@ -20869,62 +20921,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
20869
20921
|
//
|
|
20870
20922
|
// All in the name of speed.
|
|
20871
20923
|
//
|
|
20872
|
-
pp
|
|
20924
|
+
pp.readToken_dot = function() {
|
|
20873
20925
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20874
20926
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
20875
20927
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20876
20928
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
20877
20929
|
this.pos += 3;
|
|
20878
|
-
return this.finishToken(types.ellipsis)
|
|
20930
|
+
return this.finishToken(types$1.ellipsis)
|
|
20879
20931
|
} else {
|
|
20880
20932
|
++this.pos;
|
|
20881
|
-
return this.finishToken(types.dot)
|
|
20933
|
+
return this.finishToken(types$1.dot)
|
|
20882
20934
|
}
|
|
20883
20935
|
};
|
|
20884
20936
|
|
|
20885
|
-
pp
|
|
20937
|
+
pp.readToken_slash = function() { // '/'
|
|
20886
20938
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20887
20939
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
20888
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20889
|
-
return this.finishOp(types.slash, 1)
|
|
20940
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20941
|
+
return this.finishOp(types$1.slash, 1)
|
|
20890
20942
|
};
|
|
20891
20943
|
|
|
20892
|
-
pp
|
|
20944
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
20893
20945
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20894
20946
|
var size = 1;
|
|
20895
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
20947
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
20896
20948
|
|
|
20897
20949
|
// exponentiation operator ** and **=
|
|
20898
20950
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
20899
20951
|
++size;
|
|
20900
|
-
tokentype = types.starstar;
|
|
20952
|
+
tokentype = types$1.starstar;
|
|
20901
20953
|
next = this.input.charCodeAt(this.pos + 2);
|
|
20902
20954
|
}
|
|
20903
20955
|
|
|
20904
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20956
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20905
20957
|
return this.finishOp(tokentype, size)
|
|
20906
20958
|
};
|
|
20907
20959
|
|
|
20908
|
-
pp
|
|
20960
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
20909
20961
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20910
20962
|
if (next === code) {
|
|
20911
20963
|
if (this.options.ecmaVersion >= 12) {
|
|
20912
20964
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20913
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
20965
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20914
20966
|
}
|
|
20915
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
20967
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
20916
20968
|
}
|
|
20917
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20918
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
20969
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20970
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
20919
20971
|
};
|
|
20920
20972
|
|
|
20921
|
-
pp
|
|
20973
|
+
pp.readToken_caret = function() { // '^'
|
|
20922
20974
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20923
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20924
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
20975
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20976
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
20925
20977
|
};
|
|
20926
20978
|
|
|
20927
|
-
pp
|
|
20979
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
20928
20980
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20929
20981
|
if (next === code) {
|
|
20930
20982
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -20934,19 +20986,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
20934
20986
|
this.skipSpace();
|
|
20935
20987
|
return this.nextToken()
|
|
20936
20988
|
}
|
|
20937
|
-
return this.finishOp(types.incDec, 2)
|
|
20989
|
+
return this.finishOp(types$1.incDec, 2)
|
|
20938
20990
|
}
|
|
20939
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20940
|
-
return this.finishOp(types.plusMin, 1)
|
|
20991
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20992
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
20941
20993
|
};
|
|
20942
20994
|
|
|
20943
|
-
pp
|
|
20995
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
20944
20996
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20945
20997
|
var size = 1;
|
|
20946
20998
|
if (next === code) {
|
|
20947
20999
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
20948
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20949
|
-
return this.finishOp(types.bitShift, size)
|
|
21000
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
21001
|
+
return this.finishOp(types$1.bitShift, size)
|
|
20950
21002
|
}
|
|
20951
21003
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
20952
21004
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -20956,53 +21008,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
20956
21008
|
return this.nextToken()
|
|
20957
21009
|
}
|
|
20958
21010
|
if (next === 61) { size = 2; }
|
|
20959
|
-
return this.finishOp(types.relational, size)
|
|
21011
|
+
return this.finishOp(types$1.relational, size)
|
|
20960
21012
|
};
|
|
20961
21013
|
|
|
20962
|
-
pp
|
|
21014
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
20963
21015
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20964
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
21016
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
20965
21017
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
20966
21018
|
this.pos += 2;
|
|
20967
|
-
return this.finishToken(types.arrow)
|
|
21019
|
+
return this.finishToken(types$1.arrow)
|
|
20968
21020
|
}
|
|
20969
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
21021
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
20970
21022
|
};
|
|
20971
21023
|
|
|
20972
|
-
pp
|
|
21024
|
+
pp.readToken_question = function() { // '?'
|
|
20973
21025
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20974
21026
|
if (ecmaVersion >= 11) {
|
|
20975
21027
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20976
21028
|
if (next === 46) {
|
|
20977
21029
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20978
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
21030
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
20979
21031
|
}
|
|
20980
21032
|
if (next === 63) {
|
|
20981
21033
|
if (ecmaVersion >= 12) {
|
|
20982
21034
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
20983
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
21035
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20984
21036
|
}
|
|
20985
|
-
return this.finishOp(types.coalesce, 2)
|
|
21037
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
20986
21038
|
}
|
|
20987
21039
|
}
|
|
20988
|
-
return this.finishOp(types.question, 1)
|
|
21040
|
+
return this.finishOp(types$1.question, 1)
|
|
20989
21041
|
};
|
|
20990
21042
|
|
|
20991
|
-
pp
|
|
21043
|
+
pp.readToken_numberSign = function() { // '#'
|
|
20992
21044
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20993
21045
|
var code = 35; // '#'
|
|
20994
21046
|
if (ecmaVersion >= 13) {
|
|
20995
21047
|
++this.pos;
|
|
20996
21048
|
code = this.fullCharCodeAtPos();
|
|
20997
21049
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
20998
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21050
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
20999
21051
|
}
|
|
21000
21052
|
}
|
|
21001
21053
|
|
|
21002
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21054
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21003
21055
|
};
|
|
21004
21056
|
|
|
21005
|
-
pp
|
|
21057
|
+
pp.getTokenFromCode = function(code) {
|
|
21006
21058
|
switch (code) {
|
|
21007
21059
|
// The interpretation of a dot depends on whether it is followed
|
|
21008
21060
|
// by a digit or another two dots.
|
|
@@ -21010,20 +21062,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21010
21062
|
return this.readToken_dot()
|
|
21011
21063
|
|
|
21012
21064
|
// Punctuation tokens.
|
|
21013
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
21014
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
21015
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
21016
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
21017
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
21018
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
21019
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
21020
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
21021
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
21065
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21066
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21067
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21068
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21069
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21070
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21071
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21072
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21073
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21022
21074
|
|
|
21023
21075
|
case 96: // '`'
|
|
21024
21076
|
if (this.options.ecmaVersion < 6) { break }
|
|
21025
21077
|
++this.pos;
|
|
21026
|
-
return this.finishToken(types.backQuote)
|
|
21078
|
+
return this.finishToken(types$1.backQuote)
|
|
21027
21079
|
|
|
21028
21080
|
case 48: // '0'
|
|
21029
21081
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21046,7 +21098,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21046
21098
|
// often referred to. `finishOp` simply skips the amount of
|
|
21047
21099
|
// characters it is given as second argument, and returns a token
|
|
21048
21100
|
// of the type given by its first argument.
|
|
21049
|
-
|
|
21050
21101
|
case 47: // '/'
|
|
21051
21102
|
return this.readToken_slash()
|
|
21052
21103
|
|
|
@@ -21072,22 +21123,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21072
21123
|
return this.readToken_question()
|
|
21073
21124
|
|
|
21074
21125
|
case 126: // '~'
|
|
21075
|
-
return this.finishOp(types.prefix, 1)
|
|
21126
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21076
21127
|
|
|
21077
21128
|
case 35: // '#'
|
|
21078
21129
|
return this.readToken_numberSign()
|
|
21079
21130
|
}
|
|
21080
21131
|
|
|
21081
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21132
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21082
21133
|
};
|
|
21083
21134
|
|
|
21084
|
-
pp
|
|
21135
|
+
pp.finishOp = function(type, size) {
|
|
21085
21136
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21086
21137
|
this.pos += size;
|
|
21087
21138
|
return this.finishToken(type, str)
|
|
21088
21139
|
};
|
|
21089
21140
|
|
|
21090
|
-
pp
|
|
21141
|
+
pp.readRegexp = function() {
|
|
21091
21142
|
var escaped, inClass, start = this.pos;
|
|
21092
21143
|
for (;;) {
|
|
21093
21144
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21122,14 +21173,14 @@ pp$9.readRegexp = function() {
|
|
|
21122
21173
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21123
21174
|
}
|
|
21124
21175
|
|
|
21125
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21176
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21126
21177
|
};
|
|
21127
21178
|
|
|
21128
21179
|
// Read an integer in the given radix. Return null if zero digits
|
|
21129
21180
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21130
21181
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21131
21182
|
|
|
21132
|
-
pp
|
|
21183
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21133
21184
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21134
21185
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21135
21186
|
|
|
@@ -21183,7 +21234,7 @@ function stringToBigInt(str) {
|
|
|
21183
21234
|
return BigInt(str.replace(/_/g, ""))
|
|
21184
21235
|
}
|
|
21185
21236
|
|
|
21186
|
-
pp
|
|
21237
|
+
pp.readRadixNumber = function(radix) {
|
|
21187
21238
|
var start = this.pos;
|
|
21188
21239
|
this.pos += 2; // 0x
|
|
21189
21240
|
var val = this.readInt(radix);
|
|
@@ -21192,12 +21243,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21192
21243
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21193
21244
|
++this.pos;
|
|
21194
21245
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21195
|
-
return this.finishToken(types.num, val)
|
|
21246
|
+
return this.finishToken(types$1.num, val)
|
|
21196
21247
|
};
|
|
21197
21248
|
|
|
21198
21249
|
// Read an integer, octal integer, or floating-point number.
|
|
21199
21250
|
|
|
21200
|
-
pp
|
|
21251
|
+
pp.readNumber = function(startsWithDot) {
|
|
21201
21252
|
var start = this.pos;
|
|
21202
21253
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21203
21254
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21207,7 +21258,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21207
21258
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21208
21259
|
++this.pos;
|
|
21209
21260
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21210
|
-
return this.finishToken(types.num, val$1)
|
|
21261
|
+
return this.finishToken(types$1.num, val$1)
|
|
21211
21262
|
}
|
|
21212
21263
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21213
21264
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21223,12 +21274,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21223
21274
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21224
21275
|
|
|
21225
21276
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21226
|
-
return this.finishToken(types.num, val)
|
|
21277
|
+
return this.finishToken(types$1.num, val)
|
|
21227
21278
|
};
|
|
21228
21279
|
|
|
21229
21280
|
// Read a string value, interpreting backslash-escapes.
|
|
21230
21281
|
|
|
21231
|
-
pp
|
|
21282
|
+
pp.readCodePoint = function() {
|
|
21232
21283
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21233
21284
|
|
|
21234
21285
|
if (ch === 123) { // '{'
|
|
@@ -21243,14 +21294,14 @@ pp$9.readCodePoint = function() {
|
|
|
21243
21294
|
return code
|
|
21244
21295
|
};
|
|
21245
21296
|
|
|
21246
|
-
function codePointToString
|
|
21297
|
+
function codePointToString(code) {
|
|
21247
21298
|
// UTF-16 Decoding
|
|
21248
21299
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21249
21300
|
code -= 0x10000;
|
|
21250
21301
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21251
21302
|
}
|
|
21252
21303
|
|
|
21253
|
-
pp
|
|
21304
|
+
pp.readString = function(quote) {
|
|
21254
21305
|
var out = "", chunkStart = ++this.pos;
|
|
21255
21306
|
for (;;) {
|
|
21256
21307
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21273,14 +21324,14 @@ pp$9.readString = function(quote) {
|
|
|
21273
21324
|
}
|
|
21274
21325
|
}
|
|
21275
21326
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21276
|
-
return this.finishToken(types.string, out)
|
|
21327
|
+
return this.finishToken(types$1.string, out)
|
|
21277
21328
|
};
|
|
21278
21329
|
|
|
21279
21330
|
// Reads template string tokens.
|
|
21280
21331
|
|
|
21281
21332
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21282
21333
|
|
|
21283
|
-
pp
|
|
21334
|
+
pp.tryReadTemplateToken = function() {
|
|
21284
21335
|
this.inTemplateElement = true;
|
|
21285
21336
|
try {
|
|
21286
21337
|
this.readTmplToken();
|
|
@@ -21295,7 +21346,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21295
21346
|
this.inTemplateElement = false;
|
|
21296
21347
|
};
|
|
21297
21348
|
|
|
21298
|
-
pp
|
|
21349
|
+
pp.invalidStringToken = function(position, message) {
|
|
21299
21350
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21300
21351
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21301
21352
|
} else {
|
|
@@ -21303,23 +21354,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21303
21354
|
}
|
|
21304
21355
|
};
|
|
21305
21356
|
|
|
21306
|
-
pp
|
|
21357
|
+
pp.readTmplToken = function() {
|
|
21307
21358
|
var out = "", chunkStart = this.pos;
|
|
21308
21359
|
for (;;) {
|
|
21309
21360
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21310
21361
|
var ch = this.input.charCodeAt(this.pos);
|
|
21311
21362
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
21312
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
21363
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21313
21364
|
if (ch === 36) {
|
|
21314
21365
|
this.pos += 2;
|
|
21315
|
-
return this.finishToken(types.dollarBraceL)
|
|
21366
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21316
21367
|
} else {
|
|
21317
21368
|
++this.pos;
|
|
21318
|
-
return this.finishToken(types.backQuote)
|
|
21369
|
+
return this.finishToken(types$1.backQuote)
|
|
21319
21370
|
}
|
|
21320
21371
|
}
|
|
21321
21372
|
out += this.input.slice(chunkStart, this.pos);
|
|
21322
|
-
return this.finishToken(types.template, out)
|
|
21373
|
+
return this.finishToken(types$1.template, out)
|
|
21323
21374
|
}
|
|
21324
21375
|
if (ch === 92) { // '\'
|
|
21325
21376
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21350,7 +21401,7 @@ pp$9.readTmplToken = function() {
|
|
|
21350
21401
|
};
|
|
21351
21402
|
|
|
21352
21403
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21353
|
-
pp
|
|
21404
|
+
pp.readInvalidTemplateToken = function() {
|
|
21354
21405
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21355
21406
|
switch (this.input[this.pos]) {
|
|
21356
21407
|
case "\\":
|
|
@@ -21361,10 +21412,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21361
21412
|
if (this.input[this.pos + 1] !== "{") {
|
|
21362
21413
|
break
|
|
21363
21414
|
}
|
|
21364
|
-
// falls through
|
|
21365
21415
|
|
|
21416
|
+
// falls through
|
|
21366
21417
|
case "`":
|
|
21367
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21418
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21368
21419
|
|
|
21369
21420
|
// no default
|
|
21370
21421
|
}
|
|
@@ -21374,14 +21425,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21374
21425
|
|
|
21375
21426
|
// Used to read escaped characters
|
|
21376
21427
|
|
|
21377
|
-
pp
|
|
21428
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21378
21429
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21379
21430
|
++this.pos;
|
|
21380
21431
|
switch (ch) {
|
|
21381
21432
|
case 110: return "\n" // 'n' -> '\n'
|
|
21382
21433
|
case 114: return "\r" // 'r' -> '\r'
|
|
21383
21434
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21384
|
-
case 117: return codePointToString
|
|
21435
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21385
21436
|
case 116: return "\t" // 't' -> '\t'
|
|
21386
21437
|
case 98: return "\b" // 'b' -> '\b'
|
|
21387
21438
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21439,7 +21490,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21439
21490
|
|
|
21440
21491
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21441
21492
|
|
|
21442
|
-
pp
|
|
21493
|
+
pp.readHexChar = function(len) {
|
|
21443
21494
|
var codePos = this.pos;
|
|
21444
21495
|
var n = this.readInt(16, len);
|
|
21445
21496
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21452,7 +21503,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21452
21503
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21453
21504
|
// as a micro-optimization.
|
|
21454
21505
|
|
|
21455
|
-
pp
|
|
21506
|
+
pp.readWord1 = function() {
|
|
21456
21507
|
this.containsEsc = false;
|
|
21457
21508
|
var word = "", first = true, chunkStart = this.pos;
|
|
21458
21509
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21470,7 +21521,7 @@ pp$9.readWord1 = function() {
|
|
|
21470
21521
|
var esc = this.readCodePoint();
|
|
21471
21522
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21472
21523
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21473
|
-
word += codePointToString
|
|
21524
|
+
word += codePointToString(esc);
|
|
21474
21525
|
chunkStart = this.pos;
|
|
21475
21526
|
} else {
|
|
21476
21527
|
break
|
|
@@ -21483,18 +21534,18 @@ pp$9.readWord1 = function() {
|
|
|
21483
21534
|
// Read an identifier or keyword token. Will check for reserved
|
|
21484
21535
|
// words when necessary.
|
|
21485
21536
|
|
|
21486
|
-
pp
|
|
21537
|
+
pp.readWord = function() {
|
|
21487
21538
|
var word = this.readWord1();
|
|
21488
|
-
var type = types.name;
|
|
21539
|
+
var type = types$1.name;
|
|
21489
21540
|
if (this.keywords.test(word)) {
|
|
21490
|
-
type = keywords
|
|
21541
|
+
type = keywords[word];
|
|
21491
21542
|
}
|
|
21492
21543
|
return this.finishToken(type, word)
|
|
21493
21544
|
};
|
|
21494
21545
|
|
|
21495
21546
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21496
21547
|
|
|
21497
|
-
var version = "8.
|
|
21548
|
+
var version = "8.6.0";
|
|
21498
21549
|
|
|
21499
21550
|
Parser.acorn = {
|
|
21500
21551
|
Parser: Parser,
|
|
@@ -21505,10 +21556,10 @@ Parser.acorn = {
|
|
|
21505
21556
|
getLineInfo: getLineInfo,
|
|
21506
21557
|
Node: Node,
|
|
21507
21558
|
TokenType: TokenType,
|
|
21508
|
-
tokTypes: types,
|
|
21509
|
-
keywordTypes: keywords
|
|
21559
|
+
tokTypes: types$1,
|
|
21560
|
+
keywordTypes: keywords,
|
|
21510
21561
|
TokContext: TokContext,
|
|
21511
|
-
tokContexts: types
|
|
21562
|
+
tokContexts: types,
|
|
21512
21563
|
isIdentifierChar: isIdentifierChar,
|
|
21513
21564
|
isIdentifierStart: isIdentifierStart,
|
|
21514
21565
|
Token: Token,
|
|
@@ -21521,20 +21572,7 @@ Parser.acorn = {
|
|
|
21521
21572
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21522
21573
|
function mkdirpath(path) {
|
|
21523
21574
|
const dir = dirname(path);
|
|
21524
|
-
|
|
21525
|
-
fs.readdirSync(dir);
|
|
21526
|
-
}
|
|
21527
|
-
catch (_a) {
|
|
21528
|
-
mkdirpath(dir);
|
|
21529
|
-
try {
|
|
21530
|
-
fs.mkdirSync(dir);
|
|
21531
|
-
}
|
|
21532
|
-
catch (err) {
|
|
21533
|
-
if (err.code !== 'EEXIST') {
|
|
21534
|
-
throw err;
|
|
21535
|
-
}
|
|
21536
|
-
}
|
|
21537
|
-
}
|
|
21575
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21538
21576
|
}
|
|
21539
21577
|
function writeFile(dest, data) {
|
|
21540
21578
|
return new Promise((fulfil, reject) => {
|
|
@@ -21763,7 +21801,7 @@ function getCacheForUncacheablePlugin(pluginName) {
|
|
|
21763
21801
|
};
|
|
21764
21802
|
}
|
|
21765
21803
|
|
|
21766
|
-
function transform(source, module, pluginDriver, warn) {
|
|
21804
|
+
async function transform(source, module, pluginDriver, warn) {
|
|
21767
21805
|
const id = module.id;
|
|
21768
21806
|
const sourcemapChain = [];
|
|
21769
21807
|
let originalSourcemap = source.map === null ? null : decodedSourcemap(source.map);
|
|
@@ -21773,7 +21811,7 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
21773
21811
|
const emittedFiles = [];
|
|
21774
21812
|
let customTransformCache = false;
|
|
21775
21813
|
const useCustomTransformCache = () => (customTransformCache = true);
|
|
21776
|
-
let
|
|
21814
|
+
let pluginName = '';
|
|
21777
21815
|
const curSource = source.code;
|
|
21778
21816
|
function transformReducer(previousCode, result, plugin) {
|
|
21779
21817
|
let code;
|
|
@@ -21804,90 +21842,92 @@ function transform(source, module, pluginDriver, warn) {
|
|
|
21804
21842
|
}
|
|
21805
21843
|
return code;
|
|
21806
21844
|
}
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
originalSourcemap
|
|
21848
|
-
|
|
21845
|
+
let code;
|
|
21846
|
+
try {
|
|
21847
|
+
code = await pluginDriver.hookReduceArg0('transform', [curSource, id], transformReducer, (pluginContext, plugin) => {
|
|
21848
|
+
pluginName = plugin.name;
|
|
21849
|
+
return {
|
|
21850
|
+
...pluginContext,
|
|
21851
|
+
addWatchFile(id) {
|
|
21852
|
+
transformDependencies.push(id);
|
|
21853
|
+
pluginContext.addWatchFile(id);
|
|
21854
|
+
},
|
|
21855
|
+
cache: customTransformCache
|
|
21856
|
+
? pluginContext.cache
|
|
21857
|
+
: getTrackedPluginCache(pluginContext.cache, useCustomTransformCache),
|
|
21858
|
+
emitAsset(name, source) {
|
|
21859
|
+
emittedFiles.push({ name, source, type: 'asset' });
|
|
21860
|
+
return pluginContext.emitAsset(name, source);
|
|
21861
|
+
},
|
|
21862
|
+
emitChunk(id, options) {
|
|
21863
|
+
emittedFiles.push({ id, name: options && options.name, type: 'chunk' });
|
|
21864
|
+
return pluginContext.emitChunk(id, options);
|
|
21865
|
+
},
|
|
21866
|
+
emitFile(emittedFile) {
|
|
21867
|
+
emittedFiles.push(emittedFile);
|
|
21868
|
+
return pluginDriver.emitFile(emittedFile);
|
|
21869
|
+
},
|
|
21870
|
+
error(err, pos) {
|
|
21871
|
+
if (typeof err === 'string')
|
|
21872
|
+
err = { message: err };
|
|
21873
|
+
if (pos)
|
|
21874
|
+
augmentCodeLocation(err, pos, curSource, id);
|
|
21875
|
+
err.id = id;
|
|
21876
|
+
err.hook = 'transform';
|
|
21877
|
+
return pluginContext.error(err);
|
|
21878
|
+
},
|
|
21879
|
+
getCombinedSourcemap() {
|
|
21880
|
+
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
|
|
21881
|
+
if (!combinedMap) {
|
|
21882
|
+
const magicString = new MagicString$1(originalCode);
|
|
21883
|
+
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
21884
|
+
}
|
|
21885
|
+
if (originalSourcemap !== combinedMap) {
|
|
21886
|
+
originalSourcemap = combinedMap;
|
|
21887
|
+
sourcemapChain.length = 0;
|
|
21888
|
+
}
|
|
21889
|
+
return new SourceMap({
|
|
21890
|
+
...combinedMap,
|
|
21891
|
+
file: null,
|
|
21892
|
+
sourcesContent: combinedMap.sourcesContent
|
|
21893
|
+
});
|
|
21894
|
+
},
|
|
21895
|
+
setAssetSource() {
|
|
21896
|
+
return this.error({
|
|
21897
|
+
code: 'INVALID_SETASSETSOURCE',
|
|
21898
|
+
message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
|
|
21899
|
+
});
|
|
21900
|
+
},
|
|
21901
|
+
warn(warning, pos) {
|
|
21902
|
+
if (typeof warning === 'string')
|
|
21903
|
+
warning = { message: warning };
|
|
21904
|
+
if (pos)
|
|
21905
|
+
augmentCodeLocation(warning, pos, curSource, id);
|
|
21906
|
+
warning.id = id;
|
|
21907
|
+
warning.hook = 'transform';
|
|
21908
|
+
pluginContext.warn(warning);
|
|
21849
21909
|
}
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
};
|
|
21872
|
-
})
|
|
21873
|
-
.catch(err => throwPluginError(err, curPlugin.name, { hook: 'transform', id }))
|
|
21874
|
-
.then(code => {
|
|
21875
|
-
if (!customTransformCache) {
|
|
21876
|
-
// files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
21877
|
-
if (emittedFiles.length)
|
|
21878
|
-
module.transformFiles = emittedFiles;
|
|
21879
|
-
}
|
|
21880
|
-
return {
|
|
21881
|
-
ast,
|
|
21882
|
-
code,
|
|
21883
|
-
customTransformCache,
|
|
21884
|
-
meta: module.info.meta,
|
|
21885
|
-
originalCode,
|
|
21886
|
-
originalSourcemap,
|
|
21887
|
-
sourcemapChain,
|
|
21888
|
-
transformDependencies
|
|
21889
|
-
};
|
|
21890
|
-
});
|
|
21910
|
+
};
|
|
21911
|
+
});
|
|
21912
|
+
}
|
|
21913
|
+
catch (err) {
|
|
21914
|
+
throwPluginError(err, pluginName, { hook: 'transform', id });
|
|
21915
|
+
}
|
|
21916
|
+
if (!customTransformCache) {
|
|
21917
|
+
// files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
21918
|
+
if (emittedFiles.length)
|
|
21919
|
+
module.transformFiles = emittedFiles;
|
|
21920
|
+
}
|
|
21921
|
+
return {
|
|
21922
|
+
ast,
|
|
21923
|
+
code,
|
|
21924
|
+
customTransformCache,
|
|
21925
|
+
meta: module.info.meta,
|
|
21926
|
+
originalCode,
|
|
21927
|
+
originalSourcemap,
|
|
21928
|
+
sourcemapChain,
|
|
21929
|
+
transformDependencies
|
|
21930
|
+
};
|
|
21891
21931
|
}
|
|
21892
21932
|
|
|
21893
21933
|
class ModuleLoader {
|
|
@@ -21900,6 +21940,7 @@ class ModuleLoader {
|
|
|
21900
21940
|
this.indexedEntryModules = [];
|
|
21901
21941
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
21902
21942
|
this.moduleLoadPromises = new Map();
|
|
21943
|
+
this.modulesWithLoadedDependencies = new Set();
|
|
21903
21944
|
this.nextEntryModuleIndex = 0;
|
|
21904
21945
|
this.readQueue = new Queue();
|
|
21905
21946
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
@@ -21973,7 +22014,7 @@ class ModuleLoader {
|
|
|
21973
22014
|
return {
|
|
21974
22015
|
external,
|
|
21975
22016
|
id: resolvedId.id,
|
|
21976
|
-
meta: resolvedId.meta ||
|
|
22017
|
+
meta: resolvedId.meta || {},
|
|
21977
22018
|
moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
|
|
21978
22019
|
syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
|
|
21979
22020
|
};
|
|
@@ -22078,7 +22119,8 @@ class ModuleLoader {
|
|
|
22078
22119
|
this.graph.watchFiles[id] = true;
|
|
22079
22120
|
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22080
22121
|
this.getResolveStaticDependencyPromises(module),
|
|
22081
|
-
this.getResolveDynamicImportPromises(module)
|
|
22122
|
+
this.getResolveDynamicImportPromises(module),
|
|
22123
|
+
loadAndResolveDependenciesPromise
|
|
22082
22124
|
]);
|
|
22083
22125
|
const loadAndResolveDependenciesPromise = loadPromise
|
|
22084
22126
|
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
@@ -22086,23 +22128,25 @@ class ModuleLoader {
|
|
|
22086
22128
|
loadAndResolveDependenciesPromise.catch(() => {
|
|
22087
22129
|
/* avoid unhandled promise rejections */
|
|
22088
22130
|
});
|
|
22089
|
-
|
|
22090
|
-
|
|
22091
|
-
|
|
22092
|
-
|
|
22093
|
-
else {
|
|
22094
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22095
|
-
// To handle errors when resolving dependencies or in moduleParsed
|
|
22096
|
-
await loadAndResolveDependenciesPromise;
|
|
22131
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22132
|
+
const resolveDependencyPromises = await loadPromise;
|
|
22133
|
+
if (!isPreload) {
|
|
22134
|
+
await this.fetchModuleDependencies(module, ...resolveDependencyPromises);
|
|
22097
22135
|
}
|
|
22098
22136
|
return module;
|
|
22099
22137
|
}
|
|
22100
|
-
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22138
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises, loadAndResolveDependenciesPromise) {
|
|
22139
|
+
if (this.modulesWithLoadedDependencies.has(module)) {
|
|
22140
|
+
return;
|
|
22141
|
+
}
|
|
22142
|
+
this.modulesWithLoadedDependencies.add(module);
|
|
22101
22143
|
await Promise.all([
|
|
22102
22144
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22103
22145
|
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22104
22146
|
]);
|
|
22105
22147
|
module.linkImports();
|
|
22148
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22149
|
+
await loadAndResolveDependenciesPromise;
|
|
22106
22150
|
}
|
|
22107
22151
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22108
22152
|
if (resolvedId.external) {
|
|
@@ -22191,8 +22235,7 @@ class ModuleLoader {
|
|
|
22191
22235
|
async handleExistingModule(module, isEntry, isPreload) {
|
|
22192
22236
|
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22193
22237
|
if (isPreload) {
|
|
22194
|
-
|
|
22195
|
-
return;
|
|
22238
|
+
return loadPromise;
|
|
22196
22239
|
}
|
|
22197
22240
|
if (isEntry) {
|
|
22198
22241
|
module.info.isEntry = true;
|
|
@@ -22202,11 +22245,7 @@ class ModuleLoader {
|
|
|
22202
22245
|
}
|
|
22203
22246
|
module.implicitlyLoadedAfter.clear();
|
|
22204
22247
|
}
|
|
22205
|
-
|
|
22206
|
-
this.moduleLoadPromises.delete(module);
|
|
22207
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22208
|
-
}
|
|
22209
|
-
return;
|
|
22248
|
+
return this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22210
22249
|
}
|
|
22211
22250
|
handleResolveId(resolvedId, source, importer) {
|
|
22212
22251
|
if (resolvedId === null) {
|
|
@@ -22217,7 +22256,7 @@ class ModuleLoader {
|
|
|
22217
22256
|
return {
|
|
22218
22257
|
external: true,
|
|
22219
22258
|
id: source,
|
|
22220
|
-
meta:
|
|
22259
|
+
meta: {},
|
|
22221
22260
|
moduleSideEffects: this.hasModuleSideEffects(source, true),
|
|
22222
22261
|
syntheticNamedExports: false
|
|
22223
22262
|
};
|
|
@@ -22412,6 +22451,40 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22412
22451
|
return context;
|
|
22413
22452
|
}
|
|
22414
22453
|
|
|
22454
|
+
const unfulfilledActions = new Set();
|
|
22455
|
+
function addUnresolvedAction(actionTuple) {
|
|
22456
|
+
unfulfilledActions.add(actionTuple);
|
|
22457
|
+
}
|
|
22458
|
+
function resolveAction(actionTuple) {
|
|
22459
|
+
unfulfilledActions.delete(actionTuple);
|
|
22460
|
+
}
|
|
22461
|
+
function formatAction([pluginName, hookName, args]) {
|
|
22462
|
+
let action = `(${pluginName}) ${hookName}`;
|
|
22463
|
+
const s = JSON.stringify;
|
|
22464
|
+
switch (hookName) {
|
|
22465
|
+
case 'resolveId':
|
|
22466
|
+
action += ` ${s(args[0])} ${s(args[1])}`;
|
|
22467
|
+
break;
|
|
22468
|
+
case 'load':
|
|
22469
|
+
action += ` ${s(args[0])}`;
|
|
22470
|
+
break;
|
|
22471
|
+
case 'transform':
|
|
22472
|
+
action += ` ${s(args[1])}`;
|
|
22473
|
+
break;
|
|
22474
|
+
}
|
|
22475
|
+
return action;
|
|
22476
|
+
}
|
|
22477
|
+
process.on('exit', () => {
|
|
22478
|
+
if (unfulfilledActions.size) {
|
|
22479
|
+
let err = '[!] Error: unfinished hook action(s) on exit:\n';
|
|
22480
|
+
for (const action of unfulfilledActions) {
|
|
22481
|
+
err += formatAction(action) + '\n';
|
|
22482
|
+
}
|
|
22483
|
+
console.error('%s', err);
|
|
22484
|
+
process.exit(1);
|
|
22485
|
+
}
|
|
22486
|
+
});
|
|
22487
|
+
|
|
22415
22488
|
const inputHookNames = {
|
|
22416
22489
|
buildEnd: 1,
|
|
22417
22490
|
buildStart: 1,
|
|
@@ -22563,6 +22636,7 @@ class PluginDriver {
|
|
|
22563
22636
|
if (hookContext) {
|
|
22564
22637
|
context = hookContext(context, plugin);
|
|
22565
22638
|
}
|
|
22639
|
+
let action = null;
|
|
22566
22640
|
return Promise.resolve()
|
|
22567
22641
|
.then(() => {
|
|
22568
22642
|
// permit values allows values to be returned instead of a functional hook
|
|
@@ -22572,9 +22646,35 @@ class PluginDriver {
|
|
|
22572
22646
|
return throwInvalidHookError(hookName, plugin.name);
|
|
22573
22647
|
}
|
|
22574
22648
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22575
|
-
|
|
22649
|
+
const hookResult = hook.apply(context, args);
|
|
22650
|
+
if (!hookResult || !hookResult.then) {
|
|
22651
|
+
// short circuit for non-thenables and non-Promises
|
|
22652
|
+
return hookResult;
|
|
22653
|
+
}
|
|
22654
|
+
// Track pending hook actions to properly error out when
|
|
22655
|
+
// unfulfilled promises cause rollup to abruptly and confusingly
|
|
22656
|
+
// exit with a successful 0 return code but without producing any
|
|
22657
|
+
// output, errors or warnings.
|
|
22658
|
+
action = [plugin.name, hookName, args];
|
|
22659
|
+
addUnresolvedAction(action);
|
|
22660
|
+
// Although it would be more elegant to just return hookResult here
|
|
22661
|
+
// and put the .then() handler just above the .catch() handler below,
|
|
22662
|
+
// doing so would subtly change the defacto async event dispatch order
|
|
22663
|
+
// which at least one test and some plugins in the wild may depend on.
|
|
22664
|
+
const promise = Promise.resolve(hookResult);
|
|
22665
|
+
return promise.then(() => {
|
|
22666
|
+
// action was fulfilled
|
|
22667
|
+
resolveAction(action);
|
|
22668
|
+
return promise;
|
|
22669
|
+
});
|
|
22576
22670
|
})
|
|
22577
|
-
.catch(err =>
|
|
22671
|
+
.catch(err => {
|
|
22672
|
+
if (action !== null) {
|
|
22673
|
+
// action considered to be fulfilled since error being handled
|
|
22674
|
+
resolveAction(action);
|
|
22675
|
+
}
|
|
22676
|
+
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22677
|
+
});
|
|
22578
22678
|
}
|
|
22579
22679
|
/**
|
|
22580
22680
|
* Run a sync plugin hook and return the result.
|
|
@@ -22887,6 +22987,7 @@ const generatedCodePresets = {
|
|
|
22887
22987
|
reservedNamesAsProps: true
|
|
22888
22988
|
}
|
|
22889
22989
|
};
|
|
22990
|
+
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
22890
22991
|
const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (value) => {
|
|
22891
22992
|
if (typeof value === 'string') {
|
|
22892
22993
|
const preset = presets[value];
|
|
@@ -22895,7 +22996,7 @@ const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (v
|
|
|
22895
22996
|
}
|
|
22896
22997
|
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));
|
|
22897
22998
|
}
|
|
22898
|
-
return value
|
|
22999
|
+
return objectifyOption(value);
|
|
22899
23000
|
};
|
|
22900
23001
|
const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
|
|
22901
23002
|
var _a;
|
|
@@ -23543,15 +23644,14 @@ function defineConfig(options) {
|
|
|
23543
23644
|
|
|
23544
23645
|
let fsEvents;
|
|
23545
23646
|
let fsEventsImportError;
|
|
23546
|
-
function loadFsEvents() {
|
|
23647
|
+
async function loadFsEvents() {
|
|
23547
23648
|
const moduleName = 'fsevents';
|
|
23548
|
-
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
|
-
|
|
23552
|
-
.catch(err => {
|
|
23649
|
+
try {
|
|
23650
|
+
({ default: fsEvents } = await import(moduleName));
|
|
23651
|
+
}
|
|
23652
|
+
catch (err) {
|
|
23553
23653
|
fsEventsImportError = err;
|
|
23554
|
-
}
|
|
23654
|
+
}
|
|
23555
23655
|
}
|
|
23556
23656
|
// A call to this function will be injected into the chokidar code
|
|
23557
23657
|
function getFsEvents() {
|
|
@@ -23588,4 +23688,4 @@ function watch(configs) {
|
|
|
23588
23688
|
return emitter;
|
|
23589
23689
|
}
|
|
23590
23690
|
|
|
23591
|
-
export { createFilter, defaultOnWarn, defineConfig, ensureArray, fseventsImporter, generatedCodePresets, getAugmentedNamespace, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|
|
23691
|
+
export { createFilter, defaultOnWarn, defineConfig, ensureArray, fseventsImporter, generatedCodePresets, getAugmentedNamespace, objectifyOption, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|