cgen: fixed array fix
parent
92d6eec09a
commit
d2cf6894fe
|
@ -477,14 +477,17 @@ fn (g mut Gen) expr(node ast.Expr) {
|
||||||
match node {
|
match node {
|
||||||
ast.ArrayInit {
|
ast.ArrayInit {
|
||||||
type_sym := g.table.get_type_symbol(it.typ)
|
type_sym := g.table.get_type_symbol(it.typ)
|
||||||
elem_sym := g.table.get_type_symbol(it.elem_type)
|
if type_sym.kind != .array_fixed {
|
||||||
g.write('new_array_from_c_array($it.exprs.len, $it.exprs.len, sizeof($type_sym.name), ')
|
elem_sym := g.table.get_type_symbol(it.elem_type)
|
||||||
g.writeln('(${elem_sym.name}[]){\t')
|
g.write('new_array_from_c_array($it.exprs.len, $it.exprs.len, sizeof($type_sym.name), ')
|
||||||
for expr in it.exprs {
|
g.writeln('(${elem_sym.name}[]){\t')
|
||||||
g.expr(expr)
|
for expr in it.exprs {
|
||||||
g.write(', ')
|
g.expr(expr)
|
||||||
|
g.write(', ')
|
||||||
|
}
|
||||||
|
g.write('\n})')
|
||||||
}
|
}
|
||||||
g.write('\n})')
|
else {}
|
||||||
}
|
}
|
||||||
ast.AsCast {
|
ast.AsCast {
|
||||||
g.write('/* as */')
|
g.write('/* as */')
|
||||||
|
|
Loading…
Reference in New Issue