diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md
index 1f6df4ce7b861e..bbc74b7ce4d25e 100644
--- a/tools/node_modules/eslint/README.md
+++ b/tools/node_modules/eslint/README.md
@@ -206,6 +206,9 @@ This means:
These folks keep the project moving and are resources for help.
+
+
+
### Technical Steering Committee (TSC)
@@ -288,6 +291,9 @@ Nitin Kumar
+
+
+
## Sponsors
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://opencollective.com/eslint) to get your logo on our README and website.
diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js
index d66c2f1be32dee..2dcc2734884459 100644
--- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js
+++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js
@@ -461,6 +461,10 @@ function processCodePathToEnter(analyzer, node) {
startCodePath("function");
break;
+ case "StaticBlock":
+ startCodePath("class-static-block");
+ break;
+
case "ChainExpression":
state.pushChainContext();
break;
@@ -706,7 +710,8 @@ function postprocess(analyzer, node) {
case "Program":
case "FunctionDeclaration":
case "FunctionExpression":
- case "ArrowFunctionExpression": {
+ case "ArrowFunctionExpression":
+ case "StaticBlock": {
endCodePath();
break;
}
diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js
index f225c09a1d5902..0e666277094355 100644
--- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js
+++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js
@@ -40,7 +40,7 @@ class CodePath {
/**
* The reason that this code path was started. May be "program",
- * "function", or "class-field-initializer".
+ * "function", "class-field-initializer", or "class-static-block".
* @type {string}
*/
this.origin = origin;
diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js
index 410c07fee519e9..4e07a25751e114 100644
--- a/tools/node_modules/eslint/lib/linter/linter.js
+++ b/tools/node_modules/eslint/lib/linter/linter.js
@@ -626,7 +626,7 @@ function analyzeScope(ast, parserOptions, visitorKeys) {
ignoreEval: true,
nodejsScope: ecmaFeatures.globalReturn,
impliedStrict: ecmaFeatures.impliedStrict,
- ecmaVersion,
+ ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6,
sourceType: parserOptions.sourceType || "script",
childVisitorKeys: visitorKeys || evk.KEYS,
fallback: Traverser.getKeys
diff --git a/tools/node_modules/eslint/lib/rules/block-scoped-var.js b/tools/node_modules/eslint/lib/rules/block-scoped-var.js
index 10125e61fde090..d98250b062bcb2 100644
--- a/tools/node_modules/eslint/lib/rules/block-scoped-var.js
+++ b/tools/node_modules/eslint/lib/rules/block-scoped-var.js
@@ -112,6 +112,8 @@ module.exports = {
"SwitchStatement:exit": exitScope,
CatchClause: enterScope,
"CatchClause:exit": exitScope,
+ StaticBlock: enterScope,
+ "StaticBlock:exit": exitScope,
// Finds and reports references which are outside of valid scope.
VariableDeclaration: checkForVariables
diff --git a/tools/node_modules/eslint/lib/rules/block-spacing.js b/tools/node_modules/eslint/lib/rules/block-spacing.js
index 13cfbf0e2cba8d..990b441e34dd8a 100644
--- a/tools/node_modules/eslint/lib/rules/block-spacing.js
+++ b/tools/node_modules/eslint/lib/rules/block-spacing.js
@@ -40,7 +40,7 @@ module.exports = {
/**
* Gets the open brace token from a given node.
- * @param {ASTNode} node A BlockStatement/SwitchStatement node to get.
+ * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to get.
* @returns {Token} The token of the open brace.
*/
function getOpenBrace(node) {
@@ -50,6 +50,12 @@ module.exports = {
}
return sourceCode.getLastToken(node, 1);
}
+
+ if (node.type === "StaticBlock") {
+ return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+ }
+
+ // "BlockStatement"
return sourceCode.getFirstToken(node);
}
@@ -72,8 +78,8 @@ module.exports = {
}
/**
- * Reports invalid spacing style inside braces.
- * @param {ASTNode} node A BlockStatement/SwitchStatement node to get.
+ * Checks and reports invalid spacing style inside braces.
+ * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to check.
* @returns {void}
*/
function checkSpacingInsideBraces(node) {
@@ -157,6 +163,7 @@ module.exports = {
return {
BlockStatement: checkSpacingInsideBraces,
+ StaticBlock: checkSpacingInsideBraces,
SwitchStatement: checkSpacingInsideBraces
};
}
diff --git a/tools/node_modules/eslint/lib/rules/brace-style.js b/tools/node_modules/eslint/lib/rules/brace-style.js
index 60aa53269357ec..89f9ba559538d8 100644
--- a/tools/node_modules/eslint/lib/rules/brace-style.js
+++ b/tools/node_modules/eslint/lib/rules/brace-style.js
@@ -155,6 +155,12 @@ module.exports = {
validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node));
}
},
+ StaticBlock(node) {
+ validateCurlyPair(
+ sourceCode.getFirstToken(node, { skip: 1 }), // skip the `static` token
+ sourceCode.getLastToken(node)
+ );
+ },
ClassBody(node) {
validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node));
},
diff --git a/tools/node_modules/eslint/lib/rules/class-methods-use-this.js b/tools/node_modules/eslint/lib/rules/class-methods-use-this.js
index 034ba3abcaf5c1..beb742d93a7938 100644
--- a/tools/node_modules/eslint/lib/rules/class-methods-use-this.js
+++ b/tools/node_modules/eslint/lib/rules/class-methods-use-this.js
@@ -161,8 +161,17 @@ module.exports = {
/*
* Class field value are implicit functions.
*/
- "PropertyDefinition:exit": popContext,
"PropertyDefinition > *.key:exit": pushContext,
+ "PropertyDefinition:exit": popContext,
+
+ /*
+ * Class static blocks are implicit functions. They aren't required to use `this`,
+ * but we have to push context so that it captures any use of `this` in the static block
+ * separately from enclosing contexts, because static blocks have their own `this` and it
+ * shouldn't count as used `this` in enclosing contexts.
+ */
+ StaticBlock: pushContext,
+ "StaticBlock:exit": popContext,
ThisExpression: markThisUsed,
Super: markThisUsed,
diff --git a/tools/node_modules/eslint/lib/rules/complexity.js b/tools/node_modules/eslint/lib/rules/complexity.js
index b833aafc0f7ac6..a247039760e9a0 100644
--- a/tools/node_modules/eslint/lib/rules/complexity.js
+++ b/tools/node_modules/eslint/lib/rules/complexity.js
@@ -124,20 +124,28 @@ module.exports = {
/*
* This rule only evaluates complexity of functions, so "program" is excluded.
- * Class field initializers are implicit functions. Therefore, they shouldn't contribute
- * to the enclosing function's complexity, but their own complexity should be evaluated.
+ * Class field initializers and class static blocks are implicit functions. Therefore,
+ * they shouldn't contribute to the enclosing function's complexity, but their
+ * own complexity should be evaluated.
*/
if (
codePath.origin !== "function" &&
- codePath.origin !== "class-field-initializer"
+ codePath.origin !== "class-field-initializer" &&
+ codePath.origin !== "class-static-block"
) {
return;
}
if (complexity > THRESHOLD) {
- const name = codePath.origin === "class-field-initializer"
- ? "class field initializer"
- : astUtils.getFunctionNameWithKind(node);
+ let name;
+
+ if (codePath.origin === "class-field-initializer") {
+ name = "class field initializer";
+ } else if (codePath.origin === "class-static-block") {
+ name = "class static block";
+ } else {
+ name = astUtils.getFunctionNameWithKind(node);
+ }
context.report({
node,
diff --git a/tools/node_modules/eslint/lib/rules/indent.js b/tools/node_modules/eslint/lib/rules/indent.js
index 7b17e3e5402a8c..f4dbfff27b41cb 100644
--- a/tools/node_modules/eslint/lib/rules/indent.js
+++ b/tools/node_modules/eslint/lib/rules/indent.js
@@ -68,6 +68,7 @@ const KNOWN_NODES = new Set([
"ReturnStatement",
"SequenceExpression",
"SpreadElement",
+ "StaticBlock",
"Super",
"SwitchCase",
"SwitchStatement",
@@ -583,6 +584,16 @@ module.exports = {
},
additionalProperties: false
},
+ StaticBlock: {
+ type: "object",
+ properties: {
+ body: {
+ type: "integer",
+ minimum: 0
+ }
+ },
+ additionalProperties: false
+ },
CallExpression: {
type: "object",
properties: {
@@ -646,6 +657,9 @@ module.exports = {
parameters: DEFAULT_PARAMETER_INDENT,
body: DEFAULT_FUNCTION_BODY_INDENT
},
+ StaticBlock: {
+ body: DEFAULT_FUNCTION_BODY_INDENT
+ },
CallExpression: {
arguments: DEFAULT_PARAMETER_INDENT
},
@@ -1397,6 +1411,13 @@ module.exports = {
}
},
+ StaticBlock(node) {
+ const openingCurly = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+ const closingCurly = sourceCode.getLastToken(node);
+
+ addElementListIndent(node.body, openingCurly, closingCurly, options.StaticBlock.body);
+ },
+
SwitchStatement(node) {
const openingCurly = sourceCode.getTokenAfter(node.discriminant, astUtils.isOpeningBraceToken);
const closingCurly = sourceCode.getLastToken(node);
diff --git a/tools/node_modules/eslint/lib/rules/keyword-spacing.js b/tools/node_modules/eslint/lib/rules/keyword-spacing.js
index d860ae0f04bbeb..44222e1a493f68 100644
--- a/tools/node_modules/eslint/lib/rules/keyword-spacing.js
+++ b/tools/node_modules/eslint/lib/rules/keyword-spacing.js
@@ -590,6 +590,7 @@ module.exports = {
ImportNamespaceSpecifier: checkSpacingForImportNamespaceSpecifier,
MethodDefinition: checkSpacingForProperty,
PropertyDefinition: checkSpacingForProperty,
+ StaticBlock: checkSpacingAroundFirstToken,
Property: checkSpacingForProperty,
// To avoid conflicts with `space-infix-ops`, e.g. `a > this.b`
diff --git a/tools/node_modules/eslint/lib/rules/lines-around-comment.js b/tools/node_modules/eslint/lib/rules/lines-around-comment.js
index 79bcbb7fc19d87..513d196224e10a 100644
--- a/tools/node_modules/eslint/lib/rules/lines-around-comment.js
+++ b/tools/node_modules/eslint/lib/rules/lines-around-comment.js
@@ -185,10 +185,39 @@ module.exports = {
/**
* Returns the parent node that contains the given token.
* @param {token} token The token to check.
- * @returns {ASTNode} The parent node that contains the given token.
+ * @returns {ASTNode|null} The parent node that contains the given token.
*/
function getParentNodeOfToken(token) {
- return sourceCode.getNodeByRangeIndex(token.range[0]);
+ const node = sourceCode.getNodeByRangeIndex(token.range[0]);
+
+ /*
+ * For the purpose of this rule, the comment token is in a `StaticBlock` node only
+ * if it's inside the braces of that `StaticBlock` node.
+ *
+ * Example where this function returns `null`:
+ *
+ * static
+ * // comment
+ * {
+ * }
+ *
+ * Example where this function returns `StaticBlock` node:
+ *
+ * static
+ * {
+ * // comment
+ * }
+ *
+ */
+ if (node && node.type === "StaticBlock") {
+ const openingBrace = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+
+ return token.range[0] >= openingBrace.range[0]
+ ? node
+ : null;
+ }
+
+ return node;
}
/**
@@ -200,8 +229,15 @@ module.exports = {
function isCommentAtParentStart(token, nodeType) {
const parent = getParentNodeOfToken(token);
- return parent && isParentNodeType(parent, nodeType) &&
- token.loc.start.line - parent.loc.start.line === 1;
+ if (parent && isParentNodeType(parent, nodeType)) {
+ const parentStartNodeOrToken = parent.type === "StaticBlock"
+ ? sourceCode.getFirstToken(parent, { skip: 1 }) // opening brace of the static block
+ : parent;
+
+ return token.loc.start.line - parentStartNodeOrToken.loc.start.line === 1;
+ }
+
+ return false;
}
/**
@@ -213,7 +249,7 @@ module.exports = {
function isCommentAtParentEnd(token, nodeType) {
const parent = getParentNodeOfToken(token);
- return parent && isParentNodeType(parent, nodeType) &&
+ return !!parent && isParentNodeType(parent, nodeType) &&
parent.loc.end.line - token.loc.end.line === 1;
}
@@ -223,7 +259,12 @@ module.exports = {
* @returns {boolean} True if the comment is at block start.
*/
function isCommentAtBlockStart(token) {
- return isCommentAtParentStart(token, "ClassBody") || isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "SwitchCase");
+ return (
+ isCommentAtParentStart(token, "ClassBody") ||
+ isCommentAtParentStart(token, "BlockStatement") ||
+ isCommentAtParentStart(token, "StaticBlock") ||
+ isCommentAtParentStart(token, "SwitchCase")
+ );
}
/**
@@ -232,7 +273,13 @@ module.exports = {
* @returns {boolean} True if the comment is at block end.
*/
function isCommentAtBlockEnd(token) {
- return isCommentAtParentEnd(token, "ClassBody") || isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement");
+ return (
+ isCommentAtParentEnd(token, "ClassBody") ||
+ isCommentAtParentEnd(token, "BlockStatement") ||
+ isCommentAtParentEnd(token, "StaticBlock") ||
+ isCommentAtParentEnd(token, "SwitchCase") ||
+ isCommentAtParentEnd(token, "SwitchStatement")
+ );
}
/**
diff --git a/tools/node_modules/eslint/lib/rules/max-depth.js b/tools/node_modules/eslint/lib/rules/max-depth.js
index 415598b292949d..bdacc66afb1305 100644
--- a/tools/node_modules/eslint/lib/rules/max-depth.js
+++ b/tools/node_modules/eslint/lib/rules/max-depth.js
@@ -118,6 +118,7 @@ module.exports = {
FunctionDeclaration: startFunction,
FunctionExpression: startFunction,
ArrowFunctionExpression: startFunction,
+ StaticBlock: startFunction,
IfStatement(node) {
if (node.parent.type !== "IfStatement") {
@@ -146,6 +147,7 @@ module.exports = {
"FunctionDeclaration:exit": endFunction,
"FunctionExpression:exit": endFunction,
"ArrowFunctionExpression:exit": endFunction,
+ "StaticBlock:exit": endFunction,
"Program:exit": endFunction
};
diff --git a/tools/node_modules/eslint/lib/rules/max-statements.js b/tools/node_modules/eslint/lib/rules/max-statements.js
index 6f48c9218a9dd1..969e40bbd855c5 100644
--- a/tools/node_modules/eslint/lib/rules/max-statements.js
+++ b/tools/node_modules/eslint/lib/rules/max-statements.js
@@ -123,6 +123,14 @@ module.exports = {
function endFunction(node) {
const count = functionStack.pop();
+ /*
+ * This rule does not apply to class static blocks, but we have to track them so
+ * that stataments in them do not count as statements in the enclosing function.
+ */
+ if (node.type === "StaticBlock") {
+ return;
+ }
+
if (ignoreTopLevelFunctions && functionStack.length === 0) {
topLevelFunctions.push({ node, count });
} else {
@@ -148,12 +156,14 @@ module.exports = {
FunctionDeclaration: startFunction,
FunctionExpression: startFunction,
ArrowFunctionExpression: startFunction,
+ StaticBlock: startFunction,
BlockStatement: countStatements,
"FunctionDeclaration:exit": endFunction,
"FunctionExpression:exit": endFunction,
"ArrowFunctionExpression:exit": endFunction,
+ "StaticBlock:exit": endFunction,
"Program:exit"() {
if (topLevelFunctions.length === 1) {
diff --git a/tools/node_modules/eslint/lib/rules/no-eval.js b/tools/node_modules/eslint/lib/rules/no-eval.js
index 97481528357758..96b85a07120ef5 100644
--- a/tools/node_modules/eslint/lib/rules/no-eval.js
+++ b/tools/node_modules/eslint/lib/rules/no-eval.js
@@ -248,6 +248,8 @@ module.exports = {
"ArrowFunctionExpression:exit": exitVarScope,
"PropertyDefinition > *.value": enterVarScope,
"PropertyDefinition > *.value:exit": exitVarScope,
+ StaticBlock: enterVarScope,
+ "StaticBlock:exit": exitVarScope,
ThisExpression(node) {
if (!isMember(node.parent, "eval")) {
diff --git a/tools/node_modules/eslint/lib/rules/no-extra-semi.js b/tools/node_modules/eslint/lib/rules/no-extra-semi.js
index 952869c3ea7ae8..0e2bcaf077891b 100644
--- a/tools/node_modules/eslint/lib/rules/no-extra-semi.js
+++ b/tools/node_modules/eslint/lib/rules/no-extra-semi.js
@@ -116,7 +116,7 @@ module.exports = {
* @param {Node} node A MethodDefinition node of the start point.
* @returns {void}
*/
- "MethodDefinition, PropertyDefinition"(node) {
+ "MethodDefinition, PropertyDefinition, StaticBlock"(node) {
checkForPartOfClassBody(sourceCode.getTokenAfter(node));
}
};
diff --git a/tools/node_modules/eslint/lib/rules/no-inner-declarations.js b/tools/node_modules/eslint/lib/rules/no-inner-declarations.js
index 9bbe24d7c82edd..49b5114a2099bc 100644
--- a/tools/node_modules/eslint/lib/rules/no-inner-declarations.js
+++ b/tools/node_modules/eslint/lib/rules/no-inner-declarations.js
@@ -15,9 +15,33 @@ const astUtils = require("./utils/ast-utils");
// Rule Definition
//------------------------------------------------------------------------------
-const validParent = new Set(["Program", "ExportNamedDeclaration", "ExportDefaultDeclaration"]);
+const validParent = new Set(["Program", "StaticBlock", "ExportNamedDeclaration", "ExportDefaultDeclaration"]);
const validBlockStatementParent = new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]);
+/**
+ * Finds the nearest enclosing context where this rule allows declarations and returns its description.
+ * @param {ASTNode} node Node to search from.
+ * @returns {string} Description. One of "program", "function body", "class static block body".
+ */
+function getAllowedBodyDescription(node) {
+ let { parent } = node;
+
+ while (parent) {
+
+ if (parent.type === "StaticBlock") {
+ return "class static block body";
+ }
+
+ if (astUtils.isFunction(parent)) {
+ return "function body";
+ }
+
+ ({ parent } = parent);
+ }
+
+ return "program";
+}
+
module.exports = {
meta: {
type: "problem",
@@ -59,14 +83,12 @@ module.exports = {
return;
}
- const upperFunction = astUtils.getUpperFunction(parent);
-
context.report({
node,
messageId: "moveDeclToRoot",
data: {
type: (node.type === "FunctionDeclaration" ? "function" : "variable"),
- body: (upperFunction === null ? "program" : "function body")
+ body: getAllowedBodyDescription(node)
}
});
}
diff --git a/tools/node_modules/eslint/lib/rules/no-invalid-this.js b/tools/node_modules/eslint/lib/rules/no-invalid-this.js
index 77558b90dccbdb..e1d7cbcf553860 100644
--- a/tools/node_modules/eslint/lib/rules/no-invalid-this.js
+++ b/tools/node_modules/eslint/lib/rules/no-invalid-this.js
@@ -132,6 +132,10 @@ module.exports = {
"PropertyDefinition > *.value": enterFunction,
"PropertyDefinition > *.value:exit": exitFunction,
+ // Class static blocks are implicit functions.
+ StaticBlock: enterFunction,
+ "StaticBlock:exit": exitFunction,
+
// Reports if `this` of the current context is invalid.
ThisExpression(node) {
const current = stack.getCurrent();
diff --git a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js
index 5f74cd83c8c56a..33d4706a946646 100644
--- a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js
+++ b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js
@@ -39,7 +39,9 @@ module.exports = {
* @returns {void}
*/
function report(node) {
- const messageId = node.parent.type === "BlockStatement" ? "redundantNestedBlock" : "redundantBlock";
+ const messageId = node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock"
+ ? "redundantNestedBlock"
+ : "redundantBlock";
context.report({
node,
@@ -54,6 +56,7 @@ module.exports = {
*/
function isLoneBlock(node) {
return node.parent.type === "BlockStatement" ||
+ node.parent.type === "StaticBlock" ||
node.parent.type === "Program" ||
// Don't report blocks in switch cases if the block is the only statement of the case.
@@ -99,7 +102,10 @@ module.exports = {
loneBlocks.pop();
report(node);
} else if (
- node.parent.type === "BlockStatement" &&
+ (
+ node.parent.type === "BlockStatement" ||
+ node.parent.type === "StaticBlock"
+ ) &&
node.parent.body.length === 1
) {
report(node);
diff --git a/tools/node_modules/eslint/lib/rules/no-redeclare.js b/tools/node_modules/eslint/lib/rules/no-redeclare.js
index afbe6170cb7c88..3de4397b1b0e15 100644
--- a/tools/node_modules/eslint/lib/rules/no-redeclare.js
+++ b/tools/node_modules/eslint/lib/rules/no-redeclare.js
@@ -161,6 +161,8 @@ module.exports = {
FunctionExpression: checkForBlock,
ArrowFunctionExpression: checkForBlock,
+ StaticBlock: checkForBlock,
+
BlockStatement: checkForBlock,
ForStatement: checkForBlock,
ForInStatement: checkForBlock,
diff --git a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js
index 3bb816df778cc0..2081a518b30ce0 100644
--- a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js
+++ b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js
@@ -115,6 +115,12 @@ module.exports = {
const parent = ancestors[ancestors.length - 1],
grandparent = ancestors[ancestors.length - 2];
+ /**
+ * https://tc39.es/ecma262/#directive-prologue
+ *
+ * Only `FunctionBody`, `ScriptBody` and `ModuleBody` can have directive prologue.
+ * Class static blocks do not have directive prologue.
+ */
return (parent.type === "Program" || parent.type === "BlockStatement" &&
(/Function/u.test(grandparent.type))) &&
directives(parent).indexOf(node) >= 0;
diff --git a/tools/node_modules/eslint/lib/rules/no-use-before-define.js b/tools/node_modules/eslint/lib/rules/no-use-before-define.js
index 80ce3513af79df..7f904f46bd5404 100644
--- a/tools/node_modules/eslint/lib/rules/no-use-before-define.js
+++ b/tools/node_modules/eslint/lib/rules/no-use-before-define.js
@@ -45,25 +45,37 @@ function isInRange(node, location) {
/**
* Checks whether or not a given location is inside of the range of a class static initializer.
+ * Static initializers are static blocks and initializers of static fields.
* @param {ASTNode} node `ClassBody` node to check static initializers.
* @param {number} location A location to check.
* @returns {boolean} `true` if the location is inside of a class static initializer.
*/
function isInClassStaticInitializerRange(node, location) {
return node.body.some(classMember => (
- classMember.type === "PropertyDefinition" &&
- classMember.static &&
- classMember.value &&
- isInRange(classMember.value, location)
+ (
+ classMember.type === "StaticBlock" &&
+ isInRange(classMember, location)
+ ) ||
+ (
+ classMember.type === "PropertyDefinition" &&
+ classMember.static &&
+ classMember.value &&
+ isInRange(classMember.value, location)
+ )
));
}
/**
- * Checks whether a given scope is the scope of a static class field initializer.
+ * Checks whether a given scope is the scope of a a class static initializer.
+ * Static initializers are static blocks and initializers of static fields.
* @param {eslint-scope.Scope} scope A scope to check.
* @returns {boolean} `true` if the scope is a class static initializer scope.
*/
function isClassStaticInitializerScope(scope) {
+ if (scope.type === "class-static-block") {
+ return true;
+ }
+
if (scope.type === "class-field-initializer") {
// `scope.block` is PropertyDefinition#value node
@@ -82,7 +94,8 @@ function isClassStaticInitializerScope(scope) {
* - top-level
* - functions
* - class field initializers (implicit functions)
- * Static class field initializers are automatically run during the class definition evaluation,
+ * - class static blocks (implicit functions)
+ * Static class field initializers and class static blocks are automatically run during the class definition evaluation,
* and therefore we'll consider them as a part of the parent execution context.
* Example:
*
@@ -90,6 +103,7 @@ function isClassStaticInitializerScope(scope) {
*
* x; // returns `false`
* () => x; // returns `true`
+ *
* class C {
* field = x; // returns `true`
* static field = x; // returns `false`
@@ -97,6 +111,14 @@ function isClassStaticInitializerScope(scope) {
* method() {
* x; // returns `true`
* }
+ *
+ * static method() {
+ * x; // returns `true`
+ * }
+ *
+ * static {
+ * x; // returns `false`
+ * }
* }
* @param {eslint-scope.Reference} reference A reference to check.
* @returns {boolean} `true` if the reference is from a separate execution context.
@@ -127,8 +149,9 @@ function isFromSeparateExecutionContext(reference) {
* var {a = a} = obj
* for (var a in a) {}
* for (var a of a) {}
- * var C = class { [C]; }
- * var C = class { static foo = C; }
+ * var C = class { [C]; };
+ * var C = class { static foo = C; };
+ * var C = class { static { foo = C; } };
* class C extends C {}
* class C extends (class { static foo = C; }) {}
* class C { [C]; }
@@ -158,7 +181,7 @@ function isEvaluatedDuringInitialization(reference) {
/*
* Class binding is initialized before running static initializers.
- * For example, `class C { static foo = C; }` is valid.
+ * For example, `class C { static foo = C; static { bar = C; } }` is valid.
*/
!isInClassStaticInitializerRange(classDefinition.body, location)
);
diff --git a/tools/node_modules/eslint/lib/rules/one-var.js b/tools/node_modules/eslint/lib/rules/one-var.js
index 9c78ef87da8a47..daff2d22b15254 100644
--- a/tools/node_modules/eslint/lib/rules/one-var.js
+++ b/tools/node_modules/eslint/lib/rules/one-var.js
@@ -541,6 +541,8 @@ module.exports = {
FunctionDeclaration: startFunction,
FunctionExpression: startFunction,
ArrowFunctionExpression: startFunction,
+ StaticBlock: startFunction, // StaticBlock creates a new scope for `var` variables
+
BlockStatement: startBlock,
ForStatement: startBlock,
ForInStatement: startBlock,
@@ -552,10 +554,12 @@ module.exports = {
"ForInStatement:exit": endBlock,
"SwitchStatement:exit": endBlock,
"BlockStatement:exit": endBlock,
+
"Program:exit": endFunction,
"FunctionDeclaration:exit": endFunction,
"FunctionExpression:exit": endFunction,
- "ArrowFunctionExpression:exit": endFunction
+ "ArrowFunctionExpression:exit": endFunction,
+ "StaticBlock:exit": endFunction
};
}
diff --git a/tools/node_modules/eslint/lib/rules/padded-blocks.js b/tools/node_modules/eslint/lib/rules/padded-blocks.js
index ca83f11fc50b6d..de75e8d2d51b06 100644
--- a/tools/node_modules/eslint/lib/rules/padded-blocks.js
+++ b/tools/node_modules/eslint/lib/rules/padded-blocks.js
@@ -106,6 +106,12 @@ module.exports = {
if (node.type === "SwitchStatement") {
return sourceCode.getTokenBefore(node.cases[0]);
}
+
+ if (node.type === "StaticBlock") {
+ return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+ }
+
+ // `BlockStatement` or `ClassBody`
return sourceCode.getFirstToken(node);
}
@@ -172,6 +178,7 @@ module.exports = {
function requirePaddingFor(node) {
switch (node.type) {
case "BlockStatement":
+ case "StaticBlock":
return options.blocks;
case "SwitchStatement":
return options.switches;
@@ -282,6 +289,7 @@ module.exports = {
}
checkPadding(node);
};
+ rule.StaticBlock = rule.BlockStatement;
}
if (Object.prototype.hasOwnProperty.call(options, "classes")) {
diff --git a/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js b/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js
index 073940a40eb144..42859dd38b0b8f 100644
--- a/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js
+++ b/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js
@@ -618,9 +618,11 @@ module.exports = {
Program: enterScope,
BlockStatement: enterScope,
SwitchStatement: enterScope,
+ StaticBlock: enterScope,
"Program:exit": exitScope,
"BlockStatement:exit": exitScope,
"SwitchStatement:exit": exitScope,
+ "StaticBlock:exit": exitScope,
":statement": verify,
diff --git a/tools/node_modules/eslint/lib/rules/prefer-const.js b/tools/node_modules/eslint/lib/rules/prefer-const.js
index b44bd7592b536e..38ec973fcdb592 100644
--- a/tools/node_modules/eslint/lib/rules/prefer-const.js
+++ b/tools/node_modules/eslint/lib/rules/prefer-const.js
@@ -17,7 +17,7 @@ const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
const PATTERN_TYPE = /^(?:.+?Pattern|RestElement|SpreadProperty|ExperimentalRestProperty|Property)$/u;
-const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|SwitchCase)$/u;
+const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|StaticBlock|SwitchCase)$/u;
const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u;
/**
diff --git a/tools/node_modules/eslint/lib/rules/require-atomic-updates.js b/tools/node_modules/eslint/lib/rules/require-atomic-updates.js
index 9eee4ca38bc6ab..248b0eb11d00d5 100644
--- a/tools/node_modules/eslint/lib/rules/require-atomic-updates.js
+++ b/tools/node_modules/eslint/lib/rules/require-atomic-updates.js
@@ -176,7 +176,17 @@ module.exports = {
},
fixable: null,
- schema: [],
+
+ schema: [{
+ type: "object",
+ properties: {
+ allowProperties: {
+ type: "boolean",
+ default: false
+ }
+ },
+ additionalProperties: false
+ }],
messages: {
nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.",
@@ -185,6 +195,8 @@ module.exports = {
},
create(context) {
+ const allowProperties = !!context.options[0] && context.options[0].allowProperties;
+
const sourceCode = context.getSourceCode();
const assignmentReferences = new Map();
const segmentInfo = new SegmentInfo();
@@ -284,7 +296,7 @@ module.exports = {
value: variable.name
}
});
- } else {
+ } else if (!allowProperties) {
context.report({
node: node.parent,
messageId: "nonAtomicObjectUpdate",
diff --git a/tools/node_modules/eslint/lib/rules/semi-style.js b/tools/node_modules/eslint/lib/rules/semi-style.js
index 43d8d51f969ea2..2d17d028c2fb06 100644
--- a/tools/node_modules/eslint/lib/rules/semi-style.js
+++ b/tools/node_modules/eslint/lib/rules/semi-style.js
@@ -25,7 +25,8 @@ const SELECTOR = [
/**
* Get the child node list of a given node.
- * This returns `Program#body`, `BlockStatement#body`, or `SwitchCase#consequent`.
+ * This returns `BlockStatement#body`, `StaticBlock#body`, `Program#body`,
+ * `ClassBody#body`, or `SwitchCase#consequent`.
* This is used to check whether a node is the first/last child.
* @param {Node} node A node to get child node list.
* @returns {Node[]|null} The child node list.
@@ -33,7 +34,12 @@ const SELECTOR = [
function getChildren(node) {
const t = node.type;
- if (t === "BlockStatement" || t === "Program" || t === "ClassBody") {
+ if (
+ t === "BlockStatement" ||
+ t === "StaticBlock" ||
+ t === "Program" ||
+ t === "ClassBody"
+ ) {
return node.body;
}
if (t === "SwitchCase") {
diff --git a/tools/node_modules/eslint/lib/rules/semi.js b/tools/node_modules/eslint/lib/rules/semi.js
index 4124a8c508cb11..c29029cedfe153 100644
--- a/tools/node_modules/eslint/lib/rules/semi.js
+++ b/tools/node_modules/eslint/lib/rules/semi.js
@@ -306,22 +306,31 @@ module.exports = {
}
/**
- * Checks a node to see if it's in a one-liner block statement.
+ * Checks a node to see if it's the last item in a one-liner block.
+ * Block is any `BlockStatement` or `StaticBlock` node. Block is a one-liner if its
+ * braces (and consequently everything between them) are on the same line.
* @param {ASTNode} node The node to check.
- * @returns {boolean} whether the node is in a one-liner block statement.
+ * @returns {boolean} whether the node is the last item in a one-liner block.
*/
- function isOneLinerBlock(node) {
+ function isLastInOneLinerBlock(node) {
const parent = node.parent;
const nextToken = sourceCode.getTokenAfter(node);
if (!nextToken || nextToken.value !== "}") {
return false;
}
- return (
- !!parent &&
- parent.type === "BlockStatement" &&
- parent.loc.start.line === parent.loc.end.line
- );
+
+ if (parent.type === "BlockStatement") {
+ return parent.loc.start.line === parent.loc.end.line;
+ }
+
+ if (parent.type === "StaticBlock") {
+ const openingBrace = sourceCode.getFirstToken(parent, { skip: 1 }); // skip the `static` token
+
+ return openingBrace.loc.start.line === parent.loc.end.line;
+ }
+
+ return false;
}
/**
@@ -343,7 +352,7 @@ module.exports = {
report(node);
}
} else {
- const oneLinerBlock = (exceptOneLine && isOneLinerBlock(node));
+ const oneLinerBlock = (exceptOneLine && isLastInOneLinerBlock(node));
if (isSemi && oneLinerBlock) {
report(node, true);
diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js
index e4fd977c1166a9..16d7b811571483 100644
--- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js
+++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js
@@ -35,7 +35,7 @@ const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|g
const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
// A set of node types that can contain a list of statements
-const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]);
+const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "StaticBlock", "SwitchCase"]);
const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
@@ -937,6 +937,8 @@ module.exports = {
*
* First, this checks the node:
*
+ * - The given node is not in `PropertyDefinition#value` position.
+ * - The given node is not `StaticBlock`.
* - The function name does not start with uppercase. It's a convention to capitalize the names
* of constructor functions. This check is not performed if `capIsConstructor` is set to `false`.
* - The function does not have a JSDoc comment that has a @this tag.
@@ -951,7 +953,8 @@ module.exports = {
* - The location is not on an ES2015 class.
* - Its `bind`/`call`/`apply` method is not called directly.
* - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given.
- * @param {ASTNode} node A function node to check.
+ * @param {ASTNode} node A function node to check. It also can be an implicit function, like `StaticBlock`
+ * or any expression that is `PropertyDefinition#value` node.
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
* @param {boolean} [capIsConstructor = true] `false` disables the assumption that functions which name starts
* with an uppercase or are assigned to a variable which name starts with an uppercase are constructors.
@@ -964,7 +967,12 @@ module.exports = {
* Therefore, A expression node at `PropertyDefinition#value` is a function.
* In this case, `this` is always not default binding.
*/
- if (node && node.parent && node.parent.type === "PropertyDefinition" && node.value === node) {
+ if (node.parent.type === "PropertyDefinition" && node.parent.value === node) {
+ return false;
+ }
+
+ // Class static blocks are implicit functions. In this case, `this` is always not default binding.
+ if (node.type === "StaticBlock") {
return false;
}
@@ -1825,6 +1833,10 @@ module.exports = {
return true;
}
+ if (rightToken.type === "PrivateIdentifier") {
+ return true;
+ }
+
return false;
},
diff --git a/tools/node_modules/eslint/lib/rules/vars-on-top.js b/tools/node_modules/eslint/lib/rules/vars-on-top.js
index 6f913dcad9d5ba..0f95d58dbc670e 100644
--- a/tools/node_modules/eslint/lib/rules/vars-on-top.js
+++ b/tools/node_modules/eslint/lib/rules/vars-on-top.js
@@ -77,10 +77,12 @@ module.exports = {
const l = statements.length;
let i = 0;
- // skip over directives
- for (; i < l; ++i) {
- if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) {
- break;
+ // Skip over directives and imports. Static blocks don't have either.
+ if (node.parent.type !== "StaticBlock") {
+ for (; i < l; ++i) {
+ if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) {
+ break;
+ }
}
}
@@ -111,16 +113,27 @@ module.exports = {
/**
* Checks whether variable is on top at functional block scope level
* @param {ASTNode} node The node to check
- * @param {ASTNode} parent Parent of the node
- * @param {ASTNode} grandParent Parent of the node's parent
* @returns {void}
*/
- function blockScopeVarCheck(node, parent, grandParent) {
- if (!(/Function/u.test(grandParent.type) &&
- parent.type === "BlockStatement" &&
- isVarOnTop(node, parent.body))) {
- context.report({ node, messageId: "top" });
+ function blockScopeVarCheck(node) {
+ const { parent } = node;
+
+ if (
+ parent.type === "BlockStatement" &&
+ /Function/u.test(parent.parent.type) &&
+ isVarOnTop(node, parent.body)
+ ) {
+ return;
}
+
+ if (
+ parent.type === "StaticBlock" &&
+ isVarOnTop(node, parent.body)
+ ) {
+ return;
+ }
+
+ context.report({ node, messageId: "top" });
}
//--------------------------------------------------------------------------
@@ -134,7 +147,7 @@ module.exports = {
} else if (node.parent.type === "Program") {
globalVarCheck(node, node.parent);
} else {
- blockScopeVarCheck(node, node.parent, node.parent.parent);
+ blockScopeVarCheck(node);
}
}
};
diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js
index 96e3b82d834408..5d9b521ac320bd 100644
--- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js
+++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js
@@ -1,8 +1,8 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = global || self, factory(global.acorn = {}));
-}(this, (function (exports) { 'use strict';
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.acorn = {}));
+})(this, (function (exports) { 'use strict';
// Reserved word lists for various dialects of the language
@@ -18,7 +18,7 @@
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";
- var keywords = {
+ var keywords$1 = {
5: ecma5AndLessKeywords,
"5module": ecma5AndLessKeywords + " export import",
6: ecma5AndLessKeywords + " const class extends export import super"
@@ -137,17 +137,17 @@
// Map keyword names to token types.
- var keywords$1 = {};
+ var keywords = {};
// Succinct definitions of keyword token types
function kw(name, options) {
if ( options === void 0 ) options = {};
options.keyword = name;
- return keywords$1[name] = new TokenType(name, options)
+ return keywords[name] = new TokenType(name, options)
}
- var types = {
+ var types$1 = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
@@ -489,7 +489,7 @@
var Parser = function Parser(options, input, startPos) {
this.options = options = getOptions(options);
this.sourceFile = options.sourceFile;
- this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
+ this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
var reserved = "";
if (options.allowReserved !== true) {
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
@@ -520,7 +520,7 @@
// Properties of the current token:
// Its type
- this.type = types.eof;
+ this.type = types$1.eof;
// For tokens that include more information than their type, the value
this.value = null;
// Its start and end offset
@@ -580,8 +580,11 @@
};
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
+
prototypeAccessors.canAwait.get = function () {
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
var scope = this.scopeStack[i];
@@ -590,20 +593,25 @@
}
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
};
+
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
var inClassFieldInit = ref.inClassFieldInit;
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
};
+
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
+
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
+
prototypeAccessors.allowNewDotTarget.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
var inClassFieldInit = ref.inClassFieldInit;
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
};
+
prototypeAccessors.inClassStaticBlock.get = function () {
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
};
@@ -633,12 +641,12 @@
Object.defineProperties( Parser.prototype, prototypeAccessors );
- var pp = Parser.prototype;
+ var pp$9 = Parser.prototype;
// ## Parser utilities
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
- pp.strictDirective = function(start) {
+ pp$9.strictDirective = function(start) {
for (;;) {
// Try to find string literal.
skipWhiteSpace.lastIndex = start;
@@ -666,7 +674,7 @@
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
- pp.eat = function(type) {
+ pp$9.eat = function(type) {
if (this.type === type) {
this.next();
return true
@@ -677,13 +685,13 @@
// Tests whether parsed token is a contextual keyword.
- pp.isContextual = function(name) {
- return this.type === types.name && this.value === name && !this.containsEsc
+ pp$9.isContextual = function(name) {
+ return this.type === types$1.name && this.value === name && !this.containsEsc
};
// Consumes contextual keyword if possible.
- pp.eatContextual = function(name) {
+ pp$9.eatContextual = function(name) {
if (!this.isContextual(name)) { return false }
this.next();
return true
@@ -691,19 +699,19 @@
// Asserts that following token is given contextual keyword.
- pp.expectContextual = function(name) {
+ pp$9.expectContextual = function(name) {
if (!this.eatContextual(name)) { this.unexpected(); }
};
// Test whether a semicolon can be inserted at the current position.
- pp.canInsertSemicolon = function() {
- return this.type === types.eof ||
- this.type === types.braceR ||
+ pp$9.canInsertSemicolon = function() {
+ return this.type === types$1.eof ||
+ this.type === types$1.braceR ||
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
};
- pp.insertSemicolon = function() {
+ pp$9.insertSemicolon = function() {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon)
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
@@ -714,11 +722,11 @@
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
- pp.semicolon = function() {
- if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
+ pp$9.semicolon = function() {
+ if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
};
- pp.afterTrailingComma = function(tokType, notNext) {
+ pp$9.afterTrailingComma = function(tokType, notNext) {
if (this.type === tokType) {
if (this.options.onTrailingComma)
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
@@ -731,13 +739,13 @@
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
- pp.expect = function(type) {
+ pp$9.expect = function(type) {
this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
- pp.unexpected = function(pos) {
+ pp$9.unexpected = function(pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
@@ -750,7 +758,7 @@
-1;
}
- pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
+ pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
if (!refDestructuringErrors) { return }
if (refDestructuringErrors.trailingComma > -1)
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
@@ -758,7 +766,7 @@
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
};
- pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
+ pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
if (!refDestructuringErrors) { return false }
var shorthandAssign = refDestructuringErrors.shorthandAssign;
var doubleProto = refDestructuringErrors.doubleProto;
@@ -769,20 +777,20 @@
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
};
- pp.checkYieldAwaitInDefaultParams = function() {
+ pp$9.checkYieldAwaitInDefaultParams = function() {
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
if (this.awaitPos)
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
};
- pp.isSimpleAssignTarget = function(expr) {
+ pp$9.isSimpleAssignTarget = function(expr) {
if (expr.type === "ParenthesizedExpression")
{ return this.isSimpleAssignTarget(expr.expression) }
return expr.type === "Identifier" || expr.type === "MemberExpression"
};
- var pp$1 = Parser.prototype;
+ var pp$8 = Parser.prototype;
// ### Statement parsing
@@ -791,10 +799,10 @@
// `program` argument. If present, the statements will be appended
// to its body instead of creating a new node.
- pp$1.parseTopLevel = function(node) {
+ pp$8.parseTopLevel = function(node) {
var exports = Object.create(null);
if (!node.body) { node.body = []; }
- while (this.type !== types.eof) {
+ while (this.type !== types$1.eof) {
var stmt = this.parseStatement(null, true, exports);
node.body.push(stmt);
}
@@ -813,7 +821,7 @@
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
- pp$1.isLet = function(context) {
+ pp$8.isLet = function(context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
@@ -839,7 +847,7 @@
// check 'async [no LineTerminator here] function'
// - 'async /*foo*/ function' is OK.
// - 'async /*\n*/ function' is invalid.
- pp$1.isAsyncFunction = function() {
+ pp$8.isAsyncFunction = function() {
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
{ return false }
@@ -859,11 +867,11 @@
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
- pp$1.parseStatement = function(context, topLevel, exports) {
+ pp$8.parseStatement = function(context, topLevel, exports) {
var starttype = this.type, node = this.startNode(), kind;
if (this.isLet(context)) {
- starttype = types._var;
+ starttype = types$1._var;
kind = "let";
}
@@ -872,35 +880,35 @@
// complexity.
switch (starttype) {
- case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
- case types._debugger: return this.parseDebuggerStatement(node)
- case types._do: return this.parseDoStatement(node)
- case types._for: return this.parseForStatement(node)
- case types._function:
+ case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
+ case types$1._debugger: return this.parseDebuggerStatement(node)
+ case types$1._do: return this.parseDoStatement(node)
+ case types$1._for: return this.parseForStatement(node)
+ case types$1._function:
// Function as sole body of either an if statement or a labeled statement
// works, but not when it is part of a labeled statement that is the sole
// body of an if statement.
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
return this.parseFunctionStatement(node, false, !context)
- case types._class:
+ case types$1._class:
if (context) { this.unexpected(); }
return this.parseClass(node, true)
- case types._if: return this.parseIfStatement(node)
- case types._return: return this.parseReturnStatement(node)
- case types._switch: return this.parseSwitchStatement(node)
- case types._throw: return this.parseThrowStatement(node)
- case types._try: return this.parseTryStatement(node)
- case types._const: case types._var:
+ case types$1._if: return this.parseIfStatement(node)
+ case types$1._return: return this.parseReturnStatement(node)
+ case types$1._switch: return this.parseSwitchStatement(node)
+ case types$1._throw: return this.parseThrowStatement(node)
+ case types$1._try: return this.parseTryStatement(node)
+ case types$1._const: case types$1._var:
kind = kind || this.value;
if (context && kind !== "var") { this.unexpected(); }
return this.parseVarStatement(node, kind)
- case types._while: return this.parseWhileStatement(node)
- case types._with: return this.parseWithStatement(node)
- case types.braceL: return this.parseBlock(true, node)
- case types.semi: return this.parseEmptyStatement(node)
- case types._export:
- case types._import:
- if (this.options.ecmaVersion > 10 && starttype === types._import) {
+ case types$1._while: return this.parseWhileStatement(node)
+ case types$1._with: return this.parseWithStatement(node)
+ case types$1.braceL: return this.parseBlock(true, node)
+ case types$1.semi: return this.parseEmptyStatement(node)
+ case types$1._export:
+ case types$1._import:
+ if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
@@ -914,7 +922,7 @@
if (!this.inModule)
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
}
- return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
// If the statement does not start with a statement keyword or a
// brace, it's an ExpressionStatement or LabeledStatement. We
@@ -929,17 +937,17 @@
}
var maybeName = this.value, expr = this.parseExpression();
- if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
+ if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
else { return this.parseExpressionStatement(node, expr) }
}
};
- pp$1.parseBreakContinueStatement = function(node, keyword) {
+ pp$8.parseBreakContinueStatement = function(node, keyword) {
var isBreak = keyword === "break";
this.next();
- if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
- else if (this.type !== types.name) { this.unexpected(); }
+ if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
+ else if (this.type !== types$1.name) { this.unexpected(); }
else {
node.label = this.parseIdent();
this.semicolon();
@@ -959,21 +967,21 @@
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
};
- pp$1.parseDebuggerStatement = function(node) {
+ pp$8.parseDebuggerStatement = function(node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement")
};
- pp$1.parseDoStatement = function(node) {
+ pp$8.parseDoStatement = function(node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement("do");
this.labels.pop();
- this.expect(types._while);
+ this.expect(types$1._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6)
- { this.eat(types.semi); }
+ { this.eat(types$1.semi); }
else
{ this.semicolon(); }
return this.finishNode(node, "DoWhileStatement")
@@ -987,25 +995,25 @@
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
- pp$1.parseForStatement = function(node) {
+ pp$8.parseForStatement = function(node) {
this.next();
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
this.labels.push(loopLabel);
this.enterScope(0);
- this.expect(types.parenL);
- if (this.type === types.semi) {
+ this.expect(types$1.parenL);
+ if (this.type === types$1.semi) {
if (awaitAt > -1) { this.unexpected(awaitAt); }
return this.parseFor(node, null)
}
var isLet = this.isLet();
- if (this.type === types._var || this.type === types._const || isLet) {
+ if (this.type === types$1._var || this.type === types$1._const || isLet) {
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
this.next();
this.parseVar(init$1, true, kind);
this.finishNode(init$1, "VariableDeclaration");
- if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
+ if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
if (this.options.ecmaVersion >= 9) {
- if (this.type === types._in) {
+ if (this.type === types$1._in) {
if (awaitAt > -1) { this.unexpected(awaitAt); }
} else { node.await = awaitAt > -1; }
}
@@ -1017,9 +1025,9 @@
var startsWithLet = this.isContextual("let"), isForOf = false;
var refDestructuringErrors = new DestructuringErrors;
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
- if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
+ if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
if (this.options.ecmaVersion >= 9) {
- if (this.type === types._in) {
+ if (this.type === types$1._in) {
if (awaitAt > -1) { this.unexpected(awaitAt); }
} else { node.await = awaitAt > -1; }
}
@@ -1034,21 +1042,21 @@
return this.parseFor(node, init)
};
- pp$1.parseFunctionStatement = function(node, isAsync, declarationPosition) {
+ pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
this.next();
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
};
- pp$1.parseIfStatement = function(node) {
+ pp$8.parseIfStatement = function(node) {
this.next();
node.test = this.parseParenExpression();
// allow function declarations in branches, but only in non-strict mode
node.consequent = this.parseStatement("if");
- node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
+ node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
return this.finishNode(node, "IfStatement")
};
- pp$1.parseReturnStatement = function(node) {
+ pp$8.parseReturnStatement = function(node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
{ this.raise(this.start, "'return' outside of function"); }
this.next();
@@ -1057,16 +1065,16 @@
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
- if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
+ if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
else { node.argument = this.parseExpression(); this.semicolon(); }
return this.finishNode(node, "ReturnStatement")
};
- pp$1.parseSwitchStatement = function(node) {
+ pp$8.parseSwitchStatement = function(node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
- this.expect(types.braceL);
+ this.expect(types$1.braceL);
this.labels.push(switchLabel);
this.enterScope(0);
@@ -1075,9 +1083,9 @@
// adding statements to.
var cur;
- for (var sawDefault = false; this.type !== types.braceR;) {
- if (this.type === types._case || this.type === types._default) {
- var isCase = this.type === types._case;
+ for (var sawDefault = false; this.type !== types$1.braceR;) {
+ if (this.type === types$1._case || this.type === types$1._default) {
+ var isCase = this.type === types$1._case;
if (cur) { this.finishNode(cur, "SwitchCase"); }
node.cases.push(cur = this.startNode());
cur.consequent = [];
@@ -1089,7 +1097,7 @@
sawDefault = true;
cur.test = null;
}
- this.expect(types.colon);
+ this.expect(types$1.colon);
} else {
if (!cur) { this.unexpected(); }
cur.consequent.push(this.parseStatement(null));
@@ -1102,7 +1110,7 @@
return this.finishNode(node, "SwitchStatement")
};
- pp$1.parseThrowStatement = function(node) {
+ pp$8.parseThrowStatement = function(node) {
this.next();
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
@@ -1113,21 +1121,21 @@
// Reused empty array added for node fields that are always empty.
- var empty = [];
+ var empty$1 = [];
- pp$1.parseTryStatement = function(node) {
+ pp$8.parseTryStatement = function(node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
- if (this.type === types._catch) {
+ if (this.type === types$1._catch) {
var clause = this.startNode();
this.next();
- if (this.eat(types.parenL)) {
+ if (this.eat(types$1.parenL)) {
clause.param = this.parseBindingAtom();
var simple = clause.param.type === "Identifier";
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
} else {
if (this.options.ecmaVersion < 10) { this.unexpected(); }
clause.param = null;
@@ -1137,20 +1145,20 @@
this.exitScope();
node.handler = this.finishNode(clause, "CatchClause");
}
- node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
+ node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer)
{ this.raise(node.start, "Missing catch or finally clause"); }
return this.finishNode(node, "TryStatement")
};
- pp$1.parseVarStatement = function(node, kind) {
+ pp$8.parseVarStatement = function(node, kind) {
this.next();
this.parseVar(node, false, kind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration")
};
- pp$1.parseWhileStatement = function(node) {
+ pp$8.parseWhileStatement = function(node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
@@ -1159,7 +1167,7 @@
return this.finishNode(node, "WhileStatement")
};
- pp$1.parseWithStatement = function(node) {
+ pp$8.parseWithStatement = function(node) {
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
this.next();
node.object = this.parseParenExpression();
@@ -1167,12 +1175,12 @@
return this.finishNode(node, "WithStatement")
};
- pp$1.parseEmptyStatement = function(node) {
+ pp$8.parseEmptyStatement = function(node) {
this.next();
return this.finishNode(node, "EmptyStatement")
};
- pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
+ pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
{
var label = list[i$1];
@@ -1180,7 +1188,7 @@
if (label.name === maybeName)
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
} }
- var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
+ var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
for (var i = this.labels.length - 1; i >= 0; i--) {
var label$1 = this.labels[i];
if (label$1.statementStart === node.start) {
@@ -1196,7 +1204,7 @@
return this.finishNode(node, "LabeledStatement")
};
- pp$1.parseExpressionStatement = function(node, expr) {
+ pp$8.parseExpressionStatement = function(node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement")
@@ -1206,14 +1214,14 @@
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
- pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
+ pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
if ( node === void 0 ) node = this.startNode();
node.body = [];
- this.expect(types.braceL);
+ this.expect(types$1.braceL);
if (createNewLexicalScope) { this.enterScope(0); }
- while (this.type !== types.braceR) {
+ while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
@@ -1227,13 +1235,13 @@
// `parseStatement` will already have parsed the init statement or
// expression.
- pp$1.parseFor = function(node, init) {
+ pp$8.parseFor = function(node, init) {
node.init = init;
- this.expect(types.semi);
- node.test = this.type === types.semi ? null : this.parseExpression();
- this.expect(types.semi);
- node.update = this.type === types.parenR ? null : this.parseExpression();
- this.expect(types.parenR);
+ this.expect(types$1.semi);
+ node.test = this.type === types$1.semi ? null : this.parseExpression();
+ this.expect(types$1.semi);
+ node.update = this.type === types$1.parenR ? null : this.parseExpression();
+ this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
@@ -1243,8 +1251,8 @@
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
- pp$1.parseForIn = function(node, init) {
- var isForIn = this.type === types._in;
+ pp$8.parseForIn = function(node, init) {
+ var isForIn = this.type === types$1._in;
this.next();
if (
@@ -1265,7 +1273,7 @@
}
node.left = init;
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
@@ -1274,28 +1282,28 @@
// Parse a list of variable declarations.
- pp$1.parseVar = function(node, isFor, kind) {
+ pp$8.parseVar = function(node, isFor, kind) {
node.declarations = [];
node.kind = kind;
for (;;) {
var decl = this.startNode();
this.parseVarId(decl, kind);
- if (this.eat(types.eq)) {
+ if (this.eat(types$1.eq)) {
decl.init = this.parseMaybeAssign(isFor);
- } else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
+ } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
this.unexpected();
- } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
+ } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
} else {
decl.init = null;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
- if (!this.eat(types.comma)) { break }
+ if (!this.eat(types$1.comma)) { break }
}
return node
};
- pp$1.parseVarId = function(decl, kind) {
+ pp$8.parseVarId = function(decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
};
@@ -1306,18 +1314,18 @@
// `statement & FUNC_STATEMENT`).
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
- pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
+ pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
this.initFunction(node);
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
- if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
+ if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
{ this.unexpected(); }
- node.generator = this.eat(types.star);
+ node.generator = this.eat(types$1.star);
}
if (this.options.ecmaVersion >= 8)
{ node.async = !!isAsync; }
if (statement & FUNC_STATEMENT) {
- node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
+ node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
// If it is a regular function declaration in sloppy mode, then it is
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
@@ -1333,7 +1341,7 @@
this.enterScope(functionFlags(node.async, node.generator));
if (!(statement & FUNC_STATEMENT))
- { node.id = this.type === types.name ? this.parseIdent() : null; }
+ { node.id = this.type === types$1.name ? this.parseIdent() : null; }
this.parseFunctionParams(node);
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
@@ -1344,16 +1352,16 @@
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
};
- pp$1.parseFunctionParams = function(node) {
- this.expect(types.parenL);
- node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
+ pp$8.parseFunctionParams = function(node) {
+ this.expect(types$1.parenL);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
};
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
- pp$1.parseClass = function(node, isStatement) {
+ pp$8.parseClass = function(node, isStatement) {
this.next();
// ecma-262 14.6 Class Definitions
@@ -1367,8 +1375,8 @@
var classBody = this.startNode();
var hadConstructor = false;
classBody.body = [];
- this.expect(types.braceL);
- while (this.type !== types.braceR) {
+ this.expect(types$1.braceL);
+ while (this.type !== types$1.braceR) {
var element = this.parseClassElement(node.superClass !== null);
if (element) {
classBody.body.push(element);
@@ -1387,8 +1395,8 @@
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
};
- pp$1.parseClassElement = function(constructorAllowsSuper) {
- if (this.eat(types.semi)) { return null }
+ pp$8.parseClassElement = function(constructorAllowsSuper) {
+ if (this.eat(types$1.semi)) { return null }
var ecmaVersion = this.options.ecmaVersion;
var node = this.startNode();
@@ -1400,11 +1408,11 @@
if (this.eatContextual("static")) {
// Parse static init block
- if (ecmaVersion >= 13 && this.eat(types.braceL)) {
+ if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
this.parseClassStaticBlock(node);
return node
}
- if (this.isClassElementNameStart() || this.type === types.star) {
+ if (this.isClassElementNameStart() || this.type === types$1.star) {
isStatic = true;
} else {
keyName = "static";
@@ -1412,13 +1420,13 @@
}
node.static = isStatic;
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
- if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
+ if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
isAsync = true;
} else {
keyName = "async";
}
}
- if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
+ if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
isGenerator = true;
}
if (!keyName && !isAsync && !isGenerator) {
@@ -1445,7 +1453,7 @@
}
// Parse element value
- if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
+ if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
var isConstructor = !node.static && checkKeyName(node, "constructor");
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
@@ -1459,19 +1467,19 @@
return node
};
- pp$1.isClassElementNameStart = function() {
+ pp$8.isClassElementNameStart = function() {
return (
- this.type === types.name ||
- this.type === types.privateId ||
- this.type === types.num ||
- this.type === types.string ||
- this.type === types.bracketL ||
+ this.type === types$1.name ||
+ this.type === types$1.privateId ||
+ this.type === types$1.num ||
+ this.type === types$1.string ||
+ this.type === types$1.bracketL ||
this.type.keyword
)
};
- pp$1.parseClassElementName = function(element) {
- if (this.type === types.privateId) {
+ pp$8.parseClassElementName = function(element) {
+ if (this.type === types$1.privateId) {
if (this.value === "constructor") {
this.raise(this.start, "Classes can't have an element named '#constructor'");
}
@@ -1482,7 +1490,7 @@
}
};
- pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
+ pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
// Check key and flags
var key = method.key;
if (method.kind === "constructor") {
@@ -1506,14 +1514,14 @@
return this.finishNode(method, "MethodDefinition")
};
- pp$1.parseClassField = function(field) {
+ pp$8.parseClassField = function(field) {
if (checkKeyName(field, "constructor")) {
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
} else if (field.static && checkKeyName(field, "prototype")) {
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
}
- if (this.eat(types.eq)) {
+ if (this.eat(types$1.eq)) {
// To raise SyntaxError if 'arguments' exists in the initializer.
var scope = this.currentThisScope();
var inClassFieldInit = scope.inClassFieldInit;
@@ -1528,13 +1536,13 @@
return this.finishNode(field, "PropertyDefinition")
};
- pp$1.parseClassStaticBlock = function(node) {
+ pp$8.parseClassStaticBlock = function(node) {
node.body = [];
var oldLabels = this.labels;
this.labels = [];
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
- while (this.type !== types.braceR) {
+ while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
@@ -1545,8 +1553,8 @@
return this.finishNode(node, "StaticBlock")
};
- pp$1.parseClassId = function(node, isStatement) {
- if (this.type === types.name) {
+ pp$8.parseClassId = function(node, isStatement) {
+ if (this.type === types$1.name) {
node.id = this.parseIdent();
if (isStatement)
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
@@ -1557,17 +1565,17 @@
}
};
- pp$1.parseClassSuper = function(node) {
- node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
+ pp$8.parseClassSuper = function(node) {
+ node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
};
- pp$1.enterClassBody = function() {
+ pp$8.enterClassBody = function() {
var element = {declared: Object.create(null), used: []};
this.privateNameStack.push(element);
return element.declared
};
- pp$1.exitClassBody = function() {
+ pp$8.exitClassBody = function() {
var ref = this.privateNameStack.pop();
var declared = ref.declared;
var used = ref.used;
@@ -1622,10 +1630,10 @@
// Parses module export declaration.
- pp$1.parseExport = function(node, exports) {
+ pp$8.parseExport = function(node, exports) {
this.next();
// export * from '...'
- if (this.eat(types.star)) {
+ if (this.eat(types$1.star)) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
node.exported = this.parseIdent(true);
@@ -1635,20 +1643,20 @@
}
}
this.expectContextual("from");
- if (this.type !== types.string) { this.unexpected(); }
+ if (this.type !== types$1.string) { this.unexpected(); }
node.source = this.parseExprAtom();
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration")
}
- if (this.eat(types._default)) { // export default ...
+ if (this.eat(types$1._default)) { // export default ...
this.checkExport(exports, "default", this.lastTokStart);
var isAsync;
- if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
+ if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
var fNode = this.startNode();
this.next();
if (isAsync) { this.next(); }
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
- } else if (this.type === types._class) {
+ } else if (this.type === types$1._class) {
var cNode = this.startNode();
node.declaration = this.parseClass(cNode, "nullableID");
} else {
@@ -1670,7 +1678,7 @@
node.declaration = null;
node.specifiers = this.parseExportSpecifiers(exports);
if (this.eatContextual("from")) {
- if (this.type !== types.string) { this.unexpected(); }
+ if (this.type !== types$1.string) { this.unexpected(); }
node.source = this.parseExprAtom();
} else {
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
@@ -1689,14 +1697,14 @@
return this.finishNode(node, "ExportNamedDeclaration")
};
- pp$1.checkExport = function(exports, name, pos) {
+ pp$8.checkExport = function(exports, name, pos) {
if (!exports) { return }
if (has(exports, name))
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
exports[name] = true;
};
- pp$1.checkPatternExport = function(exports, pat) {
+ pp$8.checkPatternExport = function(exports, pat) {
var type = pat.type;
if (type === "Identifier")
{ this.checkExport(exports, pat.name, pat.start); }
@@ -1723,7 +1731,7 @@
{ this.checkPatternExport(exports, pat.expression); }
};
- pp$1.checkVariableExport = function(exports, decls) {
+ pp$8.checkVariableExport = function(exports, decls) {
if (!exports) { return }
for (var i = 0, list = decls; i < list.length; i += 1)
{
@@ -1733,7 +1741,7 @@
}
};
- pp$1.shouldParseExportStatement = function() {
+ pp$8.shouldParseExportStatement = function() {
return this.type.keyword === "var" ||
this.type.keyword === "const" ||
this.type.keyword === "class" ||
@@ -1744,14 +1752,14 @@
// Parses a comma-separated list of module exports.
- pp$1.parseExportSpecifiers = function(exports) {
+ pp$8.parseExportSpecifiers = function(exports) {
var nodes = [], first = true;
// export { x, y as z } [from '...']
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
+ this.expect(types$1.braceL);
+ while (!this.eat(types$1.braceR)) {
if (!first) {
- this.expect(types.comma);
- if (this.afterTrailingComma(types.braceR)) { break }
+ this.expect(types$1.comma);
+ if (this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }
var node = this.startNode();
@@ -1765,16 +1773,16 @@
// Parses import declaration.
- pp$1.parseImport = function(node) {
+ pp$8.parseImport = function(node) {
this.next();
// import '...'
- if (this.type === types.string) {
- node.specifiers = empty;
+ if (this.type === types$1.string) {
+ node.specifiers = empty$1;
node.source = this.parseExprAtom();
} else {
node.specifiers = this.parseImportSpecifiers();
this.expectContextual("from");
- node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
+ node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration")
@@ -1782,17 +1790,17 @@
// Parses a comma-separated list of module imports.
- pp$1.parseImportSpecifiers = function() {
+ pp$8.parseImportSpecifiers = function() {
var nodes = [], first = true;
- if (this.type === types.name) {
+ if (this.type === types$1.name) {
// import defaultObj, { x, y as z } from '...'
var node = this.startNode();
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
- if (!this.eat(types.comma)) { return nodes }
+ if (!this.eat(types$1.comma)) { return nodes }
}
- if (this.type === types.star) {
+ if (this.type === types$1.star) {
var node$1 = this.startNode();
this.next();
this.expectContextual("as");
@@ -1801,11 +1809,11 @@
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
return nodes
}
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
+ this.expect(types$1.braceL);
+ while (!this.eat(types$1.braceR)) {
if (!first) {
- this.expect(types.comma);
- if (this.afterTrailingComma(types.braceR)) { break }
+ this.expect(types$1.comma);
+ if (this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }
var node$2 = this.startNode();
@@ -1823,12 +1831,12 @@
};
// Set `ExpressionStatement#directive` property for directive prologues.
- pp$1.adaptDirectivePrologue = function(statements) {
+ pp$8.adaptDirectivePrologue = function(statements) {
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
statements[i].directive = statements[i].expression.raw.slice(1, -1);
}
};
- pp$1.isDirectiveCandidate = function(statement) {
+ pp$8.isDirectiveCandidate = function(statement) {
return (
statement.type === "ExpressionStatement" &&
statement.expression.type === "Literal" &&
@@ -1838,12 +1846,12 @@
)
};
- var pp$2 = Parser.prototype;
+ var pp$7 = Parser.prototype;
// Convert existing expression atom to assignable pattern
// if possible.
- pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
+ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
@@ -1924,7 +1932,7 @@
// Convert list of expression atoms to binding list.
- pp$2.toAssignableList = function(exprList, isBinding) {
+ pp$7.toAssignableList = function(exprList, isBinding) {
var end = exprList.length;
for (var i = 0; i < end; i++) {
var elt = exprList[i];
@@ -1940,19 +1948,19 @@
// Parses spread element.
- pp$2.parseSpread = function(refDestructuringErrors) {
+ pp$7.parseSpread = function(refDestructuringErrors) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
return this.finishNode(node, "SpreadElement")
};
- pp$2.parseRestBinding = function() {
+ pp$7.parseRestBinding = function() {
var node = this.startNode();
this.next();
// RestElement inside of a function parameter must be an identifier
- if (this.options.ecmaVersion === 6 && this.type !== types.name)
+ if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
{ this.unexpected(); }
node.argument = this.parseBindingAtom();
@@ -1962,36 +1970,36 @@
// Parses lvalue (assignable) atom.
- pp$2.parseBindingAtom = function() {
+ pp$7.parseBindingAtom = function() {
if (this.options.ecmaVersion >= 6) {
switch (this.type) {
- case types.bracketL:
+ case types$1.bracketL:
var node = this.startNode();
this.next();
- node.elements = this.parseBindingList(types.bracketR, true, true);
+ node.elements = this.parseBindingList(types$1.bracketR, true, true);
return this.finishNode(node, "ArrayPattern")
- case types.braceL:
+ case types$1.braceL:
return this.parseObj(true)
}
}
return this.parseIdent()
};
- pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
+ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
var elts = [], first = true;
while (!this.eat(close)) {
if (first) { first = false; }
- else { this.expect(types.comma); }
- if (allowEmpty && this.type === types.comma) {
+ else { this.expect(types$1.comma); }
+ if (allowEmpty && this.type === types$1.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break
- } else if (this.type === types.ellipsis) {
+ } else if (this.type === types$1.ellipsis) {
var rest = this.parseRestBinding();
this.parseBindingListItem(rest);
elts.push(rest);
- if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
+ if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
this.expect(close);
break
} else {
@@ -2003,15 +2011,15 @@
return elts
};
- pp$2.parseBindingListItem = function(param) {
+ pp$7.parseBindingListItem = function(param) {
return param
};
// Parses assignment pattern around given atom if possible.
- pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
+ pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
left = left || this.parseBindingAtom();
- if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
+ if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
@@ -2082,7 +2090,7 @@
// duplicate argument names. checkClashes is ignored if the provided construct
// is an assignment (i.e., bindingType is BIND_NONE).
- pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
+ pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
if ( bindingType === void 0 ) bindingType = BIND_NONE;
var isBind = bindingType !== BIND_NONE;
@@ -2120,7 +2128,7 @@
}
};
- pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
+ pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
if ( bindingType === void 0 ) bindingType = BIND_NONE;
switch (expr.type) {
@@ -2145,7 +2153,7 @@
}
};
- pp$2.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
+ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
if ( bindingType === void 0 ) bindingType = BIND_NONE;
switch (expr.type) {
@@ -2177,7 +2185,7 @@
this.generator = !!generator;
};
- var types$1 = {
+ var types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", false),
@@ -2190,38 +2198,38 @@
f_gen: new TokContext("function", false, false, null, true)
};
- var pp$3 = Parser.prototype;
+ var pp$6 = Parser.prototype;
- pp$3.initialContext = function() {
- return [types$1.b_stat]
+ pp$6.initialContext = function() {
+ return [types.b_stat]
};
- pp$3.curContext = function() {
+ pp$6.curContext = function() {
return this.context[this.context.length - 1]
};
- pp$3.braceIsBlock = function(prevType) {
+ pp$6.braceIsBlock = function(prevType) {
var parent = this.curContext();
- if (parent === types$1.f_expr || parent === types$1.f_stat)
+ if (parent === types.f_expr || parent === types.f_stat)
{ return true }
- if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
+ if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
{ return !parent.isExpr }
// The check for `tt.name && exprAllowed` detects whether we are
// after a `yield` or `of` construct. See the `updateContext` for
// `tt.name`.
- if (prevType === types._return || prevType === types.name && this.exprAllowed)
+ if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
- if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
+ if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
{ return true }
- if (prevType === types.braceL)
- { return parent === types$1.b_stat }
- if (prevType === types._var || prevType === types._const || prevType === types.name)
+ if (prevType === types$1.braceL)
+ { return parent === types.b_stat }
+ if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
{ return false }
return !this.exprAllowed
};
- pp$3.inGeneratorContext = function() {
+ pp$6.inGeneratorContext = function() {
for (var i = this.context.length - 1; i >= 1; i--) {
var context = this.context[i];
if (context.token === "function")
@@ -2230,9 +2238,9 @@
return false
};
- pp$3.updateContext = function(prevType) {
+ pp$6.updateContext = function(prevType) {
var update, type = this.type;
- if (type.keyword && prevType === types.dot)
+ if (type.keyword && prevType === types$1.dot)
{ this.exprAllowed = false; }
else if (update = type.updateContext)
{ update.call(this, prevType); }
@@ -2241,7 +2249,7 @@
};
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
- pp$3.overrideContext = function(tokenCtx) {
+ pp$6.overrideContext = function(tokenCtx) {
if (this.curContext() !== tokenCtx) {
this.context[this.context.length - 1] = tokenCtx;
}
@@ -2249,71 +2257,71 @@
// Token-specific context update code
- types.parenR.updateContext = types.braceR.updateContext = function() {
+ types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
if (this.context.length === 1) {
this.exprAllowed = true;
return
}
var out = this.context.pop();
- if (out === types$1.b_stat && this.curContext().token === "function") {
+ if (out === types.b_stat && this.curContext().token === "function") {
out = this.context.pop();
}
this.exprAllowed = !out.isExpr;
};
- types.braceL.updateContext = function(prevType) {
- this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
+ types$1.braceL.updateContext = function(prevType) {
+ this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
this.exprAllowed = true;
};
- types.dollarBraceL.updateContext = function() {
- this.context.push(types$1.b_tmpl);
+ types$1.dollarBraceL.updateContext = function() {
+ this.context.push(types.b_tmpl);
this.exprAllowed = true;
};
- types.parenL.updateContext = function(prevType) {
- var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
- this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
+ types$1.parenL.updateContext = function(prevType) {
+ var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
+ this.context.push(statementParens ? types.p_stat : types.p_expr);
this.exprAllowed = true;
};
- types.incDec.updateContext = function() {
+ types$1.incDec.updateContext = function() {
// tokExprAllowed stays unchanged
};
- types._function.updateContext = types._class.updateContext = function(prevType) {
- if (prevType.beforeExpr && prevType !== types._else &&
- !(prevType === types.semi && this.curContext() !== types$1.p_stat) &&
- !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
- !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
- { this.context.push(types$1.f_expr); }
+ types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
+ if (prevType.beforeExpr && prevType !== types$1._else &&
+ !(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
+ !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
+ !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
+ { this.context.push(types.f_expr); }
else
- { this.context.push(types$1.f_stat); }
+ { this.context.push(types.f_stat); }
this.exprAllowed = false;
};
- types.backQuote.updateContext = function() {
- if (this.curContext() === types$1.q_tmpl)
+ types$1.backQuote.updateContext = function() {
+ if (this.curContext() === types.q_tmpl)
{ this.context.pop(); }
else
- { this.context.push(types$1.q_tmpl); }
+ { this.context.push(types.q_tmpl); }
this.exprAllowed = false;
};
- types.star.updateContext = function(prevType) {
- if (prevType === types._function) {
+ types$1.star.updateContext = function(prevType) {
+ if (prevType === types$1._function) {
var index = this.context.length - 1;
- if (this.context[index] === types$1.f_expr)
- { this.context[index] = types$1.f_expr_gen; }
+ if (this.context[index] === types.f_expr)
+ { this.context[index] = types.f_expr_gen; }
else
- { this.context[index] = types$1.f_gen; }
+ { this.context[index] = types.f_gen; }
}
this.exprAllowed = true;
};
- types.name.updateContext = function(prevType) {
+ types$1.name.updateContext = function(prevType) {
var allowed = false;
- if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
+ if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
if (this.value === "of" && !this.exprAllowed ||
this.value === "yield" && this.inGeneratorContext())
{ allowed = true; }
@@ -2323,14 +2331,14 @@
// A recursive descent parser operates by defining functions for all
- var pp$4 = Parser.prototype;
+ var pp$5 = Parser.prototype;
// Check if property name clashes with already added.
// Object/class getters and setters are not allowed to clash —
// either with each other or with an init property — and in
// strict mode, init properties are also not allowed to be repeated.
- pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
+ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
{ return }
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
@@ -2347,10 +2355,12 @@
if (name === "__proto__" && kind === "init") {
if (propHash.proto) {
if (refDestructuringErrors) {
- if (refDestructuringErrors.doubleProto < 0)
- { refDestructuringErrors.doubleProto = key.start; }
- // Backwards-compat kludge. Can be removed in version 6.0
- } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); }
+ if (refDestructuringErrors.doubleProto < 0) {
+ refDestructuringErrors.doubleProto = key.start;
+ }
+ } else {
+ this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
+ }
}
propHash.proto = true;
}
@@ -2392,13 +2402,13 @@
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
- pp$4.parseExpression = function(forInit, refDestructuringErrors) {
+ pp$5.parseExpression = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
- if (this.type === types.comma) {
+ if (this.type === types$1.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
- while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
+ while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
return this.finishNode(node, "SequenceExpression")
}
return expr
@@ -2407,7 +2417,7 @@
// Parse an assignment expression. This includes applications of
// operators like `+=`.
- pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
+ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
if (this.isContextual("yield")) {
if (this.inGenerator) { return this.parseYield(forInit) }
// The tokenizer will assume an expression is allowed after
@@ -2415,10 +2425,11 @@
else { this.exprAllowed = false; }
}
- var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
+ var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
if (refDestructuringErrors) {
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
oldTrailingComma = refDestructuringErrors.trailingComma;
+ oldDoubleProto = refDestructuringErrors.doubleProto;
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
} else {
refDestructuringErrors = new DestructuringErrors;
@@ -2426,7 +2437,7 @@
}
var startPos = this.start, startLoc = this.startLoc;
- if (this.type === types.parenL || this.type === types.name) {
+ if (this.type === types$1.parenL || this.type === types$1.name) {
this.potentialArrowAt = this.start;
this.potentialArrowInForAwait = forInit === "await";
}
@@ -2435,20 +2446,21 @@
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
- if (this.type === types.eq)
+ if (this.type === types$1.eq)
{ left = this.toAssignable(left, false, refDestructuringErrors); }
if (!ownDestructuringErrors) {
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
}
if (refDestructuringErrors.shorthandAssign >= left.start)
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
- if (this.type === types.eq)
+ if (this.type === types$1.eq)
{ this.checkLValPattern(left); }
else
{ this.checkLValSimple(left); }
node.left = left;
this.next();
node.right = this.parseMaybeAssign(forInit);
+ if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
return this.finishNode(node, "AssignmentExpression")
} else {
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
@@ -2460,15 +2472,15 @@
// Parse a ternary conditional (`?:`) operator.
- pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
+ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprOps(forInit, refDestructuringErrors);
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
- if (this.eat(types.question)) {
+ if (this.eat(types$1.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
- this.expect(types.colon);
+ this.expect(types$1.colon);
node.alternate = this.parseMaybeAssign(forInit);
return this.finishNode(node, "ConditionalExpression")
}
@@ -2477,7 +2489,7 @@
// Start the precedence parser.
- pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
+ pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
@@ -2490,23 +2502,23 @@
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
- pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
+ pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
var prec = this.type.binop;
- if (prec != null && (!forInit || this.type !== types._in)) {
+ if (prec != null && (!forInit || this.type !== types$1._in)) {
if (prec > minPrec) {
- var logical = this.type === types.logicalOR || this.type === types.logicalAND;
- var coalesce = this.type === types.coalesce;
+ var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
+ var coalesce = this.type === types$1.coalesce;
if (coalesce) {
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
- prec = types.logicalAND.binop;
+ prec = types$1.logicalAND.binop;
}
var op = this.value;
this.next();
var startPos = this.start, startLoc = this.startLoc;
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
- if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
+ if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
}
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
@@ -2515,7 +2527,8 @@
return left
};
- pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
+ pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
+ if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.operator = op;
@@ -2525,13 +2538,13 @@
// Parse unary operators, both prefix and postfix.
- pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
+ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
var startPos = this.start, startLoc = this.startLoc, expr;
if (this.isContextual("await") && this.canAwait) {
expr = this.parseAwait(forInit);
sawUnary = true;
} else if (this.type.prefix) {
- var node = this.startNode(), update = this.type === types.incDec;
+ var node = this.startNode(), update = this.type === types$1.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
@@ -2545,6 +2558,11 @@
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
else { sawUnary = true; }
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
+ } else if (!sawUnary && this.type === types$1.privateId) {
+ if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
+ expr = this.parsePrivateIdent();
+ // only could be private fields in 'in', such as #x in obj
+ if (this.type !== types$1._in) { this.unexpected(); }
} else {
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
@@ -2559,7 +2577,7 @@
}
}
- if (!incDec && this.eat(types.starstar)) {
+ if (!incDec && this.eat(types$1.starstar)) {
if (sawUnary)
{ this.unexpected(this.lastTokStart); }
else
@@ -2578,7 +2596,7 @@
// Parse call, dot, and `[]`-subscript expressions.
- pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
+ pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
@@ -2592,7 +2610,7 @@
return result
};
- pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
+ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
this.potentialArrowAt === base.start;
@@ -2615,19 +2633,19 @@
}
};
- pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
+ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
var optionalSupported = this.options.ecmaVersion >= 11;
- var optional = optionalSupported && this.eat(types.questionDot);
+ var optional = optionalSupported && this.eat(types$1.questionDot);
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
- var computed = this.eat(types.bracketL);
- if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
+ var computed = this.eat(types$1.bracketL);
+ if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
if (computed) {
node.property = this.parseExpression();
- this.expect(types.bracketR);
- } else if (this.type === types.privateId && base.type !== "Super") {
+ this.expect(types$1.bracketR);
+ } else if (this.type === types$1.privateId && base.type !== "Super") {
node.property = this.parsePrivateIdent();
} else {
node.property = this.parseIdent(this.options.allowReserved !== "never");
@@ -2637,13 +2655,13 @@
node.optional = optional;
}
base = this.finishNode(node, "MemberExpression");
- } else if (!noCalls && this.eat(types.parenL)) {
+ } else if (!noCalls && this.eat(types$1.parenL)) {
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
- var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
- if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
+ var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
+ if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0)
@@ -2664,7 +2682,7 @@
node$1.optional = optional;
}
base = this.finishNode(node$1, "CallExpression");
- } else if (this.type === types.backQuote) {
+ } else if (this.type === types$1.backQuote) {
if (optional || optionalChained) {
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
}
@@ -2681,19 +2699,19 @@
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
- pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
+ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
// If a division operator appears in an expression position, the
// tokenizer got confused, and we force it to read a regexp instead.
- if (this.type === types.slash) { this.readRegexp(); }
+ if (this.type === types$1.slash) { this.readRegexp(); }
var node, canBeArrow = this.potentialArrowAt === this.start;
switch (this.type) {
- case types._super:
+ case types$1._super:
if (!this.allowSuper)
{ this.raise(this.start, "'super' keyword outside a method"); }
node = this.startNode();
this.next();
- if (this.type === types.parenL && !this.allowDirectSuper)
+ if (this.type === types$1.parenL && !this.allowDirectSuper)
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
// The `super` keyword can appear at below:
// SuperProperty:
@@ -2701,52 +2719,52 @@
// super . IdentifierName
// SuperCall:
// super ( Arguments )
- if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
+ if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
{ this.unexpected(); }
return this.finishNode(node, "Super")
- case types._this:
+ case types$1._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression")
- case types.name:
+ case types$1.name:
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
var id = this.parseIdent(false);
- if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
- this.overrideContext(types$1.f_expr);
+ if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
+ this.overrideContext(types.f_expr);
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
}
if (canBeArrow && !this.canInsertSemicolon()) {
- if (this.eat(types.arrow))
+ if (this.eat(types$1.arrow))
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
- if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
+ if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
id = this.parseIdent(false);
- if (this.canInsertSemicolon() || !this.eat(types.arrow))
+ if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
{ this.unexpected(); }
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
}
}
return id
- case types.regexp:
+ case types$1.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = {pattern: value.pattern, flags: value.flags};
return node
- case types.num: case types.string:
+ case types$1.num: case types$1.string:
return this.parseLiteral(this.value)
- case types._null: case types._true: case types._false:
+ case types$1._null: case types$1._true: case types$1._false:
node = this.startNode();
- node.value = this.type === types._null ? null : this.type === types._true;
+ node.value = this.type === types$1._null ? null : this.type === types$1._true;
node.raw = this.type.keyword;
this.next();
return this.finishNode(node, "Literal")
- case types.parenL:
+ case types$1.parenL:
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
if (refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
@@ -2756,31 +2774,31 @@
}
return expr
- case types.bracketL:
+ case types$1.bracketL:
node = this.startNode();
this.next();
- node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
+ node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
return this.finishNode(node, "ArrayExpression")
- case types.braceL:
- this.overrideContext(types$1.b_expr);
+ case types$1.braceL:
+ this.overrideContext(types.b_expr);
return this.parseObj(false, refDestructuringErrors)
- case types._function:
+ case types$1._function:
node = this.startNode();
this.next();
return this.parseFunction(node, 0)
- case types._class:
+ case types$1._class:
return this.parseClass(this.startNode(), false)
- case types._new:
+ case types$1._new:
return this.parseNew()
- case types.backQuote:
+ case types$1.backQuote:
return this.parseTemplate()
- case types._import:
+ case types$1._import:
if (this.options.ecmaVersion >= 11) {
return this.parseExprImport()
} else {
@@ -2792,7 +2810,7 @@
}
};
- pp$4.parseExprImport = function() {
+ pp$5.parseExprImport = function() {
var node = this.startNode();
// Consume `import` as an identifier for `import.meta`.
@@ -2801,9 +2819,9 @@
var meta = this.parseIdent(true);
switch (this.type) {
- case types.parenL:
+ case types$1.parenL:
return this.parseDynamicImport(node)
- case types.dot:
+ case types$1.dot:
node.meta = meta;
return this.parseImportMeta(node)
default:
@@ -2811,16 +2829,16 @@
}
};
- pp$4.parseDynamicImport = function(node) {
+ pp$5.parseDynamicImport = function(node) {
this.next(); // skip `(`
// Parse node.source.
node.source = this.parseMaybeAssign();
// Verify ending.
- if (!this.eat(types.parenR)) {
+ if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
- if (this.eat(types.comma) && this.eat(types.parenR)) {
+ if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
} else {
this.unexpected(errorPos);
@@ -2830,7 +2848,7 @@
return this.finishNode(node, "ImportExpression")
};
- pp$4.parseImportMeta = function(node) {
+ pp$5.parseImportMeta = function(node) {
this.next(); // skip `.`
var containsEsc = this.containsEsc;
@@ -2846,7 +2864,7 @@
return this.finishNode(node, "MetaProperty")
};
- pp$4.parseLiteral = function(value) {
+ pp$5.parseLiteral = function(value) {
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
@@ -2855,14 +2873,14 @@
return this.finishNode(node, "Literal")
};
- pp$4.parseParenExpression = function() {
- this.expect(types.parenL);
+ pp$5.parseParenExpression = function() {
+ this.expect(types$1.parenL);
var val = this.parseExpression();
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
return val
};
- pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
+ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
if (this.options.ecmaVersion >= 6) {
this.next();
@@ -2873,24 +2891,24 @@
this.yieldPos = 0;
this.awaitPos = 0;
// Do not save awaitIdentPos to allow checking awaits nested in parameters
- while (this.type !== types.parenR) {
- first ? first = false : this.expect(types.comma);
- if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
+ while (this.type !== types$1.parenR) {
+ first ? first = false : this.expect(types$1.comma);
+ if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
lastIsComma = true;
break
- } else if (this.type === types.ellipsis) {
+ } else if (this.type === types$1.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRestBinding()));
- if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
+ if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
break
} else {
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
}
}
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
- if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
+ if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
this.yieldPos = oldYieldPos;
@@ -2924,12 +2942,12 @@
}
};
- pp$4.parseParenItem = function(item) {
+ pp$5.parseParenItem = function(item) {
return item
};
- pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
+ pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
};
// New's precedence is slightly tricky. It must allow its argument to
@@ -2938,13 +2956,13 @@
// argument to parseSubscripts to prevent it from consuming the
// argument list.
- var empty$1 = [];
+ var empty = [];
- pp$4.parseNew = function() {
+ pp$5.parseNew = function() {
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
var node = this.startNode();
var meta = this.parseIdent(true);
- if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
+ if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
node.meta = meta;
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
@@ -2956,23 +2974,23 @@
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
return this.finishNode(node, "MetaProperty")
}
- var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
+ var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
if (isImport && node.callee.type === "ImportExpression") {
this.raise(startPos, "Cannot use new with import()");
}
- if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
- else { node.arguments = empty$1; }
+ if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
+ else { node.arguments = empty; }
return this.finishNode(node, "NewExpression")
};
// Parse template expression.
- pp$4.parseTemplateElement = function(ref) {
+ pp$5.parseTemplateElement = function(ref) {
var isTagged = ref.isTagged;
var elem = this.startNode();
- if (this.type === types.invalidTemplate) {
+ if (this.type === types$1.invalidTemplate) {
if (!isTagged) {
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
}
@@ -2987,11 +3005,11 @@
};
}
this.next();
- elem.tail = this.type === types.backQuote;
+ elem.tail = this.type === types$1.backQuote;
return this.finishNode(elem, "TemplateElement")
};
- pp$4.parseTemplate = function(ref) {
+ pp$5.parseTemplate = function(ref) {
if ( ref === void 0 ) ref = {};
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
@@ -3001,32 +3019,32 @@
var curElt = this.parseTemplateElement({isTagged: isTagged});
node.quasis = [curElt];
while (!curElt.tail) {
- if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
- this.expect(types.dollarBraceL);
+ if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
+ this.expect(types$1.dollarBraceL);
node.expressions.push(this.parseExpression());
- this.expect(types.braceR);
+ this.expect(types$1.braceR);
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
}
this.next();
return this.finishNode(node, "TemplateLiteral")
};
- pp$4.isAsyncProp = function(prop) {
+ pp$5.isAsyncProp = function(prop) {
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
- (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)) &&
+ (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)) &&
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
};
// Parse an object literal or binding pattern.
- pp$4.parseObj = function(isPattern, refDestructuringErrors) {
+ pp$5.parseObj = function(isPattern, refDestructuringErrors) {
var node = this.startNode(), first = true, propHash = {};
node.properties = [];
this.next();
- while (!this.eat(types.braceR)) {
+ while (!this.eat(types$1.braceR)) {
if (!first) {
- this.expect(types.comma);
- if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
+ this.expect(types$1.comma);
+ if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }
var prop = this.parseProperty(isPattern, refDestructuringErrors);
@@ -3036,18 +3054,18 @@
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
};
- pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
+ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
- if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
+ if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
if (isPattern) {
prop.argument = this.parseIdent(false);
- if (this.type === types.comma) {
+ if (this.type === types$1.comma) {
this.raise(this.start, "Comma is not permitted after the rest element");
}
return this.finishNode(prop, "RestElement")
}
// To disallow parenthesized identifier via `this.toAssignable()`.
- if (this.type === types.parenL && refDestructuringErrors) {
+ if (this.type === types$1.parenL && refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0) {
refDestructuringErrors.parenthesizedAssign = this.start;
}
@@ -3058,7 +3076,7 @@
// Parse argument.
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
// To disallow trailing comma via `this.toAssignable()`.
- if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
+ if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
// Finish
@@ -3072,13 +3090,13 @@
startLoc = this.startLoc;
}
if (!isPattern)
- { isGenerator = this.eat(types.star); }
+ { isGenerator = this.eat(types$1.star); }
}
var containsEsc = this.containsEsc;
this.parsePropertyName(prop);
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
isAsync = true;
- isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
+ isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
this.parsePropertyName(prop, refDestructuringErrors);
} else {
isAsync = false;
@@ -3087,14 +3105,14 @@
return this.finishNode(prop, "Property")
};
- pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
- if ((isGenerator || isAsync) && this.type === types.colon)
+ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
+ if ((isGenerator || isAsync) && this.type === types$1.colon)
{ this.unexpected(); }
- if (this.eat(types.colon)) {
+ if (this.eat(types$1.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
prop.kind = "init";
- } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
+ } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
if (isPattern) { this.unexpected(); }
prop.kind = "init";
prop.method = true;
@@ -3102,7 +3120,7 @@
} else if (!isPattern && !containsEsc &&
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
(prop.key.name === "get" || prop.key.name === "set") &&
- (this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
+ (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
if (isGenerator || isAsync) { this.unexpected(); }
prop.kind = prop.key.name;
this.parsePropertyName(prop);
@@ -3126,7 +3144,7 @@
prop.kind = "init";
if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
- } else if (this.type === types.eq && refDestructuringErrors) {
+ } else if (this.type === types$1.eq && refDestructuringErrors) {
if (refDestructuringErrors.shorthandAssign < 0)
{ refDestructuringErrors.shorthandAssign = this.start; }
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
@@ -3137,23 +3155,23 @@
} else { this.unexpected(); }
};
- pp$4.parsePropertyName = function(prop) {
+ pp$5.parsePropertyName = function(prop) {
if (this.options.ecmaVersion >= 6) {
- if (this.eat(types.bracketL)) {
+ if (this.eat(types$1.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
- this.expect(types.bracketR);
+ this.expect(types$1.bracketR);
return prop.key
} else {
prop.computed = false;
}
}
- return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
+ return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
};
// Initialize empty function node.
- pp$4.initFunction = function(node) {
+ pp$5.initFunction = function(node) {
node.id = null;
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
if (this.options.ecmaVersion >= 8) { node.async = false; }
@@ -3161,7 +3179,7 @@
// Parse object or class method.
- pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
+ pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.initFunction(node);
@@ -3175,8 +3193,8 @@
this.awaitIdentPos = 0;
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
- this.expect(types.parenL);
- node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
+ this.expect(types$1.parenL);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
this.parseFunctionBody(node, false, true, false);
@@ -3188,7 +3206,7 @@
// Parse arrow function expression with given parameters.
- pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
+ pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
@@ -3210,8 +3228,8 @@
// Parse function body and check parameters.
- pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
- var isExpression = isArrowFunction && this.type !== types.braceL;
+ pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
+ var isExpression = isArrowFunction && this.type !== types$1.braceL;
var oldStrict = this.strict, useStrict = false;
if (isExpression) {
@@ -3247,7 +3265,7 @@
this.exitScope();
};
- pp$4.isSimpleParamList = function(params) {
+ pp$5.isSimpleParamList = function(params) {
for (var i = 0, list = params; i < list.length; i += 1)
{
var param = list[i];
@@ -3260,7 +3278,7 @@
// Checks function params for various disallowed patterns such as using "eval"
// or "arguments" and duplicate parameters.
- pp$4.checkParams = function(node, allowDuplicates) {
+ pp$5.checkParams = function(node, allowDuplicates) {
var nameHash = Object.create(null);
for (var i = 0, list = node.params; i < list.length; i += 1)
{
@@ -3276,20 +3294,20 @@
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
- pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
+ pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
var elts = [], first = true;
while (!this.eat(close)) {
if (!first) {
- this.expect(types.comma);
+ this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
} else { first = false; }
var elt = (void 0);
- if (allowEmpty && this.type === types.comma)
+ if (allowEmpty && this.type === types$1.comma)
{ elt = null; }
- else if (this.type === types.ellipsis) {
+ else if (this.type === types$1.ellipsis) {
elt = this.parseSpread(refDestructuringErrors);
- if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
+ if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
{ refDestructuringErrors.trailingComma = this.start; }
} else {
elt = this.parseMaybeAssign(false, refDestructuringErrors);
@@ -3299,7 +3317,7 @@
return elts
};
- pp$4.checkUnreserved = function(ref) {
+ pp$5.checkUnreserved = function(ref) {
var start = ref.start;
var end = ref.end;
var name = ref.name;
@@ -3328,9 +3346,9 @@
// when parsing properties), it will also convert keywords into
// identifiers.
- pp$4.parseIdent = function(liberal, isBinding) {
+ pp$5.parseIdent = function(liberal, isBinding) {
var node = this.startNode();
- if (this.type === types.name) {
+ if (this.type === types$1.name) {
node.name = this.value;
} else if (this.type.keyword) {
node.name = this.type.keyword;
@@ -3356,9 +3374,9 @@
return node
};
- pp$4.parsePrivateIdent = function() {
+ pp$5.parsePrivateIdent = function() {
var node = this.startNode();
- if (this.type === types.privateId) {
+ if (this.type === types$1.privateId) {
node.name = this.value;
} else {
this.unexpected();
@@ -3378,22 +3396,22 @@
// Parses yield expression inside generator.
- pp$4.parseYield = function(forInit) {
+ pp$5.parseYield = function(forInit) {
if (!this.yieldPos) { this.yieldPos = this.start; }
var node = this.startNode();
this.next();
- if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
+ if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
node.delegate = false;
node.argument = null;
} else {
- node.delegate = this.eat(types.star);
+ node.delegate = this.eat(types$1.star);
node.argument = this.parseMaybeAssign(forInit);
}
return this.finishNode(node, "YieldExpression")
};
- pp$4.parseAwait = function(forInit) {
+ pp$5.parseAwait = function(forInit) {
if (!this.awaitPos) { this.awaitPos = this.start; }
var node = this.startNode();
@@ -3402,7 +3420,7 @@
return this.finishNode(node, "AwaitExpression")
};
- var pp$5 = Parser.prototype;
+ var pp$4 = Parser.prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
@@ -3410,7 +3428,7 @@
// of the error message, and then raises a `SyntaxError` with that
// message.
- pp$5.raise = function(pos, message) {
+ pp$4.raise = function(pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
@@ -3418,15 +3436,15 @@
throw err
};
- pp$5.raiseRecoverable = pp$5.raise;
+ pp$4.raiseRecoverable = pp$4.raise;
- pp$5.curPosition = function() {
+ pp$4.curPosition = function() {
if (this.options.locations) {
return new Position(this.curLine, this.pos - this.lineStart)
}
};
- var pp$6 = Parser.prototype;
+ var pp$3 = Parser.prototype;
var Scope = function Scope(flags) {
this.flags = flags;
@@ -3442,22 +3460,22 @@
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
- pp$6.enterScope = function(flags) {
+ pp$3.enterScope = function(flags) {
this.scopeStack.push(new Scope(flags));
};
- pp$6.exitScope = function() {
+ pp$3.exitScope = function() {
this.scopeStack.pop();
};
// The spec says:
// > At the top level of a function, or script, function declarations are
// > treated like var declarations rather than like lexical declarations.
- pp$6.treatFunctionsAsVarInScope = function(scope) {
+ pp$3.treatFunctionsAsVarInScope = function(scope) {
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
};
- pp$6.declareName = function(name, bindingType, pos) {
+ pp$3.declareName = function(name, bindingType, pos) {
var redeclared = false;
if (bindingType === BIND_LEXICAL) {
var scope = this.currentScope();
@@ -3492,7 +3510,7 @@
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
};
- pp$6.checkLocalExport = function(id) {
+ pp$3.checkLocalExport = function(id) {
// scope.functions must be empty as Module code is always strict.
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
this.scopeStack[0].var.indexOf(id.name) === -1) {
@@ -3500,11 +3518,11 @@
}
};
- pp$6.currentScope = function() {
+ pp$3.currentScope = function() {
return this.scopeStack[this.scopeStack.length - 1]
};
- pp$6.currentVarScope = function() {
+ pp$3.currentVarScope = function() {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR) { return scope }
@@ -3512,7 +3530,7 @@
};
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
- pp$6.currentThisScope = function() {
+ pp$3.currentThisScope = function() {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
@@ -3533,13 +3551,13 @@
// Start an AST node, attaching a start offset.
- var pp$7 = Parser.prototype;
+ var pp$2 = Parser.prototype;
- pp$7.startNode = function() {
+ pp$2.startNode = function() {
return new Node(this, this.start, this.startLoc)
};
- pp$7.startNodeAt = function(pos, loc) {
+ pp$2.startNodeAt = function(pos, loc) {
return new Node(this, pos, loc)
};
@@ -3555,17 +3573,17 @@
return node
}
- pp$7.finishNode = function(node, type) {
+ pp$2.finishNode = function(node, type) {
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
};
// Finish node at given position
- pp$7.finishNodeAt = function(node, type, pos, loc) {
+ pp$2.finishNodeAt = function(node, type, pos, loc) {
return finishNodeAt.call(this, node, type, pos, loc)
};
- pp$7.copyNode = function(node) {
+ pp$2.copyNode = function(node) {
var newNode = new Node(this, node.start, this.startLoc);
for (var prop in node) { newNode[prop] = node[prop]; }
return newNode
@@ -3622,7 +3640,7 @@
buildUnicodeData(11);
buildUnicodeData(12);
- var pp$8 = Parser.prototype;
+ var pp$1 = Parser.prototype;
var RegExpValidationState = function RegExpValidationState(parser) {
this.parser = parser;
@@ -3718,7 +3736,7 @@
return false
};
- function codePointToString(ch) {
+ function codePointToString$1(ch) {
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
ch -= 0x10000;
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
@@ -3730,7 +3748,7 @@
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
- pp$8.validateRegExpFlags = function(state) {
+ pp$1.validateRegExpFlags = function(state) {
var validFlags = state.validFlags;
var flags = state.flags;
@@ -3751,7 +3769,7 @@
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
- pp$8.validateRegExpPattern = function(state) {
+ pp$1.validateRegExpPattern = function(state) {
this.regexp_pattern(state);
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
@@ -3766,7 +3784,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
- pp$8.regexp_pattern = function(state) {
+ pp$1.regexp_pattern = function(state) {
state.pos = 0;
state.lastIntValue = 0;
state.lastStringValue = "";
@@ -3800,7 +3818,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
- pp$8.regexp_disjunction = function(state) {
+ pp$1.regexp_disjunction = function(state) {
this.regexp_alternative(state);
while (state.eat(0x7C /* | */)) {
this.regexp_alternative(state);
@@ -3816,13 +3834,13 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
- pp$8.regexp_alternative = function(state) {
+ pp$1.regexp_alternative = function(state) {
while (state.pos < state.source.length && this.regexp_eatTerm(state))
{ }
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
- pp$8.regexp_eatTerm = function(state) {
+ pp$1.regexp_eatTerm = function(state) {
if (this.regexp_eatAssertion(state)) {
// Handle `QuantifiableAssertion Quantifier` alternative.
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
@@ -3845,7 +3863,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
- pp$8.regexp_eatAssertion = function(state) {
+ pp$1.regexp_eatAssertion = function(state) {
var start = state.pos;
state.lastAssertionIsQuantifiable = false;
@@ -3883,7 +3901,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
- pp$8.regexp_eatQuantifier = function(state, noError) {
+ pp$1.regexp_eatQuantifier = function(state, noError) {
if ( noError === void 0 ) noError = false;
if (this.regexp_eatQuantifierPrefix(state, noError)) {
@@ -3894,7 +3912,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
- pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
+ pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
return (
state.eat(0x2A /* * */) ||
state.eat(0x2B /* + */) ||
@@ -3902,7 +3920,7 @@
this.regexp_eatBracedQuantifier(state, noError)
)
};
- pp$8.regexp_eatBracedQuantifier = function(state, noError) {
+ pp$1.regexp_eatBracedQuantifier = function(state, noError) {
var start = state.pos;
if (state.eat(0x7B /* { */)) {
var min = 0, max = -1;
@@ -3928,7 +3946,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
- pp$8.regexp_eatAtom = function(state) {
+ pp$1.regexp_eatAtom = function(state) {
return (
this.regexp_eatPatternCharacters(state) ||
state.eat(0x2E /* . */) ||
@@ -3938,7 +3956,7 @@
this.regexp_eatCapturingGroup(state)
)
};
- pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
+ pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatAtomEscape(state)) {
@@ -3948,7 +3966,7 @@
}
return false
};
- pp$8.regexp_eatUncapturingGroup = function(state) {
+ pp$1.regexp_eatUncapturingGroup = function(state) {
var start = state.pos;
if (state.eat(0x28 /* ( */)) {
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
@@ -3962,7 +3980,7 @@
}
return false
};
- pp$8.regexp_eatCapturingGroup = function(state) {
+ pp$1.regexp_eatCapturingGroup = function(state) {
if (state.eat(0x28 /* ( */)) {
if (this.options.ecmaVersion >= 9) {
this.regexp_groupSpecifier(state);
@@ -3980,7 +3998,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
- pp$8.regexp_eatExtendedAtom = function(state) {
+ pp$1.regexp_eatExtendedAtom = function(state) {
return (
state.eat(0x2E /* . */) ||
this.regexp_eatReverseSolidusAtomEscape(state) ||
@@ -3993,7 +4011,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
- pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
+ pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
if (this.regexp_eatBracedQuantifier(state, true)) {
state.raise("Nothing to repeat");
}
@@ -4001,7 +4019,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
- pp$8.regexp_eatSyntaxCharacter = function(state) {
+ pp$1.regexp_eatSyntaxCharacter = function(state) {
var ch = state.current();
if (isSyntaxCharacter(ch)) {
state.lastIntValue = ch;
@@ -4023,7 +4041,7 @@
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
// But eat eager.
- pp$8.regexp_eatPatternCharacters = function(state) {
+ pp$1.regexp_eatPatternCharacters = function(state) {
var start = state.pos;
var ch = 0;
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
@@ -4033,7 +4051,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
- pp$8.regexp_eatExtendedPatternCharacter = function(state) {
+ pp$1.regexp_eatExtendedPatternCharacter = function(state) {
var ch = state.current();
if (
ch !== -1 &&
@@ -4054,7 +4072,7 @@
// GroupSpecifier ::
// [empty]
// `?` GroupName
- pp$8.regexp_groupSpecifier = function(state) {
+ pp$1.regexp_groupSpecifier = function(state) {
if (state.eat(0x3F /* ? */)) {
if (this.regexp_eatGroupName(state)) {
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
@@ -4070,7 +4088,7 @@
// GroupName ::
// `<` RegExpIdentifierName `>`
// Note: this updates `state.lastStringValue` property with the eaten name.
- pp$8.regexp_eatGroupName = function(state) {
+ pp$1.regexp_eatGroupName = function(state) {
state.lastStringValue = "";
if (state.eat(0x3C /* < */)) {
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
@@ -4085,12 +4103,12 @@
// RegExpIdentifierStart
// RegExpIdentifierName RegExpIdentifierPart
// Note: this updates `state.lastStringValue` property with the eaten name.
- pp$8.regexp_eatRegExpIdentifierName = function(state) {
+ pp$1.regexp_eatRegExpIdentifierName = function(state) {
state.lastStringValue = "";
if (this.regexp_eatRegExpIdentifierStart(state)) {
- state.lastStringValue += codePointToString(state.lastIntValue);
+ state.lastStringValue += codePointToString$1(state.lastIntValue);
while (this.regexp_eatRegExpIdentifierPart(state)) {
- state.lastStringValue += codePointToString(state.lastIntValue);
+ state.lastStringValue += codePointToString$1(state.lastIntValue);
}
return true
}
@@ -4102,7 +4120,7 @@
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[+U]
- pp$8.regexp_eatRegExpIdentifierStart = function(state) {
+ pp$1.regexp_eatRegExpIdentifierStart = function(state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
@@ -4130,7 +4148,7 @@
// `\` RegExpUnicodeEscapeSequence[+U]
//
//
- pp$8.regexp_eatRegExpIdentifierPart = function(state) {
+ pp$1.regexp_eatRegExpIdentifierPart = function(state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
@@ -4152,7 +4170,7 @@
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
- pp$8.regexp_eatAtomEscape = function(state) {
+ pp$1.regexp_eatAtomEscape = function(state) {
if (
this.regexp_eatBackReference(state) ||
this.regexp_eatCharacterClassEscape(state) ||
@@ -4170,7 +4188,7 @@
}
return false
};
- pp$8.regexp_eatBackReference = function(state) {
+ pp$1.regexp_eatBackReference = function(state) {
var start = state.pos;
if (this.regexp_eatDecimalEscape(state)) {
var n = state.lastIntValue;
@@ -4188,7 +4206,7 @@
}
return false
};
- pp$8.regexp_eatKGroupName = function(state) {
+ pp$1.regexp_eatKGroupName = function(state) {
if (state.eat(0x6B /* k */)) {
if (this.regexp_eatGroupName(state)) {
state.backReferenceNames.push(state.lastStringValue);
@@ -4200,7 +4218,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
- pp$8.regexp_eatCharacterEscape = function(state) {
+ pp$1.regexp_eatCharacterEscape = function(state) {
return (
this.regexp_eatControlEscape(state) ||
this.regexp_eatCControlLetter(state) ||
@@ -4211,7 +4229,7 @@
this.regexp_eatIdentityEscape(state)
)
};
- pp$8.regexp_eatCControlLetter = function(state) {
+ pp$1.regexp_eatCControlLetter = function(state) {
var start = state.pos;
if (state.eat(0x63 /* c */)) {
if (this.regexp_eatControlLetter(state)) {
@@ -4221,7 +4239,7 @@
}
return false
};
- pp$8.regexp_eatZero = function(state) {
+ pp$1.regexp_eatZero = function(state) {
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
state.lastIntValue = 0;
state.advance();
@@ -4231,7 +4249,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
- pp$8.regexp_eatControlEscape = function(state) {
+ pp$1.regexp_eatControlEscape = function(state) {
var ch = state.current();
if (ch === 0x74 /* t */) {
state.lastIntValue = 0x09; /* \t */
@@ -4262,7 +4280,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
- pp$8.regexp_eatControlLetter = function(state) {
+ pp$1.regexp_eatControlLetter = function(state) {
var ch = state.current();
if (isControlLetter(ch)) {
state.lastIntValue = ch % 0x20;
@@ -4279,7 +4297,7 @@
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
- pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
+ pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
if ( forceU === void 0 ) forceU = false;
var start = state.pos;
@@ -4324,7 +4342,7 @@
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
- pp$8.regexp_eatIdentityEscape = function(state) {
+ pp$1.regexp_eatIdentityEscape = function(state) {
if (state.switchU) {
if (this.regexp_eatSyntaxCharacter(state)) {
return true
@@ -4347,7 +4365,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
- pp$8.regexp_eatDecimalEscape = function(state) {
+ pp$1.regexp_eatDecimalEscape = function(state) {
state.lastIntValue = 0;
var ch = state.current();
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
@@ -4361,7 +4379,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
- pp$8.regexp_eatCharacterClassEscape = function(state) {
+ pp$1.regexp_eatCharacterClassEscape = function(state) {
var ch = state.current();
if (isCharacterClassEscape(ch)) {
@@ -4403,7 +4421,7 @@
// UnicodePropertyValueExpression ::
// UnicodePropertyName `=` UnicodePropertyValue
// LoneUnicodePropertyNameOrValue
- pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
+ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
var start = state.pos;
// UnicodePropertyName `=` UnicodePropertyValue
@@ -4425,24 +4443,24 @@
}
return false
};
- pp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
+ pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
if (!has(state.unicodeProperties.nonBinary, name))
{ state.raise("Invalid property name"); }
if (!state.unicodeProperties.nonBinary[name].test(value))
{ state.raise("Invalid property value"); }
};
- pp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
+ pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
if (!state.unicodeProperties.binary.test(nameOrValue))
{ state.raise("Invalid property name"); }
};
// UnicodePropertyName ::
// UnicodePropertyNameCharacters
- pp$8.regexp_eatUnicodePropertyName = function(state) {
+ pp$1.regexp_eatUnicodePropertyName = function(state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyNameCharacter(ch = state.current())) {
- state.lastStringValue += codePointToString(ch);
+ state.lastStringValue += codePointToString$1(ch);
state.advance();
}
return state.lastStringValue !== ""
@@ -4453,11 +4471,11 @@
// UnicodePropertyValue ::
// UnicodePropertyValueCharacters
- pp$8.regexp_eatUnicodePropertyValue = function(state) {
+ pp$1.regexp_eatUnicodePropertyValue = function(state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyValueCharacter(ch = state.current())) {
- state.lastStringValue += codePointToString(ch);
+ state.lastStringValue += codePointToString$1(ch);
state.advance();
}
return state.lastStringValue !== ""
@@ -4468,12 +4486,12 @@
// LoneUnicodePropertyNameOrValue ::
// UnicodePropertyValueCharacters
- pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
+ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
return this.regexp_eatUnicodePropertyValue(state)
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
- pp$8.regexp_eatCharacterClass = function(state) {
+ pp$1.regexp_eatCharacterClass = function(state) {
if (state.eat(0x5B /* [ */)) {
state.eat(0x5E /* ^ */);
this.regexp_classRanges(state);
@@ -4489,7 +4507,7 @@
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
- pp$8.regexp_classRanges = function(state) {
+ pp$1.regexp_classRanges = function(state) {
while (this.regexp_eatClassAtom(state)) {
var left = state.lastIntValue;
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
@@ -4506,7 +4524,7 @@
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
- pp$8.regexp_eatClassAtom = function(state) {
+ pp$1.regexp_eatClassAtom = function(state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
@@ -4535,7 +4553,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
- pp$8.regexp_eatClassEscape = function(state) {
+ pp$1.regexp_eatClassEscape = function(state) {
var start = state.pos;
if (state.eat(0x62 /* b */)) {
@@ -4562,7 +4580,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
- pp$8.regexp_eatClassControlLetter = function(state) {
+ pp$1.regexp_eatClassControlLetter = function(state) {
var ch = state.current();
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
state.lastIntValue = ch % 0x20;
@@ -4573,7 +4591,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
- pp$8.regexp_eatHexEscapeSequence = function(state) {
+ pp$1.regexp_eatHexEscapeSequence = function(state) {
var start = state.pos;
if (state.eat(0x78 /* x */)) {
if (this.regexp_eatFixedHexDigits(state, 2)) {
@@ -4588,7 +4606,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
- pp$8.regexp_eatDecimalDigits = function(state) {
+ pp$1.regexp_eatDecimalDigits = function(state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
@@ -4603,7 +4621,7 @@
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
- pp$8.regexp_eatHexDigits = function(state) {
+ pp$1.regexp_eatHexDigits = function(state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
@@ -4632,7 +4650,7 @@
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
// Allows only 0-377(octal) i.e. 0-255(decimal).
- pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
+ pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
if (this.regexp_eatOctalDigit(state)) {
var n1 = state.lastIntValue;
if (this.regexp_eatOctalDigit(state)) {
@@ -4651,7 +4669,7 @@
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
- pp$8.regexp_eatOctalDigit = function(state) {
+ pp$1.regexp_eatOctalDigit = function(state) {
var ch = state.current();
if (isOctalDigit(ch)) {
state.lastIntValue = ch - 0x30; /* 0 */
@@ -4668,7 +4686,7 @@
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
- pp$8.regexp_eatFixedHexDigits = function(state, length) {
+ pp$1.regexp_eatFixedHexDigits = function(state, length) {
var start = state.pos;
state.lastIntValue = 0;
for (var i = 0; i < length; ++i) {
@@ -4700,11 +4718,11 @@
// ## Tokenizer
- var pp$9 = Parser.prototype;
+ var pp = Parser.prototype;
// Move to the next token
- pp$9.next = function(ignoreEscapeSequenceInKeyword) {
+ pp.next = function(ignoreEscapeSequenceInKeyword) {
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
if (this.options.onToken)
@@ -4717,21 +4735,21 @@
this.nextToken();
};
- pp$9.getToken = function() {
+ pp.getToken = function() {
this.next();
return new Token(this)
};
// If we're in an ES6 environment, make parsers iterable
if (typeof Symbol !== "undefined")
- { pp$9[Symbol.iterator] = function() {
- var this$1 = this;
+ { pp[Symbol.iterator] = function() {
+ var this$1$1 = this;
return {
next: function () {
- var token = this$1.getToken();
+ var token = this$1$1.getToken();
return {
- done: token.type === types.eof,
+ done: token.type === types$1.eof,
value: token
}
}
@@ -4744,19 +4762,19 @@
// Read a single token, updating the parser object's token-related
// properties.
- pp$9.nextToken = function() {
+ pp.nextToken = function() {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
this.start = this.pos;
if (this.options.locations) { this.startLoc = this.curPosition(); }
- if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
+ if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
if (curContext.override) { return curContext.override(this) }
else { this.readToken(this.fullCharCodeAtPos()); }
};
- pp$9.readToken = function(code) {
+ pp.readToken = function(code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
@@ -4765,14 +4783,14 @@
return this.getTokenFromCode(code)
};
- pp$9.fullCharCodeAtPos = function() {
+ pp.fullCharCodeAtPos = function() {
var code = this.input.charCodeAt(this.pos);
if (code <= 0xd7ff || code >= 0xdc00) { return code }
var next = this.input.charCodeAt(this.pos + 1);
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
};
- pp$9.skipBlockComment = function() {
+ pp.skipBlockComment = function() {
var startLoc = this.options.onComment && this.curPosition();
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
@@ -4790,7 +4808,7 @@
startLoc, this.curPosition()); }
};
- pp$9.skipLineComment = function(startSkip) {
+ pp.skipLineComment = function(startSkip) {
var start = this.pos;
var startLoc = this.options.onComment && this.curPosition();
var ch = this.input.charCodeAt(this.pos += startSkip);
@@ -4805,7 +4823,7 @@
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
- pp$9.skipSpace = function() {
+ pp.skipSpace = function() {
loop: while (this.pos < this.input.length) {
var ch = this.input.charCodeAt(this.pos);
switch (ch) {
@@ -4850,7 +4868,7 @@
// the token, so that the next one's `start` will point at the
// right position.
- pp$9.finishToken = function(type, val) {
+ pp.finishToken = function(type, val) {
this.end = this.pos;
if (this.options.locations) { this.endLoc = this.curPosition(); }
var prevType = this.type;
@@ -4869,62 +4887,62 @@
//
// All in the name of speed.
//
- pp$9.readToken_dot = function() {
+ pp.readToken_dot = function() {
var next = this.input.charCodeAt(this.pos + 1);
if (next >= 48 && next <= 57) { return this.readNumber(true) }
var next2 = this.input.charCodeAt(this.pos + 2);
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
this.pos += 3;
- return this.finishToken(types.ellipsis)
+ return this.finishToken(types$1.ellipsis)
} else {
++this.pos;
- return this.finishToken(types.dot)
+ return this.finishToken(types$1.dot)
}
};
- pp$9.readToken_slash = function() { // '/'
+ pp.readToken_slash = function() { // '/'
var next = this.input.charCodeAt(this.pos + 1);
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.slash, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.slash, 1)
};
- pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
+ pp.readToken_mult_modulo_exp = function(code) { // '%*'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
- var tokentype = code === 42 ? types.star : types.modulo;
+ var tokentype = code === 42 ? types$1.star : types$1.modulo;
// exponentiation operator ** and **=
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
++size;
- tokentype = types.starstar;
+ tokentype = types$1.starstar;
next = this.input.charCodeAt(this.pos + 2);
}
- if (next === 61) { return this.finishOp(types.assign, size + 1) }
+ if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
return this.finishOp(tokentype, size)
};
- pp$9.readToken_pipe_amp = function(code) { // '|&'
+ pp.readToken_pipe_amp = function(code) { // '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
- if (next2 === 61) { return this.finishOp(types.assign, 3) }
+ if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
}
- return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
+ return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
}
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
};
- pp$9.readToken_caret = function() { // '^'
+ pp.readToken_caret = function() { // '^'
var next = this.input.charCodeAt(this.pos + 1);
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.bitwiseXOR, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.bitwiseXOR, 1)
};
- pp$9.readToken_plus_min = function(code) { // '+-'
+ pp.readToken_plus_min = function(code) { // '+-'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
@@ -4934,19 +4952,19 @@
this.skipSpace();
return this.nextToken()
}
- return this.finishOp(types.incDec, 2)
+ return this.finishOp(types$1.incDec, 2)
}
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.plusMin, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.plusMin, 1)
};
- pp$9.readToken_lt_gt = function(code) { // '<>'
+ pp.readToken_lt_gt = function(code) { // '<>'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
- if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
- return this.finishOp(types.bitShift, size)
+ if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
+ return this.finishOp(types$1.bitShift, size)
}
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
this.input.charCodeAt(this.pos + 3) === 45) {
@@ -4956,53 +4974,53 @@
return this.nextToken()
}
if (next === 61) { size = 2; }
- return this.finishOp(types.relational, size)
+ return this.finishOp(types$1.relational, size)
};
- pp$9.readToken_eq_excl = function(code) { // '=!'
+ pp.readToken_eq_excl = function(code) { // '=!'
var next = this.input.charCodeAt(this.pos + 1);
- if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
+ if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
this.pos += 2;
- return this.finishToken(types.arrow)
+ return this.finishToken(types$1.arrow)
}
- return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
+ return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
};
- pp$9.readToken_question = function() { // '?'
+ pp.readToken_question = function() { // '?'
var ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
var next2 = this.input.charCodeAt(this.pos + 2);
- if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
+ if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
}
if (next === 63) {
if (ecmaVersion >= 12) {
var next2$1 = this.input.charCodeAt(this.pos + 2);
- if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
+ if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
}
- return this.finishOp(types.coalesce, 2)
+ return this.finishOp(types$1.coalesce, 2)
}
}
- return this.finishOp(types.question, 1)
+ return this.finishOp(types$1.question, 1)
};
- pp$9.readToken_numberSign = function() { // '#'
+ pp.readToken_numberSign = function() { // '#'
var ecmaVersion = this.options.ecmaVersion;
var code = 35; // '#'
if (ecmaVersion >= 13) {
++this.pos;
code = this.fullCharCodeAtPos();
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
- return this.finishToken(types.privateId, this.readWord1())
+ return this.finishToken(types$1.privateId, this.readWord1())
}
}
- this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
+ this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
- pp$9.getTokenFromCode = function(code) {
+ pp.getTokenFromCode = function(code) {
switch (code) {
// The interpretation of a dot depends on whether it is followed
// by a digit or another two dots.
@@ -5010,20 +5028,20 @@
return this.readToken_dot()
// Punctuation tokens.
- case 40: ++this.pos; return this.finishToken(types.parenL)
- case 41: ++this.pos; return this.finishToken(types.parenR)
- case 59: ++this.pos; return this.finishToken(types.semi)
- case 44: ++this.pos; return this.finishToken(types.comma)
- case 91: ++this.pos; return this.finishToken(types.bracketL)
- case 93: ++this.pos; return this.finishToken(types.bracketR)
- case 123: ++this.pos; return this.finishToken(types.braceL)
- case 125: ++this.pos; return this.finishToken(types.braceR)
- case 58: ++this.pos; return this.finishToken(types.colon)
+ case 40: ++this.pos; return this.finishToken(types$1.parenL)
+ case 41: ++this.pos; return this.finishToken(types$1.parenR)
+ case 59: ++this.pos; return this.finishToken(types$1.semi)
+ case 44: ++this.pos; return this.finishToken(types$1.comma)
+ case 91: ++this.pos; return this.finishToken(types$1.bracketL)
+ case 93: ++this.pos; return this.finishToken(types$1.bracketR)
+ case 123: ++this.pos; return this.finishToken(types$1.braceL)
+ case 125: ++this.pos; return this.finishToken(types$1.braceR)
+ case 58: ++this.pos; return this.finishToken(types$1.colon)
case 96: // '`'
if (this.options.ecmaVersion < 6) { break }
++this.pos;
- return this.finishToken(types.backQuote)
+ return this.finishToken(types$1.backQuote)
case 48: // '0'
var next = this.input.charCodeAt(this.pos + 1);
@@ -5046,7 +5064,6 @@
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
-
case 47: // '/'
return this.readToken_slash()
@@ -5072,22 +5089,22 @@
return this.readToken_question()
case 126: // '~'
- return this.finishOp(types.prefix, 1)
+ return this.finishOp(types$1.prefix, 1)
case 35: // '#'
return this.readToken_numberSign()
}
- this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
+ this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
- pp$9.finishOp = function(type, size) {
+ pp.finishOp = function(type, size) {
var str = this.input.slice(this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str)
};
- pp$9.readRegexp = function() {
+ pp.readRegexp = function() {
var escaped, inClass, start = this.pos;
for (;;) {
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
@@ -5122,14 +5139,14 @@
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
}
- return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
+ return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
- pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
+ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
// `len` is used for character escape sequences. In that case, disallow separators.
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
@@ -5183,7 +5200,7 @@
return BigInt(str.replace(/_/g, ""))
}
- pp$9.readRadixNumber = function(radix) {
+ pp.readRadixNumber = function(radix) {
var start = this.pos;
this.pos += 2; // 0x
var val = this.readInt(radix);
@@ -5192,12 +5209,12 @@
val = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
- return this.finishToken(types.num, val)
+ return this.finishToken(types$1.num, val)
};
// Read an integer, octal integer, or floating-point number.
- pp$9.readNumber = function(startsWithDot) {
+ pp.readNumber = function(startsWithDot) {
var start = this.pos;
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
@@ -5207,7 +5224,7 @@
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
- return this.finishToken(types.num, val$1)
+ return this.finishToken(types$1.num, val$1)
}
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
if (next === 46 && !octal) { // '.'
@@ -5223,12 +5240,12 @@
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
var val = stringToNumber(this.input.slice(start, this.pos), octal);
- return this.finishToken(types.num, val)
+ return this.finishToken(types$1.num, val)
};
// Read a string value, interpreting backslash-escapes.
- pp$9.readCodePoint = function() {
+ pp.readCodePoint = function() {
var ch = this.input.charCodeAt(this.pos), code;
if (ch === 123) { // '{'
@@ -5243,14 +5260,14 @@
return code
};
- function codePointToString$1(code) {
+ function codePointToString(code) {
// UTF-16 Decoding
if (code <= 0xFFFF) { return String.fromCharCode(code) }
code -= 0x10000;
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
}
- pp$9.readString = function(quote) {
+ pp.readString = function(quote) {
var out = "", chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
@@ -5273,14 +5290,14 @@
}
}
out += this.input.slice(chunkStart, this.pos++);
- return this.finishToken(types.string, out)
+ return this.finishToken(types$1.string, out)
};
// Reads template string tokens.
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
- pp$9.tryReadTemplateToken = function() {
+ pp.tryReadTemplateToken = function() {
this.inTemplateElement = true;
try {
this.readTmplToken();
@@ -5295,7 +5312,7 @@
this.inTemplateElement = false;
};
- pp$9.invalidStringToken = function(position, message) {
+ pp.invalidStringToken = function(position, message) {
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
throw INVALID_TEMPLATE_ESCAPE_ERROR
} else {
@@ -5303,23 +5320,23 @@
}
};
- pp$9.readTmplToken = function() {
+ pp.readTmplToken = function() {
var out = "", chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
var ch = this.input.charCodeAt(this.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
- if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
+ if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
if (ch === 36) {
this.pos += 2;
- return this.finishToken(types.dollarBraceL)
+ return this.finishToken(types$1.dollarBraceL)
} else {
++this.pos;
- return this.finishToken(types.backQuote)
+ return this.finishToken(types$1.backQuote)
}
}
out += this.input.slice(chunkStart, this.pos);
- return this.finishToken(types.template, out)
+ return this.finishToken(types$1.template, out)
}
if (ch === 92) { // '\'
out += this.input.slice(chunkStart, this.pos);
@@ -5350,7 +5367,7 @@
};
// Reads a template token to search for the end, without validating any escape sequences
- pp$9.readInvalidTemplateToken = function() {
+ pp.readInvalidTemplateToken = function() {
for (; this.pos < this.input.length; this.pos++) {
switch (this.input[this.pos]) {
case "\\":
@@ -5361,10 +5378,10 @@
if (this.input[this.pos + 1] !== "{") {
break
}
- // falls through
+ // falls through
case "`":
- return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
+ return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
// no default
}
@@ -5374,14 +5391,14 @@
// Used to read escaped characters
- pp$9.readEscapedChar = function(inTemplate) {
+ pp.readEscapedChar = function(inTemplate) {
var ch = this.input.charCodeAt(++this.pos);
++this.pos;
switch (ch) {
case 110: return "\n" // 'n' -> '\n'
case 114: return "\r" // 'r' -> '\r'
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
- case 117: return codePointToString$1(this.readCodePoint()) // 'u'
+ case 117: return codePointToString(this.readCodePoint()) // 'u'
case 116: return "\t" // 't' -> '\t'
case 98: return "\b" // 'b' -> '\b'
case 118: return "\u000b" // 'v' -> '\u000b'
@@ -5439,7 +5456,7 @@
// Used to read character escape sequences ('\x', '\u', '\U').
- pp$9.readHexChar = function(len) {
+ pp.readHexChar = function(len) {
var codePos = this.pos;
var n = this.readInt(16, len);
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
@@ -5452,7 +5469,7 @@
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
- pp$9.readWord1 = function() {
+ pp.readWord1 = function() {
this.containsEsc = false;
var word = "", first = true, chunkStart = this.pos;
var astral = this.options.ecmaVersion >= 6;
@@ -5470,7 +5487,7 @@
var esc = this.readCodePoint();
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
- word += codePointToString$1(esc);
+ word += codePointToString(esc);
chunkStart = this.pos;
} else {
break
@@ -5483,18 +5500,18 @@
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
- pp$9.readWord = function() {
+ pp.readWord = function() {
var word = this.readWord1();
- var type = types.name;
+ var type = types$1.name;
if (this.keywords.test(word)) {
- type = keywords$1[word];
+ type = keywords[word];
}
return this.finishToken(type, word)
};
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
- var version = "8.5.0";
+ var version = "8.6.0";
Parser.acorn = {
Parser: Parser,
@@ -5505,10 +5522,10 @@
getLineInfo: getLineInfo,
Node: Node,
TokenType: TokenType,
- tokTypes: types,
- keywordTypes: keywords$1,
+ tokTypes: types$1,
+ keywordTypes: keywords,
TokContext: TokContext,
- tokContexts: types$1,
+ tokContexts: types,
isIdentifierChar: isIdentifierChar,
isIdentifierStart: isIdentifierStart,
Token: Token,
@@ -5556,17 +5573,17 @@
exports.isIdentifierChar = isIdentifierChar;
exports.isIdentifierStart = isIdentifierStart;
exports.isNewLine = isNewLine;
- exports.keywordTypes = keywords$1;
+ exports.keywordTypes = keywords;
exports.lineBreak = lineBreak;
exports.lineBreakG = lineBreakG;
exports.nonASCIIwhitespace = nonASCIIwhitespace;
exports.parse = parse;
exports.parseExpressionAt = parseExpressionAt;
- exports.tokContexts = types$1;
- exports.tokTypes = types;
+ exports.tokContexts = types;
+ exports.tokTypes = types$1;
exports.tokenizer = tokenizer;
exports.version = version;
Object.defineProperty(exports, '__esModule', { value: true });
-})));
+}));
diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs
index 96a8294589badc..df5b26e5dd0f74 100644
--- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs
+++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs
@@ -12,7 +12,7 @@ var reservedWords = {
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";
-var keywords = {
+var keywords$1 = {
5: ecma5AndLessKeywords,
"5module": ecma5AndLessKeywords + " export import",
6: ecma5AndLessKeywords + " const class extends export import super"
@@ -131,17 +131,17 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
// Map keyword names to token types.
-var keywords$1 = {};
+var keywords = {};
// Succinct definitions of keyword token types
function kw(name, options) {
if ( options === void 0 ) options = {};
options.keyword = name;
- return keywords$1[name] = new TokenType(name, options)
+ return keywords[name] = new TokenType(name, options)
}
-var types = {
+var types$1 = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
@@ -483,7 +483,7 @@ var
var Parser = function Parser(options, input, startPos) {
this.options = options = getOptions(options);
this.sourceFile = options.sourceFile;
- this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
+ this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
var reserved = "";
if (options.allowReserved !== true) {
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
@@ -514,7 +514,7 @@ var Parser = function Parser(options, input, startPos) {
// Properties of the current token:
// Its type
- this.type = types.eof;
+ this.type = types$1.eof;
// For tokens that include more information than their type, the value
this.value = null;
// Its start and end offset
@@ -574,8 +574,11 @@ Parser.prototype.parse = function parse () {
};
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
+
prototypeAccessors.canAwait.get = function () {
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
var scope = this.scopeStack[i];
@@ -584,20 +587,25 @@ prototypeAccessors.canAwait.get = function () {
}
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
};
+
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
var inClassFieldInit = ref.inClassFieldInit;
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
};
+
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
+
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
+
prototypeAccessors.allowNewDotTarget.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
var inClassFieldInit = ref.inClassFieldInit;
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
};
+
prototypeAccessors.inClassStaticBlock.get = function () {
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
};
@@ -627,12 +635,12 @@ Parser.tokenizer = function tokenizer (input, options) {
Object.defineProperties( Parser.prototype, prototypeAccessors );
-var pp = Parser.prototype;
+var pp$9 = Parser.prototype;
// ## Parser utilities
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
-pp.strictDirective = function(start) {
+pp$9.strictDirective = function(start) {
for (;;) {
// Try to find string literal.
skipWhiteSpace.lastIndex = start;
@@ -660,7 +668,7 @@ pp.strictDirective = function(start) {
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
-pp.eat = function(type) {
+pp$9.eat = function(type) {
if (this.type === type) {
this.next();
return true
@@ -671,13 +679,13 @@ pp.eat = function(type) {
// Tests whether parsed token is a contextual keyword.
-pp.isContextual = function(name) {
- return this.type === types.name && this.value === name && !this.containsEsc
+pp$9.isContextual = function(name) {
+ return this.type === types$1.name && this.value === name && !this.containsEsc
};
// Consumes contextual keyword if possible.
-pp.eatContextual = function(name) {
+pp$9.eatContextual = function(name) {
if (!this.isContextual(name)) { return false }
this.next();
return true
@@ -685,19 +693,19 @@ pp.eatContextual = function(name) {
// Asserts that following token is given contextual keyword.
-pp.expectContextual = function(name) {
+pp$9.expectContextual = function(name) {
if (!this.eatContextual(name)) { this.unexpected(); }
};
// Test whether a semicolon can be inserted at the current position.
-pp.canInsertSemicolon = function() {
- return this.type === types.eof ||
- this.type === types.braceR ||
+pp$9.canInsertSemicolon = function() {
+ return this.type === types$1.eof ||
+ this.type === types$1.braceR ||
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
};
-pp.insertSemicolon = function() {
+pp$9.insertSemicolon = function() {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon)
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
@@ -708,11 +716,11 @@ pp.insertSemicolon = function() {
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
-pp.semicolon = function() {
- if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
+pp$9.semicolon = function() {
+ if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
};
-pp.afterTrailingComma = function(tokType, notNext) {
+pp$9.afterTrailingComma = function(tokType, notNext) {
if (this.type === tokType) {
if (this.options.onTrailingComma)
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
@@ -725,13 +733,13 @@ pp.afterTrailingComma = function(tokType, notNext) {
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
-pp.expect = function(type) {
+pp$9.expect = function(type) {
this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
-pp.unexpected = function(pos) {
+pp$9.unexpected = function(pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
@@ -744,7 +752,7 @@ function DestructuringErrors() {
-1;
}
-pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
+pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
if (!refDestructuringErrors) { return }
if (refDestructuringErrors.trailingComma > -1)
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
@@ -752,7 +760,7 @@ pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
};
-pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
+pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
if (!refDestructuringErrors) { return false }
var shorthandAssign = refDestructuringErrors.shorthandAssign;
var doubleProto = refDestructuringErrors.doubleProto;
@@ -763,20 +771,20 @@ pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
};
-pp.checkYieldAwaitInDefaultParams = function() {
+pp$9.checkYieldAwaitInDefaultParams = function() {
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
if (this.awaitPos)
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
};
-pp.isSimpleAssignTarget = function(expr) {
+pp$9.isSimpleAssignTarget = function(expr) {
if (expr.type === "ParenthesizedExpression")
{ return this.isSimpleAssignTarget(expr.expression) }
return expr.type === "Identifier" || expr.type === "MemberExpression"
};
-var pp$1 = Parser.prototype;
+var pp$8 = Parser.prototype;
// ### Statement parsing
@@ -785,10 +793,10 @@ var pp$1 = Parser.prototype;
// `program` argument. If present, the statements will be appended
// to its body instead of creating a new node.
-pp$1.parseTopLevel = function(node) {
+pp$8.parseTopLevel = function(node) {
var exports = Object.create(null);
if (!node.body) { node.body = []; }
- while (this.type !== types.eof) {
+ while (this.type !== types$1.eof) {
var stmt = this.parseStatement(null, true, exports);
node.body.push(stmt);
}
@@ -807,7 +815,7 @@ pp$1.parseTopLevel = function(node) {
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
-pp$1.isLet = function(context) {
+pp$8.isLet = function(context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
@@ -833,7 +841,7 @@ pp$1.isLet = function(context) {
// check 'async [no LineTerminator here] function'
// - 'async /*foo*/ function' is OK.
// - 'async /*\n*/ function' is invalid.
-pp$1.isAsyncFunction = function() {
+pp$8.isAsyncFunction = function() {
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
{ return false }
@@ -853,11 +861,11 @@ pp$1.isAsyncFunction = function() {
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
-pp$1.parseStatement = function(context, topLevel, exports) {
+pp$8.parseStatement = function(context, topLevel, exports) {
var starttype = this.type, node = this.startNode(), kind;
if (this.isLet(context)) {
- starttype = types._var;
+ starttype = types$1._var;
kind = "let";
}
@@ -866,35 +874,35 @@ pp$1.parseStatement = function(context, topLevel, exports) {
// complexity.
switch (starttype) {
- case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
- case types._debugger: return this.parseDebuggerStatement(node)
- case types._do: return this.parseDoStatement(node)
- case types._for: return this.parseForStatement(node)
- case types._function:
+ case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
+ case types$1._debugger: return this.parseDebuggerStatement(node)
+ case types$1._do: return this.parseDoStatement(node)
+ case types$1._for: return this.parseForStatement(node)
+ case types$1._function:
// Function as sole body of either an if statement or a labeled statement
// works, but not when it is part of a labeled statement that is the sole
// body of an if statement.
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
return this.parseFunctionStatement(node, false, !context)
- case types._class:
+ case types$1._class:
if (context) { this.unexpected(); }
return this.parseClass(node, true)
- case types._if: return this.parseIfStatement(node)
- case types._return: return this.parseReturnStatement(node)
- case types._switch: return this.parseSwitchStatement(node)
- case types._throw: return this.parseThrowStatement(node)
- case types._try: return this.parseTryStatement(node)
- case types._const: case types._var:
+ case types$1._if: return this.parseIfStatement(node)
+ case types$1._return: return this.parseReturnStatement(node)
+ case types$1._switch: return this.parseSwitchStatement(node)
+ case types$1._throw: return this.parseThrowStatement(node)
+ case types$1._try: return this.parseTryStatement(node)
+ case types$1._const: case types$1._var:
kind = kind || this.value;
if (context && kind !== "var") { this.unexpected(); }
return this.parseVarStatement(node, kind)
- case types._while: return this.parseWhileStatement(node)
- case types._with: return this.parseWithStatement(node)
- case types.braceL: return this.parseBlock(true, node)
- case types.semi: return this.parseEmptyStatement(node)
- case types._export:
- case types._import:
- if (this.options.ecmaVersion > 10 && starttype === types._import) {
+ case types$1._while: return this.parseWhileStatement(node)
+ case types$1._with: return this.parseWithStatement(node)
+ case types$1.braceL: return this.parseBlock(true, node)
+ case types$1.semi: return this.parseEmptyStatement(node)
+ case types$1._export:
+ case types$1._import:
+ if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
@@ -908,7 +916,7 @@ pp$1.parseStatement = function(context, topLevel, exports) {
if (!this.inModule)
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
}
- return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
// If the statement does not start with a statement keyword or a
// brace, it's an ExpressionStatement or LabeledStatement. We
@@ -923,17 +931,17 @@ pp$1.parseStatement = function(context, topLevel, exports) {
}
var maybeName = this.value, expr = this.parseExpression();
- if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
+ if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
else { return this.parseExpressionStatement(node, expr) }
}
};
-pp$1.parseBreakContinueStatement = function(node, keyword) {
+pp$8.parseBreakContinueStatement = function(node, keyword) {
var isBreak = keyword === "break";
this.next();
- if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
- else if (this.type !== types.name) { this.unexpected(); }
+ if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
+ else if (this.type !== types$1.name) { this.unexpected(); }
else {
node.label = this.parseIdent();
this.semicolon();
@@ -953,21 +961,21 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
};
-pp$1.parseDebuggerStatement = function(node) {
+pp$8.parseDebuggerStatement = function(node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement")
};
-pp$1.parseDoStatement = function(node) {
+pp$8.parseDoStatement = function(node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement("do");
this.labels.pop();
- this.expect(types._while);
+ this.expect(types$1._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6)
- { this.eat(types.semi); }
+ { this.eat(types$1.semi); }
else
{ this.semicolon(); }
return this.finishNode(node, "DoWhileStatement")
@@ -981,25 +989,25 @@ pp$1.parseDoStatement = function(node) {
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
-pp$1.parseForStatement = function(node) {
+pp$8.parseForStatement = function(node) {
this.next();
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
this.labels.push(loopLabel);
this.enterScope(0);
- this.expect(types.parenL);
- if (this.type === types.semi) {
+ this.expect(types$1.parenL);
+ if (this.type === types$1.semi) {
if (awaitAt > -1) { this.unexpected(awaitAt); }
return this.parseFor(node, null)
}
var isLet = this.isLet();
- if (this.type === types._var || this.type === types._const || isLet) {
+ if (this.type === types$1._var || this.type === types$1._const || isLet) {
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
this.next();
this.parseVar(init$1, true, kind);
this.finishNode(init$1, "VariableDeclaration");
- if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
+ if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
if (this.options.ecmaVersion >= 9) {
- if (this.type === types._in) {
+ if (this.type === types$1._in) {
if (awaitAt > -1) { this.unexpected(awaitAt); }
} else { node.await = awaitAt > -1; }
}
@@ -1011,9 +1019,9 @@ pp$1.parseForStatement = function(node) {
var startsWithLet = this.isContextual("let"), isForOf = false;
var refDestructuringErrors = new DestructuringErrors;
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
- if (this.type === types._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
+ if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
if (this.options.ecmaVersion >= 9) {
- if (this.type === types._in) {
+ if (this.type === types$1._in) {
if (awaitAt > -1) { this.unexpected(awaitAt); }
} else { node.await = awaitAt > -1; }
}
@@ -1028,21 +1036,21 @@ pp$1.parseForStatement = function(node) {
return this.parseFor(node, init)
};
-pp$1.parseFunctionStatement = function(node, isAsync, declarationPosition) {
+pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
this.next();
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
};
-pp$1.parseIfStatement = function(node) {
+pp$8.parseIfStatement = function(node) {
this.next();
node.test = this.parseParenExpression();
// allow function declarations in branches, but only in non-strict mode
node.consequent = this.parseStatement("if");
- node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
+ node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
return this.finishNode(node, "IfStatement")
};
-pp$1.parseReturnStatement = function(node) {
+pp$8.parseReturnStatement = function(node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
{ this.raise(this.start, "'return' outside of function"); }
this.next();
@@ -1051,16 +1059,16 @@ pp$1.parseReturnStatement = function(node) {
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
- if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
+ if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
else { node.argument = this.parseExpression(); this.semicolon(); }
return this.finishNode(node, "ReturnStatement")
};
-pp$1.parseSwitchStatement = function(node) {
+pp$8.parseSwitchStatement = function(node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
- this.expect(types.braceL);
+ this.expect(types$1.braceL);
this.labels.push(switchLabel);
this.enterScope(0);
@@ -1069,9 +1077,9 @@ pp$1.parseSwitchStatement = function(node) {
// adding statements to.
var cur;
- for (var sawDefault = false; this.type !== types.braceR;) {
- if (this.type === types._case || this.type === types._default) {
- var isCase = this.type === types._case;
+ for (var sawDefault = false; this.type !== types$1.braceR;) {
+ if (this.type === types$1._case || this.type === types$1._default) {
+ var isCase = this.type === types$1._case;
if (cur) { this.finishNode(cur, "SwitchCase"); }
node.cases.push(cur = this.startNode());
cur.consequent = [];
@@ -1083,7 +1091,7 @@ pp$1.parseSwitchStatement = function(node) {
sawDefault = true;
cur.test = null;
}
- this.expect(types.colon);
+ this.expect(types$1.colon);
} else {
if (!cur) { this.unexpected(); }
cur.consequent.push(this.parseStatement(null));
@@ -1096,7 +1104,7 @@ pp$1.parseSwitchStatement = function(node) {
return this.finishNode(node, "SwitchStatement")
};
-pp$1.parseThrowStatement = function(node) {
+pp$8.parseThrowStatement = function(node) {
this.next();
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
@@ -1107,21 +1115,21 @@ pp$1.parseThrowStatement = function(node) {
// Reused empty array added for node fields that are always empty.
-var empty = [];
+var empty$1 = [];
-pp$1.parseTryStatement = function(node) {
+pp$8.parseTryStatement = function(node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
- if (this.type === types._catch) {
+ if (this.type === types$1._catch) {
var clause = this.startNode();
this.next();
- if (this.eat(types.parenL)) {
+ if (this.eat(types$1.parenL)) {
clause.param = this.parseBindingAtom();
var simple = clause.param.type === "Identifier";
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
} else {
if (this.options.ecmaVersion < 10) { this.unexpected(); }
clause.param = null;
@@ -1131,20 +1139,20 @@ pp$1.parseTryStatement = function(node) {
this.exitScope();
node.handler = this.finishNode(clause, "CatchClause");
}
- node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
+ node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer)
{ this.raise(node.start, "Missing catch or finally clause"); }
return this.finishNode(node, "TryStatement")
};
-pp$1.parseVarStatement = function(node, kind) {
+pp$8.parseVarStatement = function(node, kind) {
this.next();
this.parseVar(node, false, kind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration")
};
-pp$1.parseWhileStatement = function(node) {
+pp$8.parseWhileStatement = function(node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
@@ -1153,7 +1161,7 @@ pp$1.parseWhileStatement = function(node) {
return this.finishNode(node, "WhileStatement")
};
-pp$1.parseWithStatement = function(node) {
+pp$8.parseWithStatement = function(node) {
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
this.next();
node.object = this.parseParenExpression();
@@ -1161,12 +1169,12 @@ pp$1.parseWithStatement = function(node) {
return this.finishNode(node, "WithStatement")
};
-pp$1.parseEmptyStatement = function(node) {
+pp$8.parseEmptyStatement = function(node) {
this.next();
return this.finishNode(node, "EmptyStatement")
};
-pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
+pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
{
var label = list[i$1];
@@ -1174,7 +1182,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
if (label.name === maybeName)
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
} }
- var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
+ var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
for (var i = this.labels.length - 1; i >= 0; i--) {
var label$1 = this.labels[i];
if (label$1.statementStart === node.start) {
@@ -1190,7 +1198,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
return this.finishNode(node, "LabeledStatement")
};
-pp$1.parseExpressionStatement = function(node, expr) {
+pp$8.parseExpressionStatement = function(node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement")
@@ -1200,14 +1208,14 @@ pp$1.parseExpressionStatement = function(node, expr) {
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
-pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
+pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
if ( node === void 0 ) node = this.startNode();
node.body = [];
- this.expect(types.braceL);
+ this.expect(types$1.braceL);
if (createNewLexicalScope) { this.enterScope(0); }
- while (this.type !== types.braceR) {
+ while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
@@ -1221,13 +1229,13 @@ pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
// `parseStatement` will already have parsed the init statement or
// expression.
-pp$1.parseFor = function(node, init) {
+pp$8.parseFor = function(node, init) {
node.init = init;
- this.expect(types.semi);
- node.test = this.type === types.semi ? null : this.parseExpression();
- this.expect(types.semi);
- node.update = this.type === types.parenR ? null : this.parseExpression();
- this.expect(types.parenR);
+ this.expect(types$1.semi);
+ node.test = this.type === types$1.semi ? null : this.parseExpression();
+ this.expect(types$1.semi);
+ node.update = this.type === types$1.parenR ? null : this.parseExpression();
+ this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
@@ -1237,8 +1245,8 @@ pp$1.parseFor = function(node, init) {
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
-pp$1.parseForIn = function(node, init) {
- var isForIn = this.type === types._in;
+pp$8.parseForIn = function(node, init) {
+ var isForIn = this.type === types$1._in;
this.next();
if (
@@ -1259,7 +1267,7 @@ pp$1.parseForIn = function(node, init) {
}
node.left = init;
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
@@ -1268,28 +1276,28 @@ pp$1.parseForIn = function(node, init) {
// Parse a list of variable declarations.
-pp$1.parseVar = function(node, isFor, kind) {
+pp$8.parseVar = function(node, isFor, kind) {
node.declarations = [];
node.kind = kind;
for (;;) {
var decl = this.startNode();
this.parseVarId(decl, kind);
- if (this.eat(types.eq)) {
+ if (this.eat(types$1.eq)) {
decl.init = this.parseMaybeAssign(isFor);
- } else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
+ } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
this.unexpected();
- } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
+ } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
} else {
decl.init = null;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
- if (!this.eat(types.comma)) { break }
+ if (!this.eat(types$1.comma)) { break }
}
return node
};
-pp$1.parseVarId = function(decl, kind) {
+pp$8.parseVarId = function(decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
};
@@ -1300,18 +1308,18 @@ var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
// `statement & FUNC_STATEMENT`).
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
-pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
+pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
this.initFunction(node);
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
- if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
+ if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
{ this.unexpected(); }
- node.generator = this.eat(types.star);
+ node.generator = this.eat(types$1.star);
}
if (this.options.ecmaVersion >= 8)
{ node.async = !!isAsync; }
if (statement & FUNC_STATEMENT) {
- node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
+ node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
// If it is a regular function declaration in sloppy mode, then it is
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
@@ -1327,7 +1335,7 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
this.enterScope(functionFlags(node.async, node.generator));
if (!(statement & FUNC_STATEMENT))
- { node.id = this.type === types.name ? this.parseIdent() : null; }
+ { node.id = this.type === types$1.name ? this.parseIdent() : null; }
this.parseFunctionParams(node);
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
@@ -1338,16 +1346,16 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync, for
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
};
-pp$1.parseFunctionParams = function(node) {
- this.expect(types.parenL);
- node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
+pp$8.parseFunctionParams = function(node) {
+ this.expect(types$1.parenL);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
};
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
-pp$1.parseClass = function(node, isStatement) {
+pp$8.parseClass = function(node, isStatement) {
this.next();
// ecma-262 14.6 Class Definitions
@@ -1361,8 +1369,8 @@ pp$1.parseClass = function(node, isStatement) {
var classBody = this.startNode();
var hadConstructor = false;
classBody.body = [];
- this.expect(types.braceL);
- while (this.type !== types.braceR) {
+ this.expect(types$1.braceL);
+ while (this.type !== types$1.braceR) {
var element = this.parseClassElement(node.superClass !== null);
if (element) {
classBody.body.push(element);
@@ -1381,8 +1389,8 @@ pp$1.parseClass = function(node, isStatement) {
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
};
-pp$1.parseClassElement = function(constructorAllowsSuper) {
- if (this.eat(types.semi)) { return null }
+pp$8.parseClassElement = function(constructorAllowsSuper) {
+ if (this.eat(types$1.semi)) { return null }
var ecmaVersion = this.options.ecmaVersion;
var node = this.startNode();
@@ -1394,11 +1402,11 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
if (this.eatContextual("static")) {
// Parse static init block
- if (ecmaVersion >= 13 && this.eat(types.braceL)) {
+ if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
this.parseClassStaticBlock(node);
return node
}
- if (this.isClassElementNameStart() || this.type === types.star) {
+ if (this.isClassElementNameStart() || this.type === types$1.star) {
isStatic = true;
} else {
keyName = "static";
@@ -1406,13 +1414,13 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
}
node.static = isStatic;
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
- if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
+ if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
isAsync = true;
} else {
keyName = "async";
}
}
- if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
+ if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
isGenerator = true;
}
if (!keyName && !isAsync && !isGenerator) {
@@ -1439,7 +1447,7 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
}
// Parse element value
- if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
+ if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
var isConstructor = !node.static && checkKeyName(node, "constructor");
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
@@ -1453,19 +1461,19 @@ pp$1.parseClassElement = function(constructorAllowsSuper) {
return node
};
-pp$1.isClassElementNameStart = function() {
+pp$8.isClassElementNameStart = function() {
return (
- this.type === types.name ||
- this.type === types.privateId ||
- this.type === types.num ||
- this.type === types.string ||
- this.type === types.bracketL ||
+ this.type === types$1.name ||
+ this.type === types$1.privateId ||
+ this.type === types$1.num ||
+ this.type === types$1.string ||
+ this.type === types$1.bracketL ||
this.type.keyword
)
};
-pp$1.parseClassElementName = function(element) {
- if (this.type === types.privateId) {
+pp$8.parseClassElementName = function(element) {
+ if (this.type === types$1.privateId) {
if (this.value === "constructor") {
this.raise(this.start, "Classes can't have an element named '#constructor'");
}
@@ -1476,7 +1484,7 @@ pp$1.parseClassElementName = function(element) {
}
};
-pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
+pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
// Check key and flags
var key = method.key;
if (method.kind === "constructor") {
@@ -1500,14 +1508,14 @@ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
return this.finishNode(method, "MethodDefinition")
};
-pp$1.parseClassField = function(field) {
+pp$8.parseClassField = function(field) {
if (checkKeyName(field, "constructor")) {
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
} else if (field.static && checkKeyName(field, "prototype")) {
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
}
- if (this.eat(types.eq)) {
+ if (this.eat(types$1.eq)) {
// To raise SyntaxError if 'arguments' exists in the initializer.
var scope = this.currentThisScope();
var inClassFieldInit = scope.inClassFieldInit;
@@ -1522,13 +1530,13 @@ pp$1.parseClassField = function(field) {
return this.finishNode(field, "PropertyDefinition")
};
-pp$1.parseClassStaticBlock = function(node) {
+pp$8.parseClassStaticBlock = function(node) {
node.body = [];
var oldLabels = this.labels;
this.labels = [];
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
- while (this.type !== types.braceR) {
+ while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
@@ -1539,8 +1547,8 @@ pp$1.parseClassStaticBlock = function(node) {
return this.finishNode(node, "StaticBlock")
};
-pp$1.parseClassId = function(node, isStatement) {
- if (this.type === types.name) {
+pp$8.parseClassId = function(node, isStatement) {
+ if (this.type === types$1.name) {
node.id = this.parseIdent();
if (isStatement)
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
@@ -1551,17 +1559,17 @@ pp$1.parseClassId = function(node, isStatement) {
}
};
-pp$1.parseClassSuper = function(node) {
- node.superClass = this.eat(types._extends) ? this.parseExprSubscripts(false) : null;
+pp$8.parseClassSuper = function(node) {
+ node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
};
-pp$1.enterClassBody = function() {
+pp$8.enterClassBody = function() {
var element = {declared: Object.create(null), used: []};
this.privateNameStack.push(element);
return element.declared
};
-pp$1.exitClassBody = function() {
+pp$8.exitClassBody = function() {
var ref = this.privateNameStack.pop();
var declared = ref.declared;
var used = ref.used;
@@ -1616,10 +1624,10 @@ function checkKeyName(node, name) {
// Parses module export declaration.
-pp$1.parseExport = function(node, exports) {
+pp$8.parseExport = function(node, exports) {
this.next();
// export * from '...'
- if (this.eat(types.star)) {
+ if (this.eat(types$1.star)) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
node.exported = this.parseIdent(true);
@@ -1629,20 +1637,20 @@ pp$1.parseExport = function(node, exports) {
}
}
this.expectContextual("from");
- if (this.type !== types.string) { this.unexpected(); }
+ if (this.type !== types$1.string) { this.unexpected(); }
node.source = this.parseExprAtom();
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration")
}
- if (this.eat(types._default)) { // export default ...
+ if (this.eat(types$1._default)) { // export default ...
this.checkExport(exports, "default", this.lastTokStart);
var isAsync;
- if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
+ if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
var fNode = this.startNode();
this.next();
if (isAsync) { this.next(); }
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
- } else if (this.type === types._class) {
+ } else if (this.type === types$1._class) {
var cNode = this.startNode();
node.declaration = this.parseClass(cNode, "nullableID");
} else {
@@ -1664,7 +1672,7 @@ pp$1.parseExport = function(node, exports) {
node.declaration = null;
node.specifiers = this.parseExportSpecifiers(exports);
if (this.eatContextual("from")) {
- if (this.type !== types.string) { this.unexpected(); }
+ if (this.type !== types$1.string) { this.unexpected(); }
node.source = this.parseExprAtom();
} else {
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
@@ -1683,14 +1691,14 @@ pp$1.parseExport = function(node, exports) {
return this.finishNode(node, "ExportNamedDeclaration")
};
-pp$1.checkExport = function(exports, name, pos) {
+pp$8.checkExport = function(exports, name, pos) {
if (!exports) { return }
if (has(exports, name))
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
exports[name] = true;
};
-pp$1.checkPatternExport = function(exports, pat) {
+pp$8.checkPatternExport = function(exports, pat) {
var type = pat.type;
if (type === "Identifier")
{ this.checkExport(exports, pat.name, pat.start); }
@@ -1717,7 +1725,7 @@ pp$1.checkPatternExport = function(exports, pat) {
{ this.checkPatternExport(exports, pat.expression); }
};
-pp$1.checkVariableExport = function(exports, decls) {
+pp$8.checkVariableExport = function(exports, decls) {
if (!exports) { return }
for (var i = 0, list = decls; i < list.length; i += 1)
{
@@ -1727,7 +1735,7 @@ pp$1.checkVariableExport = function(exports, decls) {
}
};
-pp$1.shouldParseExportStatement = function() {
+pp$8.shouldParseExportStatement = function() {
return this.type.keyword === "var" ||
this.type.keyword === "const" ||
this.type.keyword === "class" ||
@@ -1738,14 +1746,14 @@ pp$1.shouldParseExportStatement = function() {
// Parses a comma-separated list of module exports.
-pp$1.parseExportSpecifiers = function(exports) {
+pp$8.parseExportSpecifiers = function(exports) {
var nodes = [], first = true;
// export { x, y as z } [from '...']
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
+ this.expect(types$1.braceL);
+ while (!this.eat(types$1.braceR)) {
if (!first) {
- this.expect(types.comma);
- if (this.afterTrailingComma(types.braceR)) { break }
+ this.expect(types$1.comma);
+ if (this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }
var node = this.startNode();
@@ -1759,16 +1767,16 @@ pp$1.parseExportSpecifiers = function(exports) {
// Parses import declaration.
-pp$1.parseImport = function(node) {
+pp$8.parseImport = function(node) {
this.next();
// import '...'
- if (this.type === types.string) {
- node.specifiers = empty;
+ if (this.type === types$1.string) {
+ node.specifiers = empty$1;
node.source = this.parseExprAtom();
} else {
node.specifiers = this.parseImportSpecifiers();
this.expectContextual("from");
- node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
+ node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration")
@@ -1776,17 +1784,17 @@ pp$1.parseImport = function(node) {
// Parses a comma-separated list of module imports.
-pp$1.parseImportSpecifiers = function() {
+pp$8.parseImportSpecifiers = function() {
var nodes = [], first = true;
- if (this.type === types.name) {
+ if (this.type === types$1.name) {
// import defaultObj, { x, y as z } from '...'
var node = this.startNode();
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
- if (!this.eat(types.comma)) { return nodes }
+ if (!this.eat(types$1.comma)) { return nodes }
}
- if (this.type === types.star) {
+ if (this.type === types$1.star) {
var node$1 = this.startNode();
this.next();
this.expectContextual("as");
@@ -1795,11 +1803,11 @@ pp$1.parseImportSpecifiers = function() {
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
return nodes
}
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
+ this.expect(types$1.braceL);
+ while (!this.eat(types$1.braceR)) {
if (!first) {
- this.expect(types.comma);
- if (this.afterTrailingComma(types.braceR)) { break }
+ this.expect(types$1.comma);
+ if (this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }
var node$2 = this.startNode();
@@ -1817,12 +1825,12 @@ pp$1.parseImportSpecifiers = function() {
};
// Set `ExpressionStatement#directive` property for directive prologues.
-pp$1.adaptDirectivePrologue = function(statements) {
+pp$8.adaptDirectivePrologue = function(statements) {
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
statements[i].directive = statements[i].expression.raw.slice(1, -1);
}
};
-pp$1.isDirectiveCandidate = function(statement) {
+pp$8.isDirectiveCandidate = function(statement) {
return (
statement.type === "ExpressionStatement" &&
statement.expression.type === "Literal" &&
@@ -1832,12 +1840,12 @@ pp$1.isDirectiveCandidate = function(statement) {
)
};
-var pp$2 = Parser.prototype;
+var pp$7 = Parser.prototype;
// Convert existing expression atom to assignable pattern
// if possible.
-pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
+pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
@@ -1918,7 +1926,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
// Convert list of expression atoms to binding list.
-pp$2.toAssignableList = function(exprList, isBinding) {
+pp$7.toAssignableList = function(exprList, isBinding) {
var end = exprList.length;
for (var i = 0; i < end; i++) {
var elt = exprList[i];
@@ -1934,19 +1942,19 @@ pp$2.toAssignableList = function(exprList, isBinding) {
// Parses spread element.
-pp$2.parseSpread = function(refDestructuringErrors) {
+pp$7.parseSpread = function(refDestructuringErrors) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
return this.finishNode(node, "SpreadElement")
};
-pp$2.parseRestBinding = function() {
+pp$7.parseRestBinding = function() {
var node = this.startNode();
this.next();
// RestElement inside of a function parameter must be an identifier
- if (this.options.ecmaVersion === 6 && this.type !== types.name)
+ if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
{ this.unexpected(); }
node.argument = this.parseBindingAtom();
@@ -1956,36 +1964,36 @@ pp$2.parseRestBinding = function() {
// Parses lvalue (assignable) atom.
-pp$2.parseBindingAtom = function() {
+pp$7.parseBindingAtom = function() {
if (this.options.ecmaVersion >= 6) {
switch (this.type) {
- case types.bracketL:
+ case types$1.bracketL:
var node = this.startNode();
this.next();
- node.elements = this.parseBindingList(types.bracketR, true, true);
+ node.elements = this.parseBindingList(types$1.bracketR, true, true);
return this.finishNode(node, "ArrayPattern")
- case types.braceL:
+ case types$1.braceL:
return this.parseObj(true)
}
}
return this.parseIdent()
};
-pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
+pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
var elts = [], first = true;
while (!this.eat(close)) {
if (first) { first = false; }
- else { this.expect(types.comma); }
- if (allowEmpty && this.type === types.comma) {
+ else { this.expect(types$1.comma); }
+ if (allowEmpty && this.type === types$1.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break
- } else if (this.type === types.ellipsis) {
+ } else if (this.type === types$1.ellipsis) {
var rest = this.parseRestBinding();
this.parseBindingListItem(rest);
elts.push(rest);
- if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
+ if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
this.expect(close);
break
} else {
@@ -1997,15 +2005,15 @@ pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
return elts
};
-pp$2.parseBindingListItem = function(param) {
+pp$7.parseBindingListItem = function(param) {
return param
};
// Parses assignment pattern around given atom if possible.
-pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
+pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
left = left || this.parseBindingAtom();
- if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
+ if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
@@ -2076,7 +2084,7 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
// duplicate argument names. checkClashes is ignored if the provided construct
// is an assignment (i.e., bindingType is BIND_NONE).
-pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
+pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
if ( bindingType === void 0 ) bindingType = BIND_NONE;
var isBind = bindingType !== BIND_NONE;
@@ -2114,7 +2122,7 @@ pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
}
};
-pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
+pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
if ( bindingType === void 0 ) bindingType = BIND_NONE;
switch (expr.type) {
@@ -2139,7 +2147,7 @@ pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
}
};
-pp$2.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
+pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
if ( bindingType === void 0 ) bindingType = BIND_NONE;
switch (expr.type) {
@@ -2171,7 +2179,7 @@ var TokContext = function TokContext(token, isExpr, preserveSpace, override, gen
this.generator = !!generator;
};
-var types$1 = {
+var types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", false),
@@ -2184,38 +2192,38 @@ var types$1 = {
f_gen: new TokContext("function", false, false, null, true)
};
-var pp$3 = Parser.prototype;
+var pp$6 = Parser.prototype;
-pp$3.initialContext = function() {
- return [types$1.b_stat]
+pp$6.initialContext = function() {
+ return [types.b_stat]
};
-pp$3.curContext = function() {
+pp$6.curContext = function() {
return this.context[this.context.length - 1]
};
-pp$3.braceIsBlock = function(prevType) {
+pp$6.braceIsBlock = function(prevType) {
var parent = this.curContext();
- if (parent === types$1.f_expr || parent === types$1.f_stat)
+ if (parent === types.f_expr || parent === types.f_stat)
{ return true }
- if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
+ if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
{ return !parent.isExpr }
// The check for `tt.name && exprAllowed` detects whether we are
// after a `yield` or `of` construct. See the `updateContext` for
// `tt.name`.
- if (prevType === types._return || prevType === types.name && this.exprAllowed)
+ if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
- if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
+ if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
{ return true }
- if (prevType === types.braceL)
- { return parent === types$1.b_stat }
- if (prevType === types._var || prevType === types._const || prevType === types.name)
+ if (prevType === types$1.braceL)
+ { return parent === types.b_stat }
+ if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
{ return false }
return !this.exprAllowed
};
-pp$3.inGeneratorContext = function() {
+pp$6.inGeneratorContext = function() {
for (var i = this.context.length - 1; i >= 1; i--) {
var context = this.context[i];
if (context.token === "function")
@@ -2224,9 +2232,9 @@ pp$3.inGeneratorContext = function() {
return false
};
-pp$3.updateContext = function(prevType) {
+pp$6.updateContext = function(prevType) {
var update, type = this.type;
- if (type.keyword && prevType === types.dot)
+ if (type.keyword && prevType === types$1.dot)
{ this.exprAllowed = false; }
else if (update = type.updateContext)
{ update.call(this, prevType); }
@@ -2235,7 +2243,7 @@ pp$3.updateContext = function(prevType) {
};
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
-pp$3.overrideContext = function(tokenCtx) {
+pp$6.overrideContext = function(tokenCtx) {
if (this.curContext() !== tokenCtx) {
this.context[this.context.length - 1] = tokenCtx;
}
@@ -2243,71 +2251,71 @@ pp$3.overrideContext = function(tokenCtx) {
// Token-specific context update code
-types.parenR.updateContext = types.braceR.updateContext = function() {
+types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
if (this.context.length === 1) {
this.exprAllowed = true;
return
}
var out = this.context.pop();
- if (out === types$1.b_stat && this.curContext().token === "function") {
+ if (out === types.b_stat && this.curContext().token === "function") {
out = this.context.pop();
}
this.exprAllowed = !out.isExpr;
};
-types.braceL.updateContext = function(prevType) {
- this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
+types$1.braceL.updateContext = function(prevType) {
+ this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
this.exprAllowed = true;
};
-types.dollarBraceL.updateContext = function() {
- this.context.push(types$1.b_tmpl);
+types$1.dollarBraceL.updateContext = function() {
+ this.context.push(types.b_tmpl);
this.exprAllowed = true;
};
-types.parenL.updateContext = function(prevType) {
- var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
- this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
+types$1.parenL.updateContext = function(prevType) {
+ var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
+ this.context.push(statementParens ? types.p_stat : types.p_expr);
this.exprAllowed = true;
};
-types.incDec.updateContext = function() {
+types$1.incDec.updateContext = function() {
// tokExprAllowed stays unchanged
};
-types._function.updateContext = types._class.updateContext = function(prevType) {
- if (prevType.beforeExpr && prevType !== types._else &&
- !(prevType === types.semi && this.curContext() !== types$1.p_stat) &&
- !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
- !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
- { this.context.push(types$1.f_expr); }
+types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
+ if (prevType.beforeExpr && prevType !== types$1._else &&
+ !(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
+ !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
+ !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
+ { this.context.push(types.f_expr); }
else
- { this.context.push(types$1.f_stat); }
+ { this.context.push(types.f_stat); }
this.exprAllowed = false;
};
-types.backQuote.updateContext = function() {
- if (this.curContext() === types$1.q_tmpl)
+types$1.backQuote.updateContext = function() {
+ if (this.curContext() === types.q_tmpl)
{ this.context.pop(); }
else
- { this.context.push(types$1.q_tmpl); }
+ { this.context.push(types.q_tmpl); }
this.exprAllowed = false;
};
-types.star.updateContext = function(prevType) {
- if (prevType === types._function) {
+types$1.star.updateContext = function(prevType) {
+ if (prevType === types$1._function) {
var index = this.context.length - 1;
- if (this.context[index] === types$1.f_expr)
- { this.context[index] = types$1.f_expr_gen; }
+ if (this.context[index] === types.f_expr)
+ { this.context[index] = types.f_expr_gen; }
else
- { this.context[index] = types$1.f_gen; }
+ { this.context[index] = types.f_gen; }
}
this.exprAllowed = true;
};
-types.name.updateContext = function(prevType) {
+types$1.name.updateContext = function(prevType) {
var allowed = false;
- if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
+ if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
if (this.value === "of" && !this.exprAllowed ||
this.value === "yield" && this.inGeneratorContext())
{ allowed = true; }
@@ -2317,14 +2325,14 @@ types.name.updateContext = function(prevType) {
// A recursive descent parser operates by defining functions for all
-var pp$4 = Parser.prototype;
+var pp$5 = Parser.prototype;
// Check if property name clashes with already added.
// Object/class getters and setters are not allowed to clash —
// either with each other or with an init property — and in
// strict mode, init properties are also not allowed to be repeated.
-pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
+pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
{ return }
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
@@ -2341,10 +2349,12 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
if (name === "__proto__" && kind === "init") {
if (propHash.proto) {
if (refDestructuringErrors) {
- if (refDestructuringErrors.doubleProto < 0)
- { refDestructuringErrors.doubleProto = key.start; }
- // Backwards-compat kludge. Can be removed in version 6.0
- } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); }
+ if (refDestructuringErrors.doubleProto < 0) {
+ refDestructuringErrors.doubleProto = key.start;
+ }
+ } else {
+ this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
+ }
}
propHash.proto = true;
}
@@ -2386,13 +2396,13 @@ pp$4.checkPropClash = function(prop, propHash, refDestructuringErrors) {
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
-pp$4.parseExpression = function(forInit, refDestructuringErrors) {
+pp$5.parseExpression = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
- if (this.type === types.comma) {
+ if (this.type === types$1.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
- while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
+ while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
return this.finishNode(node, "SequenceExpression")
}
return expr
@@ -2401,7 +2411,7 @@ pp$4.parseExpression = function(forInit, refDestructuringErrors) {
// Parse an assignment expression. This includes applications of
// operators like `+=`.
-pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
+pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
if (this.isContextual("yield")) {
if (this.inGenerator) { return this.parseYield(forInit) }
// The tokenizer will assume an expression is allowed after
@@ -2409,10 +2419,11 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
else { this.exprAllowed = false; }
}
- var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
+ var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
if (refDestructuringErrors) {
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
oldTrailingComma = refDestructuringErrors.trailingComma;
+ oldDoubleProto = refDestructuringErrors.doubleProto;
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
} else {
refDestructuringErrors = new DestructuringErrors;
@@ -2420,7 +2431,7 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
}
var startPos = this.start, startLoc = this.startLoc;
- if (this.type === types.parenL || this.type === types.name) {
+ if (this.type === types$1.parenL || this.type === types$1.name) {
this.potentialArrowAt = this.start;
this.potentialArrowInForAwait = forInit === "await";
}
@@ -2429,20 +2440,21 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
- if (this.type === types.eq)
+ if (this.type === types$1.eq)
{ left = this.toAssignable(left, false, refDestructuringErrors); }
if (!ownDestructuringErrors) {
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
}
if (refDestructuringErrors.shorthandAssign >= left.start)
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
- if (this.type === types.eq)
+ if (this.type === types$1.eq)
{ this.checkLValPattern(left); }
else
{ this.checkLValSimple(left); }
node.left = left;
this.next();
node.right = this.parseMaybeAssign(forInit);
+ if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
return this.finishNode(node, "AssignmentExpression")
} else {
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
@@ -2454,15 +2466,15 @@ pp$4.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
// Parse a ternary conditional (`?:`) operator.
-pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
+pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprOps(forInit, refDestructuringErrors);
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
- if (this.eat(types.question)) {
+ if (this.eat(types$1.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
- this.expect(types.colon);
+ this.expect(types$1.colon);
node.alternate = this.parseMaybeAssign(forInit);
return this.finishNode(node, "ConditionalExpression")
}
@@ -2471,7 +2483,7 @@ pp$4.parseMaybeConditional = function(forInit, refDestructuringErrors) {
// Start the precedence parser.
-pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
+pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
@@ -2484,23 +2496,23 @@ pp$4.parseExprOps = function(forInit, refDestructuringErrors) {
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
-pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
+pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
var prec = this.type.binop;
- if (prec != null && (!forInit || this.type !== types._in)) {
+ if (prec != null && (!forInit || this.type !== types$1._in)) {
if (prec > minPrec) {
- var logical = this.type === types.logicalOR || this.type === types.logicalAND;
- var coalesce = this.type === types.coalesce;
+ var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
+ var coalesce = this.type === types$1.coalesce;
if (coalesce) {
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
- prec = types.logicalAND.binop;
+ prec = types$1.logicalAND.binop;
}
var op = this.value;
this.next();
var startPos = this.start, startLoc = this.startLoc;
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
- if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
+ if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
}
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
@@ -2509,7 +2521,8 @@ pp$4.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
return left
};
-pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
+pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
+ if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.operator = op;
@@ -2519,13 +2532,13 @@ pp$4.buildBinary = function(startPos, startLoc, left, right, op, logical) {
// Parse unary operators, both prefix and postfix.
-pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
+pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
var startPos = this.start, startLoc = this.startLoc, expr;
if (this.isContextual("await") && this.canAwait) {
expr = this.parseAwait(forInit);
sawUnary = true;
} else if (this.type.prefix) {
- var node = this.startNode(), update = this.type === types.incDec;
+ var node = this.startNode(), update = this.type === types$1.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
@@ -2539,6 +2552,11 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
else { sawUnary = true; }
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
+ } else if (!sawUnary && this.type === types$1.privateId) {
+ if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
+ expr = this.parsePrivateIdent();
+ // only could be private fields in 'in', such as #x in obj
+ if (this.type !== types$1._in) { this.unexpected(); }
} else {
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
@@ -2553,7 +2571,7 @@ pp$4.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
}
}
- if (!incDec && this.eat(types.starstar)) {
+ if (!incDec && this.eat(types$1.starstar)) {
if (sawUnary)
{ this.unexpected(this.lastTokStart); }
else
@@ -2572,7 +2590,7 @@ function isPrivateFieldAccess(node) {
// Parse call, dot, and `[]`-subscript expressions.
-pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
+pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
@@ -2586,7 +2604,7 @@ pp$4.parseExprSubscripts = function(refDestructuringErrors, forInit) {
return result
};
-pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
+pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
this.potentialArrowAt === base.start;
@@ -2609,19 +2627,19 @@ pp$4.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
}
};
-pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
+pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
var optionalSupported = this.options.ecmaVersion >= 11;
- var optional = optionalSupported && this.eat(types.questionDot);
+ var optional = optionalSupported && this.eat(types$1.questionDot);
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
- var computed = this.eat(types.bracketL);
- if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
+ var computed = this.eat(types$1.bracketL);
+ if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
if (computed) {
node.property = this.parseExpression();
- this.expect(types.bracketR);
- } else if (this.type === types.privateId && base.type !== "Super") {
+ this.expect(types$1.bracketR);
+ } else if (this.type === types$1.privateId && base.type !== "Super") {
node.property = this.parsePrivateIdent();
} else {
node.property = this.parseIdent(this.options.allowReserved !== "never");
@@ -2631,13 +2649,13 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
node.optional = optional;
}
base = this.finishNode(node, "MemberExpression");
- } else if (!noCalls && this.eat(types.parenL)) {
+ } else if (!noCalls && this.eat(types$1.parenL)) {
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
- var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
- if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
+ var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
+ if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0)
@@ -2658,7 +2676,7 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
node$1.optional = optional;
}
base = this.finishNode(node$1, "CallExpression");
- } else if (this.type === types.backQuote) {
+ } else if (this.type === types$1.backQuote) {
if (optional || optionalChained) {
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
}
@@ -2675,19 +2693,19 @@ pp$4.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
-pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
+pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
// If a division operator appears in an expression position, the
// tokenizer got confused, and we force it to read a regexp instead.
- if (this.type === types.slash) { this.readRegexp(); }
+ if (this.type === types$1.slash) { this.readRegexp(); }
var node, canBeArrow = this.potentialArrowAt === this.start;
switch (this.type) {
- case types._super:
+ case types$1._super:
if (!this.allowSuper)
{ this.raise(this.start, "'super' keyword outside a method"); }
node = this.startNode();
this.next();
- if (this.type === types.parenL && !this.allowDirectSuper)
+ if (this.type === types$1.parenL && !this.allowDirectSuper)
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
// The `super` keyword can appear at below:
// SuperProperty:
@@ -2695,52 +2713,52 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
// super . IdentifierName
// SuperCall:
// super ( Arguments )
- if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
+ if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
{ this.unexpected(); }
return this.finishNode(node, "Super")
- case types._this:
+ case types$1._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression")
- case types.name:
+ case types$1.name:
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
var id = this.parseIdent(false);
- if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) {
- this.overrideContext(types$1.f_expr);
+ if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
+ this.overrideContext(types.f_expr);
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
}
if (canBeArrow && !this.canInsertSemicolon()) {
- if (this.eat(types.arrow))
+ if (this.eat(types$1.arrow))
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
- if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
+ if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
id = this.parseIdent(false);
- if (this.canInsertSemicolon() || !this.eat(types.arrow))
+ if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
{ this.unexpected(); }
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
}
}
return id
- case types.regexp:
+ case types$1.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = {pattern: value.pattern, flags: value.flags};
return node
- case types.num: case types.string:
+ case types$1.num: case types$1.string:
return this.parseLiteral(this.value)
- case types._null: case types._true: case types._false:
+ case types$1._null: case types$1._true: case types$1._false:
node = this.startNode();
- node.value = this.type === types._null ? null : this.type === types._true;
+ node.value = this.type === types$1._null ? null : this.type === types$1._true;
node.raw = this.type.keyword;
this.next();
return this.finishNode(node, "Literal")
- case types.parenL:
+ case types$1.parenL:
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
if (refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
@@ -2750,31 +2768,31 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
}
return expr
- case types.bracketL:
+ case types$1.bracketL:
node = this.startNode();
this.next();
- node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
+ node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
return this.finishNode(node, "ArrayExpression")
- case types.braceL:
- this.overrideContext(types$1.b_expr);
+ case types$1.braceL:
+ this.overrideContext(types.b_expr);
return this.parseObj(false, refDestructuringErrors)
- case types._function:
+ case types$1._function:
node = this.startNode();
this.next();
return this.parseFunction(node, 0)
- case types._class:
+ case types$1._class:
return this.parseClass(this.startNode(), false)
- case types._new:
+ case types$1._new:
return this.parseNew()
- case types.backQuote:
+ case types$1.backQuote:
return this.parseTemplate()
- case types._import:
+ case types$1._import:
if (this.options.ecmaVersion >= 11) {
return this.parseExprImport()
} else {
@@ -2786,7 +2804,7 @@ pp$4.parseExprAtom = function(refDestructuringErrors, forInit) {
}
};
-pp$4.parseExprImport = function() {
+pp$5.parseExprImport = function() {
var node = this.startNode();
// Consume `import` as an identifier for `import.meta`.
@@ -2795,9 +2813,9 @@ pp$4.parseExprImport = function() {
var meta = this.parseIdent(true);
switch (this.type) {
- case types.parenL:
+ case types$1.parenL:
return this.parseDynamicImport(node)
- case types.dot:
+ case types$1.dot:
node.meta = meta;
return this.parseImportMeta(node)
default:
@@ -2805,16 +2823,16 @@ pp$4.parseExprImport = function() {
}
};
-pp$4.parseDynamicImport = function(node) {
+pp$5.parseDynamicImport = function(node) {
this.next(); // skip `(`
// Parse node.source.
node.source = this.parseMaybeAssign();
// Verify ending.
- if (!this.eat(types.parenR)) {
+ if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
- if (this.eat(types.comma) && this.eat(types.parenR)) {
+ if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
} else {
this.unexpected(errorPos);
@@ -2824,7 +2842,7 @@ pp$4.parseDynamicImport = function(node) {
return this.finishNode(node, "ImportExpression")
};
-pp$4.parseImportMeta = function(node) {
+pp$5.parseImportMeta = function(node) {
this.next(); // skip `.`
var containsEsc = this.containsEsc;
@@ -2840,7 +2858,7 @@ pp$4.parseImportMeta = function(node) {
return this.finishNode(node, "MetaProperty")
};
-pp$4.parseLiteral = function(value) {
+pp$5.parseLiteral = function(value) {
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
@@ -2849,14 +2867,14 @@ pp$4.parseLiteral = function(value) {
return this.finishNode(node, "Literal")
};
-pp$4.parseParenExpression = function() {
- this.expect(types.parenL);
+pp$5.parseParenExpression = function() {
+ this.expect(types$1.parenL);
var val = this.parseExpression();
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
return val
};
-pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
+pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
if (this.options.ecmaVersion >= 6) {
this.next();
@@ -2867,24 +2885,24 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
this.yieldPos = 0;
this.awaitPos = 0;
// Do not save awaitIdentPos to allow checking awaits nested in parameters
- while (this.type !== types.parenR) {
- first ? first = false : this.expect(types.comma);
- if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
+ while (this.type !== types$1.parenR) {
+ first ? first = false : this.expect(types$1.comma);
+ if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
lastIsComma = true;
break
- } else if (this.type === types.ellipsis) {
+ } else if (this.type === types$1.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRestBinding()));
- if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
+ if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
break
} else {
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
}
}
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
- this.expect(types.parenR);
+ this.expect(types$1.parenR);
- if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
+ if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
this.yieldPos = oldYieldPos;
@@ -2918,12 +2936,12 @@ pp$4.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
}
};
-pp$4.parseParenItem = function(item) {
+pp$5.parseParenItem = function(item) {
return item
};
-pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, forInit)
+pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
};
// New's precedence is slightly tricky. It must allow its argument to
@@ -2932,13 +2950,13 @@ pp$4.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
// argument to parseSubscripts to prevent it from consuming the
// argument list.
-var empty$1 = [];
+var empty = [];
-pp$4.parseNew = function() {
+pp$5.parseNew = function() {
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
var node = this.startNode();
var meta = this.parseIdent(true);
- if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
+ if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
node.meta = meta;
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
@@ -2950,23 +2968,23 @@ pp$4.parseNew = function() {
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
return this.finishNode(node, "MetaProperty")
}
- var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
+ var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
if (isImport && node.callee.type === "ImportExpression") {
this.raise(startPos, "Cannot use new with import()");
}
- if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
- else { node.arguments = empty$1; }
+ if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
+ else { node.arguments = empty; }
return this.finishNode(node, "NewExpression")
};
// Parse template expression.
-pp$4.parseTemplateElement = function(ref) {
+pp$5.parseTemplateElement = function(ref) {
var isTagged = ref.isTagged;
var elem = this.startNode();
- if (this.type === types.invalidTemplate) {
+ if (this.type === types$1.invalidTemplate) {
if (!isTagged) {
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
}
@@ -2981,11 +2999,11 @@ pp$4.parseTemplateElement = function(ref) {
};
}
this.next();
- elem.tail = this.type === types.backQuote;
+ elem.tail = this.type === types$1.backQuote;
return this.finishNode(elem, "TemplateElement")
};
-pp$4.parseTemplate = function(ref) {
+pp$5.parseTemplate = function(ref) {
if ( ref === void 0 ) ref = {};
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
@@ -2995,32 +3013,32 @@ pp$4.parseTemplate = function(ref) {
var curElt = this.parseTemplateElement({isTagged: isTagged});
node.quasis = [curElt];
while (!curElt.tail) {
- if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
- this.expect(types.dollarBraceL);
+ if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
+ this.expect(types$1.dollarBraceL);
node.expressions.push(this.parseExpression());
- this.expect(types.braceR);
+ this.expect(types$1.braceR);
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
}
this.next();
return this.finishNode(node, "TemplateLiteral")
};
-pp$4.isAsyncProp = function(prop) {
+pp$5.isAsyncProp = function(prop) {
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
- (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)) &&
+ (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)) &&
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
};
// Parse an object literal or binding pattern.
-pp$4.parseObj = function(isPattern, refDestructuringErrors) {
+pp$5.parseObj = function(isPattern, refDestructuringErrors) {
var node = this.startNode(), first = true, propHash = {};
node.properties = [];
this.next();
- while (!this.eat(types.braceR)) {
+ while (!this.eat(types$1.braceR)) {
if (!first) {
- this.expect(types.comma);
- if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
+ this.expect(types$1.comma);
+ if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
} else { first = false; }
var prop = this.parseProperty(isPattern, refDestructuringErrors);
@@ -3030,18 +3048,18 @@ pp$4.parseObj = function(isPattern, refDestructuringErrors) {
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
};
-pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
+pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
- if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
+ if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
if (isPattern) {
prop.argument = this.parseIdent(false);
- if (this.type === types.comma) {
+ if (this.type === types$1.comma) {
this.raise(this.start, "Comma is not permitted after the rest element");
}
return this.finishNode(prop, "RestElement")
}
// To disallow parenthesized identifier via `this.toAssignable()`.
- if (this.type === types.parenL && refDestructuringErrors) {
+ if (this.type === types$1.parenL && refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0) {
refDestructuringErrors.parenthesizedAssign = this.start;
}
@@ -3052,7 +3070,7 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
// Parse argument.
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
// To disallow trailing comma via `this.toAssignable()`.
- if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
+ if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
// Finish
@@ -3066,13 +3084,13 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
startLoc = this.startLoc;
}
if (!isPattern)
- { isGenerator = this.eat(types.star); }
+ { isGenerator = this.eat(types$1.star); }
}
var containsEsc = this.containsEsc;
this.parsePropertyName(prop);
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
isAsync = true;
- isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
+ isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
this.parsePropertyName(prop, refDestructuringErrors);
} else {
isAsync = false;
@@ -3081,14 +3099,14 @@ pp$4.parseProperty = function(isPattern, refDestructuringErrors) {
return this.finishNode(prop, "Property")
};
-pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
- if ((isGenerator || isAsync) && this.type === types.colon)
+pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
+ if ((isGenerator || isAsync) && this.type === types$1.colon)
{ this.unexpected(); }
- if (this.eat(types.colon)) {
+ if (this.eat(types$1.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
prop.kind = "init";
- } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
+ } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
if (isPattern) { this.unexpected(); }
prop.kind = "init";
prop.method = true;
@@ -3096,7 +3114,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
} else if (!isPattern && !containsEsc &&
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
(prop.key.name === "get" || prop.key.name === "set") &&
- (this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
+ (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
if (isGenerator || isAsync) { this.unexpected(); }
prop.kind = prop.key.name;
this.parsePropertyName(prop);
@@ -3120,7 +3138,7 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
prop.kind = "init";
if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
- } else if (this.type === types.eq && refDestructuringErrors) {
+ } else if (this.type === types$1.eq && refDestructuringErrors) {
if (refDestructuringErrors.shorthandAssign < 0)
{ refDestructuringErrors.shorthandAssign = this.start; }
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
@@ -3131,23 +3149,23 @@ pp$4.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
} else { this.unexpected(); }
};
-pp$4.parsePropertyName = function(prop) {
+pp$5.parsePropertyName = function(prop) {
if (this.options.ecmaVersion >= 6) {
- if (this.eat(types.bracketL)) {
+ if (this.eat(types$1.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
- this.expect(types.bracketR);
+ this.expect(types$1.bracketR);
return prop.key
} else {
prop.computed = false;
}
}
- return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
+ return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
};
// Initialize empty function node.
-pp$4.initFunction = function(node) {
+pp$5.initFunction = function(node) {
node.id = null;
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
if (this.options.ecmaVersion >= 8) { node.async = false; }
@@ -3155,7 +3173,7 @@ pp$4.initFunction = function(node) {
// Parse object or class method.
-pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
+pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.initFunction(node);
@@ -3169,8 +3187,8 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
this.awaitIdentPos = 0;
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
- this.expect(types.parenL);
- node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
+ this.expect(types$1.parenL);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
this.parseFunctionBody(node, false, true, false);
@@ -3182,7 +3200,7 @@ pp$4.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
// Parse arrow function expression with given parameters.
-pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
+pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
@@ -3204,8 +3222,8 @@ pp$4.parseArrowExpression = function(node, params, isAsync, forInit) {
// Parse function body and check parameters.
-pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
- var isExpression = isArrowFunction && this.type !== types.braceL;
+pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
+ var isExpression = isArrowFunction && this.type !== types$1.braceL;
var oldStrict = this.strict, useStrict = false;
if (isExpression) {
@@ -3241,7 +3259,7 @@ pp$4.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
this.exitScope();
};
-pp$4.isSimpleParamList = function(params) {
+pp$5.isSimpleParamList = function(params) {
for (var i = 0, list = params; i < list.length; i += 1)
{
var param = list[i];
@@ -3254,7 +3272,7 @@ pp$4.isSimpleParamList = function(params) {
// Checks function params for various disallowed patterns such as using "eval"
// or "arguments" and duplicate parameters.
-pp$4.checkParams = function(node, allowDuplicates) {
+pp$5.checkParams = function(node, allowDuplicates) {
var nameHash = Object.create(null);
for (var i = 0, list = node.params; i < list.length; i += 1)
{
@@ -3270,20 +3288,20 @@ pp$4.checkParams = function(node, allowDuplicates) {
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
-pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
+pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
var elts = [], first = true;
while (!this.eat(close)) {
if (!first) {
- this.expect(types.comma);
+ this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
} else { first = false; }
var elt = (void 0);
- if (allowEmpty && this.type === types.comma)
+ if (allowEmpty && this.type === types$1.comma)
{ elt = null; }
- else if (this.type === types.ellipsis) {
+ else if (this.type === types$1.ellipsis) {
elt = this.parseSpread(refDestructuringErrors);
- if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
+ if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
{ refDestructuringErrors.trailingComma = this.start; }
} else {
elt = this.parseMaybeAssign(false, refDestructuringErrors);
@@ -3293,7 +3311,7 @@ pp$4.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
return elts
};
-pp$4.checkUnreserved = function(ref) {
+pp$5.checkUnreserved = function(ref) {
var start = ref.start;
var end = ref.end;
var name = ref.name;
@@ -3322,9 +3340,9 @@ pp$4.checkUnreserved = function(ref) {
// when parsing properties), it will also convert keywords into
// identifiers.
-pp$4.parseIdent = function(liberal, isBinding) {
+pp$5.parseIdent = function(liberal, isBinding) {
var node = this.startNode();
- if (this.type === types.name) {
+ if (this.type === types$1.name) {
node.name = this.value;
} else if (this.type.keyword) {
node.name = this.type.keyword;
@@ -3350,9 +3368,9 @@ pp$4.parseIdent = function(liberal, isBinding) {
return node
};
-pp$4.parsePrivateIdent = function() {
+pp$5.parsePrivateIdent = function() {
var node = this.startNode();
- if (this.type === types.privateId) {
+ if (this.type === types$1.privateId) {
node.name = this.value;
} else {
this.unexpected();
@@ -3372,22 +3390,22 @@ pp$4.parsePrivateIdent = function() {
// Parses yield expression inside generator.
-pp$4.parseYield = function(forInit) {
+pp$5.parseYield = function(forInit) {
if (!this.yieldPos) { this.yieldPos = this.start; }
var node = this.startNode();
this.next();
- if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
+ if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
node.delegate = false;
node.argument = null;
} else {
- node.delegate = this.eat(types.star);
+ node.delegate = this.eat(types$1.star);
node.argument = this.parseMaybeAssign(forInit);
}
return this.finishNode(node, "YieldExpression")
};
-pp$4.parseAwait = function(forInit) {
+pp$5.parseAwait = function(forInit) {
if (!this.awaitPos) { this.awaitPos = this.start; }
var node = this.startNode();
@@ -3396,7 +3414,7 @@ pp$4.parseAwait = function(forInit) {
return this.finishNode(node, "AwaitExpression")
};
-var pp$5 = Parser.prototype;
+var pp$4 = Parser.prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
@@ -3404,7 +3422,7 @@ var pp$5 = Parser.prototype;
// of the error message, and then raises a `SyntaxError` with that
// message.
-pp$5.raise = function(pos, message) {
+pp$4.raise = function(pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
@@ -3412,15 +3430,15 @@ pp$5.raise = function(pos, message) {
throw err
};
-pp$5.raiseRecoverable = pp$5.raise;
+pp$4.raiseRecoverable = pp$4.raise;
-pp$5.curPosition = function() {
+pp$4.curPosition = function() {
if (this.options.locations) {
return new Position(this.curLine, this.pos - this.lineStart)
}
};
-var pp$6 = Parser.prototype;
+var pp$3 = Parser.prototype;
var Scope = function Scope(flags) {
this.flags = flags;
@@ -3436,22 +3454,22 @@ var Scope = function Scope(flags) {
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
-pp$6.enterScope = function(flags) {
+pp$3.enterScope = function(flags) {
this.scopeStack.push(new Scope(flags));
};
-pp$6.exitScope = function() {
+pp$3.exitScope = function() {
this.scopeStack.pop();
};
// The spec says:
// > At the top level of a function, or script, function declarations are
// > treated like var declarations rather than like lexical declarations.
-pp$6.treatFunctionsAsVarInScope = function(scope) {
+pp$3.treatFunctionsAsVarInScope = function(scope) {
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
};
-pp$6.declareName = function(name, bindingType, pos) {
+pp$3.declareName = function(name, bindingType, pos) {
var redeclared = false;
if (bindingType === BIND_LEXICAL) {
var scope = this.currentScope();
@@ -3486,7 +3504,7 @@ pp$6.declareName = function(name, bindingType, pos) {
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
};
-pp$6.checkLocalExport = function(id) {
+pp$3.checkLocalExport = function(id) {
// scope.functions must be empty as Module code is always strict.
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
this.scopeStack[0].var.indexOf(id.name) === -1) {
@@ -3494,11 +3512,11 @@ pp$6.checkLocalExport = function(id) {
}
};
-pp$6.currentScope = function() {
+pp$3.currentScope = function() {
return this.scopeStack[this.scopeStack.length - 1]
};
-pp$6.currentVarScope = function() {
+pp$3.currentVarScope = function() {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR) { return scope }
@@ -3506,7 +3524,7 @@ pp$6.currentVarScope = function() {
};
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
-pp$6.currentThisScope = function() {
+pp$3.currentThisScope = function() {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
@@ -3527,13 +3545,13 @@ var Node = function Node(parser, pos, loc) {
// Start an AST node, attaching a start offset.
-var pp$7 = Parser.prototype;
+var pp$2 = Parser.prototype;
-pp$7.startNode = function() {
+pp$2.startNode = function() {
return new Node(this, this.start, this.startLoc)
};
-pp$7.startNodeAt = function(pos, loc) {
+pp$2.startNodeAt = function(pos, loc) {
return new Node(this, pos, loc)
};
@@ -3549,17 +3567,17 @@ function finishNodeAt(node, type, pos, loc) {
return node
}
-pp$7.finishNode = function(node, type) {
+pp$2.finishNode = function(node, type) {
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
};
// Finish node at given position
-pp$7.finishNodeAt = function(node, type, pos, loc) {
+pp$2.finishNodeAt = function(node, type, pos, loc) {
return finishNodeAt.call(this, node, type, pos, loc)
};
-pp$7.copyNode = function(node) {
+pp$2.copyNode = function(node) {
var newNode = new Node(this, node.start, this.startLoc);
for (var prop in node) { newNode[prop] = node[prop]; }
return newNode
@@ -3616,7 +3634,7 @@ buildUnicodeData(10);
buildUnicodeData(11);
buildUnicodeData(12);
-var pp$8 = Parser.prototype;
+var pp$1 = Parser.prototype;
var RegExpValidationState = function RegExpValidationState(parser) {
this.parser = parser;
@@ -3712,7 +3730,7 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
return false
};
-function codePointToString(ch) {
+function codePointToString$1(ch) {
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
ch -= 0x10000;
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
@@ -3724,7 +3742,7 @@ function codePointToString(ch) {
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
-pp$8.validateRegExpFlags = function(state) {
+pp$1.validateRegExpFlags = function(state) {
var validFlags = state.validFlags;
var flags = state.flags;
@@ -3745,7 +3763,7 @@ pp$8.validateRegExpFlags = function(state) {
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
-pp$8.validateRegExpPattern = function(state) {
+pp$1.validateRegExpPattern = function(state) {
this.regexp_pattern(state);
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
@@ -3760,7 +3778,7 @@ pp$8.validateRegExpPattern = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
-pp$8.regexp_pattern = function(state) {
+pp$1.regexp_pattern = function(state) {
state.pos = 0;
state.lastIntValue = 0;
state.lastStringValue = "";
@@ -3794,7 +3812,7 @@ pp$8.regexp_pattern = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
-pp$8.regexp_disjunction = function(state) {
+pp$1.regexp_disjunction = function(state) {
this.regexp_alternative(state);
while (state.eat(0x7C /* | */)) {
this.regexp_alternative(state);
@@ -3810,13 +3828,13 @@ pp$8.regexp_disjunction = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
-pp$8.regexp_alternative = function(state) {
+pp$1.regexp_alternative = function(state) {
while (state.pos < state.source.length && this.regexp_eatTerm(state))
{ }
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
-pp$8.regexp_eatTerm = function(state) {
+pp$1.regexp_eatTerm = function(state) {
if (this.regexp_eatAssertion(state)) {
// Handle `QuantifiableAssertion Quantifier` alternative.
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
@@ -3839,7 +3857,7 @@ pp$8.regexp_eatTerm = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
-pp$8.regexp_eatAssertion = function(state) {
+pp$1.regexp_eatAssertion = function(state) {
var start = state.pos;
state.lastAssertionIsQuantifiable = false;
@@ -3877,7 +3895,7 @@ pp$8.regexp_eatAssertion = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
-pp$8.regexp_eatQuantifier = function(state, noError) {
+pp$1.regexp_eatQuantifier = function(state, noError) {
if ( noError === void 0 ) noError = false;
if (this.regexp_eatQuantifierPrefix(state, noError)) {
@@ -3888,7 +3906,7 @@ pp$8.regexp_eatQuantifier = function(state, noError) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
-pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
+pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
return (
state.eat(0x2A /* * */) ||
state.eat(0x2B /* + */) ||
@@ -3896,7 +3914,7 @@ pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
this.regexp_eatBracedQuantifier(state, noError)
)
};
-pp$8.regexp_eatBracedQuantifier = function(state, noError) {
+pp$1.regexp_eatBracedQuantifier = function(state, noError) {
var start = state.pos;
if (state.eat(0x7B /* { */)) {
var min = 0, max = -1;
@@ -3922,7 +3940,7 @@ pp$8.regexp_eatBracedQuantifier = function(state, noError) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
-pp$8.regexp_eatAtom = function(state) {
+pp$1.regexp_eatAtom = function(state) {
return (
this.regexp_eatPatternCharacters(state) ||
state.eat(0x2E /* . */) ||
@@ -3932,7 +3950,7 @@ pp$8.regexp_eatAtom = function(state) {
this.regexp_eatCapturingGroup(state)
)
};
-pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
+pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatAtomEscape(state)) {
@@ -3942,7 +3960,7 @@ pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
}
return false
};
-pp$8.regexp_eatUncapturingGroup = function(state) {
+pp$1.regexp_eatUncapturingGroup = function(state) {
var start = state.pos;
if (state.eat(0x28 /* ( */)) {
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
@@ -3956,7 +3974,7 @@ pp$8.regexp_eatUncapturingGroup = function(state) {
}
return false
};
-pp$8.regexp_eatCapturingGroup = function(state) {
+pp$1.regexp_eatCapturingGroup = function(state) {
if (state.eat(0x28 /* ( */)) {
if (this.options.ecmaVersion >= 9) {
this.regexp_groupSpecifier(state);
@@ -3974,7 +3992,7 @@ pp$8.regexp_eatCapturingGroup = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
-pp$8.regexp_eatExtendedAtom = function(state) {
+pp$1.regexp_eatExtendedAtom = function(state) {
return (
state.eat(0x2E /* . */) ||
this.regexp_eatReverseSolidusAtomEscape(state) ||
@@ -3987,7 +4005,7 @@ pp$8.regexp_eatExtendedAtom = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
-pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
+pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
if (this.regexp_eatBracedQuantifier(state, true)) {
state.raise("Nothing to repeat");
}
@@ -3995,7 +4013,7 @@ pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
-pp$8.regexp_eatSyntaxCharacter = function(state) {
+pp$1.regexp_eatSyntaxCharacter = function(state) {
var ch = state.current();
if (isSyntaxCharacter(ch)) {
state.lastIntValue = ch;
@@ -4017,7 +4035,7 @@ function isSyntaxCharacter(ch) {
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
// But eat eager.
-pp$8.regexp_eatPatternCharacters = function(state) {
+pp$1.regexp_eatPatternCharacters = function(state) {
var start = state.pos;
var ch = 0;
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
@@ -4027,7 +4045,7 @@ pp$8.regexp_eatPatternCharacters = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
-pp$8.regexp_eatExtendedPatternCharacter = function(state) {
+pp$1.regexp_eatExtendedPatternCharacter = function(state) {
var ch = state.current();
if (
ch !== -1 &&
@@ -4048,7 +4066,7 @@ pp$8.regexp_eatExtendedPatternCharacter = function(state) {
// GroupSpecifier ::
// [empty]
// `?` GroupName
-pp$8.regexp_groupSpecifier = function(state) {
+pp$1.regexp_groupSpecifier = function(state) {
if (state.eat(0x3F /* ? */)) {
if (this.regexp_eatGroupName(state)) {
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
@@ -4064,7 +4082,7 @@ pp$8.regexp_groupSpecifier = function(state) {
// GroupName ::
// `<` RegExpIdentifierName `>`
// Note: this updates `state.lastStringValue` property with the eaten name.
-pp$8.regexp_eatGroupName = function(state) {
+pp$1.regexp_eatGroupName = function(state) {
state.lastStringValue = "";
if (state.eat(0x3C /* < */)) {
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
@@ -4079,12 +4097,12 @@ pp$8.regexp_eatGroupName = function(state) {
// RegExpIdentifierStart
// RegExpIdentifierName RegExpIdentifierPart
// Note: this updates `state.lastStringValue` property with the eaten name.
-pp$8.regexp_eatRegExpIdentifierName = function(state) {
+pp$1.regexp_eatRegExpIdentifierName = function(state) {
state.lastStringValue = "";
if (this.regexp_eatRegExpIdentifierStart(state)) {
- state.lastStringValue += codePointToString(state.lastIntValue);
+ state.lastStringValue += codePointToString$1(state.lastIntValue);
while (this.regexp_eatRegExpIdentifierPart(state)) {
- state.lastStringValue += codePointToString(state.lastIntValue);
+ state.lastStringValue += codePointToString$1(state.lastIntValue);
}
return true
}
@@ -4096,7 +4114,7 @@ pp$8.regexp_eatRegExpIdentifierName = function(state) {
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[+U]
-pp$8.regexp_eatRegExpIdentifierStart = function(state) {
+pp$1.regexp_eatRegExpIdentifierStart = function(state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
@@ -4124,7 +4142,7 @@ function isRegExpIdentifierStart(ch) {
// `\` RegExpUnicodeEscapeSequence[+U]
//
//
-pp$8.regexp_eatRegExpIdentifierPart = function(state) {
+pp$1.regexp_eatRegExpIdentifierPart = function(state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
@@ -4146,7 +4164,7 @@ function isRegExpIdentifierPart(ch) {
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
-pp$8.regexp_eatAtomEscape = function(state) {
+pp$1.regexp_eatAtomEscape = function(state) {
if (
this.regexp_eatBackReference(state) ||
this.regexp_eatCharacterClassEscape(state) ||
@@ -4164,7 +4182,7 @@ pp$8.regexp_eatAtomEscape = function(state) {
}
return false
};
-pp$8.regexp_eatBackReference = function(state) {
+pp$1.regexp_eatBackReference = function(state) {
var start = state.pos;
if (this.regexp_eatDecimalEscape(state)) {
var n = state.lastIntValue;
@@ -4182,7 +4200,7 @@ pp$8.regexp_eatBackReference = function(state) {
}
return false
};
-pp$8.regexp_eatKGroupName = function(state) {
+pp$1.regexp_eatKGroupName = function(state) {
if (state.eat(0x6B /* k */)) {
if (this.regexp_eatGroupName(state)) {
state.backReferenceNames.push(state.lastStringValue);
@@ -4194,7 +4212,7 @@ pp$8.regexp_eatKGroupName = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
-pp$8.regexp_eatCharacterEscape = function(state) {
+pp$1.regexp_eatCharacterEscape = function(state) {
return (
this.regexp_eatControlEscape(state) ||
this.regexp_eatCControlLetter(state) ||
@@ -4205,7 +4223,7 @@ pp$8.regexp_eatCharacterEscape = function(state) {
this.regexp_eatIdentityEscape(state)
)
};
-pp$8.regexp_eatCControlLetter = function(state) {
+pp$1.regexp_eatCControlLetter = function(state) {
var start = state.pos;
if (state.eat(0x63 /* c */)) {
if (this.regexp_eatControlLetter(state)) {
@@ -4215,7 +4233,7 @@ pp$8.regexp_eatCControlLetter = function(state) {
}
return false
};
-pp$8.regexp_eatZero = function(state) {
+pp$1.regexp_eatZero = function(state) {
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
state.lastIntValue = 0;
state.advance();
@@ -4225,7 +4243,7 @@ pp$8.regexp_eatZero = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
-pp$8.regexp_eatControlEscape = function(state) {
+pp$1.regexp_eatControlEscape = function(state) {
var ch = state.current();
if (ch === 0x74 /* t */) {
state.lastIntValue = 0x09; /* \t */
@@ -4256,7 +4274,7 @@ pp$8.regexp_eatControlEscape = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
-pp$8.regexp_eatControlLetter = function(state) {
+pp$1.regexp_eatControlLetter = function(state) {
var ch = state.current();
if (isControlLetter(ch)) {
state.lastIntValue = ch % 0x20;
@@ -4273,7 +4291,7 @@ function isControlLetter(ch) {
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
-pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
+pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
if ( forceU === void 0 ) forceU = false;
var start = state.pos;
@@ -4318,7 +4336,7 @@ function isValidUnicode(ch) {
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
-pp$8.regexp_eatIdentityEscape = function(state) {
+pp$1.regexp_eatIdentityEscape = function(state) {
if (state.switchU) {
if (this.regexp_eatSyntaxCharacter(state)) {
return true
@@ -4341,7 +4359,7 @@ pp$8.regexp_eatIdentityEscape = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
-pp$8.regexp_eatDecimalEscape = function(state) {
+pp$1.regexp_eatDecimalEscape = function(state) {
state.lastIntValue = 0;
var ch = state.current();
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
@@ -4355,7 +4373,7 @@ pp$8.regexp_eatDecimalEscape = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
-pp$8.regexp_eatCharacterClassEscape = function(state) {
+pp$1.regexp_eatCharacterClassEscape = function(state) {
var ch = state.current();
if (isCharacterClassEscape(ch)) {
@@ -4397,7 +4415,7 @@ function isCharacterClassEscape(ch) {
// UnicodePropertyValueExpression ::
// UnicodePropertyName `=` UnicodePropertyValue
// LoneUnicodePropertyNameOrValue
-pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
+pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
var start = state.pos;
// UnicodePropertyName `=` UnicodePropertyValue
@@ -4419,24 +4437,24 @@ pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
}
return false
};
-pp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
+pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
if (!has(state.unicodeProperties.nonBinary, name))
{ state.raise("Invalid property name"); }
if (!state.unicodeProperties.nonBinary[name].test(value))
{ state.raise("Invalid property value"); }
};
-pp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
+pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
if (!state.unicodeProperties.binary.test(nameOrValue))
{ state.raise("Invalid property name"); }
};
// UnicodePropertyName ::
// UnicodePropertyNameCharacters
-pp$8.regexp_eatUnicodePropertyName = function(state) {
+pp$1.regexp_eatUnicodePropertyName = function(state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyNameCharacter(ch = state.current())) {
- state.lastStringValue += codePointToString(ch);
+ state.lastStringValue += codePointToString$1(ch);
state.advance();
}
return state.lastStringValue !== ""
@@ -4447,11 +4465,11 @@ function isUnicodePropertyNameCharacter(ch) {
// UnicodePropertyValue ::
// UnicodePropertyValueCharacters
-pp$8.regexp_eatUnicodePropertyValue = function(state) {
+pp$1.regexp_eatUnicodePropertyValue = function(state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyValueCharacter(ch = state.current())) {
- state.lastStringValue += codePointToString(ch);
+ state.lastStringValue += codePointToString$1(ch);
state.advance();
}
return state.lastStringValue !== ""
@@ -4462,12 +4480,12 @@ function isUnicodePropertyValueCharacter(ch) {
// LoneUnicodePropertyNameOrValue ::
// UnicodePropertyValueCharacters
-pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
+pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
return this.regexp_eatUnicodePropertyValue(state)
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
-pp$8.regexp_eatCharacterClass = function(state) {
+pp$1.regexp_eatCharacterClass = function(state) {
if (state.eat(0x5B /* [ */)) {
state.eat(0x5E /* ^ */);
this.regexp_classRanges(state);
@@ -4483,7 +4501,7 @@ pp$8.regexp_eatCharacterClass = function(state) {
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
-pp$8.regexp_classRanges = function(state) {
+pp$1.regexp_classRanges = function(state) {
while (this.regexp_eatClassAtom(state)) {
var left = state.lastIntValue;
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
@@ -4500,7 +4518,7 @@ pp$8.regexp_classRanges = function(state) {
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
-pp$8.regexp_eatClassAtom = function(state) {
+pp$1.regexp_eatClassAtom = function(state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
@@ -4529,7 +4547,7 @@ pp$8.regexp_eatClassAtom = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
-pp$8.regexp_eatClassEscape = function(state) {
+pp$1.regexp_eatClassEscape = function(state) {
var start = state.pos;
if (state.eat(0x62 /* b */)) {
@@ -4556,7 +4574,7 @@ pp$8.regexp_eatClassEscape = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
-pp$8.regexp_eatClassControlLetter = function(state) {
+pp$1.regexp_eatClassControlLetter = function(state) {
var ch = state.current();
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
state.lastIntValue = ch % 0x20;
@@ -4567,7 +4585,7 @@ pp$8.regexp_eatClassControlLetter = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
-pp$8.regexp_eatHexEscapeSequence = function(state) {
+pp$1.regexp_eatHexEscapeSequence = function(state) {
var start = state.pos;
if (state.eat(0x78 /* x */)) {
if (this.regexp_eatFixedHexDigits(state, 2)) {
@@ -4582,7 +4600,7 @@ pp$8.regexp_eatHexEscapeSequence = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
-pp$8.regexp_eatDecimalDigits = function(state) {
+pp$1.regexp_eatDecimalDigits = function(state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
@@ -4597,7 +4615,7 @@ function isDecimalDigit(ch) {
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
-pp$8.regexp_eatHexDigits = function(state) {
+pp$1.regexp_eatHexDigits = function(state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
@@ -4626,7 +4644,7 @@ function hexToInt(ch) {
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
// Allows only 0-377(octal) i.e. 0-255(decimal).
-pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
+pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
if (this.regexp_eatOctalDigit(state)) {
var n1 = state.lastIntValue;
if (this.regexp_eatOctalDigit(state)) {
@@ -4645,7 +4663,7 @@ pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
-pp$8.regexp_eatOctalDigit = function(state) {
+pp$1.regexp_eatOctalDigit = function(state) {
var ch = state.current();
if (isOctalDigit(ch)) {
state.lastIntValue = ch - 0x30; /* 0 */
@@ -4662,7 +4680,7 @@ function isOctalDigit(ch) {
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
-pp$8.regexp_eatFixedHexDigits = function(state, length) {
+pp$1.regexp_eatFixedHexDigits = function(state, length) {
var start = state.pos;
state.lastIntValue = 0;
for (var i = 0; i < length; ++i) {
@@ -4694,11 +4712,11 @@ var Token = function Token(p) {
// ## Tokenizer
-var pp$9 = Parser.prototype;
+var pp = Parser.prototype;
// Move to the next token
-pp$9.next = function(ignoreEscapeSequenceInKeyword) {
+pp.next = function(ignoreEscapeSequenceInKeyword) {
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
if (this.options.onToken)
@@ -4711,21 +4729,21 @@ pp$9.next = function(ignoreEscapeSequenceInKeyword) {
this.nextToken();
};
-pp$9.getToken = function() {
+pp.getToken = function() {
this.next();
return new Token(this)
};
// If we're in an ES6 environment, make parsers iterable
if (typeof Symbol !== "undefined")
- { pp$9[Symbol.iterator] = function() {
- var this$1 = this;
+ { pp[Symbol.iterator] = function() {
+ var this$1$1 = this;
return {
next: function () {
- var token = this$1.getToken();
+ var token = this$1$1.getToken();
return {
- done: token.type === types.eof,
+ done: token.type === types$1.eof,
value: token
}
}
@@ -4738,19 +4756,19 @@ if (typeof Symbol !== "undefined")
// Read a single token, updating the parser object's token-related
// properties.
-pp$9.nextToken = function() {
+pp.nextToken = function() {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
this.start = this.pos;
if (this.options.locations) { this.startLoc = this.curPosition(); }
- if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
+ if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
if (curContext.override) { return curContext.override(this) }
else { this.readToken(this.fullCharCodeAtPos()); }
};
-pp$9.readToken = function(code) {
+pp.readToken = function(code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
@@ -4759,14 +4777,14 @@ pp$9.readToken = function(code) {
return this.getTokenFromCode(code)
};
-pp$9.fullCharCodeAtPos = function() {
+pp.fullCharCodeAtPos = function() {
var code = this.input.charCodeAt(this.pos);
if (code <= 0xd7ff || code >= 0xdc00) { return code }
var next = this.input.charCodeAt(this.pos + 1);
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
};
-pp$9.skipBlockComment = function() {
+pp.skipBlockComment = function() {
var startLoc = this.options.onComment && this.curPosition();
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
@@ -4784,7 +4802,7 @@ pp$9.skipBlockComment = function() {
startLoc, this.curPosition()); }
};
-pp$9.skipLineComment = function(startSkip) {
+pp.skipLineComment = function(startSkip) {
var start = this.pos;
var startLoc = this.options.onComment && this.curPosition();
var ch = this.input.charCodeAt(this.pos += startSkip);
@@ -4799,7 +4817,7 @@ pp$9.skipLineComment = function(startSkip) {
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
-pp$9.skipSpace = function() {
+pp.skipSpace = function() {
loop: while (this.pos < this.input.length) {
var ch = this.input.charCodeAt(this.pos);
switch (ch) {
@@ -4844,7 +4862,7 @@ pp$9.skipSpace = function() {
// the token, so that the next one's `start` will point at the
// right position.
-pp$9.finishToken = function(type, val) {
+pp.finishToken = function(type, val) {
this.end = this.pos;
if (this.options.locations) { this.endLoc = this.curPosition(); }
var prevType = this.type;
@@ -4863,62 +4881,62 @@ pp$9.finishToken = function(type, val) {
//
// All in the name of speed.
//
-pp$9.readToken_dot = function() {
+pp.readToken_dot = function() {
var next = this.input.charCodeAt(this.pos + 1);
if (next >= 48 && next <= 57) { return this.readNumber(true) }
var next2 = this.input.charCodeAt(this.pos + 2);
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
this.pos += 3;
- return this.finishToken(types.ellipsis)
+ return this.finishToken(types$1.ellipsis)
} else {
++this.pos;
- return this.finishToken(types.dot)
+ return this.finishToken(types$1.dot)
}
};
-pp$9.readToken_slash = function() { // '/'
+pp.readToken_slash = function() { // '/'
var next = this.input.charCodeAt(this.pos + 1);
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.slash, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.slash, 1)
};
-pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
+pp.readToken_mult_modulo_exp = function(code) { // '%*'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
- var tokentype = code === 42 ? types.star : types.modulo;
+ var tokentype = code === 42 ? types$1.star : types$1.modulo;
// exponentiation operator ** and **=
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
++size;
- tokentype = types.starstar;
+ tokentype = types$1.starstar;
next = this.input.charCodeAt(this.pos + 2);
}
- if (next === 61) { return this.finishOp(types.assign, size + 1) }
+ if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
return this.finishOp(tokentype, size)
};
-pp$9.readToken_pipe_amp = function(code) { // '|&'
+pp.readToken_pipe_amp = function(code) { // '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
- if (next2 === 61) { return this.finishOp(types.assign, 3) }
+ if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
}
- return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
+ return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
}
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
};
-pp$9.readToken_caret = function() { // '^'
+pp.readToken_caret = function() { // '^'
var next = this.input.charCodeAt(this.pos + 1);
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.bitwiseXOR, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.bitwiseXOR, 1)
};
-pp$9.readToken_plus_min = function(code) { // '+-'
+pp.readToken_plus_min = function(code) { // '+-'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
@@ -4928,19 +4946,19 @@ pp$9.readToken_plus_min = function(code) { // '+-'
this.skipSpace();
return this.nextToken()
}
- return this.finishOp(types.incDec, 2)
+ return this.finishOp(types$1.incDec, 2)
}
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.plusMin, 1)
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.plusMin, 1)
};
-pp$9.readToken_lt_gt = function(code) { // '<>'
+pp.readToken_lt_gt = function(code) { // '<>'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
- if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
- return this.finishOp(types.bitShift, size)
+ if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
+ return this.finishOp(types$1.bitShift, size)
}
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
this.input.charCodeAt(this.pos + 3) === 45) {
@@ -4950,53 +4968,53 @@ pp$9.readToken_lt_gt = function(code) { // '<>'
return this.nextToken()
}
if (next === 61) { size = 2; }
- return this.finishOp(types.relational, size)
+ return this.finishOp(types$1.relational, size)
};
-pp$9.readToken_eq_excl = function(code) { // '=!'
+pp.readToken_eq_excl = function(code) { // '=!'
var next = this.input.charCodeAt(this.pos + 1);
- if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
+ if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
this.pos += 2;
- return this.finishToken(types.arrow)
+ return this.finishToken(types$1.arrow)
}
- return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
+ return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
};
-pp$9.readToken_question = function() { // '?'
+pp.readToken_question = function() { // '?'
var ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
var next2 = this.input.charCodeAt(this.pos + 2);
- if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
+ if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
}
if (next === 63) {
if (ecmaVersion >= 12) {
var next2$1 = this.input.charCodeAt(this.pos + 2);
- if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
+ if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
}
- return this.finishOp(types.coalesce, 2)
+ return this.finishOp(types$1.coalesce, 2)
}
}
- return this.finishOp(types.question, 1)
+ return this.finishOp(types$1.question, 1)
};
-pp$9.readToken_numberSign = function() { // '#'
+pp.readToken_numberSign = function() { // '#'
var ecmaVersion = this.options.ecmaVersion;
var code = 35; // '#'
if (ecmaVersion >= 13) {
++this.pos;
code = this.fullCharCodeAtPos();
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
- return this.finishToken(types.privateId, this.readWord1())
+ return this.finishToken(types$1.privateId, this.readWord1())
}
}
- this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
+ this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
-pp$9.getTokenFromCode = function(code) {
+pp.getTokenFromCode = function(code) {
switch (code) {
// The interpretation of a dot depends on whether it is followed
// by a digit or another two dots.
@@ -5004,20 +5022,20 @@ pp$9.getTokenFromCode = function(code) {
return this.readToken_dot()
// Punctuation tokens.
- case 40: ++this.pos; return this.finishToken(types.parenL)
- case 41: ++this.pos; return this.finishToken(types.parenR)
- case 59: ++this.pos; return this.finishToken(types.semi)
- case 44: ++this.pos; return this.finishToken(types.comma)
- case 91: ++this.pos; return this.finishToken(types.bracketL)
- case 93: ++this.pos; return this.finishToken(types.bracketR)
- case 123: ++this.pos; return this.finishToken(types.braceL)
- case 125: ++this.pos; return this.finishToken(types.braceR)
- case 58: ++this.pos; return this.finishToken(types.colon)
+ case 40: ++this.pos; return this.finishToken(types$1.parenL)
+ case 41: ++this.pos; return this.finishToken(types$1.parenR)
+ case 59: ++this.pos; return this.finishToken(types$1.semi)
+ case 44: ++this.pos; return this.finishToken(types$1.comma)
+ case 91: ++this.pos; return this.finishToken(types$1.bracketL)
+ case 93: ++this.pos; return this.finishToken(types$1.bracketR)
+ case 123: ++this.pos; return this.finishToken(types$1.braceL)
+ case 125: ++this.pos; return this.finishToken(types$1.braceR)
+ case 58: ++this.pos; return this.finishToken(types$1.colon)
case 96: // '`'
if (this.options.ecmaVersion < 6) { break }
++this.pos;
- return this.finishToken(types.backQuote)
+ return this.finishToken(types$1.backQuote)
case 48: // '0'
var next = this.input.charCodeAt(this.pos + 1);
@@ -5040,7 +5058,6 @@ pp$9.getTokenFromCode = function(code) {
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
-
case 47: // '/'
return this.readToken_slash()
@@ -5066,22 +5083,22 @@ pp$9.getTokenFromCode = function(code) {
return this.readToken_question()
case 126: // '~'
- return this.finishOp(types.prefix, 1)
+ return this.finishOp(types$1.prefix, 1)
case 35: // '#'
return this.readToken_numberSign()
}
- this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
+ this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
-pp$9.finishOp = function(type, size) {
+pp.finishOp = function(type, size) {
var str = this.input.slice(this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str)
};
-pp$9.readRegexp = function() {
+pp.readRegexp = function() {
var escaped, inClass, start = this.pos;
for (;;) {
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
@@ -5116,14 +5133,14 @@ pp$9.readRegexp = function() {
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
}
- return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
+ return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
-pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
+pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
// `len` is used for character escape sequences. In that case, disallow separators.
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
@@ -5177,7 +5194,7 @@ function stringToBigInt(str) {
return BigInt(str.replace(/_/g, ""))
}
-pp$9.readRadixNumber = function(radix) {
+pp.readRadixNumber = function(radix) {
var start = this.pos;
this.pos += 2; // 0x
var val = this.readInt(radix);
@@ -5186,12 +5203,12 @@ pp$9.readRadixNumber = function(radix) {
val = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
- return this.finishToken(types.num, val)
+ return this.finishToken(types$1.num, val)
};
// Read an integer, octal integer, or floating-point number.
-pp$9.readNumber = function(startsWithDot) {
+pp.readNumber = function(startsWithDot) {
var start = this.pos;
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
@@ -5201,7 +5218,7 @@ pp$9.readNumber = function(startsWithDot) {
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
- return this.finishToken(types.num, val$1)
+ return this.finishToken(types$1.num, val$1)
}
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
if (next === 46 && !octal) { // '.'
@@ -5217,12 +5234,12 @@ pp$9.readNumber = function(startsWithDot) {
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
var val = stringToNumber(this.input.slice(start, this.pos), octal);
- return this.finishToken(types.num, val)
+ return this.finishToken(types$1.num, val)
};
// Read a string value, interpreting backslash-escapes.
-pp$9.readCodePoint = function() {
+pp.readCodePoint = function() {
var ch = this.input.charCodeAt(this.pos), code;
if (ch === 123) { // '{'
@@ -5237,14 +5254,14 @@ pp$9.readCodePoint = function() {
return code
};
-function codePointToString$1(code) {
+function codePointToString(code) {
// UTF-16 Decoding
if (code <= 0xFFFF) { return String.fromCharCode(code) }
code -= 0x10000;
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
}
-pp$9.readString = function(quote) {
+pp.readString = function(quote) {
var out = "", chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
@@ -5267,14 +5284,14 @@ pp$9.readString = function(quote) {
}
}
out += this.input.slice(chunkStart, this.pos++);
- return this.finishToken(types.string, out)
+ return this.finishToken(types$1.string, out)
};
// Reads template string tokens.
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
-pp$9.tryReadTemplateToken = function() {
+pp.tryReadTemplateToken = function() {
this.inTemplateElement = true;
try {
this.readTmplToken();
@@ -5289,7 +5306,7 @@ pp$9.tryReadTemplateToken = function() {
this.inTemplateElement = false;
};
-pp$9.invalidStringToken = function(position, message) {
+pp.invalidStringToken = function(position, message) {
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
throw INVALID_TEMPLATE_ESCAPE_ERROR
} else {
@@ -5297,23 +5314,23 @@ pp$9.invalidStringToken = function(position, message) {
}
};
-pp$9.readTmplToken = function() {
+pp.readTmplToken = function() {
var out = "", chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
var ch = this.input.charCodeAt(this.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
- if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
+ if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
if (ch === 36) {
this.pos += 2;
- return this.finishToken(types.dollarBraceL)
+ return this.finishToken(types$1.dollarBraceL)
} else {
++this.pos;
- return this.finishToken(types.backQuote)
+ return this.finishToken(types$1.backQuote)
}
}
out += this.input.slice(chunkStart, this.pos);
- return this.finishToken(types.template, out)
+ return this.finishToken(types$1.template, out)
}
if (ch === 92) { // '\'
out += this.input.slice(chunkStart, this.pos);
@@ -5344,7 +5361,7 @@ pp$9.readTmplToken = function() {
};
// Reads a template token to search for the end, without validating any escape sequences
-pp$9.readInvalidTemplateToken = function() {
+pp.readInvalidTemplateToken = function() {
for (; this.pos < this.input.length; this.pos++) {
switch (this.input[this.pos]) {
case "\\":
@@ -5355,10 +5372,10 @@ pp$9.readInvalidTemplateToken = function() {
if (this.input[this.pos + 1] !== "{") {
break
}
- // falls through
+ // falls through
case "`":
- return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
+ return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
// no default
}
@@ -5368,14 +5385,14 @@ pp$9.readInvalidTemplateToken = function() {
// Used to read escaped characters
-pp$9.readEscapedChar = function(inTemplate) {
+pp.readEscapedChar = function(inTemplate) {
var ch = this.input.charCodeAt(++this.pos);
++this.pos;
switch (ch) {
case 110: return "\n" // 'n' -> '\n'
case 114: return "\r" // 'r' -> '\r'
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
- case 117: return codePointToString$1(this.readCodePoint()) // 'u'
+ case 117: return codePointToString(this.readCodePoint()) // 'u'
case 116: return "\t" // 't' -> '\t'
case 98: return "\b" // 'b' -> '\b'
case 118: return "\u000b" // 'v' -> '\u000b'
@@ -5433,7 +5450,7 @@ pp$9.readEscapedChar = function(inTemplate) {
// Used to read character escape sequences ('\x', '\u', '\U').
-pp$9.readHexChar = function(len) {
+pp.readHexChar = function(len) {
var codePos = this.pos;
var n = this.readInt(16, len);
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
@@ -5446,7 +5463,7 @@ pp$9.readHexChar = function(len) {
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
-pp$9.readWord1 = function() {
+pp.readWord1 = function() {
this.containsEsc = false;
var word = "", first = true, chunkStart = this.pos;
var astral = this.options.ecmaVersion >= 6;
@@ -5464,7 +5481,7 @@ pp$9.readWord1 = function() {
var esc = this.readCodePoint();
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
- word += codePointToString$1(esc);
+ word += codePointToString(esc);
chunkStart = this.pos;
} else {
break
@@ -5477,18 +5494,18 @@ pp$9.readWord1 = function() {
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
-pp$9.readWord = function() {
+pp.readWord = function() {
var word = this.readWord1();
- var type = types.name;
+ var type = types$1.name;
if (this.keywords.test(word)) {
- type = keywords$1[word];
+ type = keywords[word];
}
return this.finishToken(type, word)
};
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
-var version = "8.5.0";
+var version = "8.6.0";
Parser.acorn = {
Parser: Parser,
@@ -5499,10 +5516,10 @@ Parser.acorn = {
getLineInfo: getLineInfo,
Node: Node,
TokenType: TokenType,
- tokTypes: types,
- keywordTypes: keywords$1,
+ tokTypes: types$1,
+ keywordTypes: keywords,
TokContext: TokContext,
- tokContexts: types$1,
+ tokContexts: types,
isIdentifierChar: isIdentifierChar,
isIdentifierStart: isIdentifierStart,
Token: Token,
@@ -5538,4 +5555,4 @@ function tokenizer(input, options) {
return Parser.tokenizer(input, options)
}
-export { Node, Parser, Position, SourceLocation, TokContext, Token, TokenType, defaultOptions, getLineInfo, isIdentifierChar, isIdentifierStart, isNewLine, keywords$1 as keywordTypes, lineBreak, lineBreakG, nonASCIIwhitespace, parse, parseExpressionAt, types$1 as tokContexts, types as tokTypes, tokenizer, version };
+export { Node, Parser, Position, SourceLocation, TokContext, Token, TokenType, defaultOptions, getLineInfo, isIdentifierChar, isIdentifierStart, isNewLine, keywords as keywordTypes, lineBreak, lineBreakG, nonASCIIwhitespace, parse, parseExpressionAt, types as tokContexts, types$1 as tokTypes, tokenizer, version };
diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/bin.js b/tools/node_modules/eslint/node_modules/acorn/dist/bin.js
index d35d6ee9909209..675cab9ac89cae 100644
--- a/tools/node_modules/eslint/node_modules/acorn/dist/bin.js
+++ b/tools/node_modules/eslint/node_modules/acorn/dist/bin.js
@@ -4,6 +4,26 @@ var path = require('path');
var fs = require('fs');
var acorn = require('./acorn.js');
+function _interopNamespace(e) {
+ if (e && e.__esModule) return e;
+ var n = Object.create(null);
+ if (e) {
+ Object.keys(e).forEach(function (k) {
+ if (k !== 'default') {
+ var d = Object.getOwnPropertyDescriptor(e, k);
+ Object.defineProperty(n, k, d.get ? d : {
+ enumerable: true,
+ get: function () { return e[k]; }
+ });
+ }
+ });
+ }
+ n["default"] = e;
+ return Object.freeze(n);
+}
+
+var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn);
+
var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
var options = {};
@@ -44,14 +64,14 @@ function run(codeList) {
codeList.forEach(function (code, idx) {
fileIdx = idx;
if (!tokenize) {
- result = acorn.parse(code, options);
+ result = acorn__namespace.parse(code, options);
options.program = result;
} else {
- var tokenizer = acorn.tokenizer(code, options), token;
+ var tokenizer = acorn__namespace.tokenizer(code, options), token;
do {
token = tokenizer.getToken();
result.push(token);
- } while (token.type !== acorn.tokTypes.eof)
+ } while (token.type !== acorn__namespace.tokTypes.eof)
}
});
} catch (e) {
diff --git a/tools/node_modules/eslint/node_modules/acorn/package.json b/tools/node_modules/eslint/node_modules/acorn/package.json
index 138b7873d373b3..e242a235e00c84 100644
--- a/tools/node_modules/eslint/node_modules/acorn/package.json
+++ b/tools/node_modules/eslint/node_modules/acorn/package.json
@@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
- "version": "8.5.0",
+ "version": "8.6.0",
"engines": {"node": ">=0.4.0"},
"maintainers": [
{
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs b/tools/node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs
index 5b00bc8bf4adb7..c11f1bf216233f 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/dist/eslint-scope.cjs
@@ -366,7 +366,7 @@ class ParameterDefinition extends Definition {
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-const { Syntax: Syntax$2 } = estraverse__default['default'];
+const { Syntax: Syntax$2 } = estraverse__default["default"];
/**
* Test if scope is struct
@@ -491,7 +491,8 @@ class Scope {
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
/**
- * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
+ * One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
+ * "class", "class-field-initializer", "class-static-block".
* @member {string} Scope#type
*/
this.type = type;
@@ -559,7 +560,13 @@ class Scope {
* @member {Scope} Scope#variableScope
*/
this.variableScope =
- (this.type === "global" || this.type === "function" || this.type === "module" || this.type === "class-field-initializer") ? this : upperScope.variableScope;
+ this.type === "global" ||
+ this.type === "module" ||
+ this.type === "function" ||
+ this.type === "class-field-initializer" ||
+ this.type === "class-static-block"
+ ? this
+ : upperScope.variableScope;
/**
* Whether this scope is created by a FunctionExpression.
@@ -803,8 +810,8 @@ class Scope {
resolve(ident) {
let ref, i, iz;
- assert__default['default'](this.__isClosed(), "Scope should be closed.");
- assert__default['default'](ident.type === Syntax$2.Identifier, "Target should be identifier.");
+ assert__default["default"](this.__isClosed(), "Scope should be closed.");
+ assert__default["default"](ident.type === Syntax$2.Identifier, "Target should be identifier.");
for (i = 0, iz = this.references.length; i < iz; ++i) {
ref = this.references[i];
if (ref.identifier === ident) {
@@ -1008,7 +1015,7 @@ class FunctionScope extends Scope {
const variable = this.set.get("arguments");
- assert__default['default'](variable, "Always have arguments variable.");
+ assert__default["default"](variable, "Always have arguments variable.");
return variable.tainted || variable.references.length !== 0;
}
@@ -1072,6 +1079,12 @@ class ClassFieldInitializerScope extends Scope {
}
}
+class ClassStaticBlockScope extends Scope {
+ constructor(scopeManager, upperScope, block) {
+ super(scopeManager, "class-static-block", upperScope, block, true);
+ }
+}
+
/* vim: set sw=4 ts=4 et tw=80 : */
/*
@@ -1124,7 +1137,7 @@ class ScopeManager {
}
__isNodejsScope() {
- return this.__options.nodejsScope;
+ return this.__options.nodejsScope || this.__options.sourceType === "commonjs";
}
isModule() {
@@ -1248,7 +1261,7 @@ class ScopeManager {
__nestScope(scope) {
if (scope instanceof GlobalScope) {
- assert__default['default'](this.__currentScope === null);
+ assert__default["default"](this.__currentScope === null);
this.globalScope = scope;
}
this.__currentScope = scope;
@@ -1287,6 +1300,10 @@ class ScopeManager {
return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
}
+ __nestClassStaticBlockScope(node) {
+ return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
+ }
+
__nestSwitchScope(node) {
return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
}
@@ -1330,7 +1347,7 @@ class ScopeManager {
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-const { Syntax: Syntax$1 } = estraverse__default['default'];
+const { Syntax: Syntax$1 } = estraverse__default["default"];
/**
* Get last array element
@@ -1341,7 +1358,7 @@ function getLast(xs) {
return xs[xs.length - 1] || null;
}
-class PatternVisitor extends esrecurse__default['default'].Visitor {
+class PatternVisitor extends esrecurse__default["default"].Visitor {
static isPattern(node) {
const nodeType = node.type;
@@ -1477,7 +1494,7 @@ class PatternVisitor extends esrecurse__default['default'].Visitor {
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-const { Syntax } = estraverse__default['default'];
+const { Syntax } = estraverse__default["default"];
/**
* Traverse identifier in pattern
@@ -1506,7 +1523,7 @@ function traverseIdentifierInPattern(options, rootPattern, referencer, callback)
// FIXME: Now, we don't create module environment, because the context is
// implementation dependent.
-class Importer extends esrecurse__default['default'].Visitor {
+class Importer extends esrecurse__default["default"].Visitor {
constructor(declaration, referencer) {
super(null, referencer.options);
this.declaration = declaration;
@@ -1553,7 +1570,7 @@ class Importer extends esrecurse__default['default'].Visitor {
}
// Referencing variables and creating bindings.
-class Referencer extends esrecurse__default['default'].Visitor {
+class Referencer extends esrecurse__default["default"].Visitor {
constructor(options, scopeManager) {
super(null, options);
this.options = options;
@@ -1914,6 +1931,14 @@ class Referencer extends esrecurse__default['default'].Visitor {
}
}
+ StaticBlock(node) {
+ this.scopeManager.__nestClassStaticBlockScope(node);
+
+ this.visitChildren(node);
+
+ this.close(node);
+ }
+
MethodDefinition(node) {
this.visitProperty(node);
}
@@ -2035,7 +2060,7 @@ class Referencer extends esrecurse__default['default'].Visitor {
}
ImportDeclaration(node) {
- assert__default['default'](this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
+ assert__default["default"](this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
const importer = new Importer(node, this);
@@ -2087,7 +2112,7 @@ class Referencer extends esrecurse__default['default'].Visitor {
/* vim: set sw=4 ts=4 et tw=80 : */
-const version = "6.0.0";
+const version = "7.1.0";
/*
Copyright (C) 2012-2014 Yusuke Suzuki
@@ -2125,7 +2150,7 @@ function defaultOptions() {
directive: false,
nodejsScope: false,
impliedStrict: false,
- sourceType: "script", // one of ['script', 'module']
+ sourceType: "script", // one of ['script', 'module', 'commonjs']
ecmaVersion: 5,
childVisitorKeys: null,
fallback: "iteration"
@@ -2181,7 +2206,7 @@ function updateDeeply(target, override) {
* a function scope immediately following the global scope.
* @param {boolean} [providedOptions.impliedStrict=false] implied strict mode
* (if ecmaVersion >= 5).
- * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script' and 'module'
+ * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs'
* @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered
* @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
* @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
@@ -2194,7 +2219,7 @@ function analyze(tree, providedOptions) {
referencer.visit(tree);
- assert__default['default'](scopeManager.__currentScope === null, "currentScope should be null.");
+ assert__default["default"](scopeManager.__currentScope === null, "currentScope should be null.");
return scopeManager;
}
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/index.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/index.js
index ac386adfb77207..cd0678d2e66dda 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/index.js
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/index.js
@@ -66,7 +66,7 @@ function defaultOptions() {
directive: false,
nodejsScope: false,
impliedStrict: false,
- sourceType: "script", // one of ['script', 'module']
+ sourceType: "script", // one of ['script', 'module', 'commonjs']
ecmaVersion: 5,
childVisitorKeys: null,
fallback: "iteration"
@@ -122,7 +122,7 @@ function updateDeeply(target, override) {
* a function scope immediately following the global scope.
* @param {boolean} [providedOptions.impliedStrict=false] implied strict mode
* (if ecmaVersion >= 5).
- * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script' and 'module'
+ * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs'
* @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered
* @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
* @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/referencer.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/referencer.js
index 0b90ec875c9940..0147f686acd0d6 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/referencer.js
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/referencer.js
@@ -470,6 +470,14 @@ class Referencer extends esrecurse.Visitor {
}
}
+ StaticBlock(node) {
+ this.scopeManager.__nestClassStaticBlockScope(node);
+
+ this.visitChildren(node);
+
+ this.close(node);
+ }
+
MethodDefinition(node) {
this.visitProperty(node);
}
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope-manager.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope-manager.js
index 5a1231464d3bac..e41d4717399789 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope-manager.js
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope-manager.js
@@ -28,6 +28,7 @@ import {
BlockScope,
CatchScope,
ClassFieldInitializerScope,
+ ClassStaticBlockScope,
ClassScope,
ForScope,
FunctionExpressionNameScope,
@@ -65,7 +66,7 @@ class ScopeManager {
}
__isNodejsScope() {
- return this.__options.nodejsScope;
+ return this.__options.nodejsScope || this.__options.sourceType === "commonjs";
}
isModule() {
@@ -228,6 +229,10 @@ class ScopeManager {
return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
}
+ __nestClassStaticBlockScope(node) {
+ return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
+ }
+
__nestSwitchScope(node) {
return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
}
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js
index 73386e614ff4dc..42c0693791d74a 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js
@@ -157,7 +157,8 @@ class Scope {
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
/**
- * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
+ * One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
+ * "class", "class-field-initializer", "class-static-block".
* @member {string} Scope#type
*/
this.type = type;
@@ -225,7 +226,13 @@ class Scope {
* @member {Scope} Scope#variableScope
*/
this.variableScope =
- (this.type === "global" || this.type === "function" || this.type === "module" || this.type === "class-field-initializer") ? this : upperScope.variableScope;
+ this.type === "global" ||
+ this.type === "module" ||
+ this.type === "function" ||
+ this.type === "class-field-initializer" ||
+ this.type === "class-static-block"
+ ? this
+ : upperScope.variableScope;
/**
* Whether this scope is created by a FunctionExpression.
@@ -738,6 +745,12 @@ class ClassFieldInitializerScope extends Scope {
}
}
+class ClassStaticBlockScope extends Scope {
+ constructor(scopeManager, upperScope, block) {
+ super(scopeManager, "class-static-block", upperScope, block, true);
+ }
+}
+
export {
Scope,
GlobalScope,
@@ -750,7 +763,8 @@ export {
FunctionScope,
ForScope,
ClassScope,
- ClassFieldInitializerScope
+ ClassFieldInitializerScope,
+ ClassStaticBlockScope
};
/* vim: set sw=4 ts=4 et tw=80 : */
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/version.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/version.js
index 393adb787f6aa2..779fbee8eae087 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/version.js
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/version.js
@@ -1,3 +1,3 @@
-const version = "6.0.0";
+const version = "7.1.0";
export default version;
diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/package.json b/tools/node_modules/eslint/node_modules/eslint-scope/package.json
index c1f8f174631fb2..1d5fab1f2f465a 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/package.json
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/package.json
@@ -11,7 +11,7 @@
},
"./package.json": "./package.json"
},
- "version": "6.0.0",
+ "version": "7.1.0",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@@ -50,9 +50,9 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.1",
"eslint-plugin-node": "^11.1.0",
- "eslint-release": "^3.1.2",
- "eslint-visitor-keys": "^3.0.0",
- "espree": "^8.0.0",
+ "eslint-release": "^3.2.0",
+ "eslint-visitor-keys": "^3.1.0",
+ "espree": "^9.0.0",
"mocha": "^9.0.1",
"npm-license": "^0.3.3",
"rollup": "^2.52.7",
diff --git a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/README.md b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/README.md
index 71217e381dc3d2..8bc9149dceb05d 100644
--- a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/README.md
+++ b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/README.md
@@ -17,7 +17,8 @@ $ npm install eslint-visitor-keys
### Requirements
-- [Node.js] 10.0.0 or later.
+- [Node.js] `^12.22.0`, `^14.17.0`, or `>=16.0.0`
+
## 📖 Usage
@@ -102,5 +103,5 @@ Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-
[npm]: https://www.npmjs.com/
-[Node.js]: https://nodejs.org/en/
+[Node.js]: https://nodejs.org/
[ESTree]: https://github.com/estree/estree
diff --git a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
index 4213f0b2f14292..6f104196aad9de 100644
--- a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
+++ b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
@@ -239,6 +239,9 @@ const KEYS = {
SpreadElement: [
"argument"
],
+ StaticBlock: [
+ "body"
+ ],
Super: [],
SwitchStatement: [
"discriminant",
diff --git a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js
index ade8fc3bfc7475..bd39002868597b 100644
--- a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js
+++ b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js
@@ -235,6 +235,9 @@ const KEYS = {
SpreadElement: [
"argument"
],
+ StaticBlock: [
+ "body"
+ ],
Super: [],
SwitchStatement: [
"discriminant",
diff --git a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json
index 82c2115bdb539e..0612d3c44f6e9c 100644
--- a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json
+++ b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-visitor-keys",
- "version": "3.0.0",
+ "version": "3.1.0",
"description": "Constants and utilities about visitor keys to traverse AST.",
"type": "module",
"main": "dist/eslint-visitor-keys.cjs",
@@ -27,7 +27,7 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.0",
"eslint-plugin-node": "^11.1.0",
- "eslint-release": "^3.1.2",
+ "eslint-release": "^3.2.0",
"mocha": "^9.0.1",
"opener": "^1.5.2",
"rollup": "^2.52.1"
diff --git a/tools/node_modules/eslint/node_modules/espree/README.md b/tools/node_modules/eslint/node_modules/espree/README.md
index d4c49c75a01f3f..b8bad72b4ceebe 100644
--- a/tools/node_modules/eslint/node_modules/espree/README.md
+++ b/tools/node_modules/eslint/node_modules/espree/README.md
@@ -145,7 +145,7 @@ const options = {
// You can also set "latest" to use the most recently supported version.
ecmaVersion: 5,
- // specify which type of script you're parsing ("script" or "module")
+ // specify which type of script you're parsing ("script", "module", or "commonjs")
sourceType: "script",
// specify additional language features
@@ -154,7 +154,7 @@ const options = {
// enable JSX parsing
jsx: false,
- // enable return in global scope
+ // enable return in global scope (set to true automatically when sourceType is "commonjs")
globalReturn: false,
// enable implied strict mode (if ecmaVersion >= 5)
@@ -238,6 +238,7 @@ Because ECMAScript 2022 is still under development, we are implementing features
* [Class static fields, static private methods and accessors](https://github.com/tc39/proposal-static-class-features)
* [RegExp match indices](https://github.com/tc39/proposal-regexp-match-indices)
* [Top-level await](https://github.com/tc39/proposal-top-level-await)
+* [Class static initialization blocks](https://github.com/tc39/proposal-class-static-block)
See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to know what features are finalized.
diff --git a/tools/node_modules/eslint/node_modules/espree/dist/espree.cjs b/tools/node_modules/eslint/node_modules/espree/dist/espree.cjs
index 233a7ab537de9d..d6b139ed76998b 100644
--- a/tools/node_modules/eslint/node_modules/espree/dist/espree.cjs
+++ b/tools/node_modules/eslint/node_modules/espree/dist/espree.cjs
@@ -17,14 +17,12 @@ function _interopNamespace(e) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
- get: function () {
- return e[k];
- }
+ get: function () { return e[k]; }
});
}
});
}
- n['default'] = e;
+ n["default"] = e;
return Object.freeze(n);
}
@@ -462,6 +460,11 @@ function normalizeSourceType(sourceType = "script") {
if (sourceType === "script" || sourceType === "module") {
return sourceType;
}
+
+ if (sourceType === "commonjs") {
+ return "script";
+ }
+
throw new Error("Invalid sourceType.");
}
@@ -477,16 +480,21 @@ function normalizeOptions(options) {
const ranges = options.range === true;
const locations = options.loc === true;
const allowReserved = ecmaVersion === 3 ? "never" : false;
+ const ecmaFeatures = options.ecmaFeatures || {};
+ const allowReturnOutsideFunction = options.sourceType === "commonjs" ||
+ Boolean(ecmaFeatures.globalReturn);
if (sourceType === "module" && ecmaVersion < 6) {
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
}
+
return Object.assign({}, options, {
ecmaVersion,
sourceType,
ranges,
locations,
- allowReserved
+ allowReserved,
+ allowReturnOutsideFunction
});
}
@@ -546,6 +554,8 @@ var espree = () => Parser => {
code = String(code);
}
+ // save original source type in case of commonjs
+ const originalSourceType = opts.sourceType;
const options = normalizeOptions(opts);
const ecmaFeatures = options.ecmaFeatures || {};
const tokenTranslator =
@@ -564,7 +574,7 @@ var espree = () => Parser => {
allowReserved: options.allowReserved,
// Truthy value is true for backward compatibility.
- allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn),
+ allowReturnOutsideFunction: options.allowReturnOutsideFunction,
// Collect tokens
onToken: token => {
@@ -588,8 +598,13 @@ var espree = () => Parser => {
}
}, code);
- // Initialize internal state.
+ /*
+ * Data that is unique to Espree and is not represented internally in
+ * Acorn. We put all of this data into a symbol property as a way to
+ * avoid potential naming conflicts with future versions of Acorn.
+ */
this[STATE] = {
+ originalSourceType: originalSourceType || options.sourceType,
tokens: tokenTranslator ? [] : null,
comments: options.comment === true ? [] : null,
impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,
@@ -634,7 +649,7 @@ var espree = () => Parser => {
const extra = this[STATE];
const program = super.parse();
- program.sourceType = this.options.sourceType;
+ program.sourceType = extra.originalSourceType;
if (extra.comments) {
program.comments = extra.comments;
@@ -810,7 +825,7 @@ var espree = () => Parser => {
};
};
-const version$1 = "9.0.0";
+const version$1 = "9.1.0";
/**
* @fileoverview Main Espree file that converts Acorn into Esprima output.
@@ -884,7 +899,7 @@ const parsers = {
get jsx() {
if (this._jsx === null) {
- this._jsx = acorn__namespace.Parser.extend(jsx__default['default'](), espree());
+ this._jsx = acorn__namespace.Parser.extend(jsx__default["default"](), espree());
}
return this._jsx;
},
diff --git a/tools/node_modules/eslint/node_modules/espree/lib/espree.js b/tools/node_modules/eslint/node_modules/espree/lib/espree.js
index e0be3b5a172ec7..786d89fa2c39a5 100644
--- a/tools/node_modules/eslint/node_modules/espree/lib/espree.js
+++ b/tools/node_modules/eslint/node_modules/espree/lib/espree.js
@@ -56,6 +56,8 @@ export default () => Parser => {
code = String(code);
}
+ // save original source type in case of commonjs
+ const originalSourceType = opts.sourceType;
const options = normalizeOptions(opts);
const ecmaFeatures = options.ecmaFeatures || {};
const tokenTranslator =
@@ -74,7 +76,7 @@ export default () => Parser => {
allowReserved: options.allowReserved,
// Truthy value is true for backward compatibility.
- allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn),
+ allowReturnOutsideFunction: options.allowReturnOutsideFunction,
// Collect tokens
onToken: token => {
@@ -98,8 +100,13 @@ export default () => Parser => {
}
}, code);
- // Initialize internal state.
+ /*
+ * Data that is unique to Espree and is not represented internally in
+ * Acorn. We put all of this data into a symbol property as a way to
+ * avoid potential naming conflicts with future versions of Acorn.
+ */
this[STATE] = {
+ originalSourceType: originalSourceType || options.sourceType,
tokens: tokenTranslator ? [] : null,
comments: options.comment === true ? [] : null,
impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,
@@ -144,7 +151,7 @@ export default () => Parser => {
const extra = this[STATE];
const program = super.parse();
- program.sourceType = this.options.sourceType;
+ program.sourceType = extra.originalSourceType;
if (extra.comments) {
program.comments = extra.comments;
diff --git a/tools/node_modules/eslint/node_modules/espree/lib/options.js b/tools/node_modules/eslint/node_modules/espree/lib/options.js
index acc1e3a2a917db..02c1a750885b7a 100644
--- a/tools/node_modules/eslint/node_modules/espree/lib/options.js
+++ b/tools/node_modules/eslint/node_modules/espree/lib/options.js
@@ -73,6 +73,11 @@ function normalizeSourceType(sourceType = "script") {
if (sourceType === "script" || sourceType === "module") {
return sourceType;
}
+
+ if (sourceType === "commonjs") {
+ return "script";
+ }
+
throw new Error("Invalid sourceType.");
}
@@ -88,15 +93,20 @@ export function normalizeOptions(options) {
const ranges = options.range === true;
const locations = options.loc === true;
const allowReserved = ecmaVersion === 3 ? "never" : false;
+ const ecmaFeatures = options.ecmaFeatures || {};
+ const allowReturnOutsideFunction = options.sourceType === "commonjs" ||
+ Boolean(ecmaFeatures.globalReturn);
if (sourceType === "module" && ecmaVersion < 6) {
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
}
+
return Object.assign({}, options, {
ecmaVersion,
sourceType,
ranges,
locations,
- allowReserved
+ allowReserved,
+ allowReturnOutsideFunction
});
}
diff --git a/tools/node_modules/eslint/node_modules/espree/lib/version.js b/tools/node_modules/eslint/node_modules/espree/lib/version.js
index cd9899749da2be..5a93e177e62c4b 100644
--- a/tools/node_modules/eslint/node_modules/espree/lib/version.js
+++ b/tools/node_modules/eslint/node_modules/espree/lib/version.js
@@ -1,3 +1,3 @@
-const version = "9.0.0";
+const version = "9.1.0";
export default version;
diff --git a/tools/node_modules/eslint/node_modules/espree/package.json b/tools/node_modules/eslint/node_modules/espree/package.json
index 736b8f55b220e0..17b050b1533cc5 100644
--- a/tools/node_modules/eslint/node_modules/espree/package.json
+++ b/tools/node_modules/eslint/node_modules/espree/package.json
@@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
- "version": "9.0.0",
+ "version": "9.1.0",
"files": [
"lib",
"dist/espree.cjs",
@@ -31,9 +31,9 @@
},
"license": "BSD-2-Clause",
"dependencies": {
- "acorn": "^8.5.0",
+ "acorn": "^8.6.0",
"acorn-jsx": "^5.3.1",
- "eslint-visitor-keys": "^3.0.0"
+ "eslint-visitor-keys": "^3.1.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.1.0",
@@ -44,7 +44,7 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^32.2.0",
"eslint-plugin-node": "^11.1.0",
- "eslint-release": "^3.1.2",
+ "eslint-release": "^3.2.0",
"esprima": "latest",
"esprima-fb": "^8001.2001.0-dev-harmony-fb",
"json-diff": "^0.5.4",
diff --git a/tools/node_modules/eslint/node_modules/flatted/README.md b/tools/node_modules/eslint/node_modules/flatted/README.md
index 1f52cc5b3877ff..78763277c28160 100644
--- a/tools/node_modules/eslint/node_modules/flatted/README.md
+++ b/tools/node_modules/eslint/node_modules/flatted/README.md
@@ -6,6 +6,18 @@
**Social Media Photo by [Matt Seymour](https://unsplash.com/@mattseymour) on [Unsplash](https://unsplash.com/)**
+## Announcement 📣
+
+There is a standard approach to recursion and more data-types than what JSON allow, and it's part of this [Structured Clone Module](https://github.com/ungap/structured-clone/#readme).
+
+Beside acting as a polyfill, its `@ungap/structured-clone/json` export provides both `stringify` and `parse`, and it's been tested for being faster than *flatted*, but its produced output is also smaller than *flatted*.
+
+The *@ungap/structured-clone* module is, in short, a drop in replacement for *flatted*, but it's not compatible with *flatted* specialized syntax.
+
+However, if recursion, as well as more data-types, are what you are after, or interesting for your projects, consider switching to this new module whenever you can 👍
+
+- - -
+
A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson).
Now available also for **[PHP](./php/flatted.php)**.
diff --git a/tools/node_modules/eslint/node_modules/flatted/index.js b/tools/node_modules/eslint/node_modules/flatted/index.js
index d170879e50ccf8..9cc91070180dcf 100644
--- a/tools/node_modules/eslint/node_modules/flatted/index.js
+++ b/tools/node_modules/eslint/node_modules/flatted/index.js
@@ -124,4 +124,4 @@ self.Flatted = (function (exports) {
return exports;
-}({}));
+})({});
diff --git a/tools/node_modules/eslint/node_modules/flatted/package.json b/tools/node_modules/eslint/node_modules/flatted/package.json
index 60f79eb7304267..3de71375238fe5 100644
--- a/tools/node_modules/eslint/node_modules/flatted/package.json
+++ b/tools/node_modules/eslint/node_modules/flatted/package.json
@@ -1,6 +1,6 @@
{
"name": "flatted",
- "version": "3.2.2",
+ "version": "3.2.4",
"description": "A super light and fast circular JSON parser.",
"unpkg": "min.js",
"types": "types.d.ts",
@@ -12,9 +12,9 @@
"rollup:babel": "rollup --config rollup/babel.config.js && sed -i.bck 's/^var /self./' index.js && rm -rf index.js.bck && drop-babel-typeof index.js",
"min": "terser index.js -c -m -o min.js",
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c9 min.js | wc -c;cat min.js | brotli | wc -c; cat es.js | brotli | wc -c",
- "coveralls": "c8 report --reporter=text-lcov | coveralls",
"test": "c8 node test/index.js",
- "test:php": "php php/test.php"
+ "test:php": "php php/test.php",
+ "coverage": "mkdir -p ./coverage; c8 report --reporter=text-lcov > ./coverage/lcov.info"
},
"repository": {
"type": "git",
@@ -34,20 +34,20 @@
},
"homepage": "https://github.com/WebReflection/flatted#readme",
"devDependencies": {
- "@babel/core": "^7.14.6",
- "@babel/preset-env": "^7.14.7",
+ "@babel/core": "^7.16.0",
+ "@babel/preset-env": "^7.16.0",
+ "@ungap/structured-clone": "^0.3.4",
"ascjs": "^5.0.1",
- "c8": "^7.7.3",
+ "c8": "^7.10.0",
"circular-json": "^0.5.9",
"circular-json-es6": "^2.0.2",
- "coveralls": "^3.1.1",
"drop-babel-typeof": "^1.0.3",
"jsan": "^3.1.13",
- "rollup": "^2.52.8",
+ "rollup": "^2.59.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",
- "terser": "^5.7.1"
+ "terser": "^5.9.0"
},
"module": "./esm/index.js",
"type": "module",
diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json
index f578cf434528a8..c3dfa1bb3703e4 100644
--- a/tools/node_modules/eslint/package.json
+++ b/tools/node_modules/eslint/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint",
- "version": "8.2.0",
+ "version": "8.3.0",
"author": "Nicholas C. Zakas ",
"description": "An AST-based pattern checker for JavaScript.",
"bin": {
@@ -56,10 +56,10 @@
"doctrine": "^3.0.0",
"enquirer": "^2.3.5",
"escape-string-regexp": "^4.0.0",
- "eslint-scope": "^6.0.0",
+ "eslint-scope": "^7.1.0",
"eslint-utils": "^3.0.0",
- "eslint-visitor-keys": "^3.0.0",
- "espree": "^9.0.0",
+ "eslint-visitor-keys": "^3.1.0",
+ "espree": "^9.1.0",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",