   ###
 
   pushStack: (node) ->
-    @parent = @scope
+    [ oldScope, oldCtx ] = [ @scope, @ctx ]
+    # TODO remove @parent = @scope
     @scopes.push [ node, @ctx ]
     @ctx = clone(@ctx)
     @scope = node
-    @onScopeEnter?(node, @ctx)
+    @onScopeEnter?(@scope, @ctx, oldScope, oldCtx)
 
   popStack: (node) ->
-    @onScopeExit?(node, @ctx)
+    [ oldScope, oldCtx ] = [ @scope, @ctx ]
     [ @scope, @ctx ] = @scopes.pop()
-    @parent = if @scopes.length > 1 then @scopes[@scopes.length-2]
+    # TODO remove @parent = if @scopes.length > 1 then @scopes[@scopes.length-2]
+    @onScopeExit?(@scope, @ctx, oldScope, oldCtx)
     node
 
   ###*

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


    else
      ""

  TransformerBase::onBeforeEnter = (node, depth, fn) ->
    console.log Array(depth+1).join("  "), node.type, (if fn then "*" else ""), isDead(@ast)

  TransformerBase::onBeforeExit = (node, depth, fn) ->
    console.log Array(depth+1).join("  "), ""+node.type+"Exit", (if fn then "*" else ""), isDead(@ast)

# js2coffee.debug()
