mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix return formatting
This commit is contained in:
parent
b290efa394
commit
0f08a92302
@ -1309,6 +1309,7 @@ fn (g mut Gen) return_statement(it ast.Return) {
|
||||
fn_return_is_optional := table.type_is_optional(g.fn_decl.return_type)
|
||||
// multiple returns
|
||||
if it.exprs.len > 1 {
|
||||
g.write(' ')
|
||||
typ_sym := g.table.get_type_symbol(g.fn_decl.return_type)
|
||||
mr_info := typ_sym.info as table.MultiReturn
|
||||
mut styp := g.typ(g.fn_decl.return_type)
|
||||
@ -1331,6 +1332,7 @@ fn (g mut Gen) return_statement(it ast.Return) {
|
||||
}
|
||||
// normal return
|
||||
else if it.exprs.len == 1 {
|
||||
g.write(' ')
|
||||
// `return opt_ok(expr)` for functions that expect an optional
|
||||
if fn_return_is_optional && !table.type_is_optional(it.types[0]) {
|
||||
mut is_none := false
|
||||
|
Loading…
Reference in New Issue
Block a user