and now with if/else statements, CoffeeScript-in-CoffeeScript is language-complete -- now for the shakedown cruise

This commit is contained in:
Jeremy Ashkenas
2010-02-10 21:40:10 -05:00
parent 13d3b3a3ce
commit 38e1991f82
5 changed files with 194 additions and 5 deletions

View File

@@ -1029,7 +1029,7 @@ module CoffeeScript
# Compile the IfNode into a ternary operator.
def compile_ternary(o)
if_part = "#{@condition.compile(o)} ? #{@body.compile(o)}"
else_part = @else_body ? "#{@else_body.compile(o)}" : 'null'
else_part = @else_body ? @else_body.compile(o) : 'null'
"#{if_part} : #{else_part}"
end
end