cgen: insert a newline every 8 elements in array init (#10034)

pull/10038/head^2
zakuro 2021-05-08 19:35:21 +09:00 committed by GitHub
parent 262ef7598d
commit 82a9add25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -113,7 +113,12 @@ fn (mut g Gen) array_init(node ast.ArrayInit) {
for i, expr in node.exprs {
g.expr_with_cast(expr, node.expr_types[i], node.elem_type)
if i != len - 1 {
g.write(', ')
if i > 0 && i & 7 == 0 { // i > 0 && i % 8 == 0
g.writeln(',')
g.write('\t\t')
} else {
g.write(', ')
}
}
}
g.write('}))')