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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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