         self.node = node
         depth += 1
         fn = self["#{node.type}"]
-        self.onBeforeEnter?(node, depth, fn, res)
-        res = (fn.apply(self, [ node, parent ]) if fn)
-        self.onEnter?(node, depth, fn, res)
+        self.onBeforeEnter?(node, depth)
+        res = self["#{node.type}"]?(node, parent)
+        self.onEnter?(node, depth)
         res
       leave: (node, parent) ->
         self.controller = this
         self.node = node
         depth -= 1
         fn = self["#{node.type}Exit"]
-        self.onBeforeExit?(node, depth, fn, res)
+        self.onBeforeExit?(node, depth)
         res = (fn.apply(self, [ node, parent ]) if fn)
-        self.onExit?(node, depth, fn, res)
+        self.onExit?(node, depth)
         res
     root
 

# ----------------------------------------------------------------------------

###
# Debugging provisions
###

js2coffee.debug = ->
  isDead = (ast) ->
    output = require('util').inspect(ast, depth: 1000)
    if ~output.indexOf("[Circular]")
      "[CIRCULAR]"
    else
      ""

  print = (depth, type, etc) ->
    color = if (/\*$/.test(type)) then 35 else 30
    type = "\u001b[#{color}m#{type}\u001b[0m"
    indent = "\u001b[#{30 + (depth % 5)}m·  \u001b[0m"

    console.log \
      Array(depth+1).join(indent) + type,
      etc

  TransformerBase::onBeforeEnter = (node, depth, fn) ->
    msg = "#{node.type}"
    print depth, (if fn then "#{msg} *" else "#{msg}"), isDead(@ast)

  TransformerBase::onBeforeExit = (node, depth, fn) ->
    msg = "#{node.type}Exit"
    print depth, (if fn then "#{msg} *" else "#{msg}"), isDead(@ast)

# ----------------------------------------------------------------------------



js2coffee.Builder = Builder
js2coffee.BuilderBase = BuilderBase

# js2coffee.debug()
