Browse files

fix output on blank file input, previously produced invalid javascrip…

…t, now it produces a valid file
  • Loading branch information...
1 parent a030385 commit dcbd1269ab5bfd141cb33a63fb57722ca97902a1 @sktaylor sktaylor committed Aug 2, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/ast.js
View
7 lib/ast.js
@@ -1995,7 +1995,12 @@ function Program (shbang, statements) {
out.addLine ("var __tame_defer_cb = null;");
var body = this._body.compile (eng);
out.addOutput (body);
- out.addLine (body.fnName() + " (" + out.endFn() + ");");
+ if(body.fnName() === undefined){
+ out.addLine ("(function(){})(" + out.endFn() + ");");
+ }else{
+ out.addLine (body.fnName() + " (" + out.endFn() + ");");
+ }
+
return out;
};

0 comments on commit dcbd126

Please sign in to comment.