fix files only containg comments not being output - fixes #259

This commit is contained in:
Sebastian McKenzie
2014-12-07 11:19:17 +11:00
parent 302e6f4caa
commit 88a85c0ca8
4 changed files with 14 additions and 2 deletions

View File

@@ -71,6 +71,12 @@ CodeGenerator.prototype.generate = function () {
this.print(ast);
var comments = [];
_.each(ast.comments, function (comment) {
if (!comment._displayed) comments.push(comment);
});
if (comments.length) this._printComments(comments);
return {
map: this.map.get(),
code: this.buffer.get()
@@ -259,6 +265,8 @@ CodeGenerator.prototype._printComments = function (comments) {
var self = this;
_.each(comments, function (comment) {
comment._displayed = true;
// whitespace before
self.newline(self.whitespace.getNewlinesBefore(comment));