@babel/traverse 8.0.0-alpha.5 → 8.0.0-alpha.7
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 +13 -8
- package/lib/index.js.map +1 -1
- package/package.json +11 -11
package/lib/index.js
CHANGED
@@ -1632,10 +1632,10 @@ const {
|
|
1632
1632
|
} = _t;
|
1633
1633
|
function createUnionType(types) {
|
1634
1634
|
{
|
1635
|
-
if (isFlowType(
|
1635
|
+
if (types.every(v => isFlowType(v))) {
|
1636
1636
|
return createFlowUnionType(types);
|
1637
1637
|
}
|
1638
|
-
if (isTSType(
|
1638
|
+
if (types.every(v => isTSType(v))) {
|
1639
1639
|
return createTSUnionType(types);
|
1640
1640
|
}
|
1641
1641
|
}
|
@@ -2672,7 +2672,7 @@ function _evaluate(path, state) {
|
|
2672
2672
|
if (object.isIdentifier() && property.isIdentifier() && isValidObjectCallee(object.node.name) && !isInvalidMethod(property.node.name)) {
|
2673
2673
|
context = global[object.node.name];
|
2674
2674
|
const key = property.node.name;
|
2675
|
-
if (Object.
|
2675
|
+
if (Object.hasOwn(context, key)) {
|
2676
2676
|
func = context[key];
|
2677
2677
|
}
|
2678
2678
|
}
|
@@ -3829,8 +3829,10 @@ function _removeFromScope() {
|
|
3829
3829
|
Object.keys(bindings).forEach(name => this.scope.removeBinding(name));
|
3830
3830
|
}
|
3831
3831
|
function _callRemovalHooks() {
|
3832
|
-
|
3833
|
-
|
3832
|
+
if (this.parentPath) {
|
3833
|
+
for (const fn of hooks) {
|
3834
|
+
if (fn(this, this.parentPath)) return true;
|
3835
|
+
}
|
3834
3836
|
}
|
3835
3837
|
}
|
3836
3838
|
function _remove() {
|
@@ -4848,7 +4850,10 @@ class TraversalContext {
|
|
4848
4850
|
this.priorityQueue = [];
|
4849
4851
|
const visited = new WeakSet();
|
4850
4852
|
let stop = false;
|
4851
|
-
|
4853
|
+
let visitIndex = 0;
|
4854
|
+
for (; visitIndex < queue.length;) {
|
4855
|
+
const path = queue[visitIndex];
|
4856
|
+
visitIndex++;
|
4852
4857
|
path.resync();
|
4853
4858
|
if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
|
4854
4859
|
path.pushContext(this);
|
@@ -4870,8 +4875,8 @@ class TraversalContext {
|
|
4870
4875
|
if (stop) break;
|
4871
4876
|
}
|
4872
4877
|
}
|
4873
|
-
for (
|
4874
|
-
|
4878
|
+
for (let i = 0; i < visitIndex; i++) {
|
4879
|
+
queue[i].popContext();
|
4875
4880
|
}
|
4876
4881
|
this.queue = null;
|
4877
4882
|
return stop;
|