@babel/traverse
Advanced tools
Comparing version 7.9.0 to 7.9.5
@@ -273,2 +273,24 @@ "use strict"; | ||
} | ||
}, | ||
CatchClause(path) { | ||
path.scope.registerBinding("let", path); | ||
}, | ||
Function(path) { | ||
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) { | ||
path.scope.registerBinding("local", path.get("id"), path); | ||
} | ||
const params = path.get("params"); | ||
for (const param of params) { | ||
path.scope.registerBinding("param", param); | ||
} | ||
}, | ||
ClassExpression(path) { | ||
if (path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) { | ||
path.scope.registerBinding("local", path); | ||
} | ||
} | ||
@@ -297,2 +319,3 @@ | ||
this.labels = new Map(); | ||
this.inited = false; | ||
} | ||
@@ -552,2 +575,4 @@ | ||
for (const name of Object.keys(ids)) { | ||
parent.references[name] = true; | ||
for (const id of ids[name]) { | ||
@@ -561,4 +586,2 @@ const local = this.getOwnBinding(name); | ||
parent.references[name] = true; | ||
if (local) { | ||
@@ -603,9 +626,3 @@ this.registerConstantViolation(bindingPath); | ||
hasReference(name) { | ||
let scope = this; | ||
do { | ||
if (scope.references[name]) return true; | ||
} while (scope = scope.parent); | ||
return false; | ||
return !!this.getProgramParent().references[name]; | ||
} | ||
@@ -690,3 +707,6 @@ | ||
init() { | ||
if (!this.references) this.crawl(); | ||
if (!this.inited) { | ||
this.inited = true; | ||
this.crawl(); | ||
} | ||
} | ||
@@ -702,22 +722,7 @@ | ||
if (path.isLoop()) { | ||
for (const key of t.FOR_INIT_KEYS) { | ||
const node = path.get(key); | ||
if (node.isBlockScoped()) this.registerBinding(node.node.kind, node); | ||
} | ||
} | ||
if (path.isFunctionExpression() && path.has("id")) { | ||
if (!path.get("id").node[t.NOT_LOCAL_BINDING]) { | ||
if (path.isFunction()) { | ||
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) { | ||
this.registerBinding("local", path.get("id"), path); | ||
} | ||
} | ||
if (path.isClassExpression() && path.has("id")) { | ||
if (!path.get("id").node[t.NOT_LOCAL_BINDING]) { | ||
this.registerBinding("local", path); | ||
} | ||
} | ||
if (path.isFunction()) { | ||
const params = path.get("params"); | ||
@@ -730,8 +735,4 @@ | ||
if (path.isCatchClause()) { | ||
this.registerBinding("let", path); | ||
} | ||
const parent = this.getProgramParent(); | ||
if (parent.crawling) return; | ||
const programParent = this.getProgramParent(); | ||
if (programParent.crawling) return; | ||
const state = { | ||
@@ -748,7 +749,5 @@ references: [], | ||
const ids = path.getBindingIdentifiers(); | ||
let programParent; | ||
for (const name of Object.keys(ids)) { | ||
if (path.scope.getBinding(name)) continue; | ||
programParent = programParent || path.scope.getProgramParent(); | ||
programParent.addGlobal(ids[name]); | ||
@@ -766,3 +765,3 @@ } | ||
} else { | ||
ref.scope.getProgramParent().addGlobal(ref.node); | ||
programParent.addGlobal(ref.node); | ||
} | ||
@@ -769,0 +768,0 @@ } |
{ | ||
"name": "@babel/traverse", | ||
"version": "7.9.0", | ||
"version": "7.9.5", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -15,7 +15,7 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"@babel/code-frame": "^7.8.3", | ||
"@babel/generator": "^7.9.0", | ||
"@babel/helper-function-name": "^7.8.3", | ||
"@babel/generator": "^7.9.5", | ||
"@babel/helper-function-name": "^7.9.5", | ||
"@babel/helper-split-export-declaration": "^7.8.3", | ||
"@babel/parser": "^7.9.0", | ||
"@babel/types": "^7.9.0", | ||
"@babel/types": "^7.9.5", | ||
"debug": "^4.1.0", | ||
@@ -28,3 +28,3 @@ "globals": "^11.1.0", | ||
}, | ||
"gitHead": "8d5e422be27251cfaadf8dd2536b31b4a5024b02" | ||
"gitHead": "5b97e77e030cf3853a147fdff81844ea4026219d" | ||
} |
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
155850
4352
Updated@babel/generator@^7.9.5
Updated@babel/types@^7.9.5