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

Fixing issue #700, block comment after first line of class definition.

This commit is contained in:
Jeremy Ashkenas 2010-09-21 23:13:46 -04:00
parent 07d9e9b71e
commit c0a89a7988
3 changed files with 14 additions and 1 deletions

View file

@ -151,6 +151,9 @@
if (token[0] === ':' && (!last || last[0] !== '{')) {
stack.push('{');
idx = this.tag(i - 2) === '@' ? i - 2 : i - 1;
if (this.tag(idx - 2) === 'HERECOMMENT') {
idx -= 2;
}
tok = ['{', '{', token[2]];
tok.generated = true;
this.tokens.splice(idx, 0, tok);

View file

@ -131,6 +131,7 @@ exports.Rewriter = class Rewriter
if token[0] is ':' and (not last or last[0] isnt '{')
stack.push '{'
idx = if @tag(i - 2) is '@' then i - 2 else i - 1
idx -= 2 if @tag(idx - 2) is 'HERECOMMENT'
tok = ['{', '{', token[2]]
tok.generated = yes
@tokens.splice idx, 0, tok

View file

@ -155,3 +155,12 @@ class A
c: ->
ok A.prototype.c instanceof Function
class A
###
Comment
###
b: ->
c: ->
ok A.prototype.b instanceof Function