Fixes Issue #603 -- a longstanding precedence issue involving prefix vs postfix if and unless, involving using the entire single-line if statment as an expression.

This commit is contained in:
Jeremy Ashkenas
2010-08-11 21:28:22 -04:00
parent ac752a46bc
commit ba02ebc3dc
6 changed files with 65 additions and 19 deletions

View File

@@ -64,10 +64,20 @@ ok result is undefined
# Return an if with no else.
func = ->
return (if false then callback())
return if false then callback()
ok func() is null
func = ->
return unless false then 100 else -100
ok func() is 100
ident = (x) -> x
result = ident if false then 300 else 100
ok result is 100
# If-to-ternary with instanceof requires parentheses (no comment).
if {} instanceof Object