       del @options, 'operation'
       del @options, 'chainRoot' unless this instanceof AccessorNode or this instanceof IndexNode
     top     = if @topSensitive() then @options.top else del @options, 'top'
-    closure = @isStatement() and not @isPureStatement() and not top and
+    closure = @isStatement(o) and not @isPureStatement() and not top and
               not @options.asStatement and not (this instanceof CommentNode) and
               not @containsPureStatement()
     if closure then @compileClosure(@options) else @compileNode(@options)

  compileExpression: (node, o) ->
    @tab = o.indent
    compiledNode = node.compile merge o, top: true
    if node.isStatement() then compiledNode else "#{@idt()}#{compiledNode};"

# Wrap up the given nodes as an **Expressions**, unless it already happens
# to be one.


  # The **IfNode** only compiles into a statement if either of its bodies needs
  # to be a statement. Otherwise a ternary is safe.
  isStatement: (o) ->
    @statement or= !!((o and o.top) or @tags.statement or @bodyNode().isStatement(o) or (@elseBody and @elseBodyNode().isStatement(o)))

  compileCondition: (o) ->
    (cond.compile(o) for cond in flatten([@condition])).join(' || ')

  compileNode: (o) ->
    if @isStatement(o) then @compileStatement(o) else @compileTernary(o)

  makeReturn: ->
    if @isStatement()
