diff --git a/estraverse.js b/estraverse.js index 09ae478..26aa6dd 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; + while (worklist.length) { element = worklist.pop(); @@ -551,6 +554,8 @@ } } } + + onEnd && onEnd(); }; Controller.prototype.replace = function replace(root, visitor) {