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
|
// push a single element
|
||||||
elem_type_str := g.typ(array_info.elem_type)
|
elem_type_str := g.typ(array_info.elem_type)
|
||||||
elem_sym := g.table.sym(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*)')
|
g.write('array_push${noscan}((array*)')
|
||||||
if !left.typ.is_ptr()
|
if !left.typ.is_ptr()
|
||||||
|| (node.left_type.has_flag(.shared_f) && !node.left_type.deref().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 {
|
if elem_sym.kind == .function {
|
||||||
g.write(', _MOV((voidptr[]){ ')
|
g.write(', _MOV((voidptr[]){ ')
|
||||||
} else if elem_is_array {
|
} else if elem_is_array_var {
|
||||||
g.write(', &')
|
g.write(', &')
|
||||||
} else {
|
} else {
|
||||||
g.write(', _MOV(($elem_type_str[]){ ')
|
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 {
|
if needs_clone {
|
||||||
g.write(')')
|
g.write(')')
|
||||||
}
|
}
|
||||||
if elem_is_array {
|
if elem_is_array_var {
|
||||||
g.write(')')
|
g.write(')')
|
||||||
} else {
|
} else {
|
||||||
g.write(' }))')
|
g.write(' }))')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue