mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: minor cleanup in ref_or_deref_arg() (#14862)
This commit is contained in:
parent
044698746e
commit
6be287d476
@ -1993,17 +1993,17 @@ fn (mut g Gen) keep_alive_call_postgen(node ast.CallExpr, tmp_cnt_save int) {
|
||||
|
||||
[inline]
|
||||
fn (mut g Gen) ref_or_deref_arg(arg ast.CallArg, expected_type ast.Type, lang ast.Language) {
|
||||
arg_is_ptr := expected_type.is_ptr() || expected_type.idx() in ast.pointer_type_idxs
|
||||
expr_is_ptr := arg.typ.is_ptr() || arg.typ.idx() in ast.pointer_type_idxs
|
||||
exp_is_ptr := expected_type.is_ptr() || expected_type.idx() in ast.pointer_type_idxs
|
||||
arg_is_ptr := arg.typ.is_ptr() || arg.typ.idx() in ast.pointer_type_idxs
|
||||
if expected_type == 0 {
|
||||
g.checker_bug('ref_or_deref_arg expected_type is 0', arg.pos)
|
||||
}
|
||||
exp_sym := g.table.sym(expected_type)
|
||||
arg_typ := g.unwrap_generic(arg.typ)
|
||||
mut needs_closing := false
|
||||
if arg.is_mut && !arg_is_ptr {
|
||||
if arg.is_mut && !exp_is_ptr {
|
||||
g.write('&/*mut*/')
|
||||
} else if arg_is_ptr && !expr_is_ptr {
|
||||
} else if exp_is_ptr && !arg_is_ptr {
|
||||
if arg.is_mut {
|
||||
arg_sym := g.table.sym(arg_typ)
|
||||
if exp_sym.kind == .array {
|
||||
|
Loading…
Reference in New Issue
Block a user