mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 03:21:20 -05:00
adding a statement-as-expression test, and returning null from while loops, if asked
This commit is contained in:
@@ -575,12 +575,13 @@ module CoffeeScript
|
||||
end
|
||||
|
||||
def compile_node(o)
|
||||
o.delete(:return)
|
||||
returns = o.delete(:return)
|
||||
indent = o[:indent]
|
||||
o[:indent] += TAB
|
||||
o[:top] = true
|
||||
cond = @condition.compile(o)
|
||||
write("#{indent}while (#{cond}) {\n#{@body.compile(o)}\n#{indent}}")
|
||||
post = returns ? "\n#{indent}return null;" : ''
|
||||
write("#{indent}while (#{cond}) {\n#{@body.compile(o)}\n#{indent}}#{post}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user