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:
parent
b52a1ed60a
commit
1f5727fe9d
3 changed files with 5 additions and 3 deletions
|
@ -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('{');
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -216,6 +216,8 @@ eq '\\`', `
|
|||
|
||||
# Shorthand objects with property references.
|
||||
obj =
|
||||
### comment one ###
|
||||
### comment two ###
|
||||
one: 1
|
||||
two: 2
|
||||
object: -> {@one, @two}
|
||||
|
|
Loading…
Reference in a new issue