fixes #2037: line terminators are incorrectly added after herecomments

thanks @geraldalewis for finding the relevant line and making this fix
way too easy for me
This commit is contained in:
Michael Ficarra
2012-01-14 10:40:15 -05:00
parent 9e1d418d7a
commit df7ab264ab
4 changed files with 2 additions and 4 deletions

View File

@@ -171,7 +171,6 @@
herecomment: true,
indent: Array(this.indent + 1).join(' ')
}));
this.token('TERMINATOR', '\n');
}
this.line += count(comment, '\n');
return comment.length;

View File

@@ -654,7 +654,7 @@
Comment.prototype.compileNode = function(o, level) {
var code;
code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/");
code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/\n");
if ((level || o.level) === LEVEL_TOP) code = o.indent + code;
return code;
};

View File

@@ -178,7 +178,6 @@ exports.Lexer = class Lexer
if here
@token 'HERECOMMENT', @sanitizeHeredoc here,
herecomment: true, indent: Array(@indent + 1).join(' ')
@token 'TERMINATOR', '\n'
@line += count comment, '\n'
comment.length

View File

@@ -468,7 +468,7 @@ exports.Comment = class Comment extends Base
makeReturn: THIS
compileNode: (o, level) ->
code = '/*' + multident(@comment, @tab) + "\n#{@tab}*/"
code = '/*' + multident(@comment, @tab) + "\n#{@tab}*/\n"
code = o.indent + code if (level or o.level) is LEVEL_TOP
code