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}