better verify the type of the new node before requeueing it and also stop current node traversal on skip
This commit is contained in:
parent
2fbb3cad9f
commit
78b72512cb
@ -717,16 +717,19 @@ export default class TraversalPath {
|
||||
|
||||
// call the function with the params (node, parent, scope, state)
|
||||
var replacement = fn.call(this, node, this.parent, this.scope, this.state);
|
||||
|
||||
if (replacement) {
|
||||
var previousType = this.type;
|
||||
|
||||
this.replaceWith(replacement, true);
|
||||
if (this.type !== previousType) {
|
||||
|
||||
if (previousType !== this.type) {
|
||||
this.queueNode(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shouldStop || this.removed) return;
|
||||
if (this.shouldStop || this.shouldSkip || this.removed) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user