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

@ -1,3 +1,7 @@
# 1.14.18
* Fix files only containg comments not being output.
# 1.14.17
* Add default initializer to let variables within loop bodies.

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));

View File

@ -1,6 +1,6 @@
"use strict";
// from #23
/**/
/*
*/
test