don't requeue node unless the type has changed

This commit is contained in:
Sebastian McKenzie 2015-05-07 16:01:00 +01:00
parent 6f664ca64e
commit 9ffc265bea

View File

@ -699,9 +699,12 @@ 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);
this.queueNode(this);
break;
if (this.type !== previousType) {
this.queueNode(this);
break;
}
}
if (this.shouldStop || this.removed) break;