be more vigorous about removing mid-expression newlines, 'when' closes implicit blocks, a better comment-detecting regex lexer that doesn't eat outdents

This commit is contained in:
Jeremy Ashkenas
2009-12-30 19:26:37 -05:00
parent cd68f02981
commit dc821f2e4c
2 changed files with 10 additions and 7 deletions

View File

@@ -469,8 +469,8 @@ module CoffeeScript
indent = o[:indent]
o[:indent] += TAB
props = @properties.map { |prop|
joiner = prop == @properties.last ? '' : prop.is_a?(CommentNode) ? "\n" : ",\n"
o[:indent] + prop.compile(o) + joiner
joiner = prop == @properties.first ? '' : prop.is_a?(CommentNode) ? "\n" : ",\n"
joiner + o[:indent] + prop.compile(o)
}.join('')
write("{\n#{props}\n#{indent}}")
end