From d2cf6894fef89b6b004c3bf750d1bd5b8eb5ef36 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 12 Mar 2020 09:29:52 +0100 Subject: [PATCH] cgen: fixed array fix --- vlib/v/gen/cgen.v | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 94553bd89f..da5aee96f0 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -477,14 +477,17 @@ fn (g mut Gen) expr(node ast.Expr) { match node { ast.ArrayInit { type_sym := g.table.get_type_symbol(it.typ) - elem_sym := g.table.get_type_symbol(it.elem_type) - g.write('new_array_from_c_array($it.exprs.len, $it.exprs.len, sizeof($type_sym.name), ') - g.writeln('(${elem_sym.name}[]){\t') - for expr in it.exprs { - g.expr(expr) - g.write(', ') + if type_sym.kind != .array_fixed { + elem_sym := g.table.get_type_symbol(it.elem_type) + g.write('new_array_from_c_array($it.exprs.len, $it.exprs.len, sizeof($type_sym.name), ') + g.writeln('(${elem_sym.name}[]){\t') + for expr in it.exprs { + g.expr(expr) + g.write(', ') + } + g.write('\n})') } - g.write('\n})') + else {} } ast.AsCast { g.write('/* as */')