mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
removing no_paren -- can cause order of operations errors
This commit is contained in:
@@ -207,7 +207,7 @@ module CoffeeScript
|
|||||||
|
|
||||||
def compile(o={})
|
def compile(o={})
|
||||||
o = super(o)
|
o = super(o)
|
||||||
args = @arguments.map{|a| a.compile(o.merge(:no_paren => true)) }.join(', ')
|
args = @arguments.map{|a| a.compile(o) }.join(', ')
|
||||||
return write(compile_super(args, o)) if super?
|
return write(compile_super(args, o)) if super?
|
||||||
prefix = @new ? "new " : ''
|
prefix = @new ? "new " : ''
|
||||||
write("#{prefix}#{@variable.compile(o)}(#{args})")
|
write("#{prefix}#{@variable.compile(o)}(#{args})")
|
||||||
@@ -511,7 +511,7 @@ module CoffeeScript
|
|||||||
o = super(o)
|
o = super(o)
|
||||||
o.delete(:return)
|
o.delete(:return)
|
||||||
indent = o[:indent] + TAB
|
indent = o[:indent] + TAB
|
||||||
cond = @condition.compile(o.merge(:no_paren => true))
|
cond = @condition.compile(o)
|
||||||
write("while (#{cond}) {\n#{@body.compile(o.merge(:indent => indent))}\n#{o[:indent]}}")
|
write("while (#{cond}) {\n#{@body.compile(o.merge(:indent => indent))}\n#{o[:indent]}}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -656,7 +656,7 @@ module CoffeeScript
|
|||||||
o = super(o)
|
o = super(o)
|
||||||
compiled = @expressions.compile(o)
|
compiled = @expressions.compile(o)
|
||||||
compiled = compiled[0...-1] if compiled[-1..-1] == ';'
|
compiled = compiled[0...-1] if compiled[-1..-1] == ';'
|
||||||
write(o[:no_paren] ? compiled : "(#{compiled})")
|
write("(#{compiled})")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
3
test/fixtures/generation/whitespace.coffee
vendored
3
test/fixtures/generation/whitespace.coffee
vendored
@@ -4,3 +4,6 @@ f1: x =>
|
|||||||
f2: y =>
|
f2: y =>
|
||||||
y * x
|
y * x
|
||||||
|
|
||||||
|
elements.each(el =>
|
||||||
|
el.click(event =>
|
||||||
|
el.show() if event.active))
|
||||||
Reference in New Issue
Block a user