mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
fixing If/else-to-ternary with instanceof as an unparenthesized condition. JS operator precedence.
This commit is contained in:
@@ -1330,9 +1330,12 @@ exports.IfNode: class IfNode extends BaseNode
|
||||
constructor: (condition, body, tags) ->
|
||||
@condition: condition
|
||||
@body: body
|
||||
@elseBody: null
|
||||
@tags: tags or {}
|
||||
@condition: new OpNode('!', new ParentheticalNode(@condition)) if @tags.invert
|
||||
if @tags.invert
|
||||
@condition: new OpNode('!', new ParentheticalNode(@condition))
|
||||
else if @condition instanceof OpNode and @condition.operator is 'instanceof'
|
||||
@condition: new ParentheticalNode(@condition)
|
||||
@elseBody: null
|
||||
@isChain: false
|
||||
|
||||
bodyNode: -> @body?.unwrap()
|
||||
|
||||
Reference in New Issue
Block a user