mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
Fixing Issue #506. existential chains should force parentheses in the presense of a compiled ternary operator.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user