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

Merge pull request #3979 from lydell/herecomments-formatting

Fix formatting of `#`-only lines in herecomments
This commit is contained in:
Michael Ficarra 2015-05-13 09:02:34 -07:00
commit 769f02ec05
3 changed files with 3 additions and 3 deletions

View file

@ -74,7 +74,7 @@
for (i = 0, len = fragments.length; i < len; i++) {
fragment = fragments[i];
if (options.sourceMap) {
if (fragment.locationData) {
if (fragment.locationData && !/^[;\s]*$/.test(fragment.code)) {
map.add([fragment.locationData.first_line, fragment.locationData.first_column], [currentLine, currentColumn], {
noReplace: true
});

View file

@ -868,7 +868,7 @@
Comment.prototype.compileNode = function(o, level) {
var code, comment;
comment = this.comment.replace(/^(\s*)# /gm, "$1 * ");
comment = this.comment.replace(/^(\s*)#(?=\s)/gm, "$1 *");
code = "/*" + (multident(comment, this.tab)) + (indexOf.call(comment, '\n') >= 0 ? "\n" + this.tab : '') + " */";
if ((level || o.level) === LEVEL_TOP) {
code = o.indent + code;

View file

@ -584,7 +584,7 @@ exports.Comment = class Comment extends Base
makeReturn: THIS
compileNode: (o, level) ->
comment = @comment.replace /^(\s*)# /gm, "$1 * "
comment = @comment.replace /^(\s*)#(?=\s)/gm, "$1 *"
code = "/*#{multident comment, @tab}#{if '\n' in comment then "\n#{@tab}" else ''} */"
code = o.indent + code if (level or o.level) is LEVEL_TOP
[@makeCode("\n"), @makeCode(code)]