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

fix pushing to mutable array args

This commit is contained in:
Alexander Medvednikov
2019-09-29 17:02:28 +03:00
parent 918edad525
commit 83022a2478
4 changed files with 54 additions and 49 deletions

View File

@@ -948,9 +948,10 @@ fn (p mut Parser) fn_call_args(f mut Fn) &Fn {
// Reference
// TODO ptr hacks. DOOM hacks, fix please.
if !got_ptr && exp_ptr && got != 'voidptr' {
// Special case for mutable arrays. We can't `&` function results,
// Special case for mutable arrays. We can't `&` function
// results,
// have to use `(array[]){ expr }` hack.
if expected.starts_with('array_') && exp_ptr {
if expected.starts_with('array_') && exp_ptr { //&& !arg.is_mut{
p.cgen.set_placeholder(ph, '& /*111*/ (array[]){')
p.gen('}[0] ')
}