mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: auto dereference mutable variable upon return
This commit is contained in:
parent
14f13ff55a
commit
38db845378
@ -3352,7 +3352,11 @@ fn (p mut Parser) return_st() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if total_text == '' || expr_type == 'void*' {
|
if total_text == '' || expr_type == 'void*' {
|
||||||
p.cgen.resetln('return $ret')
|
if expr_type == '${p.cur_fn.typ}*' {
|
||||||
|
p.cgen.resetln('return *$ret')
|
||||||
|
} else {
|
||||||
|
p.cgen.resetln('return $ret')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tmp := p.get_tmp()
|
tmp := p.get_tmp()
|
||||||
p.cgen.resetln('$expr_type $tmp = $ret;\n')
|
p.cgen.resetln('$expr_type $tmp = $ret;\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user