array: fix a regression

pull/2558/head
Alexander Medvednikov 2019-10-26 22:26:30 +03:00
parent 570a7aaaf3
commit dd12a85429
1 changed files with 3 additions and 3 deletions

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) )')
}
}
}