1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

array of pointers support

This commit is contained in:
BigBlack
2019-12-18 08:26:04 +08:00
committed by Alexander Medvednikov
parent f00f9fbf5a
commit 67cf7f18e6
5 changed files with 27 additions and 15 deletions

View File

@ -676,11 +676,7 @@ fn (p mut Parser) gen_array_push(ph int, typ, expr_type, tmp, elm_type string) {
// Don't dereference if it's already a mutable array argument (`fn foo(mut []int)`)
push_call := if typ.contains('*'){'_PUSH('} else { '_PUSH(&'}
p.cgen.set_placeholder(ph, push_call)
if elm_type.ends_with('*') {
p.gen('), $tmp, ${elm_type[..elm_type.len - 1]})')
} else {
p.gen('), $tmp, $elm_type)')
}
p.gen('), $tmp, $elm_type)')
}
}