From 0fc0ac80326475297e6932be6b11ae0e86de825f Mon Sep 17 00:00:00 2001 From: yuyi98 Date: Sat, 2 Apr 2022 14:41:01 +0800 Subject: [PATCH] fix non-variable array value --- vlib/v/gen/c/infix_expr.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/v/gen/c/infix_expr.v b/vlib/v/gen/c/infix_expr.v index b459f023c8..04140453e2 100644 --- a/vlib/v/gen/c/infix_expr.v +++ b/vlib/v/gen/c/infix_expr.v @@ -613,7 +613,7 @@ fn (mut g Gen) infix_expr_left_shift_op(node ast.InfixExpr) { // push a single element elem_type_str := g.typ(array_info.elem_type) elem_sym := g.table.sym(array_info.elem_type) - elem_is_array := elem_sym.kind in [.array, .array_fixed] && node.right !is ast.ArrayInit + elem_is_array_var := elem_sym.kind in [.array, .array_fixed] && node.right is ast.Ident g.write('array_push${noscan}((array*)') if !left.typ.is_ptr() || (node.left_type.has_flag(.shared_f) && !node.left_type.deref().is_ptr()) { @@ -625,7 +625,7 @@ fn (mut g Gen) infix_expr_left_shift_op(node ast.InfixExpr) { } if elem_sym.kind == .function { g.write(', _MOV((voidptr[]){ ') - } else if elem_is_array { + } else if elem_is_array_var { g.write(', &') } else { g.write(', _MOV(($elem_type_str[]){ ') @@ -639,7 +639,7 @@ fn (mut g Gen) infix_expr_left_shift_op(node ast.InfixExpr) { if needs_clone { g.write(')') } - if elem_is_array { + if elem_is_array_var { g.write(')') } else { g.write(' }))')