                 @function_stack.shift()
                 n
 
+        visitFor: (n) ->
+                @skipExpressionStatement = true
+                init = @visit n.init
+                @skipExpressionStatement = false
+                n.test = @visit n.test
+                n.update = @visit n.update
+                n.body = @visit n.body
+                n
+                        
         visitForIn: (n) ->
                 if n.left.type is syntax.VariableDeclaration
                         @function_stack[0].vars.push

                        assignments = []
                        for i in [0...n.declarations.length]
                                if n.declarations[i].init?
                                        assignments.push
                                                type: syntax.ExpressionStatement
                                                expression:
                                                        type: syntax.AssignmentExpression
                                                        left: create_identifier n.declarations[i].id.name
                                                        right: n.declarations[i].init
                                                        operator: "="

                        # now return the new assignments, which will replace the original variable
                        # declaration node.
                        if assignments.length == 1
                                return assignments[0]

                        return {
                                type: syntax.BlockStatement
                                body: assignments
                        }
                n

# this class really doesn't behave like a normal NodeVisitor, as it modifies the tree in-place

        passes.forEach (passType) ->
                pass = new passType(filename)
                tree = pass.visit tree
                #debug.log 1, "after: #{passType.name}"
                #debug.log 1, -> escodegen.generate tree

        tree
