From 06823fbf1c2e763a5bf76c3990ca98fbbcd98691 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 14 May 2024 14:05:49 +0800 Subject: updated node_modules --- node_modules/@babel/traverse/lib/scope/index.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'node_modules/@babel/traverse/lib/scope/index.js') diff --git a/node_modules/@babel/traverse/lib/scope/index.js b/node_modules/@babel/traverse/lib/scope/index.js index ed90029f..ff56a2a5 100644 --- a/node_modules/@babel/traverse/lib/scope/index.js +++ b/node_modules/@babel/traverse/lib/scope/index.js @@ -20,6 +20,7 @@ const { identifier, isArrayExpression, isBinary, + isCallExpression, isClass, isClassBody, isClassDeclaration, @@ -30,6 +31,7 @@ const { isIdentifier, isImportDeclaration, isLiteral, + isMemberExpression, isMethod, isModuleSpecifier, isNullLiteral, @@ -274,6 +276,9 @@ const collectorVisitor = { if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) { path.scope.registerBinding("local", path); } + }, + TSTypeAnnotation(path) { + path.skip(); } }; let uid = 0; @@ -622,13 +627,23 @@ class Scope { return true; } else if (isUnaryExpression(node)) { return this.isPure(node.argument, constantsOnly); - } else if (isTaggedTemplateExpression(node)) { - return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly); } else if (isTemplateLiteral(node)) { for (const expression of node.expressions) { if (!this.isPure(expression, constantsOnly)) return false; } return true; + } else if (isTaggedTemplateExpression(node)) { + return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", { + noGlobals: true + }) && this.isPure(node.quasi, constantsOnly); + } else if (isMemberExpression(node)) { + return !node.computed && isIdentifier(node.object) && node.object.name === "Symbol" && isIdentifier(node.property) && node.property.name !== "for" && !this.hasBinding("Symbol", { + noGlobals: true + }); + } else if (isCallExpression(node)) { + return matchesPattern(node.callee, "Symbol.for") && !this.hasBinding("Symbol", { + noGlobals: true + }) && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0]); } else { return isPureish(node); } @@ -720,9 +735,9 @@ class Scope { kind = "var", id } = opts; - if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && t.isCallExpression(path.parent, { + if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && isCallExpression(path.parent, { callee: path.node - }) && path.parent.arguments.length <= path.node.params.length && t.isIdentifier(id)) { + }) && path.parent.arguments.length <= path.node.params.length && isIdentifier(id)) { path.pushContainer("params", id); path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]); return; -- cgit v1.2.3