   # object with their parent closure, to preserve the expected lexical scope.
   compileClosure: (o) ->
     o.sharedScope = o.scope
-    Closure.wrap(this, no, yes).compile o
+    throw new Error 'cannot include a pure statement in an expression.' if @containsPureStatement()
+    Closure.wrap(this).compile o
 
   # If the code generation wishes to use the result of a complex expression
   # in multiple places, ensure that the expression is only ever evaluated once,

      body.unshift  new Literal "var #{name} = #{ivar}" if range
      body.unshift  new Literal "var #{namePart}" if namePart
      body.unshift  new Literal "var #{index} = #{ivar}" if index
      body        = Closure.wrap(body, true)
    else
      varPart     = "#{idt1}#{namePart};\n" if namePart
    if @object

    rvar          = scope.freeVariable 'result' unless topLevel
    ivar          = if range then name else index
    ivar          = scope.freeVariable 'i' if not ivar or codeInBody
    nvar          = scope.freeVariable 'i' if name and not range
    varPart       = ''
    guardPart     = ''
    body          = Expressions.wrap([@body])
