mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
fixing comment-within-objecta-and-array-literal printing for the new expression regime.
This commit is contained in:
@@ -536,7 +536,8 @@ module CoffeeScript
|
|||||||
props = @properties.map { |prop|
|
props = @properties.map { |prop|
|
||||||
join = joins[prop]
|
join = joins[prop]
|
||||||
join = '' if prop == @properties.last
|
join = '' if prop == @properties.last
|
||||||
o[:indent] + prop.compile(o) + join
|
idt = prop.is_a?(CommentNode) ? '' : o[:indent]
|
||||||
|
"#{idt}#{prop.compile(o)}#{join}"
|
||||||
}.join('')
|
}.join('')
|
||||||
write("{\n#{props}\n#{indent}}")
|
write("{\n#{props}\n#{indent}}")
|
||||||
end
|
end
|
||||||
@@ -551,11 +552,14 @@ module CoffeeScript
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile_node(o)
|
def compile_node(o)
|
||||||
|
indent = o[:indent]
|
||||||
|
o[:indent] += TAB
|
||||||
objects = @objects.map { |obj|
|
objects = @objects.map { |obj|
|
||||||
joiner = obj.is_a?(CommentNode) ? "\n#{o[:indent] + TAB}" : obj == @objects.last ? '' : ', '
|
code = obj.compile(o)
|
||||||
obj.compile(o.merge(:indent => o[:indent] + TAB)) + joiner
|
obj.is_a?(CommentNode) ? "\n#{code}\n#{o[:indent]}" :
|
||||||
|
obj == @objects.last ? code : "#{code}, "
|
||||||
}.join('')
|
}.join('')
|
||||||
ending = objects.include?("\n") ? "\n#{o[:indent]}]" : ']'
|
ending = objects.include?("\n") ? "\n#{indent}]" : ']'
|
||||||
write("[#{objects}#{ending}")
|
write("[#{objects}#{ending}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user