@babel/traverse 7.12.7 → 7.12.8

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.

Potentially problematic release.


This version of @babel/traverse might be problematic. Click here for more details.

@@ -141,7 +141,7 @@ function getSibling(key) {
141
141
  container: this.container,
142
142
  listKey: this.listKey,
143
143
  key: key
144
- });
144
+ }).setContext(this.context);
145
145
  }
146
146
 
147
147
  function getPrevSibling() {
@@ -25,9 +25,9 @@ function getTypeAnnotation() {
25
25
  return this.typeAnnotation = type;
26
26
  }
27
27
 
28
- function _getTypeAnnotation() {
29
- var _inferer;
28
+ const typeAnnotationInferringNodes = new WeakSet();
30
29
 
30
+ function _getTypeAnnotation() {
31
31
  const node = this.node;
32
32
 
33
33
  if (!node) {
@@ -53,16 +53,28 @@ function _getTypeAnnotation() {
53
53
  return node.typeAnnotation;
54
54
  }
55
55
 
56
- let inferer = inferers[node.type];
57
-
58
- if (inferer) {
59
- return inferer.call(this, node);
56
+ if (typeAnnotationInferringNodes.has(node)) {
57
+ return;
60
58
  }
61
59
 
62
- inferer = inferers[this.parentPath.type];
60
+ typeAnnotationInferringNodes.add(node);
61
+
62
+ try {
63
+ var _inferer;
64
+
65
+ let inferer = inferers[node.type];
63
66
 
64
- if ((_inferer = inferer) == null ? void 0 : _inferer.validParent) {
65
- return this.parentPath.getTypeAnnotation();
67
+ if (inferer) {
68
+ return inferer.call(this, node);
69
+ }
70
+
71
+ inferer = inferers[this.parentPath.type];
72
+
73
+ if ((_inferer = inferer) == null ? void 0 : _inferer.validParent) {
74
+ return this.parentPath.getTypeAnnotation();
75
+ }
76
+ } finally {
77
+ typeAnnotationInferringNodes.delete(node);
66
78
  }
67
79
  }
68
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/traverse",
3
- "version": "7.12.7",
3
+ "version": "7.12.8",
4
4
  "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
5
5
  "author": "Sebastian McKenzie <sebmck@gmail.com>",
6
6
  "homepage": "https://babeljs.io/",