Fixing Issue #506. existential chains should force parentheses in the presense of a compiled ternary operator.

This commit is contained in:
Jeremy Ashkenas
2010-07-15 21:38:35 -04:00
parent 72c4efbc39
commit b810d10e80
3 changed files with 9 additions and 2 deletions

View File

@@ -1402,8 +1402,9 @@ exports.IfNode: class IfNode extends BaseNode
# Compile the IfNode as a ternary operator.
compileTernary: (o) ->
ifPart: @condition.compile(o) + ' ? ' + @bodyNode().compile(o)
elsePart: if @elseBody then @elseBodyNode().compile(o) else 'null'
o.operation: true
ifPart: @condition.compile(o) + ' ? ' + @bodyNode().compile(o)
elsePart: if @elseBody then @elseBodyNode().compile(o) else 'null'
"$ifPart : $elsePart"
# Faux-Nodes