Skip to content

Commit d01cdbf

Browse files
committed
Fixed recursive function declarations
1 parent a292f71 commit d01cdbf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/LuaTransformer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3115,7 +3115,9 @@ export class LuaTransformer {
31153115
statements.push(
31163116
tstl.createAssignmentStatement(lhs.map(i => this.createExportedIdentifier(i)), rhs, parent));
31173117
} else {
3118-
if (tsOriginal && tsHelper.findFirstNodeAbove(tsOriginal, ts.isFunctionLike)) {
3118+
// TODO this check probably should be moved out of this function or be improved?
3119+
if (tsOriginal &&
3120+
(ts.isFunctionLike(tsOriginal) || tsHelper.findFirstNodeAbove(tsOriginal, ts.isFunctionLike))) {
31193121
// Separate declaration from assignment to allow for recursion
31203122
statements.push(tstl.createVariableDeclarationStatement(lhs, undefined, parent));
31213123
statements.push(tstl.createAssignmentStatement(lhs, rhs, parent));

0 commit comments

Comments
 (0)