@babel/traverse 8.0.0-alpha.13 → 8.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -289,7 +289,7 @@ function verify$1(visitor) {
289
289
  }
290
290
  if (shouldIgnoreKey(nodeType)) continue;
291
291
  if (!TYPES.includes(nodeType)) {
292
- throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"8.0.0-alpha.13"}`);
292
+ throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"8.0.0-alpha.14"}`);
293
293
  }
294
294
  const visitors = visitor[nodeType];
295
295
  if (typeof visitors === "object") {
@@ -607,10 +607,10 @@ function isDeclaredInLoop(path) {
607
607
  for (let {
608
608
  parentPath,
609
609
  key
610
- } = path; parentPath; ({
610
+ } = path; parentPath; {
611
611
  parentPath,
612
612
  key
613
- } = parentPath)) {
613
+ } = parentPath) {
614
614
  if (parentPath.isFunctionParent()) return false;
615
615
  if (parentPath.isWhile() || parentPath.isForXStatement() || parentPath.isForStatement() && key === "body") {
616
616
  return true;
@@ -1269,8 +1269,14 @@ class Scope {
1269
1269
  this.globals = Object.create(null);
1270
1270
  this.uids = Object.create(null);
1271
1271
  this.data = Object.create(null);
1272
- const programParent = this.getProgramParent();
1273
- if (programParent.crawling) return;
1272
+ let scope = this;
1273
+ do {
1274
+ if (scope.crawling) return;
1275
+ if (scope.path.isProgram()) {
1276
+ break;
1277
+ }
1278
+ } while (scope = scope.parent);
1279
+ const programParent = scope;
1274
1280
  const state = {
1275
1281
  references: [],
1276
1282
  constantViolations: [],