fix replacement requeue exiting too early

This commit is contained in:
Sebastian McKenzie 2015-05-08 22:52:38 +01:00
parent d6a5c39079
commit 8292d6d8ad

View File

@ -717,19 +717,18 @@ 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);
var previousType = this.type;
if (replacement) {
var previousType = this.type;
this.replaceWith(replacement, true);
if (previousType !== this.type) {
this.queueNode(this);
return;
}
}
if (this.shouldStop || this.shouldSkip || this.removed) return;
if (replacement && previousType !== this.type) {
this.queueNode(this);
return;
}
}
}