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

cgen: use gen.expr for default fixed array init expr. closes #7411

This commit is contained in:
joe-conigliaro 2020-12-20 15:50:43 +11:00
parent 829334890b
commit bbcaaa1232
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1

View File

@ -1967,10 +1967,12 @@ fn (mut g Gen) gen_assign_stmt(assign_stmt ast.AssignStmt) {
if is_fixed_array_init && !has_val {
if val is ast.ArrayInit {
if val.has_default {
g.write('{$val.default_expr')
g.write('{')
g.expr(val.default_expr)
info := right_sym.info as table.ArrayFixed
for _ in 1 .. info.size {
g.write(', $val.default_expr')
g.write(', ')
g.expr(val.default_expr)
}
g.write('}')
} else {