1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Coco 38aa762: rewriter: made addImplicitBraces consume multiple leading comments

This commit is contained in:
Jeremy Ashkenas 2010-11-28 17:54:00 -08:00
parent b52a1ed60a
commit 1f5727fe9d
3 changed files with 5 additions and 3 deletions

View file

@ -138,7 +138,7 @@
}
stack.push(['{']);
idx = ago === '@' ? i - 2 : i - 1;
if (this.tag(idx - 2) === 'HERECOMMENT') {
while (this.tag(idx - 2) === 'HERECOMMENT') {
idx -= 2;
}
value = new String('{');

View file

@ -115,8 +115,8 @@ class exports.Rewriter
return 1 unless tag is ':' and
((ago = @tag i - 2) is ':' or stack[stack.length - 1]?[0] isnt '{')
stack.push ['{']
idx = if ago is '@' then i - 2 else i - 1
idx -= 2 if @tag(idx - 2) is 'HERECOMMENT'
idx = if ago is '@' then i - 2 else i - 1
idx -= 2 while @tag(idx - 2) is 'HERECOMMENT'
value = new String('{')
value.generated = yes
tok = ['{', value, token[2]]

View file

@ -216,6 +216,8 @@ eq '\\`', `
# Shorthand objects with property references.
obj =
### comment one ###
### comment two ###
one: 1
two: 2
object: -> {@one, @two}