             params: node.params
             body: node.body
 
-      @block.body = [ statement ].concat(@block.body)
+      @parent._prebody ?= []
+      @parent._prebody.unshift statement
+      console.log 'pushed to prebody of', @parent.type
       @replace node, type: 'Identifier', name: node.id.name
     else
       node

  BlockStatementExit: (node) ->
    @consolidateBodies node
    @removeEmptyStatementsFromBody node

  consolidateBodies: (node) ->
    if node._prebody?
      node.body = node._prebody.concat(node.body)
      delete node._prebody
  FunctionDeclaration: (node, parent) ->
    @pushStack node.body
    @removeUndefinedParameter node


  recurse: (root) ->
    self = this
    @estraverse().replace root,
      enter: (node, parent) ->
        fn = self["#{node.type}"]
        fn.apply(self, [ node, parent, (=> @skip()), (=> @break()) ]) if fn
      leave: (node, parent) ->
        fn = self["#{node.type}Exit"]
        fn.apply(self, [ node, parent, (=> @skip()), (=> @break()) ]) if fn
    root

  estraverse: ->
