Skip to content

Commit

Permalink
compileReturnStmt
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Aug 22, 2021
1 parent b8a1035 commit f7ab9b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cl/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ func compileReturnStmt(ctx *blockCtx, expr *ast.ReturnStmt) {
compileCompositeLit(ctx, c, typ, true)
} else {
twoValue := false
if _, ok := ret.(*ast.ComprehensionExpr); ok && len(expr.Results) == 1 {
results = ctx.cb.Func().Type().(*types.Signature).Results()
twoValue = (results.Len() == 2)
if len(expr.Results) == 1 {
if _, ok := ret.(*ast.ComprehensionExpr); ok {
results = ctx.cb.Func().Type().(*types.Signature).Results()
twoValue = (results.Len() == 2)
}
}
compileExpr(ctx, ret, twoValue)
}
Expand Down

0 comments on commit f7ab9b8

Please sign in to comment.