Skip to content

Commit eb65053

Browse files
authored
Merge pull request #13 from lolleko/patch-1
Empty Return Fix
2 parents 36c2376 + d6c2180 commit eb65053

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Transpiler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,11 @@ export class LuaTranspiler {
337337
}
338338

339339
transpileReturn(node: ts.ReturnStatement): string {
340-
return "return " + this.transpileExpression(node.expression);
340+
if (node.expression) {
341+
return "return " + this.transpileExpression(node.expression);
342+
} else {
343+
return "return"
344+
}
341345
}
342346

343347
transpileExpression(node: ts.Node, brackets?: boolean): string {
@@ -941,4 +945,4 @@ export class LuaTranspiler {
941945
return `function(${paramNames.join(",")}) return ` + this.transpileExpression(node.body) + " end";
942946
}
943947
}
944-
}
948+
}

0 commit comments

Comments
 (0)