adding test for body-less while, using null as the body so JSLint doesn't get in a tizzy

This commit is contained in:
Jeremy Ashkenas
2010-01-09 11:58:50 -05:00
parent ae58e2ec6c
commit 7befbddae2
2 changed files with 8 additions and 2 deletions

View File

@@ -609,7 +609,7 @@ module CoffeeScript
o[:top] = true
cond = @condition.compile(o)
post = returns ? "\n#{idt}return null;" : ''
return write("#{idt}while (#{cond});#{post}") if @body.nil?
return write("#{idt}while (#{cond}) null;#{post}") if @body.nil?
write("#{idt}while (#{cond}) {\n#{@body.compile(o)}\n#{idt}}#{post}")
end
end