fix comments-only rendering

This commit is contained in:
Sebastian McKenzie 2014-12-07 11:30:50 +11:00
parent 88a85c0ca8
commit eef0344cb2
2 changed files with 8 additions and 4 deletions

View File

@ -75,7 +75,7 @@ CodeGenerator.prototype.generate = function () {
_.each(ast.comments, function (comment) {
if (!comment._displayed) comments.push(comment);
});
if (comments.length) this._printComments(comments);
this._printComments(comments);
return {
map: this.map.get(),
@ -265,7 +265,13 @@ CodeGenerator.prototype._printComments = function (comments) {
var self = this;
_.each(comments, function (comment) {
comment._displayed = true;
// find the original comment in the ast and set it as displayed
_.each(self.ast.comments, function (origComment) {
if (origComment.start === comment.start) {
origComment._displayed = true;
return false;
}
});
// whitespace before
self.newline(self.whitespace.getNewlinesBefore(comment));

View File

@ -1,5 +1,3 @@
"use strict";
// from #23
/**/
/*