Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 3, 2023
1 parent f9f6ee7 commit 2142430
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion vlib/v/gen/c/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,21 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
g.write(')')
}
} else {
g.expr(node.left)
if is_range_slice && node.left is ast.IndexExpr && node.left.index is ast.RangeExpr {
arr_type := g.unwrap_generic(node.left.left_type)
arr_sym := g.table.final_sym(arr_type)

if arr_sym.kind == .array_fixed {
arr_info := arr_sym.array_fixed_info()
g.write('new_array_from_c_array_no_alloc(${arr_info.size}, 0, sizeof(${g.typ(arr_info.elem_type)}), ')
g.expr(node.left.left)
g.write(')')
} else {
g.expr(node.left)
}
} else {
g.expr(node.left)
}
}
if !is_interface || node.from_embed_types.len == 0 {
for i, embed in node.from_embed_types {
Expand Down

0 comments on commit 2142430

Please sign in to comment.