diff --git a/estraverse.js b/estraverse.js index 09ae478..6c0e340 100644 --- a/estraverse.js +++ b/estraverse.js @@ -468,7 +468,8 @@ current2, candidates, candidate, - sentinel; + sentinel, + onEnd; this.__initialize(root, visitor); @@ -482,6 +483,8 @@ worklist.push(new Element(root, null, null, null)); leavelist.push(new Element(null, null, null, null)); + onEnd = visitor.onEnd.bind(visitor); + while (worklist.length) { element = worklist.pop(); @@ -551,6 +554,10 @@ } } } + + if (onEnd) { + setTimeout(onEnd, 0); + } }; Controller.prototype.replace = function replace(root, visitor) {