rollup 2.60.1 → 2.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/dist/bin/rollup +3 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +724 -690
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +3 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +1 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +96 -37
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +724 -690
- package/dist/shared/watch-cli.js +36 -13
- package/dist/shared/watch.js +2 -2
- package/package.json +22 -22
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.62.0
|
|
4
|
+
Fri, 24 Dec 2021 06:27:02 GMT - commit 81ce56f87de5fae51c00c4a0a977830ee93c5987
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -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.62.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,8 @@ 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
|
+
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8120
|
+
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
8096
8121
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
8097
8122
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
8098
8123
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
@@ -8110,6 +8135,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
8110
8135
|
some: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN,
|
|
8111
8136
|
sort: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF,
|
|
8112
8137
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
8138
|
+
toLocaleString: METHOD_RETURNS_STRING,
|
|
8139
|
+
toString: METHOD_RETURNS_STRING,
|
|
8113
8140
|
unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
|
|
8114
8141
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
8115
8142
|
}, OBJECT_PROTOTYPE, true);
|
|
@@ -11942,13 +11969,19 @@ class SyntheticNamedExportVariable extends Variable {
|
|
|
11942
11969
|
}
|
|
11943
11970
|
}
|
|
11944
11971
|
|
|
11972
|
+
var BuildPhase;
|
|
11973
|
+
(function (BuildPhase) {
|
|
11974
|
+
BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
|
|
11975
|
+
BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
|
|
11976
|
+
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
11977
|
+
})(BuildPhase || (BuildPhase = {}));
|
|
11978
|
+
|
|
11945
11979
|
function getId(m) {
|
|
11946
11980
|
return m.id;
|
|
11947
11981
|
}
|
|
11948
11982
|
|
|
11949
11983
|
function getOriginalLocation(sourcemapChain, location) {
|
|
11950
|
-
|
|
11951
|
-
const filteredSourcemapChain = sourcemapChain.filter(sourcemap => sourcemap.mappings);
|
|
11984
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
11952
11985
|
while (filteredSourcemapChain.length > 0) {
|
|
11953
11986
|
const sourcemap = filteredSourcemapChain.pop();
|
|
11954
11987
|
const line = sourcemap.mappings[location.line - 1];
|
|
@@ -12221,10 +12254,10 @@ class Module {
|
|
|
12221
12254
|
hasModuleSideEffects,
|
|
12222
12255
|
id,
|
|
12223
12256
|
get implicitlyLoadedAfterOneOf() {
|
|
12224
|
-
return Array.from(module.implicitlyLoadedAfter, getId);
|
|
12257
|
+
return Array.from(module.implicitlyLoadedAfter, getId).sort();
|
|
12225
12258
|
},
|
|
12226
12259
|
get implicitlyLoadedBefore() {
|
|
12227
|
-
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12260
|
+
return Array.from(module.implicitlyLoadedBefore, getId).sort();
|
|
12228
12261
|
},
|
|
12229
12262
|
get importedIds() {
|
|
12230
12263
|
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 +12267,12 @@ class Module {
|
|
|
12234
12267
|
},
|
|
12235
12268
|
isEntry,
|
|
12236
12269
|
isExternal: false,
|
|
12270
|
+
get isIncluded() {
|
|
12271
|
+
if (module.graph.phase !== BuildPhase.GENERATE) {
|
|
12272
|
+
return null;
|
|
12273
|
+
}
|
|
12274
|
+
return module.isIncluded();
|
|
12275
|
+
},
|
|
12237
12276
|
meta,
|
|
12238
12277
|
syntheticNamedExports
|
|
12239
12278
|
};
|
|
@@ -14024,7 +14063,7 @@ function escapeId(id) {
|
|
|
14024
14063
|
function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
|
|
14025
14064
|
let nameIndex = 0;
|
|
14026
14065
|
for (const variable of exports) {
|
|
14027
|
-
let exportName = variable.name
|
|
14066
|
+
let [exportName] = variable.name;
|
|
14028
14067
|
if (exportsByName[exportName]) {
|
|
14029
14068
|
do {
|
|
14030
14069
|
exportName = toBase64(++nameIndex);
|
|
@@ -14033,7 +14072,7 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14033
14072
|
nameIndex += 9 * 64 ** (exportName.length - 1);
|
|
14034
14073
|
exportName = toBase64(nameIndex);
|
|
14035
14074
|
}
|
|
14036
|
-
} while (RESERVED_NAMES
|
|
14075
|
+
} while (RESERVED_NAMES$1.has(exportName) || exportsByName[exportName]);
|
|
14037
14076
|
}
|
|
14038
14077
|
exportsByName[exportName] = variable;
|
|
14039
14078
|
exportNamesByVariable.set(variable, [exportName]);
|
|
@@ -14848,11 +14887,11 @@ class Chunk {
|
|
|
14848
14887
|
continue;
|
|
14849
14888
|
}
|
|
14850
14889
|
const renderedResolution = resolution instanceof Module
|
|
14851
|
-
? `'${this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions)}'`
|
|
14890
|
+
? `'${escapeId(this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions))}'`
|
|
14852
14891
|
: resolution instanceof ExternalModule
|
|
14853
|
-
? `'${resolution.renormalizeRenderPath
|
|
14892
|
+
? `'${escapeId(resolution.renormalizeRenderPath
|
|
14854
14893
|
? this.getRelativePath(resolution.renderPath, stripKnownJsExtensions)
|
|
14855
|
-
: resolution.renderPath}'`
|
|
14894
|
+
: resolution.renderPath)}'`
|
|
14856
14895
|
: resolution;
|
|
14857
14896
|
node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
|
|
14858
14897
|
!(facadeChunk === null || facadeChunk === void 0 ? void 0 : facadeChunk.strictFacade) &&
|
|
@@ -15251,13 +15290,6 @@ function getChunkNameFromModule(module) {
|
|
|
15251
15290
|
return module.chunkName || getAliasName(module.id);
|
|
15252
15291
|
}
|
|
15253
15292
|
|
|
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
15293
|
function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
15262
15294
|
const emittedName = outputOptions.sanitizeFileName(name || 'asset');
|
|
15263
15295
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
@@ -15768,7 +15800,7 @@ function getGenerateCodeSnippets({ compact, generatedCode: { arrowFunctions, con
|
|
|
15768
15800
|
];
|
|
15769
15801
|
const isValidPropName = reservedNamesAsProps
|
|
15770
15802
|
? (name) => validPropName.test(name)
|
|
15771
|
-
: (name) => !RESERVED_NAMES
|
|
15803
|
+
: (name) => !RESERVED_NAMES$1.has(name) && validPropName.test(name);
|
|
15772
15804
|
return {
|
|
15773
15805
|
_,
|
|
15774
15806
|
cnst,
|
|
@@ -15993,7 +16025,7 @@ function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
|
|
|
15993
16025
|
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
16026
|
}
|
|
15995
16027
|
function getIncludedModules(modulesById) {
|
|
15996
|
-
return [...modulesById.values()].filter(module => module instanceof Module &&
|
|
16028
|
+
return [...modulesById.values()].filter((module) => module instanceof Module &&
|
|
15997
16029
|
(module.isIncluded() || module.info.isEntry || module.includedDynamicImporters.length > 0));
|
|
15998
16030
|
}
|
|
15999
16031
|
function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
@@ -16018,7 +16050,7 @@ var reservedWords = {
|
|
|
16018
16050
|
|
|
16019
16051
|
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
16052
|
|
|
16021
|
-
var keywords = {
|
|
16053
|
+
var keywords$1 = {
|
|
16022
16054
|
5: ecma5AndLessKeywords,
|
|
16023
16055
|
"5module": ecma5AndLessKeywords + " export import",
|
|
16024
16056
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -16137,17 +16169,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
16137
16169
|
|
|
16138
16170
|
// Map keyword names to token types.
|
|
16139
16171
|
|
|
16140
|
-
var keywords
|
|
16172
|
+
var keywords = {};
|
|
16141
16173
|
|
|
16142
16174
|
// Succinct definitions of keyword token types
|
|
16143
16175
|
function kw(name, options) {
|
|
16144
16176
|
if ( options === void 0 ) options = {};
|
|
16145
16177
|
|
|
16146
16178
|
options.keyword = name;
|
|
16147
|
-
return keywords
|
|
16179
|
+
return keywords[name] = new TokenType(name, options)
|
|
16148
16180
|
}
|
|
16149
16181
|
|
|
16150
|
-
var types = {
|
|
16182
|
+
var types$1 = {
|
|
16151
16183
|
num: new TokenType("num", startsExpr),
|
|
16152
16184
|
regexp: new TokenType("regexp", startsExpr),
|
|
16153
16185
|
string: new TokenType("string", startsExpr),
|
|
@@ -16489,7 +16521,7 @@ var
|
|
|
16489
16521
|
var Parser = function Parser(options, input, startPos) {
|
|
16490
16522
|
this.options = options = getOptions(options);
|
|
16491
16523
|
this.sourceFile = options.sourceFile;
|
|
16492
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16524
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
16493
16525
|
var reserved = "";
|
|
16494
16526
|
if (options.allowReserved !== true) {
|
|
16495
16527
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -16520,7 +16552,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
16520
16552
|
|
|
16521
16553
|
// Properties of the current token:
|
|
16522
16554
|
// Its type
|
|
16523
|
-
this.type = types.eof;
|
|
16555
|
+
this.type = types$1.eof;
|
|
16524
16556
|
// For tokens that include more information than their type, the value
|
|
16525
16557
|
this.value = null;
|
|
16526
16558
|
// Its start and end offset
|
|
@@ -16580,8 +16612,11 @@ Parser.prototype.parse = function parse () {
|
|
|
16580
16612
|
};
|
|
16581
16613
|
|
|
16582
16614
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
16615
|
+
|
|
16583
16616
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16617
|
+
|
|
16584
16618
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
16619
|
+
|
|
16585
16620
|
prototypeAccessors.canAwait.get = function () {
|
|
16586
16621
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
16587
16622
|
var scope = this.scopeStack[i];
|
|
@@ -16590,20 +16625,25 @@ prototypeAccessors.canAwait.get = function () {
|
|
|
16590
16625
|
}
|
|
16591
16626
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
16592
16627
|
};
|
|
16628
|
+
|
|
16593
16629
|
prototypeAccessors.allowSuper.get = function () {
|
|
16594
16630
|
var ref = this.currentThisScope();
|
|
16595
16631
|
var flags = ref.flags;
|
|
16596
16632
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16597
16633
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
16598
16634
|
};
|
|
16635
|
+
|
|
16599
16636
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
16637
|
+
|
|
16600
16638
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
16639
|
+
|
|
16601
16640
|
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
16602
16641
|
var ref = this.currentThisScope();
|
|
16603
16642
|
var flags = ref.flags;
|
|
16604
16643
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
16605
16644
|
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
16606
16645
|
};
|
|
16646
|
+
|
|
16607
16647
|
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
16608
16648
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
16609
16649
|
};
|
|
@@ -16633,12 +16673,12 @@ Parser.tokenizer = function tokenizer (input, options) {
|
|
|
16633
16673
|
|
|
16634
16674
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
16635
16675
|
|
|
16636
|
-
var pp = Parser.prototype;
|
|
16676
|
+
var pp$9 = Parser.prototype;
|
|
16637
16677
|
|
|
16638
16678
|
// ## Parser utilities
|
|
16639
16679
|
|
|
16640
16680
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16641
|
-
pp.strictDirective = function(start) {
|
|
16681
|
+
pp$9.strictDirective = function(start) {
|
|
16642
16682
|
for (;;) {
|
|
16643
16683
|
// Try to find string literal.
|
|
16644
16684
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16666,7 +16706,7 @@ pp.strictDirective = function(start) {
|
|
|
16666
16706
|
// Predicate that tests whether the next token is of the given
|
|
16667
16707
|
// type, and if yes, consumes it as a side effect.
|
|
16668
16708
|
|
|
16669
|
-
pp.eat = function(type) {
|
|
16709
|
+
pp$9.eat = function(type) {
|
|
16670
16710
|
if (this.type === type) {
|
|
16671
16711
|
this.next();
|
|
16672
16712
|
return true
|
|
@@ -16677,13 +16717,13 @@ pp.eat = function(type) {
|
|
|
16677
16717
|
|
|
16678
16718
|
// Tests whether parsed token is a contextual keyword.
|
|
16679
16719
|
|
|
16680
|
-
pp.isContextual = function(name) {
|
|
16681
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
16720
|
+
pp$9.isContextual = function(name) {
|
|
16721
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
16682
16722
|
};
|
|
16683
16723
|
|
|
16684
16724
|
// Consumes contextual keyword if possible.
|
|
16685
16725
|
|
|
16686
|
-
pp.eatContextual = function(name) {
|
|
16726
|
+
pp$9.eatContextual = function(name) {
|
|
16687
16727
|
if (!this.isContextual(name)) { return false }
|
|
16688
16728
|
this.next();
|
|
16689
16729
|
return true
|
|
@@ -16691,19 +16731,19 @@ pp.eatContextual = function(name) {
|
|
|
16691
16731
|
|
|
16692
16732
|
// Asserts that following token is given contextual keyword.
|
|
16693
16733
|
|
|
16694
|
-
pp.expectContextual = function(name) {
|
|
16734
|
+
pp$9.expectContextual = function(name) {
|
|
16695
16735
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
16696
16736
|
};
|
|
16697
16737
|
|
|
16698
16738
|
// Test whether a semicolon can be inserted at the current position.
|
|
16699
16739
|
|
|
16700
|
-
pp.canInsertSemicolon = function() {
|
|
16701
|
-
return this.type === types.eof ||
|
|
16702
|
-
this.type === types.braceR ||
|
|
16740
|
+
pp$9.canInsertSemicolon = function() {
|
|
16741
|
+
return this.type === types$1.eof ||
|
|
16742
|
+
this.type === types$1.braceR ||
|
|
16703
16743
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
16704
16744
|
};
|
|
16705
16745
|
|
|
16706
|
-
pp.insertSemicolon = function() {
|
|
16746
|
+
pp$9.insertSemicolon = function() {
|
|
16707
16747
|
if (this.canInsertSemicolon()) {
|
|
16708
16748
|
if (this.options.onInsertedSemicolon)
|
|
16709
16749
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -16714,11 +16754,11 @@ pp.insertSemicolon = function() {
|
|
|
16714
16754
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
16715
16755
|
// pretend that there is a semicolon at this position.
|
|
16716
16756
|
|
|
16717
|
-
pp.semicolon = function() {
|
|
16718
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16757
|
+
pp$9.semicolon = function() {
|
|
16758
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
16719
16759
|
};
|
|
16720
16760
|
|
|
16721
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
16761
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
16722
16762
|
if (this.type === tokType) {
|
|
16723
16763
|
if (this.options.onTrailingComma)
|
|
16724
16764
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -16731,13 +16771,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
|
|
|
16731
16771
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
16732
16772
|
// raise an unexpected token error.
|
|
16733
16773
|
|
|
16734
|
-
pp.expect = function(type) {
|
|
16774
|
+
pp$9.expect = function(type) {
|
|
16735
16775
|
this.eat(type) || this.unexpected();
|
|
16736
16776
|
};
|
|
16737
16777
|
|
|
16738
16778
|
// Raise an unexpected token error.
|
|
16739
16779
|
|
|
16740
|
-
pp.unexpected = function(pos) {
|
|
16780
|
+
pp$9.unexpected = function(pos) {
|
|
16741
16781
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16742
16782
|
};
|
|
16743
16783
|
|
|
@@ -16750,7 +16790,7 @@ function DestructuringErrors() {
|
|
|
16750
16790
|
-1;
|
|
16751
16791
|
}
|
|
16752
16792
|
|
|
16753
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16793
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16754
16794
|
if (!refDestructuringErrors) { return }
|
|
16755
16795
|
if (refDestructuringErrors.trailingComma > -1)
|
|
16756
16796
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -16758,7 +16798,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
16758
16798
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
16759
16799
|
};
|
|
16760
16800
|
|
|
16761
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16801
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
16762
16802
|
if (!refDestructuringErrors) { return false }
|
|
16763
16803
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
16764
16804
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -16769,20 +16809,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
|
16769
16809
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
16770
16810
|
};
|
|
16771
16811
|
|
|
16772
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
16812
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
16773
16813
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
16774
16814
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
16775
16815
|
if (this.awaitPos)
|
|
16776
16816
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
16777
16817
|
};
|
|
16778
16818
|
|
|
16779
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
16819
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
16780
16820
|
if (expr.type === "ParenthesizedExpression")
|
|
16781
16821
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
16782
16822
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
16783
16823
|
};
|
|
16784
16824
|
|
|
16785
|
-
var pp$
|
|
16825
|
+
var pp$8 = Parser.prototype;
|
|
16786
16826
|
|
|
16787
16827
|
// ### Statement parsing
|
|
16788
16828
|
|
|
@@ -16791,10 +16831,10 @@ var pp$1 = Parser.prototype;
|
|
|
16791
16831
|
// `program` argument. If present, the statements will be appended
|
|
16792
16832
|
// to its body instead of creating a new node.
|
|
16793
16833
|
|
|
16794
|
-
pp$
|
|
16834
|
+
pp$8.parseTopLevel = function(node) {
|
|
16795
16835
|
var exports = Object.create(null);
|
|
16796
16836
|
if (!node.body) { node.body = []; }
|
|
16797
|
-
while (this.type !== types.eof) {
|
|
16837
|
+
while (this.type !== types$1.eof) {
|
|
16798
16838
|
var stmt = this.parseStatement(null, true, exports);
|
|
16799
16839
|
node.body.push(stmt);
|
|
16800
16840
|
}
|
|
@@ -16813,7 +16853,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
16813
16853
|
|
|
16814
16854
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
16815
16855
|
|
|
16816
|
-
pp$
|
|
16856
|
+
pp$8.isLet = function(context) {
|
|
16817
16857
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
16818
16858
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16819
16859
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -16839,7 +16879,7 @@ pp$1.isLet = function(context) {
|
|
|
16839
16879
|
// check 'async [no LineTerminator here] function'
|
|
16840
16880
|
// - 'async /*foo*/ function' is OK.
|
|
16841
16881
|
// - 'async /*\n*/ function' is invalid.
|
|
16842
|
-
pp$
|
|
16882
|
+
pp$8.isAsyncFunction = function() {
|
|
16843
16883
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
16844
16884
|
{ return false }
|
|
16845
16885
|
|
|
@@ -16859,11 +16899,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
16859
16899
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
16860
16900
|
// does not help.
|
|
16861
16901
|
|
|
16862
|
-
pp$
|
|
16902
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
16863
16903
|
var starttype = this.type, node = this.startNode(), kind;
|
|
16864
16904
|
|
|
16865
16905
|
if (this.isLet(context)) {
|
|
16866
|
-
starttype = types._var;
|
|
16906
|
+
starttype = types$1._var;
|
|
16867
16907
|
kind = "let";
|
|
16868
16908
|
}
|
|
16869
16909
|
|
|
@@ -16872,35 +16912,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16872
16912
|
// complexity.
|
|
16873
16913
|
|
|
16874
16914
|
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:
|
|
16915
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
16916
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
16917
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
16918
|
+
case types$1._for: return this.parseForStatement(node)
|
|
16919
|
+
case types$1._function:
|
|
16880
16920
|
// Function as sole body of either an if statement or a labeled statement
|
|
16881
16921
|
// works, but not when it is part of a labeled statement that is the sole
|
|
16882
16922
|
// body of an if statement.
|
|
16883
16923
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
16884
16924
|
return this.parseFunctionStatement(node, false, !context)
|
|
16885
|
-
case types._class:
|
|
16925
|
+
case types$1._class:
|
|
16886
16926
|
if (context) { this.unexpected(); }
|
|
16887
16927
|
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:
|
|
16928
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
16929
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
16930
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
16931
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
16932
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
16933
|
+
case types$1._const: case types$1._var:
|
|
16894
16934
|
kind = kind || this.value;
|
|
16895
16935
|
if (context && kind !== "var") { this.unexpected(); }
|
|
16896
16936
|
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) {
|
|
16937
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
16938
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
16939
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
16940
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
16941
|
+
case types$1._export:
|
|
16942
|
+
case types$1._import:
|
|
16943
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
16904
16944
|
skipWhiteSpace.lastIndex = this.pos;
|
|
16905
16945
|
var skip = skipWhiteSpace.exec(this.input);
|
|
16906
16946
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -16914,7 +16954,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16914
16954
|
if (!this.inModule)
|
|
16915
16955
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
16916
16956
|
}
|
|
16917
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16957
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
16918
16958
|
|
|
16919
16959
|
// If the statement does not start with a statement keyword or a
|
|
16920
16960
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -16929,17 +16969,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
|
16929
16969
|
}
|
|
16930
16970
|
|
|
16931
16971
|
var maybeName = this.value, expr = this.parseExpression();
|
|
16932
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
16972
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
16933
16973
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
16934
16974
|
else { return this.parseExpressionStatement(node, expr) }
|
|
16935
16975
|
}
|
|
16936
16976
|
};
|
|
16937
16977
|
|
|
16938
|
-
pp$
|
|
16978
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
16939
16979
|
var isBreak = keyword === "break";
|
|
16940
16980
|
this.next();
|
|
16941
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16942
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
16981
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
16982
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
16943
16983
|
else {
|
|
16944
16984
|
node.label = this.parseIdent();
|
|
16945
16985
|
this.semicolon();
|
|
@@ -16959,21 +16999,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
|
16959
16999
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
16960
17000
|
};
|
|
16961
17001
|
|
|
16962
|
-
pp$
|
|
17002
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
16963
17003
|
this.next();
|
|
16964
17004
|
this.semicolon();
|
|
16965
17005
|
return this.finishNode(node, "DebuggerStatement")
|
|
16966
17006
|
};
|
|
16967
17007
|
|
|
16968
|
-
pp$
|
|
17008
|
+
pp$8.parseDoStatement = function(node) {
|
|
16969
17009
|
this.next();
|
|
16970
17010
|
this.labels.push(loopLabel);
|
|
16971
17011
|
node.body = this.parseStatement("do");
|
|
16972
17012
|
this.labels.pop();
|
|
16973
|
-
this.expect(types._while);
|
|
17013
|
+
this.expect(types$1._while);
|
|
16974
17014
|
node.test = this.parseParenExpression();
|
|
16975
17015
|
if (this.options.ecmaVersion >= 6)
|
|
16976
|
-
{ this.eat(types.semi); }
|
|
17016
|
+
{ this.eat(types$1.semi); }
|
|
16977
17017
|
else
|
|
16978
17018
|
{ this.semicolon(); }
|
|
16979
17019
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -16987,25 +17027,25 @@ pp$1.parseDoStatement = function(node) {
|
|
|
16987
17027
|
// part (semicolon immediately after the opening parenthesis), it
|
|
16988
17028
|
// is a regular `for` loop.
|
|
16989
17029
|
|
|
16990
|
-
pp$
|
|
17030
|
+
pp$8.parseForStatement = function(node) {
|
|
16991
17031
|
this.next();
|
|
16992
17032
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
16993
17033
|
this.labels.push(loopLabel);
|
|
16994
17034
|
this.enterScope(0);
|
|
16995
|
-
this.expect(types.parenL);
|
|
16996
|
-
if (this.type === types.semi) {
|
|
17035
|
+
this.expect(types$1.parenL);
|
|
17036
|
+
if (this.type === types$1.semi) {
|
|
16997
17037
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
16998
17038
|
return this.parseFor(node, null)
|
|
16999
17039
|
}
|
|
17000
17040
|
var isLet = this.isLet();
|
|
17001
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
17041
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
17002
17042
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
17003
17043
|
this.next();
|
|
17004
17044
|
this.parseVar(init$1, true, kind);
|
|
17005
17045
|
this.finishNode(init$1, "VariableDeclaration");
|
|
17006
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17046
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
17007
17047
|
if (this.options.ecmaVersion >= 9) {
|
|
17008
|
-
if (this.type === types._in) {
|
|
17048
|
+
if (this.type === types$1._in) {
|
|
17009
17049
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17010
17050
|
} else { node.await = awaitAt > -1; }
|
|
17011
17051
|
}
|
|
@@ -17017,9 +17057,9 @@ pp$1.parseForStatement = function(node) {
|
|
|
17017
17057
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
17018
17058
|
var refDestructuringErrors = new DestructuringErrors;
|
|
17019
17059
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
17020
|
-
if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17060
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
17021
17061
|
if (this.options.ecmaVersion >= 9) {
|
|
17022
|
-
if (this.type === types._in) {
|
|
17062
|
+
if (this.type === types$1._in) {
|
|
17023
17063
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
17024
17064
|
} else { node.await = awaitAt > -1; }
|
|
17025
17065
|
}
|
|
@@ -17034,21 +17074,21 @@ pp$1.parseForStatement = function(node) {
|
|
|
17034
17074
|
return this.parseFor(node, init)
|
|
17035
17075
|
};
|
|
17036
17076
|
|
|
17037
|
-
pp$
|
|
17077
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
17038
17078
|
this.next();
|
|
17039
17079
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
17040
17080
|
};
|
|
17041
17081
|
|
|
17042
|
-
pp$
|
|
17082
|
+
pp$8.parseIfStatement = function(node) {
|
|
17043
17083
|
this.next();
|
|
17044
17084
|
node.test = this.parseParenExpression();
|
|
17045
17085
|
// allow function declarations in branches, but only in non-strict mode
|
|
17046
17086
|
node.consequent = this.parseStatement("if");
|
|
17047
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
17087
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
17048
17088
|
return this.finishNode(node, "IfStatement")
|
|
17049
17089
|
};
|
|
17050
17090
|
|
|
17051
|
-
pp$
|
|
17091
|
+
pp$8.parseReturnStatement = function(node) {
|
|
17052
17092
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
17053
17093
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
17054
17094
|
this.next();
|
|
@@ -17057,16 +17097,16 @@ pp$1.parseReturnStatement = function(node) {
|
|
|
17057
17097
|
// optional arguments, we eagerly look for a semicolon or the
|
|
17058
17098
|
// possibility to insert one.
|
|
17059
17099
|
|
|
17060
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17100
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
17061
17101
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
17062
17102
|
return this.finishNode(node, "ReturnStatement")
|
|
17063
17103
|
};
|
|
17064
17104
|
|
|
17065
|
-
pp$
|
|
17105
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
17066
17106
|
this.next();
|
|
17067
17107
|
node.discriminant = this.parseParenExpression();
|
|
17068
17108
|
node.cases = [];
|
|
17069
|
-
this.expect(types.braceL);
|
|
17109
|
+
this.expect(types$1.braceL);
|
|
17070
17110
|
this.labels.push(switchLabel);
|
|
17071
17111
|
this.enterScope(0);
|
|
17072
17112
|
|
|
@@ -17075,9 +17115,9 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17075
17115
|
// adding statements to.
|
|
17076
17116
|
|
|
17077
17117
|
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;
|
|
17118
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
17119
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
17120
|
+
var isCase = this.type === types$1._case;
|
|
17081
17121
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
17082
17122
|
node.cases.push(cur = this.startNode());
|
|
17083
17123
|
cur.consequent = [];
|
|
@@ -17089,7 +17129,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17089
17129
|
sawDefault = true;
|
|
17090
17130
|
cur.test = null;
|
|
17091
17131
|
}
|
|
17092
|
-
this.expect(types.colon);
|
|
17132
|
+
this.expect(types$1.colon);
|
|
17093
17133
|
} else {
|
|
17094
17134
|
if (!cur) { this.unexpected(); }
|
|
17095
17135
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -17102,7 +17142,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
|
17102
17142
|
return this.finishNode(node, "SwitchStatement")
|
|
17103
17143
|
};
|
|
17104
17144
|
|
|
17105
|
-
pp$
|
|
17145
|
+
pp$8.parseThrowStatement = function(node) {
|
|
17106
17146
|
this.next();
|
|
17107
17147
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
17108
17148
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -17113,21 +17153,21 @@ pp$1.parseThrowStatement = function(node) {
|
|
|
17113
17153
|
|
|
17114
17154
|
// Reused empty array added for node fields that are always empty.
|
|
17115
17155
|
|
|
17116
|
-
var empty = [];
|
|
17156
|
+
var empty$1 = [];
|
|
17117
17157
|
|
|
17118
|
-
pp$
|
|
17158
|
+
pp$8.parseTryStatement = function(node) {
|
|
17119
17159
|
this.next();
|
|
17120
17160
|
node.block = this.parseBlock();
|
|
17121
17161
|
node.handler = null;
|
|
17122
|
-
if (this.type === types._catch) {
|
|
17162
|
+
if (this.type === types$1._catch) {
|
|
17123
17163
|
var clause = this.startNode();
|
|
17124
17164
|
this.next();
|
|
17125
|
-
if (this.eat(types.parenL)) {
|
|
17165
|
+
if (this.eat(types$1.parenL)) {
|
|
17126
17166
|
clause.param = this.parseBindingAtom();
|
|
17127
17167
|
var simple = clause.param.type === "Identifier";
|
|
17128
17168
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
17129
17169
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
17130
|
-
this.expect(types.parenR);
|
|
17170
|
+
this.expect(types$1.parenR);
|
|
17131
17171
|
} else {
|
|
17132
17172
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
17133
17173
|
clause.param = null;
|
|
@@ -17137,20 +17177,20 @@ pp$1.parseTryStatement = function(node) {
|
|
|
17137
17177
|
this.exitScope();
|
|
17138
17178
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17139
17179
|
}
|
|
17140
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
17180
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
17141
17181
|
if (!node.handler && !node.finalizer)
|
|
17142
17182
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
17143
17183
|
return this.finishNode(node, "TryStatement")
|
|
17144
17184
|
};
|
|
17145
17185
|
|
|
17146
|
-
pp$
|
|
17186
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
17147
17187
|
this.next();
|
|
17148
17188
|
this.parseVar(node, false, kind);
|
|
17149
17189
|
this.semicolon();
|
|
17150
17190
|
return this.finishNode(node, "VariableDeclaration")
|
|
17151
17191
|
};
|
|
17152
17192
|
|
|
17153
|
-
pp$
|
|
17193
|
+
pp$8.parseWhileStatement = function(node) {
|
|
17154
17194
|
this.next();
|
|
17155
17195
|
node.test = this.parseParenExpression();
|
|
17156
17196
|
this.labels.push(loopLabel);
|
|
@@ -17159,7 +17199,7 @@ pp$1.parseWhileStatement = function(node) {
|
|
|
17159
17199
|
return this.finishNode(node, "WhileStatement")
|
|
17160
17200
|
};
|
|
17161
17201
|
|
|
17162
|
-
pp$
|
|
17202
|
+
pp$8.parseWithStatement = function(node) {
|
|
17163
17203
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
17164
17204
|
this.next();
|
|
17165
17205
|
node.object = this.parseParenExpression();
|
|
@@ -17167,12 +17207,12 @@ pp$1.parseWithStatement = function(node) {
|
|
|
17167
17207
|
return this.finishNode(node, "WithStatement")
|
|
17168
17208
|
};
|
|
17169
17209
|
|
|
17170
|
-
pp$
|
|
17210
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
17171
17211
|
this.next();
|
|
17172
17212
|
return this.finishNode(node, "EmptyStatement")
|
|
17173
17213
|
};
|
|
17174
17214
|
|
|
17175
|
-
pp$
|
|
17215
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
17176
17216
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
17177
17217
|
{
|
|
17178
17218
|
var label = list[i$1];
|
|
@@ -17180,7 +17220,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17180
17220
|
if (label.name === maybeName)
|
|
17181
17221
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
17182
17222
|
} }
|
|
17183
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
17223
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
17184
17224
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
17185
17225
|
var label$1 = this.labels[i];
|
|
17186
17226
|
if (label$1.statementStart === node.start) {
|
|
@@ -17196,7 +17236,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
|
17196
17236
|
return this.finishNode(node, "LabeledStatement")
|
|
17197
17237
|
};
|
|
17198
17238
|
|
|
17199
|
-
pp$
|
|
17239
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
17200
17240
|
node.expression = expr;
|
|
17201
17241
|
this.semicolon();
|
|
17202
17242
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -17206,14 +17246,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
|
17206
17246
|
// strict"` declarations when `allowStrict` is true (used for
|
|
17207
17247
|
// function bodies).
|
|
17208
17248
|
|
|
17209
|
-
pp$
|
|
17249
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
17210
17250
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
17211
17251
|
if ( node === void 0 ) node = this.startNode();
|
|
17212
17252
|
|
|
17213
17253
|
node.body = [];
|
|
17214
|
-
this.expect(types.braceL);
|
|
17254
|
+
this.expect(types$1.braceL);
|
|
17215
17255
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
17216
|
-
while (this.type !== types.braceR) {
|
|
17256
|
+
while (this.type !== types$1.braceR) {
|
|
17217
17257
|
var stmt = this.parseStatement(null);
|
|
17218
17258
|
node.body.push(stmt);
|
|
17219
17259
|
}
|
|
@@ -17227,13 +17267,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
|
17227
17267
|
// `parseStatement` will already have parsed the init statement or
|
|
17228
17268
|
// expression.
|
|
17229
17269
|
|
|
17230
|
-
pp$
|
|
17270
|
+
pp$8.parseFor = function(node, init) {
|
|
17231
17271
|
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);
|
|
17272
|
+
this.expect(types$1.semi);
|
|
17273
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
17274
|
+
this.expect(types$1.semi);
|
|
17275
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
17276
|
+
this.expect(types$1.parenR);
|
|
17237
17277
|
node.body = this.parseStatement("for");
|
|
17238
17278
|
this.exitScope();
|
|
17239
17279
|
this.labels.pop();
|
|
@@ -17243,8 +17283,8 @@ pp$1.parseFor = function(node, init) {
|
|
|
17243
17283
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
17244
17284
|
// same from parser's perspective.
|
|
17245
17285
|
|
|
17246
|
-
pp$
|
|
17247
|
-
var isForIn = this.type === types._in;
|
|
17286
|
+
pp$8.parseForIn = function(node, init) {
|
|
17287
|
+
var isForIn = this.type === types$1._in;
|
|
17248
17288
|
this.next();
|
|
17249
17289
|
|
|
17250
17290
|
if (
|
|
@@ -17265,7 +17305,7 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17265
17305
|
}
|
|
17266
17306
|
node.left = init;
|
|
17267
17307
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
17268
|
-
this.expect(types.parenR);
|
|
17308
|
+
this.expect(types$1.parenR);
|
|
17269
17309
|
node.body = this.parseStatement("for");
|
|
17270
17310
|
this.exitScope();
|
|
17271
17311
|
this.labels.pop();
|
|
@@ -17274,28 +17314,28 @@ pp$1.parseForIn = function(node, init) {
|
|
|
17274
17314
|
|
|
17275
17315
|
// Parse a list of variable declarations.
|
|
17276
17316
|
|
|
17277
|
-
pp$
|
|
17317
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
17278
17318
|
node.declarations = [];
|
|
17279
17319
|
node.kind = kind;
|
|
17280
17320
|
for (;;) {
|
|
17281
17321
|
var decl = this.startNode();
|
|
17282
17322
|
this.parseVarId(decl, kind);
|
|
17283
|
-
if (this.eat(types.eq)) {
|
|
17323
|
+
if (this.eat(types$1.eq)) {
|
|
17284
17324
|
decl.init = this.parseMaybeAssign(isFor);
|
|
17285
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17325
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
17286
17326
|
this.unexpected();
|
|
17287
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
17327
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
17288
17328
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
17289
17329
|
} else {
|
|
17290
17330
|
decl.init = null;
|
|
17291
17331
|
}
|
|
17292
17332
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
17293
|
-
if (!this.eat(types.comma)) { break }
|
|
17333
|
+
if (!this.eat(types$1.comma)) { break }
|
|
17294
17334
|
}
|
|
17295
17335
|
return node
|
|
17296
17336
|
};
|
|
17297
17337
|
|
|
17298
|
-
pp$
|
|
17338
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
17299
17339
|
decl.id = this.parseBindingAtom();
|
|
17300
17340
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
17301
17341
|
};
|
|
@@ -17306,18 +17346,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
|
17306
17346
|
// `statement & FUNC_STATEMENT`).
|
|
17307
17347
|
|
|
17308
17348
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
17309
|
-
pp$
|
|
17349
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
17310
17350
|
this.initFunction(node);
|
|
17311
17351
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
17312
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17352
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
17313
17353
|
{ this.unexpected(); }
|
|
17314
|
-
node.generator = this.eat(types.star);
|
|
17354
|
+
node.generator = this.eat(types$1.star);
|
|
17315
17355
|
}
|
|
17316
17356
|
if (this.options.ecmaVersion >= 8)
|
|
17317
17357
|
{ node.async = !!isAsync; }
|
|
17318
17358
|
|
|
17319
17359
|
if (statement & FUNC_STATEMENT) {
|
|
17320
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
17360
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
17321
17361
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
17322
17362
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
17323
17363
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -17333,7 +17373,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17333
17373
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
17334
17374
|
|
|
17335
17375
|
if (!(statement & FUNC_STATEMENT))
|
|
17336
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
17376
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
17337
17377
|
|
|
17338
17378
|
this.parseFunctionParams(node);
|
|
17339
17379
|
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
@@ -17344,16 +17384,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
|
|
|
17344
17384
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
17345
17385
|
};
|
|
17346
17386
|
|
|
17347
|
-
pp$
|
|
17348
|
-
this.expect(types.parenL);
|
|
17349
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
17387
|
+
pp$8.parseFunctionParams = function(node) {
|
|
17388
|
+
this.expect(types$1.parenL);
|
|
17389
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
17350
17390
|
this.checkYieldAwaitInDefaultParams();
|
|
17351
17391
|
};
|
|
17352
17392
|
|
|
17353
17393
|
// Parse a class declaration or literal (depending on the
|
|
17354
17394
|
// `isStatement` parameter).
|
|
17355
17395
|
|
|
17356
|
-
pp$
|
|
17396
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
17357
17397
|
this.next();
|
|
17358
17398
|
|
|
17359
17399
|
// ecma-262 14.6 Class Definitions
|
|
@@ -17367,8 +17407,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17367
17407
|
var classBody = this.startNode();
|
|
17368
17408
|
var hadConstructor = false;
|
|
17369
17409
|
classBody.body = [];
|
|
17370
|
-
this.expect(types.braceL);
|
|
17371
|
-
while (this.type !== types.braceR) {
|
|
17410
|
+
this.expect(types$1.braceL);
|
|
17411
|
+
while (this.type !== types$1.braceR) {
|
|
17372
17412
|
var element = this.parseClassElement(node.superClass !== null);
|
|
17373
17413
|
if (element) {
|
|
17374
17414
|
classBody.body.push(element);
|
|
@@ -17387,8 +17427,8 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
17387
17427
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
17388
17428
|
};
|
|
17389
17429
|
|
|
17390
|
-
pp$
|
|
17391
|
-
if (this.eat(types.semi)) { return null }
|
|
17430
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
17431
|
+
if (this.eat(types$1.semi)) { return null }
|
|
17392
17432
|
|
|
17393
17433
|
var ecmaVersion = this.options.ecmaVersion;
|
|
17394
17434
|
var node = this.startNode();
|
|
@@ -17400,11 +17440,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17400
17440
|
|
|
17401
17441
|
if (this.eatContextual("static")) {
|
|
17402
17442
|
// Parse static init block
|
|
17403
|
-
if (ecmaVersion >= 13 && this.eat(types.braceL)) {
|
|
17443
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
17404
17444
|
this.parseClassStaticBlock(node);
|
|
17405
17445
|
return node
|
|
17406
17446
|
}
|
|
17407
|
-
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
17447
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
17408
17448
|
isStatic = true;
|
|
17409
17449
|
} else {
|
|
17410
17450
|
keyName = "static";
|
|
@@ -17412,13 +17452,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17412
17452
|
}
|
|
17413
17453
|
node.static = isStatic;
|
|
17414
17454
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
17415
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
17455
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
17416
17456
|
isAsync = true;
|
|
17417
17457
|
} else {
|
|
17418
17458
|
keyName = "async";
|
|
17419
17459
|
}
|
|
17420
17460
|
}
|
|
17421
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
17461
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
17422
17462
|
isGenerator = true;
|
|
17423
17463
|
}
|
|
17424
17464
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -17445,7 +17485,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17445
17485
|
}
|
|
17446
17486
|
|
|
17447
17487
|
// Parse element value
|
|
17448
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17488
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
17449
17489
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
17450
17490
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
17451
17491
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -17459,19 +17499,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
|
17459
17499
|
return node
|
|
17460
17500
|
};
|
|
17461
17501
|
|
|
17462
|
-
pp$
|
|
17502
|
+
pp$8.isClassElementNameStart = function() {
|
|
17463
17503
|
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 ||
|
|
17504
|
+
this.type === types$1.name ||
|
|
17505
|
+
this.type === types$1.privateId ||
|
|
17506
|
+
this.type === types$1.num ||
|
|
17507
|
+
this.type === types$1.string ||
|
|
17508
|
+
this.type === types$1.bracketL ||
|
|
17469
17509
|
this.type.keyword
|
|
17470
17510
|
)
|
|
17471
17511
|
};
|
|
17472
17512
|
|
|
17473
|
-
pp$
|
|
17474
|
-
if (this.type === types.privateId) {
|
|
17513
|
+
pp$8.parseClassElementName = function(element) {
|
|
17514
|
+
if (this.type === types$1.privateId) {
|
|
17475
17515
|
if (this.value === "constructor") {
|
|
17476
17516
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
17477
17517
|
}
|
|
@@ -17482,7 +17522,7 @@ pp$1.parseClassElementName = function(element) {
|
|
|
17482
17522
|
}
|
|
17483
17523
|
};
|
|
17484
17524
|
|
|
17485
|
-
pp$
|
|
17525
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
17486
17526
|
// Check key and flags
|
|
17487
17527
|
var key = method.key;
|
|
17488
17528
|
if (method.kind === "constructor") {
|
|
@@ -17506,14 +17546,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
|
|
|
17506
17546
|
return this.finishNode(method, "MethodDefinition")
|
|
17507
17547
|
};
|
|
17508
17548
|
|
|
17509
|
-
pp$
|
|
17549
|
+
pp$8.parseClassField = function(field) {
|
|
17510
17550
|
if (checkKeyName(field, "constructor")) {
|
|
17511
17551
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
17512
17552
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
17513
17553
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
17514
17554
|
}
|
|
17515
17555
|
|
|
17516
|
-
if (this.eat(types.eq)) {
|
|
17556
|
+
if (this.eat(types$1.eq)) {
|
|
17517
17557
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
17518
17558
|
var scope = this.currentThisScope();
|
|
17519
17559
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -17528,13 +17568,13 @@ pp$1.parseClassField = function(field) {
|
|
|
17528
17568
|
return this.finishNode(field, "PropertyDefinition")
|
|
17529
17569
|
};
|
|
17530
17570
|
|
|
17531
|
-
pp$
|
|
17571
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
17532
17572
|
node.body = [];
|
|
17533
17573
|
|
|
17534
17574
|
var oldLabels = this.labels;
|
|
17535
17575
|
this.labels = [];
|
|
17536
17576
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
17537
|
-
while (this.type !== types.braceR) {
|
|
17577
|
+
while (this.type !== types$1.braceR) {
|
|
17538
17578
|
var stmt = this.parseStatement(null);
|
|
17539
17579
|
node.body.push(stmt);
|
|
17540
17580
|
}
|
|
@@ -17545,8 +17585,8 @@ pp$1.parseClassStaticBlock = function(node) {
|
|
|
17545
17585
|
return this.finishNode(node, "StaticBlock")
|
|
17546
17586
|
};
|
|
17547
17587
|
|
|
17548
|
-
pp$
|
|
17549
|
-
if (this.type === types.name) {
|
|
17588
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
17589
|
+
if (this.type === types$1.name) {
|
|
17550
17590
|
node.id = this.parseIdent();
|
|
17551
17591
|
if (isStatement)
|
|
17552
17592
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -17557,17 +17597,17 @@ pp$1.parseClassId = function(node, isStatement) {
|
|
|
17557
17597
|
}
|
|
17558
17598
|
};
|
|
17559
17599
|
|
|
17560
|
-
pp$
|
|
17561
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
|
|
17600
|
+
pp$8.parseClassSuper = function(node) {
|
|
17601
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
17562
17602
|
};
|
|
17563
17603
|
|
|
17564
|
-
pp$
|
|
17604
|
+
pp$8.enterClassBody = function() {
|
|
17565
17605
|
var element = {declared: Object.create(null), used: []};
|
|
17566
17606
|
this.privateNameStack.push(element);
|
|
17567
17607
|
return element.declared
|
|
17568
17608
|
};
|
|
17569
17609
|
|
|
17570
|
-
pp$
|
|
17610
|
+
pp$8.exitClassBody = function() {
|
|
17571
17611
|
var ref = this.privateNameStack.pop();
|
|
17572
17612
|
var declared = ref.declared;
|
|
17573
17613
|
var used = ref.used;
|
|
@@ -17622,10 +17662,10 @@ function checkKeyName(node, name) {
|
|
|
17622
17662
|
|
|
17623
17663
|
// Parses module export declaration.
|
|
17624
17664
|
|
|
17625
|
-
pp$
|
|
17665
|
+
pp$8.parseExport = function(node, exports) {
|
|
17626
17666
|
this.next();
|
|
17627
17667
|
// export * from '...'
|
|
17628
|
-
if (this.eat(types.star)) {
|
|
17668
|
+
if (this.eat(types$1.star)) {
|
|
17629
17669
|
if (this.options.ecmaVersion >= 11) {
|
|
17630
17670
|
if (this.eatContextual("as")) {
|
|
17631
17671
|
node.exported = this.parseIdent(true);
|
|
@@ -17635,20 +17675,20 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17635
17675
|
}
|
|
17636
17676
|
}
|
|
17637
17677
|
this.expectContextual("from");
|
|
17638
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17678
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17639
17679
|
node.source = this.parseExprAtom();
|
|
17640
17680
|
this.semicolon();
|
|
17641
17681
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
17642
17682
|
}
|
|
17643
|
-
if (this.eat(types._default)) { // export default ...
|
|
17683
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
17644
17684
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
17645
17685
|
var isAsync;
|
|
17646
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
17686
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
17647
17687
|
var fNode = this.startNode();
|
|
17648
17688
|
this.next();
|
|
17649
17689
|
if (isAsync) { this.next(); }
|
|
17650
17690
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
17651
|
-
} else if (this.type === types._class) {
|
|
17691
|
+
} else if (this.type === types$1._class) {
|
|
17652
17692
|
var cNode = this.startNode();
|
|
17653
17693
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
17654
17694
|
} else {
|
|
@@ -17670,7 +17710,7 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17670
17710
|
node.declaration = null;
|
|
17671
17711
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
17672
17712
|
if (this.eatContextual("from")) {
|
|
17673
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
17713
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
17674
17714
|
node.source = this.parseExprAtom();
|
|
17675
17715
|
} else {
|
|
17676
17716
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -17689,14 +17729,14 @@ pp$1.parseExport = function(node, exports) {
|
|
|
17689
17729
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
17690
17730
|
};
|
|
17691
17731
|
|
|
17692
|
-
pp$
|
|
17732
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
17693
17733
|
if (!exports) { return }
|
|
17694
17734
|
if (has(exports, name))
|
|
17695
17735
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17696
17736
|
exports[name] = true;
|
|
17697
17737
|
};
|
|
17698
17738
|
|
|
17699
|
-
pp$
|
|
17739
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
17700
17740
|
var type = pat.type;
|
|
17701
17741
|
if (type === "Identifier")
|
|
17702
17742
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -17723,7 +17763,7 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
|
17723
17763
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
17724
17764
|
};
|
|
17725
17765
|
|
|
17726
|
-
pp$
|
|
17766
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
17727
17767
|
if (!exports) { return }
|
|
17728
17768
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
17729
17769
|
{
|
|
@@ -17733,7 +17773,7 @@ pp$1.checkVariableExport = function(exports, decls) {
|
|
|
17733
17773
|
}
|
|
17734
17774
|
};
|
|
17735
17775
|
|
|
17736
|
-
pp$
|
|
17776
|
+
pp$8.shouldParseExportStatement = function() {
|
|
17737
17777
|
return this.type.keyword === "var" ||
|
|
17738
17778
|
this.type.keyword === "const" ||
|
|
17739
17779
|
this.type.keyword === "class" ||
|
|
@@ -17744,14 +17784,14 @@ pp$1.shouldParseExportStatement = function() {
|
|
|
17744
17784
|
|
|
17745
17785
|
// Parses a comma-separated list of module exports.
|
|
17746
17786
|
|
|
17747
|
-
pp$
|
|
17787
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
17748
17788
|
var nodes = [], first = true;
|
|
17749
17789
|
// export { x, y as z } [from '...']
|
|
17750
|
-
this.expect(types.braceL);
|
|
17751
|
-
while (!this.eat(types.braceR)) {
|
|
17790
|
+
this.expect(types$1.braceL);
|
|
17791
|
+
while (!this.eat(types$1.braceR)) {
|
|
17752
17792
|
if (!first) {
|
|
17753
|
-
this.expect(types.comma);
|
|
17754
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17793
|
+
this.expect(types$1.comma);
|
|
17794
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17755
17795
|
} else { first = false; }
|
|
17756
17796
|
|
|
17757
17797
|
var node = this.startNode();
|
|
@@ -17765,16 +17805,16 @@ pp$1.parseExportSpecifiers = function(exports) {
|
|
|
17765
17805
|
|
|
17766
17806
|
// Parses import declaration.
|
|
17767
17807
|
|
|
17768
|
-
pp$
|
|
17808
|
+
pp$8.parseImport = function(node) {
|
|
17769
17809
|
this.next();
|
|
17770
17810
|
// import '...'
|
|
17771
|
-
if (this.type === types.string) {
|
|
17772
|
-
node.specifiers = empty;
|
|
17811
|
+
if (this.type === types$1.string) {
|
|
17812
|
+
node.specifiers = empty$1;
|
|
17773
17813
|
node.source = this.parseExprAtom();
|
|
17774
17814
|
} else {
|
|
17775
17815
|
node.specifiers = this.parseImportSpecifiers();
|
|
17776
17816
|
this.expectContextual("from");
|
|
17777
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
17817
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
17778
17818
|
}
|
|
17779
17819
|
this.semicolon();
|
|
17780
17820
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -17782,17 +17822,17 @@ pp$1.parseImport = function(node) {
|
|
|
17782
17822
|
|
|
17783
17823
|
// Parses a comma-separated list of module imports.
|
|
17784
17824
|
|
|
17785
|
-
pp$
|
|
17825
|
+
pp$8.parseImportSpecifiers = function() {
|
|
17786
17826
|
var nodes = [], first = true;
|
|
17787
|
-
if (this.type === types.name) {
|
|
17827
|
+
if (this.type === types$1.name) {
|
|
17788
17828
|
// import defaultObj, { x, y as z } from '...'
|
|
17789
17829
|
var node = this.startNode();
|
|
17790
17830
|
node.local = this.parseIdent();
|
|
17791
17831
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
17792
17832
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
17793
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
17833
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
17794
17834
|
}
|
|
17795
|
-
if (this.type === types.star) {
|
|
17835
|
+
if (this.type === types$1.star) {
|
|
17796
17836
|
var node$1 = this.startNode();
|
|
17797
17837
|
this.next();
|
|
17798
17838
|
this.expectContextual("as");
|
|
@@ -17801,11 +17841,11 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17801
17841
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
17802
17842
|
return nodes
|
|
17803
17843
|
}
|
|
17804
|
-
this.expect(types.braceL);
|
|
17805
|
-
while (!this.eat(types.braceR)) {
|
|
17844
|
+
this.expect(types$1.braceL);
|
|
17845
|
+
while (!this.eat(types$1.braceR)) {
|
|
17806
17846
|
if (!first) {
|
|
17807
|
-
this.expect(types.comma);
|
|
17808
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
17847
|
+
this.expect(types$1.comma);
|
|
17848
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
17809
17849
|
} else { first = false; }
|
|
17810
17850
|
|
|
17811
17851
|
var node$2 = this.startNode();
|
|
@@ -17823,12 +17863,12 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
17823
17863
|
};
|
|
17824
17864
|
|
|
17825
17865
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
17826
|
-
pp$
|
|
17866
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
17827
17867
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
17828
17868
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
17829
17869
|
}
|
|
17830
17870
|
};
|
|
17831
|
-
pp$
|
|
17871
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
17832
17872
|
return (
|
|
17833
17873
|
statement.type === "ExpressionStatement" &&
|
|
17834
17874
|
statement.expression.type === "Literal" &&
|
|
@@ -17838,12 +17878,12 @@ pp$1.isDirectiveCandidate = function(statement) {
|
|
|
17838
17878
|
)
|
|
17839
17879
|
};
|
|
17840
17880
|
|
|
17841
|
-
var pp$
|
|
17881
|
+
var pp$7 = Parser.prototype;
|
|
17842
17882
|
|
|
17843
17883
|
// Convert existing expression atom to assignable pattern
|
|
17844
17884
|
// if possible.
|
|
17845
17885
|
|
|
17846
|
-
pp$
|
|
17886
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
17847
17887
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
17848
17888
|
switch (node.type) {
|
|
17849
17889
|
case "Identifier":
|
|
@@ -17924,7 +17964,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
17924
17964
|
|
|
17925
17965
|
// Convert list of expression atoms to binding list.
|
|
17926
17966
|
|
|
17927
|
-
pp$
|
|
17967
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
17928
17968
|
var end = exprList.length;
|
|
17929
17969
|
for (var i = 0; i < end; i++) {
|
|
17930
17970
|
var elt = exprList[i];
|
|
@@ -17940,19 +17980,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
|
|
|
17940
17980
|
|
|
17941
17981
|
// Parses spread element.
|
|
17942
17982
|
|
|
17943
|
-
pp$
|
|
17983
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
17944
17984
|
var node = this.startNode();
|
|
17945
17985
|
this.next();
|
|
17946
17986
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
17947
17987
|
return this.finishNode(node, "SpreadElement")
|
|
17948
17988
|
};
|
|
17949
17989
|
|
|
17950
|
-
pp$
|
|
17990
|
+
pp$7.parseRestBinding = function() {
|
|
17951
17991
|
var node = this.startNode();
|
|
17952
17992
|
this.next();
|
|
17953
17993
|
|
|
17954
17994
|
// RestElement inside of a function parameter must be an identifier
|
|
17955
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
17995
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
17956
17996
|
{ this.unexpected(); }
|
|
17957
17997
|
|
|
17958
17998
|
node.argument = this.parseBindingAtom();
|
|
@@ -17962,36 +18002,36 @@ pp$2.parseRestBinding = function() {
|
|
|
17962
18002
|
|
|
17963
18003
|
// Parses lvalue (assignable) atom.
|
|
17964
18004
|
|
|
17965
|
-
pp$
|
|
18005
|
+
pp$7.parseBindingAtom = function() {
|
|
17966
18006
|
if (this.options.ecmaVersion >= 6) {
|
|
17967
18007
|
switch (this.type) {
|
|
17968
|
-
case types.bracketL:
|
|
18008
|
+
case types$1.bracketL:
|
|
17969
18009
|
var node = this.startNode();
|
|
17970
18010
|
this.next();
|
|
17971
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
18011
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
17972
18012
|
return this.finishNode(node, "ArrayPattern")
|
|
17973
18013
|
|
|
17974
|
-
case types.braceL:
|
|
18014
|
+
case types$1.braceL:
|
|
17975
18015
|
return this.parseObj(true)
|
|
17976
18016
|
}
|
|
17977
18017
|
}
|
|
17978
18018
|
return this.parseIdent()
|
|
17979
18019
|
};
|
|
17980
18020
|
|
|
17981
|
-
pp$
|
|
18021
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
17982
18022
|
var elts = [], first = true;
|
|
17983
18023
|
while (!this.eat(close)) {
|
|
17984
18024
|
if (first) { first = false; }
|
|
17985
|
-
else { this.expect(types.comma); }
|
|
17986
|
-
if (allowEmpty && this.type === types.comma) {
|
|
18025
|
+
else { this.expect(types$1.comma); }
|
|
18026
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
17987
18027
|
elts.push(null);
|
|
17988
18028
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
17989
18029
|
break
|
|
17990
|
-
} else if (this.type === types.ellipsis) {
|
|
18030
|
+
} else if (this.type === types$1.ellipsis) {
|
|
17991
18031
|
var rest = this.parseRestBinding();
|
|
17992
18032
|
this.parseBindingListItem(rest);
|
|
17993
18033
|
elts.push(rest);
|
|
17994
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18034
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
17995
18035
|
this.expect(close);
|
|
17996
18036
|
break
|
|
17997
18037
|
} else {
|
|
@@ -18003,15 +18043,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
18003
18043
|
return elts
|
|
18004
18044
|
};
|
|
18005
18045
|
|
|
18006
|
-
pp$
|
|
18046
|
+
pp$7.parseBindingListItem = function(param) {
|
|
18007
18047
|
return param
|
|
18008
18048
|
};
|
|
18009
18049
|
|
|
18010
18050
|
// Parses assignment pattern around given atom if possible.
|
|
18011
18051
|
|
|
18012
|
-
pp$
|
|
18052
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
18013
18053
|
left = left || this.parseBindingAtom();
|
|
18014
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
18054
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
18015
18055
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18016
18056
|
node.left = left;
|
|
18017
18057
|
node.right = this.parseMaybeAssign();
|
|
@@ -18082,7 +18122,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
18082
18122
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
18083
18123
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
18084
18124
|
|
|
18085
|
-
pp$
|
|
18125
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
18086
18126
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18087
18127
|
|
|
18088
18128
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -18120,7 +18160,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
|
18120
18160
|
}
|
|
18121
18161
|
};
|
|
18122
18162
|
|
|
18123
|
-
pp$
|
|
18163
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
18124
18164
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18125
18165
|
|
|
18126
18166
|
switch (expr.type) {
|
|
@@ -18145,7 +18185,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
18145
18185
|
}
|
|
18146
18186
|
};
|
|
18147
18187
|
|
|
18148
|
-
pp$
|
|
18188
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
18149
18189
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
18150
18190
|
|
|
18151
18191
|
switch (expr.type) {
|
|
@@ -18177,7 +18217,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
|
|
|
18177
18217
|
this.generator = !!generator;
|
|
18178
18218
|
};
|
|
18179
18219
|
|
|
18180
|
-
var types
|
|
18220
|
+
var types = {
|
|
18181
18221
|
b_stat: new TokContext("{", false),
|
|
18182
18222
|
b_expr: new TokContext("{", true),
|
|
18183
18223
|
b_tmpl: new TokContext("${", false),
|
|
@@ -18190,38 +18230,38 @@ var types$1 = {
|
|
|
18190
18230
|
f_gen: new TokContext("function", false, false, null, true)
|
|
18191
18231
|
};
|
|
18192
18232
|
|
|
18193
|
-
var pp$
|
|
18233
|
+
var pp$6 = Parser.prototype;
|
|
18194
18234
|
|
|
18195
|
-
pp$
|
|
18196
|
-
return [types
|
|
18235
|
+
pp$6.initialContext = function() {
|
|
18236
|
+
return [types.b_stat]
|
|
18197
18237
|
};
|
|
18198
18238
|
|
|
18199
|
-
pp$
|
|
18239
|
+
pp$6.curContext = function() {
|
|
18200
18240
|
return this.context[this.context.length - 1]
|
|
18201
18241
|
};
|
|
18202
18242
|
|
|
18203
|
-
pp$
|
|
18243
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
18204
18244
|
var parent = this.curContext();
|
|
18205
|
-
if (parent === types
|
|
18245
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
18206
18246
|
{ return true }
|
|
18207
|
-
if (prevType === types.colon && (parent === types
|
|
18247
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
18208
18248
|
{ return !parent.isExpr }
|
|
18209
18249
|
|
|
18210
18250
|
// The check for `tt.name && exprAllowed` detects whether we are
|
|
18211
18251
|
// after a `yield` or `of` construct. See the `updateContext` for
|
|
18212
18252
|
// `tt.name`.
|
|
18213
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
18253
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
18214
18254
|
{ 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)
|
|
18255
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
18216
18256
|
{ return true }
|
|
18217
|
-
if (prevType === types.braceL)
|
|
18218
|
-
{ return parent === types
|
|
18219
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
18257
|
+
if (prevType === types$1.braceL)
|
|
18258
|
+
{ return parent === types.b_stat }
|
|
18259
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
18220
18260
|
{ return false }
|
|
18221
18261
|
return !this.exprAllowed
|
|
18222
18262
|
};
|
|
18223
18263
|
|
|
18224
|
-
pp$
|
|
18264
|
+
pp$6.inGeneratorContext = function() {
|
|
18225
18265
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
18226
18266
|
var context = this.context[i];
|
|
18227
18267
|
if (context.token === "function")
|
|
@@ -18230,9 +18270,9 @@ pp$3.inGeneratorContext = function() {
|
|
|
18230
18270
|
return false
|
|
18231
18271
|
};
|
|
18232
18272
|
|
|
18233
|
-
pp$
|
|
18273
|
+
pp$6.updateContext = function(prevType) {
|
|
18234
18274
|
var update, type = this.type;
|
|
18235
|
-
if (type.keyword && prevType === types.dot)
|
|
18275
|
+
if (type.keyword && prevType === types$1.dot)
|
|
18236
18276
|
{ this.exprAllowed = false; }
|
|
18237
18277
|
else if (update = type.updateContext)
|
|
18238
18278
|
{ update.call(this, prevType); }
|
|
@@ -18241,7 +18281,7 @@ pp$3.updateContext = function(prevType) {
|
|
|
18241
18281
|
};
|
|
18242
18282
|
|
|
18243
18283
|
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
18244
|
-
pp$
|
|
18284
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
18245
18285
|
if (this.curContext() !== tokenCtx) {
|
|
18246
18286
|
this.context[this.context.length - 1] = tokenCtx;
|
|
18247
18287
|
}
|
|
@@ -18249,71 +18289,71 @@ pp$3.overrideContext = function(tokenCtx) {
|
|
|
18249
18289
|
|
|
18250
18290
|
// Token-specific context update code
|
|
18251
18291
|
|
|
18252
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
18292
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
18253
18293
|
if (this.context.length === 1) {
|
|
18254
18294
|
this.exprAllowed = true;
|
|
18255
18295
|
return
|
|
18256
18296
|
}
|
|
18257
18297
|
var out = this.context.pop();
|
|
18258
|
-
if (out === types
|
|
18298
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
18259
18299
|
out = this.context.pop();
|
|
18260
18300
|
}
|
|
18261
18301
|
this.exprAllowed = !out.isExpr;
|
|
18262
18302
|
};
|
|
18263
18303
|
|
|
18264
|
-
types.braceL.updateContext = function(prevType) {
|
|
18265
|
-
this.context.push(this.braceIsBlock(prevType) ? types
|
|
18304
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
18305
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
18266
18306
|
this.exprAllowed = true;
|
|
18267
18307
|
};
|
|
18268
18308
|
|
|
18269
|
-
types.dollarBraceL.updateContext = function() {
|
|
18270
|
-
this.context.push(types
|
|
18309
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
18310
|
+
this.context.push(types.b_tmpl);
|
|
18271
18311
|
this.exprAllowed = true;
|
|
18272
18312
|
};
|
|
18273
18313
|
|
|
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
|
|
18314
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
18315
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
18316
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
18277
18317
|
this.exprAllowed = true;
|
|
18278
18318
|
};
|
|
18279
18319
|
|
|
18280
|
-
types.incDec.updateContext = function() {
|
|
18320
|
+
types$1.incDec.updateContext = function() {
|
|
18281
18321
|
// tokExprAllowed stays unchanged
|
|
18282
18322
|
};
|
|
18283
18323
|
|
|
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
|
|
18324
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
18325
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
18326
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
18327
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
18328
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
18329
|
+
{ this.context.push(types.f_expr); }
|
|
18290
18330
|
else
|
|
18291
|
-
{ this.context.push(types
|
|
18331
|
+
{ this.context.push(types.f_stat); }
|
|
18292
18332
|
this.exprAllowed = false;
|
|
18293
18333
|
};
|
|
18294
18334
|
|
|
18295
|
-
types.backQuote.updateContext = function() {
|
|
18296
|
-
if (this.curContext() === types
|
|
18335
|
+
types$1.backQuote.updateContext = function() {
|
|
18336
|
+
if (this.curContext() === types.q_tmpl)
|
|
18297
18337
|
{ this.context.pop(); }
|
|
18298
18338
|
else
|
|
18299
|
-
{ this.context.push(types
|
|
18339
|
+
{ this.context.push(types.q_tmpl); }
|
|
18300
18340
|
this.exprAllowed = false;
|
|
18301
18341
|
};
|
|
18302
18342
|
|
|
18303
|
-
types.star.updateContext = function(prevType) {
|
|
18304
|
-
if (prevType === types._function) {
|
|
18343
|
+
types$1.star.updateContext = function(prevType) {
|
|
18344
|
+
if (prevType === types$1._function) {
|
|
18305
18345
|
var index = this.context.length - 1;
|
|
18306
|
-
if (this.context[index] === types
|
|
18307
|
-
{ this.context[index] = types
|
|
18346
|
+
if (this.context[index] === types.f_expr)
|
|
18347
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
18308
18348
|
else
|
|
18309
|
-
{ this.context[index] = types
|
|
18349
|
+
{ this.context[index] = types.f_gen; }
|
|
18310
18350
|
}
|
|
18311
18351
|
this.exprAllowed = true;
|
|
18312
18352
|
};
|
|
18313
18353
|
|
|
18314
|
-
types.name.updateContext = function(prevType) {
|
|
18354
|
+
types$1.name.updateContext = function(prevType) {
|
|
18315
18355
|
var allowed = false;
|
|
18316
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
18356
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
18317
18357
|
if (this.value === "of" && !this.exprAllowed ||
|
|
18318
18358
|
this.value === "yield" && this.inGeneratorContext())
|
|
18319
18359
|
{ allowed = true; }
|
|
@@ -18323,14 +18363,14 @@ types.name.updateContext = function(prevType) {
|
|
|
18323
18363
|
|
|
18324
18364
|
// A recursive descent parser operates by defining functions for all
|
|
18325
18365
|
|
|
18326
|
-
var pp$
|
|
18366
|
+
var pp$5 = Parser.prototype;
|
|
18327
18367
|
|
|
18328
18368
|
// Check if property name clashes with already added.
|
|
18329
18369
|
// Object/class getters and setters are not allowed to clash —
|
|
18330
18370
|
// either with each other or with an init property — and in
|
|
18331
18371
|
// strict mode, init properties are also not allowed to be repeated.
|
|
18332
18372
|
|
|
18333
|
-
pp$
|
|
18373
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
18334
18374
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
18335
18375
|
{ return }
|
|
18336
18376
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -18347,10 +18387,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18347
18387
|
if (name === "__proto__" && kind === "init") {
|
|
18348
18388
|
if (propHash.proto) {
|
|
18349
18389
|
if (refDestructuringErrors) {
|
|
18350
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
} else {
|
|
18390
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
18391
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
18392
|
+
}
|
|
18393
|
+
} else {
|
|
18394
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
18395
|
+
}
|
|
18354
18396
|
}
|
|
18355
18397
|
propHash.proto = true;
|
|
18356
18398
|
}
|
|
@@ -18392,13 +18434,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
18392
18434
|
// and object pattern might appear (so it's possible to raise
|
|
18393
18435
|
// delayed syntax error at correct position).
|
|
18394
18436
|
|
|
18395
|
-
pp$
|
|
18437
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
18396
18438
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18397
18439
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
18398
|
-
if (this.type === types.comma) {
|
|
18440
|
+
if (this.type === types$1.comma) {
|
|
18399
18441
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18400
18442
|
node.expressions = [expr];
|
|
18401
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18443
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
18402
18444
|
return this.finishNode(node, "SequenceExpression")
|
|
18403
18445
|
}
|
|
18404
18446
|
return expr
|
|
@@ -18407,7 +18449,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
18407
18449
|
// Parse an assignment expression. This includes applications of
|
|
18408
18450
|
// operators like `+=`.
|
|
18409
18451
|
|
|
18410
|
-
pp$
|
|
18452
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
18411
18453
|
if (this.isContextual("yield")) {
|
|
18412
18454
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
18413
18455
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -18415,10 +18457,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18415
18457
|
else { this.exprAllowed = false; }
|
|
18416
18458
|
}
|
|
18417
18459
|
|
|
18418
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
18460
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
18419
18461
|
if (refDestructuringErrors) {
|
|
18420
18462
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
18421
18463
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
18464
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
18422
18465
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
18423
18466
|
} else {
|
|
18424
18467
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -18426,7 +18469,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18426
18469
|
}
|
|
18427
18470
|
|
|
18428
18471
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18429
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
18472
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
18430
18473
|
this.potentialArrowAt = this.start;
|
|
18431
18474
|
this.potentialArrowInForAwait = forInit === "await";
|
|
18432
18475
|
}
|
|
@@ -18435,20 +18478,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18435
18478
|
if (this.type.isAssign) {
|
|
18436
18479
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18437
18480
|
node.operator = this.value;
|
|
18438
|
-
if (this.type === types.eq)
|
|
18481
|
+
if (this.type === types$1.eq)
|
|
18439
18482
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
18440
18483
|
if (!ownDestructuringErrors) {
|
|
18441
18484
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
18442
18485
|
}
|
|
18443
18486
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
18444
18487
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
18445
|
-
if (this.type === types.eq)
|
|
18488
|
+
if (this.type === types$1.eq)
|
|
18446
18489
|
{ this.checkLValPattern(left); }
|
|
18447
18490
|
else
|
|
18448
18491
|
{ this.checkLValSimple(left); }
|
|
18449
18492
|
node.left = left;
|
|
18450
18493
|
this.next();
|
|
18451
18494
|
node.right = this.parseMaybeAssign(forInit);
|
|
18495
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
18452
18496
|
return this.finishNode(node, "AssignmentExpression")
|
|
18453
18497
|
} else {
|
|
18454
18498
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -18460,15 +18504,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
18460
18504
|
|
|
18461
18505
|
// Parse a ternary conditional (`?:`) operator.
|
|
18462
18506
|
|
|
18463
|
-
pp$
|
|
18507
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
18464
18508
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18465
18509
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
18466
18510
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
18467
|
-
if (this.eat(types.question)) {
|
|
18511
|
+
if (this.eat(types$1.question)) {
|
|
18468
18512
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18469
18513
|
node.test = expr;
|
|
18470
18514
|
node.consequent = this.parseMaybeAssign();
|
|
18471
|
-
this.expect(types.colon);
|
|
18515
|
+
this.expect(types$1.colon);
|
|
18472
18516
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
18473
18517
|
return this.finishNode(node, "ConditionalExpression")
|
|
18474
18518
|
}
|
|
@@ -18477,7 +18521,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
18477
18521
|
|
|
18478
18522
|
// Start the precedence parser.
|
|
18479
18523
|
|
|
18480
|
-
pp$
|
|
18524
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
18481
18525
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18482
18526
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
18483
18527
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18490,23 +18534,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
|
18490
18534
|
// defer further parser to one of its callers when it encounters an
|
|
18491
18535
|
// operator that has a lower precedence than the set it is parsing.
|
|
18492
18536
|
|
|
18493
|
-
pp$
|
|
18537
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
18494
18538
|
var prec = this.type.binop;
|
|
18495
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
18539
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
18496
18540
|
if (prec > minPrec) {
|
|
18497
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
18498
|
-
var coalesce = this.type === types.coalesce;
|
|
18541
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
18542
|
+
var coalesce = this.type === types$1.coalesce;
|
|
18499
18543
|
if (coalesce) {
|
|
18500
18544
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
18501
18545
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
18502
|
-
prec = types.logicalAND.binop;
|
|
18546
|
+
prec = types$1.logicalAND.binop;
|
|
18503
18547
|
}
|
|
18504
18548
|
var op = this.value;
|
|
18505
18549
|
this.next();
|
|
18506
18550
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18507
18551
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
18508
18552
|
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))) {
|
|
18553
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
18510
18554
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
18511
18555
|
}
|
|
18512
18556
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -18515,7 +18559,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
18515
18559
|
return left
|
|
18516
18560
|
};
|
|
18517
18561
|
|
|
18518
|
-
pp$
|
|
18562
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
18563
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
18519
18564
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18520
18565
|
node.left = left;
|
|
18521
18566
|
node.operator = op;
|
|
@@ -18525,13 +18570,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
18525
18570
|
|
|
18526
18571
|
// Parse unary operators, both prefix and postfix.
|
|
18527
18572
|
|
|
18528
|
-
pp$
|
|
18573
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
18529
18574
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
18530
18575
|
if (this.isContextual("await") && this.canAwait) {
|
|
18531
18576
|
expr = this.parseAwait(forInit);
|
|
18532
18577
|
sawUnary = true;
|
|
18533
18578
|
} else if (this.type.prefix) {
|
|
18534
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
18579
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
18535
18580
|
node.operator = this.value;
|
|
18536
18581
|
node.prefix = true;
|
|
18537
18582
|
this.next();
|
|
@@ -18545,6 +18590,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18545
18590
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
18546
18591
|
else { sawUnary = true; }
|
|
18547
18592
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
18593
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
18594
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
18595
|
+
expr = this.parsePrivateIdent();
|
|
18596
|
+
// only could be private fields in 'in', such as #x in obj
|
|
18597
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
18548
18598
|
} else {
|
|
18549
18599
|
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
18550
18600
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
@@ -18559,7 +18609,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
18559
18609
|
}
|
|
18560
18610
|
}
|
|
18561
18611
|
|
|
18562
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
18612
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
18563
18613
|
if (sawUnary)
|
|
18564
18614
|
{ this.unexpected(this.lastTokStart); }
|
|
18565
18615
|
else
|
|
@@ -18578,7 +18628,7 @@ function isPrivateFieldAccess(node) {
|
|
|
18578
18628
|
|
|
18579
18629
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
18580
18630
|
|
|
18581
|
-
pp$
|
|
18631
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
18582
18632
|
var startPos = this.start, startLoc = this.startLoc;
|
|
18583
18633
|
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
18584
18634
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
@@ -18592,7 +18642,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
|
18592
18642
|
return result
|
|
18593
18643
|
};
|
|
18594
18644
|
|
|
18595
|
-
pp$
|
|
18645
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
18596
18646
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
18597
18647
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
18598
18648
|
this.potentialArrowAt === base.start;
|
|
@@ -18615,19 +18665,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
18615
18665
|
}
|
|
18616
18666
|
};
|
|
18617
18667
|
|
|
18618
|
-
pp$
|
|
18668
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
18619
18669
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
18620
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
18670
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
18621
18671
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
18622
18672
|
|
|
18623
|
-
var computed = this.eat(types.bracketL);
|
|
18624
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
18673
|
+
var computed = this.eat(types$1.bracketL);
|
|
18674
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
18625
18675
|
var node = this.startNodeAt(startPos, startLoc);
|
|
18626
18676
|
node.object = base;
|
|
18627
18677
|
if (computed) {
|
|
18628
18678
|
node.property = this.parseExpression();
|
|
18629
|
-
this.expect(types.bracketR);
|
|
18630
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
18679
|
+
this.expect(types$1.bracketR);
|
|
18680
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
18631
18681
|
node.property = this.parsePrivateIdent();
|
|
18632
18682
|
} else {
|
|
18633
18683
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -18637,13 +18687,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18637
18687
|
node.optional = optional;
|
|
18638
18688
|
}
|
|
18639
18689
|
base = this.finishNode(node, "MemberExpression");
|
|
18640
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
18690
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
18641
18691
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
18642
18692
|
this.yieldPos = 0;
|
|
18643
18693
|
this.awaitPos = 0;
|
|
18644
18694
|
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)) {
|
|
18695
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
18696
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18647
18697
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18648
18698
|
this.checkYieldAwaitInDefaultParams();
|
|
18649
18699
|
if (this.awaitIdentPos > 0)
|
|
@@ -18664,7 +18714,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18664
18714
|
node$1.optional = optional;
|
|
18665
18715
|
}
|
|
18666
18716
|
base = this.finishNode(node$1, "CallExpression");
|
|
18667
|
-
} else if (this.type === types.backQuote) {
|
|
18717
|
+
} else if (this.type === types$1.backQuote) {
|
|
18668
18718
|
if (optional || optionalChained) {
|
|
18669
18719
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
18670
18720
|
}
|
|
@@ -18681,19 +18731,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
18681
18731
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
18682
18732
|
// or `{}`.
|
|
18683
18733
|
|
|
18684
|
-
pp$
|
|
18734
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
18685
18735
|
// If a division operator appears in an expression position, the
|
|
18686
18736
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
18687
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
18737
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
18688
18738
|
|
|
18689
18739
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
18690
18740
|
switch (this.type) {
|
|
18691
|
-
case types._super:
|
|
18741
|
+
case types$1._super:
|
|
18692
18742
|
if (!this.allowSuper)
|
|
18693
18743
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
18694
18744
|
node = this.startNode();
|
|
18695
18745
|
this.next();
|
|
18696
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
18746
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
18697
18747
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
18698
18748
|
// The `super` keyword can appear at below:
|
|
18699
18749
|
// SuperProperty:
|
|
@@ -18701,52 +18751,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18701
18751
|
// super . IdentifierName
|
|
18702
18752
|
// SuperCall:
|
|
18703
18753
|
// super ( Arguments )
|
|
18704
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
18754
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
18705
18755
|
{ this.unexpected(); }
|
|
18706
18756
|
return this.finishNode(node, "Super")
|
|
18707
18757
|
|
|
18708
|
-
case types._this:
|
|
18758
|
+
case types$1._this:
|
|
18709
18759
|
node = this.startNode();
|
|
18710
18760
|
this.next();
|
|
18711
18761
|
return this.finishNode(node, "ThisExpression")
|
|
18712
18762
|
|
|
18713
|
-
case types.name:
|
|
18763
|
+
case types$1.name:
|
|
18714
18764
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
18715
18765
|
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
|
|
18766
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
18767
|
+
this.overrideContext(types.f_expr);
|
|
18718
18768
|
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
18719
18769
|
}
|
|
18720
18770
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
18721
|
-
if (this.eat(types.arrow))
|
|
18771
|
+
if (this.eat(types$1.arrow))
|
|
18722
18772
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
18723
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
18773
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
18724
18774
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
18725
18775
|
id = this.parseIdent(false);
|
|
18726
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
18776
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
18727
18777
|
{ this.unexpected(); }
|
|
18728
18778
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
18729
18779
|
}
|
|
18730
18780
|
}
|
|
18731
18781
|
return id
|
|
18732
18782
|
|
|
18733
|
-
case types.regexp:
|
|
18783
|
+
case types$1.regexp:
|
|
18734
18784
|
var value = this.value;
|
|
18735
18785
|
node = this.parseLiteral(value.value);
|
|
18736
18786
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
18737
18787
|
return node
|
|
18738
18788
|
|
|
18739
|
-
case types.num: case types.string:
|
|
18789
|
+
case types$1.num: case types$1.string:
|
|
18740
18790
|
return this.parseLiteral(this.value)
|
|
18741
18791
|
|
|
18742
|
-
case types._null: case types._true: case types._false:
|
|
18792
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
18743
18793
|
node = this.startNode();
|
|
18744
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
18794
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
18745
18795
|
node.raw = this.type.keyword;
|
|
18746
18796
|
this.next();
|
|
18747
18797
|
return this.finishNode(node, "Literal")
|
|
18748
18798
|
|
|
18749
|
-
case types.parenL:
|
|
18799
|
+
case types$1.parenL:
|
|
18750
18800
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
18751
18801
|
if (refDestructuringErrors) {
|
|
18752
18802
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
@@ -18756,31 +18806,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18756
18806
|
}
|
|
18757
18807
|
return expr
|
|
18758
18808
|
|
|
18759
|
-
case types.bracketL:
|
|
18809
|
+
case types$1.bracketL:
|
|
18760
18810
|
node = this.startNode();
|
|
18761
18811
|
this.next();
|
|
18762
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
18812
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
18763
18813
|
return this.finishNode(node, "ArrayExpression")
|
|
18764
18814
|
|
|
18765
|
-
case types.braceL:
|
|
18766
|
-
this.overrideContext(types
|
|
18815
|
+
case types$1.braceL:
|
|
18816
|
+
this.overrideContext(types.b_expr);
|
|
18767
18817
|
return this.parseObj(false, refDestructuringErrors)
|
|
18768
18818
|
|
|
18769
|
-
case types._function:
|
|
18819
|
+
case types$1._function:
|
|
18770
18820
|
node = this.startNode();
|
|
18771
18821
|
this.next();
|
|
18772
18822
|
return this.parseFunction(node, 0)
|
|
18773
18823
|
|
|
18774
|
-
case types._class:
|
|
18824
|
+
case types$1._class:
|
|
18775
18825
|
return this.parseClass(this.startNode(), false)
|
|
18776
18826
|
|
|
18777
|
-
case types._new:
|
|
18827
|
+
case types$1._new:
|
|
18778
18828
|
return this.parseNew()
|
|
18779
18829
|
|
|
18780
|
-
case types.backQuote:
|
|
18830
|
+
case types$1.backQuote:
|
|
18781
18831
|
return this.parseTemplate()
|
|
18782
18832
|
|
|
18783
|
-
case types._import:
|
|
18833
|
+
case types$1._import:
|
|
18784
18834
|
if (this.options.ecmaVersion >= 11) {
|
|
18785
18835
|
return this.parseExprImport()
|
|
18786
18836
|
} else {
|
|
@@ -18792,7 +18842,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
18792
18842
|
}
|
|
18793
18843
|
};
|
|
18794
18844
|
|
|
18795
|
-
pp$
|
|
18845
|
+
pp$5.parseExprImport = function() {
|
|
18796
18846
|
var node = this.startNode();
|
|
18797
18847
|
|
|
18798
18848
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -18801,9 +18851,9 @@ pp$4.parseExprImport = function() {
|
|
|
18801
18851
|
var meta = this.parseIdent(true);
|
|
18802
18852
|
|
|
18803
18853
|
switch (this.type) {
|
|
18804
|
-
case types.parenL:
|
|
18854
|
+
case types$1.parenL:
|
|
18805
18855
|
return this.parseDynamicImport(node)
|
|
18806
|
-
case types.dot:
|
|
18856
|
+
case types$1.dot:
|
|
18807
18857
|
node.meta = meta;
|
|
18808
18858
|
return this.parseImportMeta(node)
|
|
18809
18859
|
default:
|
|
@@ -18811,16 +18861,16 @@ pp$4.parseExprImport = function() {
|
|
|
18811
18861
|
}
|
|
18812
18862
|
};
|
|
18813
18863
|
|
|
18814
|
-
pp$
|
|
18864
|
+
pp$5.parseDynamicImport = function(node) {
|
|
18815
18865
|
this.next(); // skip `(`
|
|
18816
18866
|
|
|
18817
18867
|
// Parse node.source.
|
|
18818
18868
|
node.source = this.parseMaybeAssign();
|
|
18819
18869
|
|
|
18820
18870
|
// Verify ending.
|
|
18821
|
-
if (!this.eat(types.parenR)) {
|
|
18871
|
+
if (!this.eat(types$1.parenR)) {
|
|
18822
18872
|
var errorPos = this.start;
|
|
18823
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
18873
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
18824
18874
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
18825
18875
|
} else {
|
|
18826
18876
|
this.unexpected(errorPos);
|
|
@@ -18830,7 +18880,7 @@ pp$4.parseDynamicImport = function(node) {
|
|
|
18830
18880
|
return this.finishNode(node, "ImportExpression")
|
|
18831
18881
|
};
|
|
18832
18882
|
|
|
18833
|
-
pp$
|
|
18883
|
+
pp$5.parseImportMeta = function(node) {
|
|
18834
18884
|
this.next(); // skip `.`
|
|
18835
18885
|
|
|
18836
18886
|
var containsEsc = this.containsEsc;
|
|
@@ -18846,7 +18896,7 @@ pp$4.parseImportMeta = function(node) {
|
|
|
18846
18896
|
return this.finishNode(node, "MetaProperty")
|
|
18847
18897
|
};
|
|
18848
18898
|
|
|
18849
|
-
pp$
|
|
18899
|
+
pp$5.parseLiteral = function(value) {
|
|
18850
18900
|
var node = this.startNode();
|
|
18851
18901
|
node.value = value;
|
|
18852
18902
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -18855,14 +18905,14 @@ pp$4.parseLiteral = function(value) {
|
|
|
18855
18905
|
return this.finishNode(node, "Literal")
|
|
18856
18906
|
};
|
|
18857
18907
|
|
|
18858
|
-
pp$
|
|
18859
|
-
this.expect(types.parenL);
|
|
18908
|
+
pp$5.parseParenExpression = function() {
|
|
18909
|
+
this.expect(types$1.parenL);
|
|
18860
18910
|
var val = this.parseExpression();
|
|
18861
|
-
this.expect(types.parenR);
|
|
18911
|
+
this.expect(types$1.parenR);
|
|
18862
18912
|
return val
|
|
18863
18913
|
};
|
|
18864
18914
|
|
|
18865
|
-
pp$
|
|
18915
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
18866
18916
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
18867
18917
|
if (this.options.ecmaVersion >= 6) {
|
|
18868
18918
|
this.next();
|
|
@@ -18873,24 +18923,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18873
18923
|
this.yieldPos = 0;
|
|
18874
18924
|
this.awaitPos = 0;
|
|
18875
18925
|
// 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)) {
|
|
18926
|
+
while (this.type !== types$1.parenR) {
|
|
18927
|
+
first ? first = false : this.expect(types$1.comma);
|
|
18928
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
18879
18929
|
lastIsComma = true;
|
|
18880
18930
|
break
|
|
18881
|
-
} else if (this.type === types.ellipsis) {
|
|
18931
|
+
} else if (this.type === types$1.ellipsis) {
|
|
18882
18932
|
spreadStart = this.start;
|
|
18883
18933
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
18884
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18934
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
18885
18935
|
break
|
|
18886
18936
|
} else {
|
|
18887
18937
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
18888
18938
|
}
|
|
18889
18939
|
}
|
|
18890
18940
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
18891
|
-
this.expect(types.parenR);
|
|
18941
|
+
this.expect(types$1.parenR);
|
|
18892
18942
|
|
|
18893
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
18943
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
18894
18944
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
18895
18945
|
this.checkYieldAwaitInDefaultParams();
|
|
18896
18946
|
this.yieldPos = oldYieldPos;
|
|
@@ -18924,12 +18974,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
18924
18974
|
}
|
|
18925
18975
|
};
|
|
18926
18976
|
|
|
18927
|
-
pp$
|
|
18977
|
+
pp$5.parseParenItem = function(item) {
|
|
18928
18978
|
return item
|
|
18929
18979
|
};
|
|
18930
18980
|
|
|
18931
|
-
pp$
|
|
18932
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
|
|
18981
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
18982
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
18933
18983
|
};
|
|
18934
18984
|
|
|
18935
18985
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -18938,13 +18988,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
|
18938
18988
|
// argument to parseSubscripts to prevent it from consuming the
|
|
18939
18989
|
// argument list.
|
|
18940
18990
|
|
|
18941
|
-
var empty
|
|
18991
|
+
var empty = [];
|
|
18942
18992
|
|
|
18943
|
-
pp$
|
|
18993
|
+
pp$5.parseNew = function() {
|
|
18944
18994
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
18945
18995
|
var node = this.startNode();
|
|
18946
18996
|
var meta = this.parseIdent(true);
|
|
18947
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
18997
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
18948
18998
|
node.meta = meta;
|
|
18949
18999
|
var containsEsc = this.containsEsc;
|
|
18950
19000
|
node.property = this.parseIdent(true);
|
|
@@ -18956,23 +19006,23 @@ pp$4.parseNew = function() {
|
|
|
18956
19006
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
18957
19007
|
return this.finishNode(node, "MetaProperty")
|
|
18958
19008
|
}
|
|
18959
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
19009
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
18960
19010
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
18961
19011
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
18962
19012
|
this.raise(startPos, "Cannot use new with import()");
|
|
18963
19013
|
}
|
|
18964
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
18965
|
-
else { node.arguments = empty
|
|
19014
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
19015
|
+
else { node.arguments = empty; }
|
|
18966
19016
|
return this.finishNode(node, "NewExpression")
|
|
18967
19017
|
};
|
|
18968
19018
|
|
|
18969
19019
|
// Parse template expression.
|
|
18970
19020
|
|
|
18971
|
-
pp$
|
|
19021
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
18972
19022
|
var isTagged = ref.isTagged;
|
|
18973
19023
|
|
|
18974
19024
|
var elem = this.startNode();
|
|
18975
|
-
if (this.type === types.invalidTemplate) {
|
|
19025
|
+
if (this.type === types$1.invalidTemplate) {
|
|
18976
19026
|
if (!isTagged) {
|
|
18977
19027
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
18978
19028
|
}
|
|
@@ -18987,11 +19037,11 @@ pp$4.parseTemplateElement = function(ref) {
|
|
|
18987
19037
|
};
|
|
18988
19038
|
}
|
|
18989
19039
|
this.next();
|
|
18990
|
-
elem.tail = this.type === types.backQuote;
|
|
19040
|
+
elem.tail = this.type === types$1.backQuote;
|
|
18991
19041
|
return this.finishNode(elem, "TemplateElement")
|
|
18992
19042
|
};
|
|
18993
19043
|
|
|
18994
|
-
pp$
|
|
19044
|
+
pp$5.parseTemplate = function(ref) {
|
|
18995
19045
|
if ( ref === void 0 ) ref = {};
|
|
18996
19046
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
18997
19047
|
|
|
@@ -19001,32 +19051,32 @@ pp$4.parseTemplate = function(ref) {
|
|
|
19001
19051
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
19002
19052
|
node.quasis = [curElt];
|
|
19003
19053
|
while (!curElt.tail) {
|
|
19004
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19005
|
-
this.expect(types.dollarBraceL);
|
|
19054
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
19055
|
+
this.expect(types$1.dollarBraceL);
|
|
19006
19056
|
node.expressions.push(this.parseExpression());
|
|
19007
|
-
this.expect(types.braceR);
|
|
19057
|
+
this.expect(types$1.braceR);
|
|
19008
19058
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
19009
19059
|
}
|
|
19010
19060
|
this.next();
|
|
19011
19061
|
return this.finishNode(node, "TemplateLiteral")
|
|
19012
19062
|
};
|
|
19013
19063
|
|
|
19014
|
-
pp$
|
|
19064
|
+
pp$5.isAsyncProp = function(prop) {
|
|
19015
19065
|
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)) &&
|
|
19066
|
+
(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
19067
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
19018
19068
|
};
|
|
19019
19069
|
|
|
19020
19070
|
// Parse an object literal or binding pattern.
|
|
19021
19071
|
|
|
19022
|
-
pp$
|
|
19072
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
19023
19073
|
var node = this.startNode(), first = true, propHash = {};
|
|
19024
19074
|
node.properties = [];
|
|
19025
19075
|
this.next();
|
|
19026
|
-
while (!this.eat(types.braceR)) {
|
|
19076
|
+
while (!this.eat(types$1.braceR)) {
|
|
19027
19077
|
if (!first) {
|
|
19028
|
-
this.expect(types.comma);
|
|
19029
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
19078
|
+
this.expect(types$1.comma);
|
|
19079
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
19030
19080
|
} else { first = false; }
|
|
19031
19081
|
|
|
19032
19082
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -19036,18 +19086,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
19036
19086
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
19037
19087
|
};
|
|
19038
19088
|
|
|
19039
|
-
pp$
|
|
19089
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
19040
19090
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
19041
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
19091
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
19042
19092
|
if (isPattern) {
|
|
19043
19093
|
prop.argument = this.parseIdent(false);
|
|
19044
|
-
if (this.type === types.comma) {
|
|
19094
|
+
if (this.type === types$1.comma) {
|
|
19045
19095
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
19046
19096
|
}
|
|
19047
19097
|
return this.finishNode(prop, "RestElement")
|
|
19048
19098
|
}
|
|
19049
19099
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19050
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
19100
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19051
19101
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19052
19102
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19053
19103
|
}
|
|
@@ -19058,7 +19108,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19058
19108
|
// Parse argument.
|
|
19059
19109
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19060
19110
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
19061
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19111
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
19062
19112
|
refDestructuringErrors.trailingComma = this.start;
|
|
19063
19113
|
}
|
|
19064
19114
|
// Finish
|
|
@@ -19072,13 +19122,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19072
19122
|
startLoc = this.startLoc;
|
|
19073
19123
|
}
|
|
19074
19124
|
if (!isPattern)
|
|
19075
|
-
{ isGenerator = this.eat(types.star); }
|
|
19125
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
19076
19126
|
}
|
|
19077
19127
|
var containsEsc = this.containsEsc;
|
|
19078
19128
|
this.parsePropertyName(prop);
|
|
19079
19129
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
19080
19130
|
isAsync = true;
|
|
19081
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
19131
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
19082
19132
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
19083
19133
|
} else {
|
|
19084
19134
|
isAsync = false;
|
|
@@ -19087,14 +19137,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19087
19137
|
return this.finishNode(prop, "Property")
|
|
19088
19138
|
};
|
|
19089
19139
|
|
|
19090
|
-
pp$
|
|
19091
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
19140
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
19141
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
19092
19142
|
{ this.unexpected(); }
|
|
19093
19143
|
|
|
19094
|
-
if (this.eat(types.colon)) {
|
|
19144
|
+
if (this.eat(types$1.colon)) {
|
|
19095
19145
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19096
19146
|
prop.kind = "init";
|
|
19097
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
19147
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
19098
19148
|
if (isPattern) { this.unexpected(); }
|
|
19099
19149
|
prop.kind = "init";
|
|
19100
19150
|
prop.method = true;
|
|
@@ -19102,7 +19152,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19102
19152
|
} else if (!isPattern && !containsEsc &&
|
|
19103
19153
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
19104
19154
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
19105
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
19155
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
19106
19156
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
19107
19157
|
prop.kind = prop.key.name;
|
|
19108
19158
|
this.parsePropertyName(prop);
|
|
@@ -19126,7 +19176,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19126
19176
|
prop.kind = "init";
|
|
19127
19177
|
if (isPattern) {
|
|
19128
19178
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
19129
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
19179
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
19130
19180
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
19131
19181
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
19132
19182
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -19137,23 +19187,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
19137
19187
|
} else { this.unexpected(); }
|
|
19138
19188
|
};
|
|
19139
19189
|
|
|
19140
|
-
pp$
|
|
19190
|
+
pp$5.parsePropertyName = function(prop) {
|
|
19141
19191
|
if (this.options.ecmaVersion >= 6) {
|
|
19142
|
-
if (this.eat(types.bracketL)) {
|
|
19192
|
+
if (this.eat(types$1.bracketL)) {
|
|
19143
19193
|
prop.computed = true;
|
|
19144
19194
|
prop.key = this.parseMaybeAssign();
|
|
19145
|
-
this.expect(types.bracketR);
|
|
19195
|
+
this.expect(types$1.bracketR);
|
|
19146
19196
|
return prop.key
|
|
19147
19197
|
} else {
|
|
19148
19198
|
prop.computed = false;
|
|
19149
19199
|
}
|
|
19150
19200
|
}
|
|
19151
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19201
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
19152
19202
|
};
|
|
19153
19203
|
|
|
19154
19204
|
// Initialize empty function node.
|
|
19155
19205
|
|
|
19156
|
-
pp$
|
|
19206
|
+
pp$5.initFunction = function(node) {
|
|
19157
19207
|
node.id = null;
|
|
19158
19208
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
19159
19209
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -19161,7 +19211,7 @@ pp$4.initFunction = function(node) {
|
|
|
19161
19211
|
|
|
19162
19212
|
// Parse object or class method.
|
|
19163
19213
|
|
|
19164
|
-
pp$
|
|
19214
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
19165
19215
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19166
19216
|
|
|
19167
19217
|
this.initFunction(node);
|
|
@@ -19175,8 +19225,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19175
19225
|
this.awaitIdentPos = 0;
|
|
19176
19226
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
19177
19227
|
|
|
19178
|
-
this.expect(types.parenL);
|
|
19179
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
19228
|
+
this.expect(types$1.parenL);
|
|
19229
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
19180
19230
|
this.checkYieldAwaitInDefaultParams();
|
|
19181
19231
|
this.parseFunctionBody(node, false, true, false);
|
|
19182
19232
|
|
|
@@ -19188,7 +19238,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
|
19188
19238
|
|
|
19189
19239
|
// Parse arrow function expression with given parameters.
|
|
19190
19240
|
|
|
19191
|
-
pp$
|
|
19241
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
19192
19242
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
19193
19243
|
|
|
19194
19244
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -19210,8 +19260,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
19210
19260
|
|
|
19211
19261
|
// Parse function body and check parameters.
|
|
19212
19262
|
|
|
19213
|
-
pp$
|
|
19214
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
19263
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
19264
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
19215
19265
|
var oldStrict = this.strict, useStrict = false;
|
|
19216
19266
|
|
|
19217
19267
|
if (isExpression) {
|
|
@@ -19247,7 +19297,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
19247
19297
|
this.exitScope();
|
|
19248
19298
|
};
|
|
19249
19299
|
|
|
19250
|
-
pp$
|
|
19300
|
+
pp$5.isSimpleParamList = function(params) {
|
|
19251
19301
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
19252
19302
|
{
|
|
19253
19303
|
var param = list[i];
|
|
@@ -19260,7 +19310,7 @@ pp$4.isSimpleParamList = function(params) {
|
|
|
19260
19310
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
19261
19311
|
// or "arguments" and duplicate parameters.
|
|
19262
19312
|
|
|
19263
|
-
pp$
|
|
19313
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
19264
19314
|
var nameHash = Object.create(null);
|
|
19265
19315
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
19266
19316
|
{
|
|
@@ -19276,20 +19326,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
|
|
|
19276
19326
|
// nothing in between them to be parsed as `null` (which is needed
|
|
19277
19327
|
// for array literals).
|
|
19278
19328
|
|
|
19279
|
-
pp$
|
|
19329
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
19280
19330
|
var elts = [], first = true;
|
|
19281
19331
|
while (!this.eat(close)) {
|
|
19282
19332
|
if (!first) {
|
|
19283
|
-
this.expect(types.comma);
|
|
19333
|
+
this.expect(types$1.comma);
|
|
19284
19334
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
19285
19335
|
} else { first = false; }
|
|
19286
19336
|
|
|
19287
19337
|
var elt = (void 0);
|
|
19288
|
-
if (allowEmpty && this.type === types.comma)
|
|
19338
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
19289
19339
|
{ elt = null; }
|
|
19290
|
-
else if (this.type === types.ellipsis) {
|
|
19340
|
+
else if (this.type === types$1.ellipsis) {
|
|
19291
19341
|
elt = this.parseSpread(refDestructuringErrors);
|
|
19292
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
19342
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
19293
19343
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
19294
19344
|
} else {
|
|
19295
19345
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -19299,7 +19349,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
19299
19349
|
return elts
|
|
19300
19350
|
};
|
|
19301
19351
|
|
|
19302
|
-
pp$
|
|
19352
|
+
pp$5.checkUnreserved = function(ref) {
|
|
19303
19353
|
var start = ref.start;
|
|
19304
19354
|
var end = ref.end;
|
|
19305
19355
|
var name = ref.name;
|
|
@@ -19328,9 +19378,9 @@ pp$4.checkUnreserved = function(ref) {
|
|
|
19328
19378
|
// when parsing properties), it will also convert keywords into
|
|
19329
19379
|
// identifiers.
|
|
19330
19380
|
|
|
19331
|
-
pp$
|
|
19381
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
19332
19382
|
var node = this.startNode();
|
|
19333
|
-
if (this.type === types.name) {
|
|
19383
|
+
if (this.type === types$1.name) {
|
|
19334
19384
|
node.name = this.value;
|
|
19335
19385
|
} else if (this.type.keyword) {
|
|
19336
19386
|
node.name = this.type.keyword;
|
|
@@ -19356,9 +19406,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
|
|
|
19356
19406
|
return node
|
|
19357
19407
|
};
|
|
19358
19408
|
|
|
19359
|
-
pp$
|
|
19409
|
+
pp$5.parsePrivateIdent = function() {
|
|
19360
19410
|
var node = this.startNode();
|
|
19361
|
-
if (this.type === types.privateId) {
|
|
19411
|
+
if (this.type === types$1.privateId) {
|
|
19362
19412
|
node.name = this.value;
|
|
19363
19413
|
} else {
|
|
19364
19414
|
this.unexpected();
|
|
@@ -19378,22 +19428,22 @@ pp$4.parsePrivateIdent = function() {
|
|
|
19378
19428
|
|
|
19379
19429
|
// Parses yield expression inside generator.
|
|
19380
19430
|
|
|
19381
|
-
pp$
|
|
19431
|
+
pp$5.parseYield = function(forInit) {
|
|
19382
19432
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
19383
19433
|
|
|
19384
19434
|
var node = this.startNode();
|
|
19385
19435
|
this.next();
|
|
19386
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
19436
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
19387
19437
|
node.delegate = false;
|
|
19388
19438
|
node.argument = null;
|
|
19389
19439
|
} else {
|
|
19390
|
-
node.delegate = this.eat(types.star);
|
|
19440
|
+
node.delegate = this.eat(types$1.star);
|
|
19391
19441
|
node.argument = this.parseMaybeAssign(forInit);
|
|
19392
19442
|
}
|
|
19393
19443
|
return this.finishNode(node, "YieldExpression")
|
|
19394
19444
|
};
|
|
19395
19445
|
|
|
19396
|
-
pp$
|
|
19446
|
+
pp$5.parseAwait = function(forInit) {
|
|
19397
19447
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
19398
19448
|
|
|
19399
19449
|
var node = this.startNode();
|
|
@@ -19402,7 +19452,7 @@ pp$4.parseAwait = function(forInit) {
|
|
|
19402
19452
|
return this.finishNode(node, "AwaitExpression")
|
|
19403
19453
|
};
|
|
19404
19454
|
|
|
19405
|
-
var pp$
|
|
19455
|
+
var pp$4 = Parser.prototype;
|
|
19406
19456
|
|
|
19407
19457
|
// This function is used to raise exceptions on parse errors. It
|
|
19408
19458
|
// takes an offset integer (into the current `input`) to indicate
|
|
@@ -19410,7 +19460,7 @@ var pp$5 = Parser.prototype;
|
|
|
19410
19460
|
// of the error message, and then raises a `SyntaxError` with that
|
|
19411
19461
|
// message.
|
|
19412
19462
|
|
|
19413
|
-
pp$
|
|
19463
|
+
pp$4.raise = function(pos, message) {
|
|
19414
19464
|
var loc = getLineInfo(this.input, pos);
|
|
19415
19465
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
19416
19466
|
var err = new SyntaxError(message);
|
|
@@ -19418,15 +19468,15 @@ pp$5.raise = function(pos, message) {
|
|
|
19418
19468
|
throw err
|
|
19419
19469
|
};
|
|
19420
19470
|
|
|
19421
|
-
pp$
|
|
19471
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
19422
19472
|
|
|
19423
|
-
pp$
|
|
19473
|
+
pp$4.curPosition = function() {
|
|
19424
19474
|
if (this.options.locations) {
|
|
19425
19475
|
return new Position(this.curLine, this.pos - this.lineStart)
|
|
19426
19476
|
}
|
|
19427
19477
|
};
|
|
19428
19478
|
|
|
19429
|
-
var pp$
|
|
19479
|
+
var pp$3 = Parser.prototype;
|
|
19430
19480
|
|
|
19431
19481
|
var Scope = function Scope(flags) {
|
|
19432
19482
|
this.flags = flags;
|
|
@@ -19442,22 +19492,22 @@ var Scope = function Scope(flags) {
|
|
|
19442
19492
|
|
|
19443
19493
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
19444
19494
|
|
|
19445
|
-
pp$
|
|
19495
|
+
pp$3.enterScope = function(flags) {
|
|
19446
19496
|
this.scopeStack.push(new Scope(flags));
|
|
19447
19497
|
};
|
|
19448
19498
|
|
|
19449
|
-
pp$
|
|
19499
|
+
pp$3.exitScope = function() {
|
|
19450
19500
|
this.scopeStack.pop();
|
|
19451
19501
|
};
|
|
19452
19502
|
|
|
19453
19503
|
// The spec says:
|
|
19454
19504
|
// > At the top level of a function, or script, function declarations are
|
|
19455
19505
|
// > treated like var declarations rather than like lexical declarations.
|
|
19456
|
-
pp$
|
|
19506
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
19457
19507
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
19458
19508
|
};
|
|
19459
19509
|
|
|
19460
|
-
pp$
|
|
19510
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
19461
19511
|
var redeclared = false;
|
|
19462
19512
|
if (bindingType === BIND_LEXICAL) {
|
|
19463
19513
|
var scope = this.currentScope();
|
|
@@ -19492,7 +19542,7 @@ pp$6.declareName = function(name, bindingType, pos) {
|
|
|
19492
19542
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
19493
19543
|
};
|
|
19494
19544
|
|
|
19495
|
-
pp$
|
|
19545
|
+
pp$3.checkLocalExport = function(id) {
|
|
19496
19546
|
// scope.functions must be empty as Module code is always strict.
|
|
19497
19547
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
19498
19548
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -19500,11 +19550,11 @@ pp$6.checkLocalExport = function(id) {
|
|
|
19500
19550
|
}
|
|
19501
19551
|
};
|
|
19502
19552
|
|
|
19503
|
-
pp$
|
|
19553
|
+
pp$3.currentScope = function() {
|
|
19504
19554
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
19505
19555
|
};
|
|
19506
19556
|
|
|
19507
|
-
pp$
|
|
19557
|
+
pp$3.currentVarScope = function() {
|
|
19508
19558
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19509
19559
|
var scope = this.scopeStack[i];
|
|
19510
19560
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -19512,7 +19562,7 @@ pp$6.currentVarScope = function() {
|
|
|
19512
19562
|
};
|
|
19513
19563
|
|
|
19514
19564
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
19515
|
-
pp$
|
|
19565
|
+
pp$3.currentThisScope = function() {
|
|
19516
19566
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
19517
19567
|
var scope = this.scopeStack[i];
|
|
19518
19568
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -19533,13 +19583,13 @@ var Node = function Node(parser, pos, loc) {
|
|
|
19533
19583
|
|
|
19534
19584
|
// Start an AST node, attaching a start offset.
|
|
19535
19585
|
|
|
19536
|
-
var pp$
|
|
19586
|
+
var pp$2 = Parser.prototype;
|
|
19537
19587
|
|
|
19538
|
-
pp$
|
|
19588
|
+
pp$2.startNode = function() {
|
|
19539
19589
|
return new Node(this, this.start, this.startLoc)
|
|
19540
19590
|
};
|
|
19541
19591
|
|
|
19542
|
-
pp$
|
|
19592
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
19543
19593
|
return new Node(this, pos, loc)
|
|
19544
19594
|
};
|
|
19545
19595
|
|
|
@@ -19555,17 +19605,17 @@ function finishNodeAt(node, type, pos, loc) {
|
|
|
19555
19605
|
return node
|
|
19556
19606
|
}
|
|
19557
19607
|
|
|
19558
|
-
pp$
|
|
19608
|
+
pp$2.finishNode = function(node, type) {
|
|
19559
19609
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
19560
19610
|
};
|
|
19561
19611
|
|
|
19562
19612
|
// Finish node at given position
|
|
19563
19613
|
|
|
19564
|
-
pp$
|
|
19614
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
19565
19615
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
19566
19616
|
};
|
|
19567
19617
|
|
|
19568
|
-
pp$
|
|
19618
|
+
pp$2.copyNode = function(node) {
|
|
19569
19619
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
19570
19620
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
19571
19621
|
return newNode
|
|
@@ -19622,7 +19672,7 @@ buildUnicodeData(10);
|
|
|
19622
19672
|
buildUnicodeData(11);
|
|
19623
19673
|
buildUnicodeData(12);
|
|
19624
19674
|
|
|
19625
|
-
var pp$
|
|
19675
|
+
var pp$1 = Parser.prototype;
|
|
19626
19676
|
|
|
19627
19677
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
19628
19678
|
this.parser = parser;
|
|
@@ -19718,7 +19768,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19718
19768
|
return false
|
|
19719
19769
|
};
|
|
19720
19770
|
|
|
19721
|
-
function codePointToString(ch) {
|
|
19771
|
+
function codePointToString$1(ch) {
|
|
19722
19772
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19723
19773
|
ch -= 0x10000;
|
|
19724
19774
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -19730,7 +19780,7 @@ function codePointToString(ch) {
|
|
|
19730
19780
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19731
19781
|
* @returns {void}
|
|
19732
19782
|
*/
|
|
19733
|
-
pp$
|
|
19783
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
19734
19784
|
var validFlags = state.validFlags;
|
|
19735
19785
|
var flags = state.flags;
|
|
19736
19786
|
|
|
@@ -19751,7 +19801,7 @@ pp$8.validateRegExpFlags = function(state) {
|
|
|
19751
19801
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
19752
19802
|
* @returns {void}
|
|
19753
19803
|
*/
|
|
19754
|
-
pp$
|
|
19804
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
19755
19805
|
this.regexp_pattern(state);
|
|
19756
19806
|
|
|
19757
19807
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -19766,7 +19816,7 @@ pp$8.validateRegExpPattern = function(state) {
|
|
|
19766
19816
|
};
|
|
19767
19817
|
|
|
19768
19818
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
19769
|
-
pp$
|
|
19819
|
+
pp$1.regexp_pattern = function(state) {
|
|
19770
19820
|
state.pos = 0;
|
|
19771
19821
|
state.lastIntValue = 0;
|
|
19772
19822
|
state.lastStringValue = "";
|
|
@@ -19800,7 +19850,7 @@ pp$8.regexp_pattern = function(state) {
|
|
|
19800
19850
|
};
|
|
19801
19851
|
|
|
19802
19852
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
19803
|
-
pp$
|
|
19853
|
+
pp$1.regexp_disjunction = function(state) {
|
|
19804
19854
|
this.regexp_alternative(state);
|
|
19805
19855
|
while (state.eat(0x7C /* | */)) {
|
|
19806
19856
|
this.regexp_alternative(state);
|
|
@@ -19816,13 +19866,13 @@ pp$8.regexp_disjunction = function(state) {
|
|
|
19816
19866
|
};
|
|
19817
19867
|
|
|
19818
19868
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
19819
|
-
pp$
|
|
19869
|
+
pp$1.regexp_alternative = function(state) {
|
|
19820
19870
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
19821
19871
|
{ }
|
|
19822
19872
|
};
|
|
19823
19873
|
|
|
19824
19874
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
19825
|
-
pp$
|
|
19875
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
19826
19876
|
if (this.regexp_eatAssertion(state)) {
|
|
19827
19877
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
19828
19878
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -19845,7 +19895,7 @@ pp$8.regexp_eatTerm = function(state) {
|
|
|
19845
19895
|
};
|
|
19846
19896
|
|
|
19847
19897
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
19848
|
-
pp$
|
|
19898
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
19849
19899
|
var start = state.pos;
|
|
19850
19900
|
state.lastAssertionIsQuantifiable = false;
|
|
19851
19901
|
|
|
@@ -19883,7 +19933,7 @@ pp$8.regexp_eatAssertion = function(state) {
|
|
|
19883
19933
|
};
|
|
19884
19934
|
|
|
19885
19935
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
19886
|
-
pp$
|
|
19936
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
19887
19937
|
if ( noError === void 0 ) noError = false;
|
|
19888
19938
|
|
|
19889
19939
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -19894,7 +19944,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
|
|
|
19894
19944
|
};
|
|
19895
19945
|
|
|
19896
19946
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
19897
|
-
pp$
|
|
19947
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
19898
19948
|
return (
|
|
19899
19949
|
state.eat(0x2A /* * */) ||
|
|
19900
19950
|
state.eat(0x2B /* + */) ||
|
|
@@ -19902,7 +19952,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
|
19902
19952
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
19903
19953
|
)
|
|
19904
19954
|
};
|
|
19905
|
-
pp$
|
|
19955
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
19906
19956
|
var start = state.pos;
|
|
19907
19957
|
if (state.eat(0x7B /* { */)) {
|
|
19908
19958
|
var min = 0, max = -1;
|
|
@@ -19928,7 +19978,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
19928
19978
|
};
|
|
19929
19979
|
|
|
19930
19980
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
19931
|
-
pp$
|
|
19981
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
19932
19982
|
return (
|
|
19933
19983
|
this.regexp_eatPatternCharacters(state) ||
|
|
19934
19984
|
state.eat(0x2E /* . */) ||
|
|
@@ -19938,7 +19988,7 @@ pp$8.regexp_eatAtom = function(state) {
|
|
|
19938
19988
|
this.regexp_eatCapturingGroup(state)
|
|
19939
19989
|
)
|
|
19940
19990
|
};
|
|
19941
|
-
pp$
|
|
19991
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
19942
19992
|
var start = state.pos;
|
|
19943
19993
|
if (state.eat(0x5C /* \ */)) {
|
|
19944
19994
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -19948,7 +19998,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
|
19948
19998
|
}
|
|
19949
19999
|
return false
|
|
19950
20000
|
};
|
|
19951
|
-
pp$
|
|
20001
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
19952
20002
|
var start = state.pos;
|
|
19953
20003
|
if (state.eat(0x28 /* ( */)) {
|
|
19954
20004
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -19962,7 +20012,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
|
|
|
19962
20012
|
}
|
|
19963
20013
|
return false
|
|
19964
20014
|
};
|
|
19965
|
-
pp$
|
|
20015
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
19966
20016
|
if (state.eat(0x28 /* ( */)) {
|
|
19967
20017
|
if (this.options.ecmaVersion >= 9) {
|
|
19968
20018
|
this.regexp_groupSpecifier(state);
|
|
@@ -19980,7 +20030,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
|
|
|
19980
20030
|
};
|
|
19981
20031
|
|
|
19982
20032
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
19983
|
-
pp$
|
|
20033
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
19984
20034
|
return (
|
|
19985
20035
|
state.eat(0x2E /* . */) ||
|
|
19986
20036
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -19993,7 +20043,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
|
|
|
19993
20043
|
};
|
|
19994
20044
|
|
|
19995
20045
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
19996
|
-
pp$
|
|
20046
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
19997
20047
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
19998
20048
|
state.raise("Nothing to repeat");
|
|
19999
20049
|
}
|
|
@@ -20001,7 +20051,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
|
20001
20051
|
};
|
|
20002
20052
|
|
|
20003
20053
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
20004
|
-
pp$
|
|
20054
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
20005
20055
|
var ch = state.current();
|
|
20006
20056
|
if (isSyntaxCharacter(ch)) {
|
|
20007
20057
|
state.lastIntValue = ch;
|
|
@@ -20023,7 +20073,7 @@ function isSyntaxCharacter(ch) {
|
|
|
20023
20073
|
|
|
20024
20074
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
20025
20075
|
// But eat eager.
|
|
20026
|
-
pp$
|
|
20076
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
20027
20077
|
var start = state.pos;
|
|
20028
20078
|
var ch = 0;
|
|
20029
20079
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -20033,7 +20083,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
|
|
|
20033
20083
|
};
|
|
20034
20084
|
|
|
20035
20085
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
20036
|
-
pp$
|
|
20086
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
20037
20087
|
var ch = state.current();
|
|
20038
20088
|
if (
|
|
20039
20089
|
ch !== -1 &&
|
|
@@ -20054,7 +20104,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
20054
20104
|
// GroupSpecifier ::
|
|
20055
20105
|
// [empty]
|
|
20056
20106
|
// `?` GroupName
|
|
20057
|
-
pp$
|
|
20107
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
20058
20108
|
if (state.eat(0x3F /* ? */)) {
|
|
20059
20109
|
if (this.regexp_eatGroupName(state)) {
|
|
20060
20110
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -20070,7 +20120,7 @@ pp$8.regexp_groupSpecifier = function(state) {
|
|
|
20070
20120
|
// GroupName ::
|
|
20071
20121
|
// `<` RegExpIdentifierName `>`
|
|
20072
20122
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20073
|
-
pp$
|
|
20123
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
20074
20124
|
state.lastStringValue = "";
|
|
20075
20125
|
if (state.eat(0x3C /* < */)) {
|
|
20076
20126
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -20085,12 +20135,12 @@ pp$8.regexp_eatGroupName = function(state) {
|
|
|
20085
20135
|
// RegExpIdentifierStart
|
|
20086
20136
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
20087
20137
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
20088
|
-
pp$
|
|
20138
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20089
20139
|
state.lastStringValue = "";
|
|
20090
20140
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20091
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20141
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20092
20142
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20093
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20143
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
20094
20144
|
}
|
|
20095
20145
|
return true
|
|
20096
20146
|
}
|
|
@@ -20102,7 +20152,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
|
|
20102
20152
|
// `$`
|
|
20103
20153
|
// `_`
|
|
20104
20154
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20105
|
-
pp$
|
|
20155
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
20106
20156
|
var start = state.pos;
|
|
20107
20157
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20108
20158
|
var ch = state.current(forceU);
|
|
@@ -20130,7 +20180,7 @@ function isRegExpIdentifierStart(ch) {
|
|
|
20130
20180
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
20131
20181
|
// <ZWNJ>
|
|
20132
20182
|
// <ZWJ>
|
|
20133
|
-
pp$
|
|
20183
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
20134
20184
|
var start = state.pos;
|
|
20135
20185
|
var forceU = this.options.ecmaVersion >= 11;
|
|
20136
20186
|
var ch = state.current(forceU);
|
|
@@ -20152,7 +20202,7 @@ function isRegExpIdentifierPart(ch) {
|
|
|
20152
20202
|
}
|
|
20153
20203
|
|
|
20154
20204
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
20155
|
-
pp$
|
|
20205
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
20156
20206
|
if (
|
|
20157
20207
|
this.regexp_eatBackReference(state) ||
|
|
20158
20208
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -20170,7 +20220,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
|
|
|
20170
20220
|
}
|
|
20171
20221
|
return false
|
|
20172
20222
|
};
|
|
20173
|
-
pp$
|
|
20223
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
20174
20224
|
var start = state.pos;
|
|
20175
20225
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
20176
20226
|
var n = state.lastIntValue;
|
|
@@ -20188,7 +20238,7 @@ pp$8.regexp_eatBackReference = function(state) {
|
|
|
20188
20238
|
}
|
|
20189
20239
|
return false
|
|
20190
20240
|
};
|
|
20191
|
-
pp$
|
|
20241
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
20192
20242
|
if (state.eat(0x6B /* k */)) {
|
|
20193
20243
|
if (this.regexp_eatGroupName(state)) {
|
|
20194
20244
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -20200,7 +20250,7 @@ pp$8.regexp_eatKGroupName = function(state) {
|
|
|
20200
20250
|
};
|
|
20201
20251
|
|
|
20202
20252
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
20203
|
-
pp$
|
|
20253
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
20204
20254
|
return (
|
|
20205
20255
|
this.regexp_eatControlEscape(state) ||
|
|
20206
20256
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -20211,7 +20261,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
|
|
|
20211
20261
|
this.regexp_eatIdentityEscape(state)
|
|
20212
20262
|
)
|
|
20213
20263
|
};
|
|
20214
|
-
pp$
|
|
20264
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
20215
20265
|
var start = state.pos;
|
|
20216
20266
|
if (state.eat(0x63 /* c */)) {
|
|
20217
20267
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -20221,7 +20271,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
|
|
|
20221
20271
|
}
|
|
20222
20272
|
return false
|
|
20223
20273
|
};
|
|
20224
|
-
pp$
|
|
20274
|
+
pp$1.regexp_eatZero = function(state) {
|
|
20225
20275
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
20226
20276
|
state.lastIntValue = 0;
|
|
20227
20277
|
state.advance();
|
|
@@ -20231,7 +20281,7 @@ pp$8.regexp_eatZero = function(state) {
|
|
|
20231
20281
|
};
|
|
20232
20282
|
|
|
20233
20283
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
20234
|
-
pp$
|
|
20284
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
20235
20285
|
var ch = state.current();
|
|
20236
20286
|
if (ch === 0x74 /* t */) {
|
|
20237
20287
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -20262,7 +20312,7 @@ pp$8.regexp_eatControlEscape = function(state) {
|
|
|
20262
20312
|
};
|
|
20263
20313
|
|
|
20264
20314
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
20265
|
-
pp$
|
|
20315
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
20266
20316
|
var ch = state.current();
|
|
20267
20317
|
if (isControlLetter(ch)) {
|
|
20268
20318
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20279,7 +20329,7 @@ function isControlLetter(ch) {
|
|
|
20279
20329
|
}
|
|
20280
20330
|
|
|
20281
20331
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
20282
|
-
pp$
|
|
20332
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
20283
20333
|
if ( forceU === void 0 ) forceU = false;
|
|
20284
20334
|
|
|
20285
20335
|
var start = state.pos;
|
|
@@ -20324,7 +20374,7 @@ function isValidUnicode(ch) {
|
|
|
20324
20374
|
}
|
|
20325
20375
|
|
|
20326
20376
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
20327
|
-
pp$
|
|
20377
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
20328
20378
|
if (state.switchU) {
|
|
20329
20379
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
20330
20380
|
return true
|
|
@@ -20347,7 +20397,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
|
|
|
20347
20397
|
};
|
|
20348
20398
|
|
|
20349
20399
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
20350
|
-
pp$
|
|
20400
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
20351
20401
|
state.lastIntValue = 0;
|
|
20352
20402
|
var ch = state.current();
|
|
20353
20403
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -20361,7 +20411,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
|
|
|
20361
20411
|
};
|
|
20362
20412
|
|
|
20363
20413
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
20364
|
-
pp$
|
|
20414
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
20365
20415
|
var ch = state.current();
|
|
20366
20416
|
|
|
20367
20417
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -20403,7 +20453,7 @@ function isCharacterClassEscape(ch) {
|
|
|
20403
20453
|
// UnicodePropertyValueExpression ::
|
|
20404
20454
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
20405
20455
|
// LoneUnicodePropertyNameOrValue
|
|
20406
|
-
pp$
|
|
20456
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
20407
20457
|
var start = state.pos;
|
|
20408
20458
|
|
|
20409
20459
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -20425,24 +20475,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
20425
20475
|
}
|
|
20426
20476
|
return false
|
|
20427
20477
|
};
|
|
20428
|
-
pp$
|
|
20478
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
20429
20479
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
20430
20480
|
{ state.raise("Invalid property name"); }
|
|
20431
20481
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
20432
20482
|
{ state.raise("Invalid property value"); }
|
|
20433
20483
|
};
|
|
20434
|
-
pp$
|
|
20484
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
20435
20485
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
20436
20486
|
{ state.raise("Invalid property name"); }
|
|
20437
20487
|
};
|
|
20438
20488
|
|
|
20439
20489
|
// UnicodePropertyName ::
|
|
20440
20490
|
// UnicodePropertyNameCharacters
|
|
20441
|
-
pp$
|
|
20491
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
20442
20492
|
var ch = 0;
|
|
20443
20493
|
state.lastStringValue = "";
|
|
20444
20494
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20445
|
-
state.lastStringValue += codePointToString(ch);
|
|
20495
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20446
20496
|
state.advance();
|
|
20447
20497
|
}
|
|
20448
20498
|
return state.lastStringValue !== ""
|
|
@@ -20453,11 +20503,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
|
20453
20503
|
|
|
20454
20504
|
// UnicodePropertyValue ::
|
|
20455
20505
|
// UnicodePropertyValueCharacters
|
|
20456
|
-
pp$
|
|
20506
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
20457
20507
|
var ch = 0;
|
|
20458
20508
|
state.lastStringValue = "";
|
|
20459
20509
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20460
|
-
state.lastStringValue += codePointToString(ch);
|
|
20510
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
20461
20511
|
state.advance();
|
|
20462
20512
|
}
|
|
20463
20513
|
return state.lastStringValue !== ""
|
|
@@ -20468,12 +20518,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
|
20468
20518
|
|
|
20469
20519
|
// LoneUnicodePropertyNameOrValue ::
|
|
20470
20520
|
// UnicodePropertyValueCharacters
|
|
20471
|
-
pp$
|
|
20521
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
20472
20522
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
20473
20523
|
};
|
|
20474
20524
|
|
|
20475
20525
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
20476
|
-
pp$
|
|
20526
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
20477
20527
|
if (state.eat(0x5B /* [ */)) {
|
|
20478
20528
|
state.eat(0x5E /* ^ */);
|
|
20479
20529
|
this.regexp_classRanges(state);
|
|
@@ -20489,7 +20539,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
|
|
|
20489
20539
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
20490
20540
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
20491
20541
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
20492
|
-
pp$
|
|
20542
|
+
pp$1.regexp_classRanges = function(state) {
|
|
20493
20543
|
while (this.regexp_eatClassAtom(state)) {
|
|
20494
20544
|
var left = state.lastIntValue;
|
|
20495
20545
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -20506,7 +20556,7 @@ pp$8.regexp_classRanges = function(state) {
|
|
|
20506
20556
|
|
|
20507
20557
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
20508
20558
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
20509
|
-
pp$
|
|
20559
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
20510
20560
|
var start = state.pos;
|
|
20511
20561
|
|
|
20512
20562
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -20535,7 +20585,7 @@ pp$8.regexp_eatClassAtom = function(state) {
|
|
|
20535
20585
|
};
|
|
20536
20586
|
|
|
20537
20587
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
20538
|
-
pp$
|
|
20588
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
20539
20589
|
var start = state.pos;
|
|
20540
20590
|
|
|
20541
20591
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -20562,7 +20612,7 @@ pp$8.regexp_eatClassEscape = function(state) {
|
|
|
20562
20612
|
};
|
|
20563
20613
|
|
|
20564
20614
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
20565
|
-
pp$
|
|
20615
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
20566
20616
|
var ch = state.current();
|
|
20567
20617
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
20568
20618
|
state.lastIntValue = ch % 0x20;
|
|
@@ -20573,7 +20623,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
|
|
|
20573
20623
|
};
|
|
20574
20624
|
|
|
20575
20625
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20576
|
-
pp$
|
|
20626
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
20577
20627
|
var start = state.pos;
|
|
20578
20628
|
if (state.eat(0x78 /* x */)) {
|
|
20579
20629
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -20588,7 +20638,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
|
|
|
20588
20638
|
};
|
|
20589
20639
|
|
|
20590
20640
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
20591
|
-
pp$
|
|
20641
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
20592
20642
|
var start = state.pos;
|
|
20593
20643
|
var ch = 0;
|
|
20594
20644
|
state.lastIntValue = 0;
|
|
@@ -20603,7 +20653,7 @@ function isDecimalDigit(ch) {
|
|
|
20603
20653
|
}
|
|
20604
20654
|
|
|
20605
20655
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
20606
|
-
pp$
|
|
20656
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
20607
20657
|
var start = state.pos;
|
|
20608
20658
|
var ch = 0;
|
|
20609
20659
|
state.lastIntValue = 0;
|
|
@@ -20632,7 +20682,7 @@ function hexToInt(ch) {
|
|
|
20632
20682
|
|
|
20633
20683
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
20634
20684
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
20635
|
-
pp$
|
|
20685
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
20636
20686
|
if (this.regexp_eatOctalDigit(state)) {
|
|
20637
20687
|
var n1 = state.lastIntValue;
|
|
20638
20688
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -20651,7 +20701,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
|
20651
20701
|
};
|
|
20652
20702
|
|
|
20653
20703
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
20654
|
-
pp$
|
|
20704
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
20655
20705
|
var ch = state.current();
|
|
20656
20706
|
if (isOctalDigit(ch)) {
|
|
20657
20707
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -20668,7 +20718,7 @@ function isOctalDigit(ch) {
|
|
|
20668
20718
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
20669
20719
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
20670
20720
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
20671
|
-
pp$
|
|
20721
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
20672
20722
|
var start = state.pos;
|
|
20673
20723
|
state.lastIntValue = 0;
|
|
20674
20724
|
for (var i = 0; i < length; ++i) {
|
|
@@ -20700,11 +20750,11 @@ var Token = function Token(p) {
|
|
|
20700
20750
|
|
|
20701
20751
|
// ## Tokenizer
|
|
20702
20752
|
|
|
20703
|
-
var pp
|
|
20753
|
+
var pp = Parser.prototype;
|
|
20704
20754
|
|
|
20705
20755
|
// Move to the next token
|
|
20706
20756
|
|
|
20707
|
-
pp
|
|
20757
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
20708
20758
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
20709
20759
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
20710
20760
|
if (this.options.onToken)
|
|
@@ -20717,21 +20767,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
|
|
|
20717
20767
|
this.nextToken();
|
|
20718
20768
|
};
|
|
20719
20769
|
|
|
20720
|
-
pp
|
|
20770
|
+
pp.getToken = function() {
|
|
20721
20771
|
this.next();
|
|
20722
20772
|
return new Token(this)
|
|
20723
20773
|
};
|
|
20724
20774
|
|
|
20725
20775
|
// If we're in an ES6 environment, make parsers iterable
|
|
20726
20776
|
if (typeof Symbol !== "undefined")
|
|
20727
|
-
{ pp
|
|
20777
|
+
{ pp[Symbol.iterator] = function() {
|
|
20728
20778
|
var this$1$1 = this;
|
|
20729
20779
|
|
|
20730
20780
|
return {
|
|
20731
20781
|
next: function () {
|
|
20732
20782
|
var token = this$1$1.getToken();
|
|
20733
20783
|
return {
|
|
20734
|
-
done: token.type === types.eof,
|
|
20784
|
+
done: token.type === types$1.eof,
|
|
20735
20785
|
value: token
|
|
20736
20786
|
}
|
|
20737
20787
|
}
|
|
@@ -20744,19 +20794,19 @@ if (typeof Symbol !== "undefined")
|
|
|
20744
20794
|
// Read a single token, updating the parser object's token-related
|
|
20745
20795
|
// properties.
|
|
20746
20796
|
|
|
20747
|
-
pp
|
|
20797
|
+
pp.nextToken = function() {
|
|
20748
20798
|
var curContext = this.curContext();
|
|
20749
20799
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
20750
20800
|
|
|
20751
20801
|
this.start = this.pos;
|
|
20752
20802
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
20753
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
20803
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
20754
20804
|
|
|
20755
20805
|
if (curContext.override) { return curContext.override(this) }
|
|
20756
20806
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
20757
20807
|
};
|
|
20758
20808
|
|
|
20759
|
-
pp
|
|
20809
|
+
pp.readToken = function(code) {
|
|
20760
20810
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
20761
20811
|
// identifiers, so '\' also dispatches to that.
|
|
20762
20812
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -20765,14 +20815,14 @@ pp$9.readToken = function(code) {
|
|
|
20765
20815
|
return this.getTokenFromCode(code)
|
|
20766
20816
|
};
|
|
20767
20817
|
|
|
20768
|
-
pp
|
|
20818
|
+
pp.fullCharCodeAtPos = function() {
|
|
20769
20819
|
var code = this.input.charCodeAt(this.pos);
|
|
20770
20820
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
20771
20821
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20772
20822
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
20773
20823
|
};
|
|
20774
20824
|
|
|
20775
|
-
pp
|
|
20825
|
+
pp.skipBlockComment = function() {
|
|
20776
20826
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20777
20827
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
20778
20828
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -20790,7 +20840,7 @@ pp$9.skipBlockComment = function() {
|
|
|
20790
20840
|
startLoc, this.curPosition()); }
|
|
20791
20841
|
};
|
|
20792
20842
|
|
|
20793
|
-
pp
|
|
20843
|
+
pp.skipLineComment = function(startSkip) {
|
|
20794
20844
|
var start = this.pos;
|
|
20795
20845
|
var startLoc = this.options.onComment && this.curPosition();
|
|
20796
20846
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -20805,7 +20855,7 @@ pp$9.skipLineComment = function(startSkip) {
|
|
|
20805
20855
|
// Called at the start of the parse and after every token. Skips
|
|
20806
20856
|
// whitespace and comments, and.
|
|
20807
20857
|
|
|
20808
|
-
pp
|
|
20858
|
+
pp.skipSpace = function() {
|
|
20809
20859
|
loop: while (this.pos < this.input.length) {
|
|
20810
20860
|
var ch = this.input.charCodeAt(this.pos);
|
|
20811
20861
|
switch (ch) {
|
|
@@ -20850,7 +20900,7 @@ pp$9.skipSpace = function() {
|
|
|
20850
20900
|
// the token, so that the next one's `start` will point at the
|
|
20851
20901
|
// right position.
|
|
20852
20902
|
|
|
20853
|
-
pp
|
|
20903
|
+
pp.finishToken = function(type, val) {
|
|
20854
20904
|
this.end = this.pos;
|
|
20855
20905
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
20856
20906
|
var prevType = this.type;
|
|
@@ -20869,62 +20919,62 @@ pp$9.finishToken = function(type, val) {
|
|
|
20869
20919
|
//
|
|
20870
20920
|
// All in the name of speed.
|
|
20871
20921
|
//
|
|
20872
|
-
pp
|
|
20922
|
+
pp.readToken_dot = function() {
|
|
20873
20923
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20874
20924
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
20875
20925
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20876
20926
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
20877
20927
|
this.pos += 3;
|
|
20878
|
-
return this.finishToken(types.ellipsis)
|
|
20928
|
+
return this.finishToken(types$1.ellipsis)
|
|
20879
20929
|
} else {
|
|
20880
20930
|
++this.pos;
|
|
20881
|
-
return this.finishToken(types.dot)
|
|
20931
|
+
return this.finishToken(types$1.dot)
|
|
20882
20932
|
}
|
|
20883
20933
|
};
|
|
20884
20934
|
|
|
20885
|
-
pp
|
|
20935
|
+
pp.readToken_slash = function() { // '/'
|
|
20886
20936
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20887
20937
|
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)
|
|
20938
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20939
|
+
return this.finishOp(types$1.slash, 1)
|
|
20890
20940
|
};
|
|
20891
20941
|
|
|
20892
|
-
pp
|
|
20942
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
20893
20943
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20894
20944
|
var size = 1;
|
|
20895
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
20945
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
20896
20946
|
|
|
20897
20947
|
// exponentiation operator ** and **=
|
|
20898
20948
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
20899
20949
|
++size;
|
|
20900
|
-
tokentype = types.starstar;
|
|
20950
|
+
tokentype = types$1.starstar;
|
|
20901
20951
|
next = this.input.charCodeAt(this.pos + 2);
|
|
20902
20952
|
}
|
|
20903
20953
|
|
|
20904
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
20954
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20905
20955
|
return this.finishOp(tokentype, size)
|
|
20906
20956
|
};
|
|
20907
20957
|
|
|
20908
|
-
pp
|
|
20958
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
20909
20959
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20910
20960
|
if (next === code) {
|
|
20911
20961
|
if (this.options.ecmaVersion >= 12) {
|
|
20912
20962
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20913
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
20963
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20914
20964
|
}
|
|
20915
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
20965
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
20916
20966
|
}
|
|
20917
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20918
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
20967
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20968
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
20919
20969
|
};
|
|
20920
20970
|
|
|
20921
|
-
pp
|
|
20971
|
+
pp.readToken_caret = function() { // '^'
|
|
20922
20972
|
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)
|
|
20973
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20974
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
20925
20975
|
};
|
|
20926
20976
|
|
|
20927
|
-
pp
|
|
20977
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
20928
20978
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20929
20979
|
if (next === code) {
|
|
20930
20980
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -20934,19 +20984,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
|
|
|
20934
20984
|
this.skipSpace();
|
|
20935
20985
|
return this.nextToken()
|
|
20936
20986
|
}
|
|
20937
|
-
return this.finishOp(types.incDec, 2)
|
|
20987
|
+
return this.finishOp(types$1.incDec, 2)
|
|
20938
20988
|
}
|
|
20939
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
20940
|
-
return this.finishOp(types.plusMin, 1)
|
|
20989
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
20990
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
20941
20991
|
};
|
|
20942
20992
|
|
|
20943
|
-
pp
|
|
20993
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
20944
20994
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20945
20995
|
var size = 1;
|
|
20946
20996
|
if (next === code) {
|
|
20947
20997
|
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)
|
|
20998
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
20999
|
+
return this.finishOp(types$1.bitShift, size)
|
|
20950
21000
|
}
|
|
20951
21001
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
20952
21002
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -20956,53 +21006,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
|
|
|
20956
21006
|
return this.nextToken()
|
|
20957
21007
|
}
|
|
20958
21008
|
if (next === 61) { size = 2; }
|
|
20959
|
-
return this.finishOp(types.relational, size)
|
|
21009
|
+
return this.finishOp(types$1.relational, size)
|
|
20960
21010
|
};
|
|
20961
21011
|
|
|
20962
|
-
pp
|
|
21012
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
20963
21013
|
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) }
|
|
21014
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
20965
21015
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
20966
21016
|
this.pos += 2;
|
|
20967
|
-
return this.finishToken(types.arrow)
|
|
21017
|
+
return this.finishToken(types$1.arrow)
|
|
20968
21018
|
}
|
|
20969
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
21019
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
20970
21020
|
};
|
|
20971
21021
|
|
|
20972
|
-
pp
|
|
21022
|
+
pp.readToken_question = function() { // '?'
|
|
20973
21023
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20974
21024
|
if (ecmaVersion >= 11) {
|
|
20975
21025
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
20976
21026
|
if (next === 46) {
|
|
20977
21027
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
20978
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
21028
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
20979
21029
|
}
|
|
20980
21030
|
if (next === 63) {
|
|
20981
21031
|
if (ecmaVersion >= 12) {
|
|
20982
21032
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
20983
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
21033
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
20984
21034
|
}
|
|
20985
|
-
return this.finishOp(types.coalesce, 2)
|
|
21035
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
20986
21036
|
}
|
|
20987
21037
|
}
|
|
20988
|
-
return this.finishOp(types.question, 1)
|
|
21038
|
+
return this.finishOp(types$1.question, 1)
|
|
20989
21039
|
};
|
|
20990
21040
|
|
|
20991
|
-
pp
|
|
21041
|
+
pp.readToken_numberSign = function() { // '#'
|
|
20992
21042
|
var ecmaVersion = this.options.ecmaVersion;
|
|
20993
21043
|
var code = 35; // '#'
|
|
20994
21044
|
if (ecmaVersion >= 13) {
|
|
20995
21045
|
++this.pos;
|
|
20996
21046
|
code = this.fullCharCodeAtPos();
|
|
20997
21047
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
20998
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
21048
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
20999
21049
|
}
|
|
21000
21050
|
}
|
|
21001
21051
|
|
|
21002
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21052
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21003
21053
|
};
|
|
21004
21054
|
|
|
21005
|
-
pp
|
|
21055
|
+
pp.getTokenFromCode = function(code) {
|
|
21006
21056
|
switch (code) {
|
|
21007
21057
|
// The interpretation of a dot depends on whether it is followed
|
|
21008
21058
|
// by a digit or another two dots.
|
|
@@ -21010,20 +21060,20 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21010
21060
|
return this.readToken_dot()
|
|
21011
21061
|
|
|
21012
21062
|
// 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)
|
|
21063
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
21064
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
21065
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
21066
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
21067
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
21068
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
21069
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
21070
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
21071
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
21022
21072
|
|
|
21023
21073
|
case 96: // '`'
|
|
21024
21074
|
if (this.options.ecmaVersion < 6) { break }
|
|
21025
21075
|
++this.pos;
|
|
21026
|
-
return this.finishToken(types.backQuote)
|
|
21076
|
+
return this.finishToken(types$1.backQuote)
|
|
21027
21077
|
|
|
21028
21078
|
case 48: // '0'
|
|
21029
21079
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -21046,7 +21096,6 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21046
21096
|
// often referred to. `finishOp` simply skips the amount of
|
|
21047
21097
|
// characters it is given as second argument, and returns a token
|
|
21048
21098
|
// of the type given by its first argument.
|
|
21049
|
-
|
|
21050
21099
|
case 47: // '/'
|
|
21051
21100
|
return this.readToken_slash()
|
|
21052
21101
|
|
|
@@ -21072,22 +21121,22 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
21072
21121
|
return this.readToken_question()
|
|
21073
21122
|
|
|
21074
21123
|
case 126: // '~'
|
|
21075
|
-
return this.finishOp(types.prefix, 1)
|
|
21124
|
+
return this.finishOp(types$1.prefix, 1)
|
|
21076
21125
|
|
|
21077
21126
|
case 35: // '#'
|
|
21078
21127
|
return this.readToken_numberSign()
|
|
21079
21128
|
}
|
|
21080
21129
|
|
|
21081
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
21130
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
21082
21131
|
};
|
|
21083
21132
|
|
|
21084
|
-
pp
|
|
21133
|
+
pp.finishOp = function(type, size) {
|
|
21085
21134
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
21086
21135
|
this.pos += size;
|
|
21087
21136
|
return this.finishToken(type, str)
|
|
21088
21137
|
};
|
|
21089
21138
|
|
|
21090
|
-
pp
|
|
21139
|
+
pp.readRegexp = function() {
|
|
21091
21140
|
var escaped, inClass, start = this.pos;
|
|
21092
21141
|
for (;;) {
|
|
21093
21142
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -21122,14 +21171,14 @@ pp$9.readRegexp = function() {
|
|
|
21122
21171
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
21123
21172
|
}
|
|
21124
21173
|
|
|
21125
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21174
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
21126
21175
|
};
|
|
21127
21176
|
|
|
21128
21177
|
// Read an integer in the given radix. Return null if zero digits
|
|
21129
21178
|
// were read, the integer value otherwise. When `len` is given, this
|
|
21130
21179
|
// will return `null` unless the integer has exactly `len` digits.
|
|
21131
21180
|
|
|
21132
|
-
pp
|
|
21181
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
21133
21182
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
21134
21183
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
21135
21184
|
|
|
@@ -21183,7 +21232,7 @@ function stringToBigInt(str) {
|
|
|
21183
21232
|
return BigInt(str.replace(/_/g, ""))
|
|
21184
21233
|
}
|
|
21185
21234
|
|
|
21186
|
-
pp
|
|
21235
|
+
pp.readRadixNumber = function(radix) {
|
|
21187
21236
|
var start = this.pos;
|
|
21188
21237
|
this.pos += 2; // 0x
|
|
21189
21238
|
var val = this.readInt(radix);
|
|
@@ -21192,12 +21241,12 @@ pp$9.readRadixNumber = function(radix) {
|
|
|
21192
21241
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
21193
21242
|
++this.pos;
|
|
21194
21243
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21195
|
-
return this.finishToken(types.num, val)
|
|
21244
|
+
return this.finishToken(types$1.num, val)
|
|
21196
21245
|
};
|
|
21197
21246
|
|
|
21198
21247
|
// Read an integer, octal integer, or floating-point number.
|
|
21199
21248
|
|
|
21200
|
-
pp
|
|
21249
|
+
pp.readNumber = function(startsWithDot) {
|
|
21201
21250
|
var start = this.pos;
|
|
21202
21251
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
21203
21252
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -21207,7 +21256,7 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21207
21256
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
21208
21257
|
++this.pos;
|
|
21209
21258
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21210
|
-
return this.finishToken(types.num, val$1)
|
|
21259
|
+
return this.finishToken(types$1.num, val$1)
|
|
21211
21260
|
}
|
|
21212
21261
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
21213
21262
|
if (next === 46 && !octal) { // '.'
|
|
@@ -21223,12 +21272,12 @@ pp$9.readNumber = function(startsWithDot) {
|
|
|
21223
21272
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
21224
21273
|
|
|
21225
21274
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
21226
|
-
return this.finishToken(types.num, val)
|
|
21275
|
+
return this.finishToken(types$1.num, val)
|
|
21227
21276
|
};
|
|
21228
21277
|
|
|
21229
21278
|
// Read a string value, interpreting backslash-escapes.
|
|
21230
21279
|
|
|
21231
|
-
pp
|
|
21280
|
+
pp.readCodePoint = function() {
|
|
21232
21281
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
21233
21282
|
|
|
21234
21283
|
if (ch === 123) { // '{'
|
|
@@ -21243,14 +21292,14 @@ pp$9.readCodePoint = function() {
|
|
|
21243
21292
|
return code
|
|
21244
21293
|
};
|
|
21245
21294
|
|
|
21246
|
-
function codePointToString
|
|
21295
|
+
function codePointToString(code) {
|
|
21247
21296
|
// UTF-16 Decoding
|
|
21248
21297
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21249
21298
|
code -= 0x10000;
|
|
21250
21299
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21251
21300
|
}
|
|
21252
21301
|
|
|
21253
|
-
pp
|
|
21302
|
+
pp.readString = function(quote) {
|
|
21254
21303
|
var out = "", chunkStart = ++this.pos;
|
|
21255
21304
|
for (;;) {
|
|
21256
21305
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -21273,14 +21322,14 @@ pp$9.readString = function(quote) {
|
|
|
21273
21322
|
}
|
|
21274
21323
|
}
|
|
21275
21324
|
out += this.input.slice(chunkStart, this.pos++);
|
|
21276
|
-
return this.finishToken(types.string, out)
|
|
21325
|
+
return this.finishToken(types$1.string, out)
|
|
21277
21326
|
};
|
|
21278
21327
|
|
|
21279
21328
|
// Reads template string tokens.
|
|
21280
21329
|
|
|
21281
21330
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
21282
21331
|
|
|
21283
|
-
pp
|
|
21332
|
+
pp.tryReadTemplateToken = function() {
|
|
21284
21333
|
this.inTemplateElement = true;
|
|
21285
21334
|
try {
|
|
21286
21335
|
this.readTmplToken();
|
|
@@ -21295,7 +21344,7 @@ pp$9.tryReadTemplateToken = function() {
|
|
|
21295
21344
|
this.inTemplateElement = false;
|
|
21296
21345
|
};
|
|
21297
21346
|
|
|
21298
|
-
pp
|
|
21347
|
+
pp.invalidStringToken = function(position, message) {
|
|
21299
21348
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
21300
21349
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
21301
21350
|
} else {
|
|
@@ -21303,23 +21352,23 @@ pp$9.invalidStringToken = function(position, message) {
|
|
|
21303
21352
|
}
|
|
21304
21353
|
};
|
|
21305
21354
|
|
|
21306
|
-
pp
|
|
21355
|
+
pp.readTmplToken = function() {
|
|
21307
21356
|
var out = "", chunkStart = this.pos;
|
|
21308
21357
|
for (;;) {
|
|
21309
21358
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
21310
21359
|
var ch = this.input.charCodeAt(this.pos);
|
|
21311
21360
|
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)) {
|
|
21361
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
21313
21362
|
if (ch === 36) {
|
|
21314
21363
|
this.pos += 2;
|
|
21315
|
-
return this.finishToken(types.dollarBraceL)
|
|
21364
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
21316
21365
|
} else {
|
|
21317
21366
|
++this.pos;
|
|
21318
|
-
return this.finishToken(types.backQuote)
|
|
21367
|
+
return this.finishToken(types$1.backQuote)
|
|
21319
21368
|
}
|
|
21320
21369
|
}
|
|
21321
21370
|
out += this.input.slice(chunkStart, this.pos);
|
|
21322
|
-
return this.finishToken(types.template, out)
|
|
21371
|
+
return this.finishToken(types$1.template, out)
|
|
21323
21372
|
}
|
|
21324
21373
|
if (ch === 92) { // '\'
|
|
21325
21374
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -21350,7 +21399,7 @@ pp$9.readTmplToken = function() {
|
|
|
21350
21399
|
};
|
|
21351
21400
|
|
|
21352
21401
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
21353
|
-
pp
|
|
21402
|
+
pp.readInvalidTemplateToken = function() {
|
|
21354
21403
|
for (; this.pos < this.input.length; this.pos++) {
|
|
21355
21404
|
switch (this.input[this.pos]) {
|
|
21356
21405
|
case "\\":
|
|
@@ -21361,10 +21410,10 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21361
21410
|
if (this.input[this.pos + 1] !== "{") {
|
|
21362
21411
|
break
|
|
21363
21412
|
}
|
|
21364
|
-
// falls through
|
|
21365
21413
|
|
|
21414
|
+
// falls through
|
|
21366
21415
|
case "`":
|
|
21367
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21416
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
21368
21417
|
|
|
21369
21418
|
// no default
|
|
21370
21419
|
}
|
|
@@ -21374,14 +21423,14 @@ pp$9.readInvalidTemplateToken = function() {
|
|
|
21374
21423
|
|
|
21375
21424
|
// Used to read escaped characters
|
|
21376
21425
|
|
|
21377
|
-
pp
|
|
21426
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
21378
21427
|
var ch = this.input.charCodeAt(++this.pos);
|
|
21379
21428
|
++this.pos;
|
|
21380
21429
|
switch (ch) {
|
|
21381
21430
|
case 110: return "\n" // 'n' -> '\n'
|
|
21382
21431
|
case 114: return "\r" // 'r' -> '\r'
|
|
21383
21432
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
21384
|
-
case 117: return codePointToString
|
|
21433
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
21385
21434
|
case 116: return "\t" // 't' -> '\t'
|
|
21386
21435
|
case 98: return "\b" // 'b' -> '\b'
|
|
21387
21436
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -21439,7 +21488,7 @@ pp$9.readEscapedChar = function(inTemplate) {
|
|
|
21439
21488
|
|
|
21440
21489
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
21441
21490
|
|
|
21442
|
-
pp
|
|
21491
|
+
pp.readHexChar = function(len) {
|
|
21443
21492
|
var codePos = this.pos;
|
|
21444
21493
|
var n = this.readInt(16, len);
|
|
21445
21494
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -21452,7 +21501,7 @@ pp$9.readHexChar = function(len) {
|
|
|
21452
21501
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
21453
21502
|
// as a micro-optimization.
|
|
21454
21503
|
|
|
21455
|
-
pp
|
|
21504
|
+
pp.readWord1 = function() {
|
|
21456
21505
|
this.containsEsc = false;
|
|
21457
21506
|
var word = "", first = true, chunkStart = this.pos;
|
|
21458
21507
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -21470,7 +21519,7 @@ pp$9.readWord1 = function() {
|
|
|
21470
21519
|
var esc = this.readCodePoint();
|
|
21471
21520
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
21472
21521
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
21473
|
-
word += codePointToString
|
|
21522
|
+
word += codePointToString(esc);
|
|
21474
21523
|
chunkStart = this.pos;
|
|
21475
21524
|
} else {
|
|
21476
21525
|
break
|
|
@@ -21483,18 +21532,18 @@ pp$9.readWord1 = function() {
|
|
|
21483
21532
|
// Read an identifier or keyword token. Will check for reserved
|
|
21484
21533
|
// words when necessary.
|
|
21485
21534
|
|
|
21486
|
-
pp
|
|
21535
|
+
pp.readWord = function() {
|
|
21487
21536
|
var word = this.readWord1();
|
|
21488
|
-
var type = types.name;
|
|
21537
|
+
var type = types$1.name;
|
|
21489
21538
|
if (this.keywords.test(word)) {
|
|
21490
|
-
type = keywords
|
|
21539
|
+
type = keywords[word];
|
|
21491
21540
|
}
|
|
21492
21541
|
return this.finishToken(type, word)
|
|
21493
21542
|
};
|
|
21494
21543
|
|
|
21495
21544
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21496
21545
|
|
|
21497
|
-
var version = "8.
|
|
21546
|
+
var version = "8.6.0";
|
|
21498
21547
|
|
|
21499
21548
|
Parser.acorn = {
|
|
21500
21549
|
Parser: Parser,
|
|
@@ -21505,10 +21554,10 @@ Parser.acorn = {
|
|
|
21505
21554
|
getLineInfo: getLineInfo,
|
|
21506
21555
|
Node: Node,
|
|
21507
21556
|
TokenType: TokenType,
|
|
21508
|
-
tokTypes: types,
|
|
21509
|
-
keywordTypes: keywords
|
|
21557
|
+
tokTypes: types$1,
|
|
21558
|
+
keywordTypes: keywords,
|
|
21510
21559
|
TokContext: TokContext,
|
|
21511
|
-
tokContexts: types
|
|
21560
|
+
tokContexts: types,
|
|
21512
21561
|
isIdentifierChar: isIdentifierChar,
|
|
21513
21562
|
isIdentifierStart: isIdentifierStart,
|
|
21514
21563
|
Token: Token,
|
|
@@ -21521,20 +21570,7 @@ Parser.acorn = {
|
|
|
21521
21570
|
const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
|
|
21522
21571
|
function mkdirpath(path) {
|
|
21523
21572
|
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
|
-
}
|
|
21573
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21538
21574
|
}
|
|
21539
21575
|
function writeFile(dest, data) {
|
|
21540
21576
|
return new Promise((fulfil, reject) => {
|
|
@@ -21900,6 +21936,7 @@ class ModuleLoader {
|
|
|
21900
21936
|
this.indexedEntryModules = [];
|
|
21901
21937
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
21902
21938
|
this.moduleLoadPromises = new Map();
|
|
21939
|
+
this.modulesWithLoadedDependencies = new Set();
|
|
21903
21940
|
this.nextEntryModuleIndex = 0;
|
|
21904
21941
|
this.readQueue = new Queue();
|
|
21905
21942
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
@@ -22078,7 +22115,8 @@ class ModuleLoader {
|
|
|
22078
22115
|
this.graph.watchFiles[id] = true;
|
|
22079
22116
|
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22080
22117
|
this.getResolveStaticDependencyPromises(module),
|
|
22081
|
-
this.getResolveDynamicImportPromises(module)
|
|
22118
|
+
this.getResolveDynamicImportPromises(module),
|
|
22119
|
+
loadAndResolveDependenciesPromise
|
|
22082
22120
|
]);
|
|
22083
22121
|
const loadAndResolveDependenciesPromise = loadPromise
|
|
22084
22122
|
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
@@ -22086,23 +22124,25 @@ class ModuleLoader {
|
|
|
22086
22124
|
loadAndResolveDependenciesPromise.catch(() => {
|
|
22087
22125
|
/* avoid unhandled promise rejections */
|
|
22088
22126
|
});
|
|
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;
|
|
22127
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22128
|
+
const resolveDependencyPromises = await loadPromise;
|
|
22129
|
+
if (!isPreload) {
|
|
22130
|
+
await this.fetchModuleDependencies(module, ...resolveDependencyPromises);
|
|
22097
22131
|
}
|
|
22098
22132
|
return module;
|
|
22099
22133
|
}
|
|
22100
|
-
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22134
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises, loadAndResolveDependenciesPromise) {
|
|
22135
|
+
if (this.modulesWithLoadedDependencies.has(module)) {
|
|
22136
|
+
return;
|
|
22137
|
+
}
|
|
22138
|
+
this.modulesWithLoadedDependencies.add(module);
|
|
22101
22139
|
await Promise.all([
|
|
22102
22140
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22103
22141
|
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22104
22142
|
]);
|
|
22105
22143
|
module.linkImports();
|
|
22144
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22145
|
+
await loadAndResolveDependenciesPromise;
|
|
22106
22146
|
}
|
|
22107
22147
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22108
22148
|
if (resolvedId.external) {
|
|
@@ -22191,8 +22231,7 @@ class ModuleLoader {
|
|
|
22191
22231
|
async handleExistingModule(module, isEntry, isPreload) {
|
|
22192
22232
|
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22193
22233
|
if (isPreload) {
|
|
22194
|
-
|
|
22195
|
-
return;
|
|
22234
|
+
return loadPromise;
|
|
22196
22235
|
}
|
|
22197
22236
|
if (isEntry) {
|
|
22198
22237
|
module.info.isEntry = true;
|
|
@@ -22202,11 +22241,7 @@ class ModuleLoader {
|
|
|
22202
22241
|
}
|
|
22203
22242
|
module.implicitlyLoadedAfter.clear();
|
|
22204
22243
|
}
|
|
22205
|
-
|
|
22206
|
-
this.moduleLoadPromises.delete(module);
|
|
22207
|
-
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22208
|
-
}
|
|
22209
|
-
return;
|
|
22244
|
+
return this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22210
22245
|
}
|
|
22211
22246
|
handleResolveId(resolvedId, source, importer) {
|
|
22212
22247
|
if (resolvedId === null) {
|
|
@@ -23543,15 +23578,14 @@ function defineConfig(options) {
|
|
|
23543
23578
|
|
|
23544
23579
|
let fsEvents;
|
|
23545
23580
|
let fsEventsImportError;
|
|
23546
|
-
function loadFsEvents() {
|
|
23581
|
+
async function loadFsEvents() {
|
|
23547
23582
|
const moduleName = 'fsevents';
|
|
23548
|
-
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
|
-
|
|
23552
|
-
.catch(err => {
|
|
23583
|
+
try {
|
|
23584
|
+
({ default: fsEvents } = await import(moduleName));
|
|
23585
|
+
}
|
|
23586
|
+
catch (err) {
|
|
23553
23587
|
fsEventsImportError = err;
|
|
23554
|
-
}
|
|
23588
|
+
}
|
|
23555
23589
|
}
|
|
23556
23590
|
// A call to this function will be injected into the chokidar code
|
|
23557
23591
|
function getFsEvents() {
|