@babel/traverse
Advanced tools
Comparing version 7.22.5 to 7.22.6
@@ -12,2 +12,3 @@ "use strict"; | ||
var _t = require("@babel/types"); | ||
var t = _t; | ||
var _cache = require("../cache"); | ||
@@ -513,4 +514,4 @@ var _visitors = require("../visitors"); | ||
for (const name of Object.keys(ids)) { | ||
const binding = this.getBinding(name); | ||
if (binding) binding.reassign(path); | ||
var _this$getBinding; | ||
(_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.reassign(path); | ||
} | ||
@@ -717,2 +718,15 @@ } | ||
} | ||
const { | ||
init, | ||
unique, | ||
kind = "var", | ||
id | ||
} = opts; | ||
if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && t.isCallExpression(path.parent, { | ||
callee: path.node | ||
}) && path.parent.arguments.length <= path.node.params.length && t.isIdentifier(id)) { | ||
path.pushContainer("params", id); | ||
path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]); | ||
return; | ||
} | ||
if (path.isLoop() || path.isCatchClause() || path.isFunction()) { | ||
@@ -722,4 +736,2 @@ path.ensureBlock(); | ||
} | ||
const unique = opts.unique; | ||
const kind = opts.kind || "var"; | ||
const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; | ||
@@ -734,3 +746,3 @@ const dataKey = `declaration:${kind}:${blockHoist}`; | ||
} | ||
const declarator = variableDeclarator(opts.id, opts.init); | ||
const declarator = variableDeclarator(id, init); | ||
const len = declarPath.node.declarations.push(declarator); | ||
@@ -825,4 +837,4 @@ path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]); | ||
getBindingIdentifier(name) { | ||
var _this$getBinding; | ||
return (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.identifier; | ||
var _this$getBinding2; | ||
return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier; | ||
} | ||
@@ -867,4 +879,4 @@ getOwnBindingIdentifier(name) { | ||
removeBinding(name) { | ||
var _this$getBinding2; | ||
(_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.scope.removeOwnBinding(name); | ||
var _this$getBinding3; | ||
(_this$getBinding3 = this.getBinding(name)) == null ? void 0 : _this$getBinding3.scope.removeOwnBinding(name); | ||
let scope = this; | ||
@@ -871,0 +883,0 @@ do { |
{ | ||
"name": "@babel/traverse", | ||
"version": "7.22.5", | ||
"version": "7.22.6", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -24,4 +24,4 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"@babel/helper-hoist-variables": "^7.22.5", | ||
"@babel/helper-split-export-declaration": "^7.22.5", | ||
"@babel/parser": "^7.22.5", | ||
"@babel/helper-split-export-declaration": "^7.22.6", | ||
"@babel/parser": "^7.22.6", | ||
"@babel/types": "^7.22.5", | ||
@@ -28,0 +28,0 @@ "debug": "^4.1.0", |
@@ -5,3 +5,3 @@ # @babel/traverse | ||
See our website [@babel/traverse](https://babeljs.io/docs/en/babel-traverse) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22+is%3Aopen) associated with this package. | ||
See our website [@babel/traverse](https://babeljs.io/docs/babel-traverse) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22+is%3Aopen) associated with this package. | ||
@@ -8,0 +8,0 @@ ## Install |
Sorry, the diff of this file is not supported yet
595447
5108