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

cgen: optimize the format of the generated code

This commit is contained in:
yuyi 2020-06-18 18:08:36 +08:00 committed by GitHub
parent 930c3d73c1
commit 947e8922f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4334,7 +4334,9 @@ fn (mut g Gen) array_init(it ast.ArrayInit) {
}
len := it.exprs.len
g.write('new_array_from_c_array($len, $len, sizeof($elem_type_str), _MOV(($elem_type_str[$len]){')
if len > 8 {
g.writeln('')
}
for i, expr in it.exprs {
if it.is_interface {
// sym := g.table.get_type_symbol(it.interface_types[i])
@ -4345,9 +4347,13 @@ fn (mut g Gen) array_init(it ast.ArrayInit) {
if it.is_interface {
g.write(')')
}
if i != len - 1 {
g.write(', ')
}
}
if len > 8 {
g.writeln('')
}
g.write('}))')
}