diff --git a/lib/6to5/traverse/index.js b/lib/6to5/traverse/index.js index d34b8155c8..91cb138f29 100644 --- a/lib/6to5/traverse/index.js +++ b/lib/6to5/traverse/index.js @@ -76,11 +76,6 @@ TraversalContext.prototype.enterNode = function (obj, key, node, enter, parent, } } - if (this.shouldRemove) { - obj[key] = null; - this.shouldFlatten = true; - } - return node; }; @@ -97,6 +92,11 @@ TraversalContext.prototype.exitNode = function (obj, key, node, exit, parent, sc } } + if (this.shouldRemove) { + obj[key] = null; + this.shouldFlatten = true; + } + return node; };