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

pull/7424/head
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
1 changed files with 4 additions and 2 deletions

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 {