     else
       varPart     = "#{idt1}#{namePart};\n" if namePart
     if @object
-      forPart     = "#{ivar} in #{svar}"
+      forPart     = "#{ivar} in #{sourcePart}"
       guardPart   = "\n#{idt1}if (!#{utility('hasProp')}.call(#{svar}, #{ivar})) continue;" unless @raw
     body          = body.compile merge o, indent: idt1, top: true
     vars          = if range then name else "#{name}, #{ivar}"
     """
-    #{sourcePart}for (#{forPart}) {#{guardPart}
+    #{resultPart}#{@tab}for (#{forPart}) {#{guardPart}
     #{varPart}#{body}
     #{@tab}}#{returnResult}
     """

    body          = Expressions.wrap([@body])
    idt1          = @idt 1
    if range
      sourcePart  = source.compileVariables(o)
      forPart     = source.compile merge o, index: ivar, step: @step
    else
      [sourcePart, svar] = @source.compileReference merge(o, top: yes), precompile: yes
      sourcePart = if sourcePart is svar then '' else "#{sourcePart};"
      namePart = if @pattern
        new Assign(@name, literal "#{svar}[#{ivar}]").compile merge o, top: on
      else if name

    parts = []
    parts.push @from if @from isnt @fromVar
    parts.push @to if @to isnt @toVar

  # When compiled normally, the range returns the contents of the *for loop*
  # needed to iterate over the values in the range. Used by comprehensions.
  compileNode: (o) ->
    @compileVariables o
    return    @compileArray(o)  unless o.index
    return    @compileSimple(o) if @fromNum and @toNum
    idx      = del o, 'index'
    step     = del o, 'step'
    vars     = "#{idx} = #{@from}" + if @to isnt @toVar then ", #{@to}" else ''
    intro    = "(#{@fromVar} <= #{@toVar} ? #{idx}"
    compare  = "#{intro} <#{@equals} #{@toVar} : #{idx} >#{@equals} #{@toVar})"
    stepPart = if step then step.compile(o) else '1'
