From 9ffc265beaa1ec17ac6ce972abf73ac50e190747 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 7 May 2015 16:01:00 +0100 Subject: [PATCH] don't requeue node unless the `type` has changed --- src/babel/traversal/path/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/babel/traversal/path/index.js b/src/babel/traversal/path/index.js index 23b971a900..408726f235 100644 --- a/src/babel/traversal/path/index.js +++ b/src/babel/traversal/path/index.js @@ -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;