Fixed: blank file as input produces invalid javascript file #34

Merged
merged 1 commit into from Aug 3, 2012
View
@@ -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;
};