@babel/traverse
Advanced tools
Comparing version 7.21.2 to 7.21.3
@@ -57,3 +57,4 @@ "use strict"; | ||
traverse.cheap = function (node, enter) { | ||
return traverseFast(node, enter); | ||
traverseFast(node, enter); | ||
return; | ||
}; | ||
@@ -60,0 +61,0 @@ traverse.node = function (node, opts, scope, state, path, skipKeys) { |
@@ -150,3 +150,4 @@ "use strict"; | ||
if (this.container[i] === this.node) { | ||
return this.setKey(i); | ||
this.setKey(i); | ||
return; | ||
} | ||
@@ -157,3 +158,4 @@ } | ||
if (this.container[key] === this.node) { | ||
return this.setKey(key); | ||
this.setKey(key); | ||
return; | ||
} | ||
@@ -160,0 +162,0 @@ } |
@@ -25,2 +25,3 @@ "use strict"; | ||
} | ||
const Globals = new Map([["undefined", undefined], ["Infinity", Infinity], ["NaN", NaN]]); | ||
function evaluateCached(path, state) { | ||
@@ -115,24 +116,25 @@ const { | ||
const binding = path.scope.getBinding(path.node.name); | ||
if (binding && binding.constantViolations.length > 0) { | ||
return deopt(binding.path, state); | ||
if (binding) { | ||
if (binding.constantViolations.length > 0 || path.node.start < binding.path.node.end) { | ||
deopt(binding.path, state); | ||
return; | ||
} | ||
if (binding.hasValue) { | ||
return binding.value; | ||
} | ||
} | ||
if (binding && path.node.start < binding.path.node.end) { | ||
return deopt(binding.path, state); | ||
const name = path.node.name; | ||
if (Globals.has(name)) { | ||
if (!binding) { | ||
return Globals.get(name); | ||
} | ||
deopt(binding.path, state); | ||
return; | ||
} | ||
if (binding != null && binding.hasValue) { | ||
return binding.value; | ||
const resolved = path.resolve(); | ||
if (resolved === path) { | ||
deopt(path, state); | ||
return; | ||
} else { | ||
if (path.node.name === "undefined") { | ||
return binding ? deopt(binding.path, state) : undefined; | ||
} else if (path.node.name === "Infinity") { | ||
return binding ? deopt(binding.path, state) : Infinity; | ||
} else if (path.node.name === "NaN") { | ||
return binding ? deopt(binding.path, state) : NaN; | ||
} | ||
const resolved = path.resolve(); | ||
if (resolved === path) { | ||
return deopt(path, state); | ||
} else { | ||
return evaluateCached(resolved, state); | ||
} | ||
return evaluateCached(resolved, state); | ||
} | ||
@@ -173,3 +175,4 @@ } | ||
} else { | ||
return deopt(elemValue.deopt, state); | ||
deopt(elemValue.deopt, state); | ||
return; | ||
} | ||
@@ -184,3 +187,4 @@ } | ||
if (prop.isObjectMethod() || prop.isSpreadElement()) { | ||
return deopt(prop, state); | ||
deopt(prop, state); | ||
return; | ||
} | ||
@@ -192,3 +196,4 @@ const keyPath = prop.get("key"); | ||
if (!key.confident) { | ||
return deopt(key.deopt, state); | ||
deopt(key.deopt, state); | ||
return; | ||
} | ||
@@ -204,3 +209,4 @@ key = key.value; | ||
if (!value.confident) { | ||
return deopt(value.deopt, state); | ||
deopt(value.deopt, state); | ||
return; | ||
} | ||
@@ -207,0 +213,0 @@ value = value.value; |
@@ -404,3 +404,5 @@ "use strict"; | ||
const renamer = new _renamer.default(binding, oldName, newName); | ||
return renamer.rename(arguments[2]); | ||
{ | ||
renamer.rename(arguments[2]); | ||
} | ||
} | ||
@@ -407,0 +409,0 @@ } |
{ | ||
"name": "@babel/traverse", | ||
"version": "7.21.2", | ||
"version": "7.21.3", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -20,3 +20,3 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"@babel/code-frame": "^7.18.6", | ||
"@babel/generator": "^7.21.1", | ||
"@babel/generator": "^7.21.3", | ||
"@babel/helper-environment-visitor": "^7.18.9", | ||
@@ -26,4 +26,4 @@ "@babel/helper-function-name": "^7.21.0", | ||
"@babel/helper-split-export-declaration": "^7.18.6", | ||
"@babel/parser": "^7.21.2", | ||
"@babel/types": "^7.21.2", | ||
"@babel/parser": "^7.21.3", | ||
"@babel/types": "^7.21.3", | ||
"debug": "^4.1.0", | ||
@@ -30,0 +30,0 @@ "globals": "^11.1.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
585176
5048
29
Updated@babel/generator@^7.21.3
Updated@babel/parser@^7.21.3
Updated@babel/types@^7.21.3