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

array: fix a regression

This commit is contained in:
Alexander Medvednikov 2019-10-26 22:26:30 +03:00
parent 570a7aaaf3
commit dd12a85429

View File

@ -195,12 +195,12 @@ fn (p mut Parser) index_get(typ string, fn_ph int, cfg IndexConfig) {
p.gen('$index_expr ]')
}
else {
amp := if cfg.is_ptr { '&' } else { '' }
ref := if cfg.is_ptr { '*' } else { '' }
if cfg.is_slice {
p.gen(' array_slice($amp $index_expr) ')
p.gen(' array_slice($ref $index_expr) ')
}
else {
p.gen('( *($typ*) array_get($amp $index_expr) )')
p.gen('( *($typ*) array_get($ref $index_expr) )')
}
}
}