mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 03:21:20 -05:00
adding test for body-less while, using null as the body so JSLint doesn't get in a tizzy
This commit is contained in:
@@ -609,7 +609,7 @@ module CoffeeScript
|
|||||||
o[:top] = true
|
o[:top] = true
|
||||||
cond = @condition.compile(o)
|
cond = @condition.compile(o)
|
||||||
post = returns ? "\n#{idt}return null;" : ''
|
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}")
|
write("#{idt}while (#{cond}) {\n#{@body.compile(o)}\n#{idt}}#{post}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
8
test/fixtures/execution/test_literals.coffee
vendored
8
test/fixtures/execution/test_literals.coffee
vendored
@@ -23,4 +23,10 @@ print(func() is null)
|
|||||||
str: "\\"
|
str: "\\"
|
||||||
reg: /\\/
|
reg: /\\/
|
||||||
|
|
||||||
print(reg(str) and str is '\\')
|
print(reg(str) and str is '\\')
|
||||||
|
|
||||||
|
|
||||||
|
i: 10
|
||||||
|
while i -= 1
|
||||||
|
|
||||||
|
print(i is 0)
|
||||||
Reference in New Issue
Block a user