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

cgen: minor array_init fix

This commit is contained in:
yuyi
2020-06-12 08:19:48 +08:00
committed by GitHub
parent ff1437fc5a
commit 47ffedc5de

View File

@ -4345,13 +4345,11 @@ fn (mut g Gen) array_init(it ast.ArrayInit) {
g.write('sizeof($elem_type_str), ') g.write('sizeof($elem_type_str), ')
if is_default_array { if is_default_array {
g.write('_val_$it.pos.pos)') g.write('_val_$it.pos.pos)')
} else { } else if it.has_default || (it.has_len && it.elem_type == table.string_type) {
if it.has_default || (it.has_len && it.elem_type == table.string_type) {
g.write('&_val_$it.pos.pos)') g.write('&_val_$it.pos.pos)')
} else { } else {
g.write('0)') g.write('0)')
} }
}
return return
} }
len := it.exprs.len len := it.exprs.len