fix non-variable array value
parent
019f1a8c80
commit
0fc0ac8032
|
|
@ -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(' }))')
|
||||
|
|
|
|||
Loading…
Reference in New Issue