Skip to content

Commit

Permalink
Check if function returns any results at all
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Apr 8, 2021
1 parent 8ce590a commit 2c7ad94
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transpiler/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func getFunctionReturnCount(ctx context.Context, callExpr *ast.CallExpr) (int, e
global := ctx.Value(contextGlobal).(*Global)
for _, function := range global.Functions {
if function.Name == funcName {
if function.Declaration.Type.Results == nil {
return 0, nil
}
return len(function.Declaration.Type.Results.List), nil
}
}
Expand Down

0 comments on commit 2c7ad94

Please sign in to comment.