           vars = []
 
           token.vars.forEach (v) ->
-            vars.push v unless (v in vars or v in declared)
-            declared.push v unless v in declared
+            vars.push v unless isDeclared v, token.depth
+            declareVar v, token.depth
 
           return if vars.length is 0
           code = "[#{vars.join(",")}] = []"

        lastSpacing ?= ""
        code += "\n\n#{lastSpacing}done()"

      tokens.forEach (token) ->

        if token.type is "describe"


    getVariableNames: (code) ->
      tokens = require("coffee-script").tokens(code)

      reduceFn = (vars, token) ->
        [type, value] = token
        return vars unless type is "IDENTIFIER" and token.variable
        return vars unless vars.indexOf(value) is -1
        vars.concat value

      tokens.reduce reduceFn, []

    convert: (tokens) ->
      currentDepth = 0
