1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: simplify slicing fixed array (#13767)

This commit is contained in:
Nick Treleaven 2022-03-18 14:50:30 +00:00 committed by GitHub
parent bb2ddb98a3
commit f903ef24e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,17 +115,8 @@ fn (mut g Gen) range_expr(node ast.IndexExpr, range ast.RangeExpr) {
g.write('array_slice(') g.write('array_slice(')
} }
g.write('new_array_from_c_array${noscan}(') g.write('new_array_from_c_array${noscan}(')
g.write('$info.size') ctype := g.typ(info.elem_type)
g.write(', $info.size') g.write('$info.size, $info.size, sizeof($ctype), ')
g.write(', sizeof(')
if node.left_type.is_ptr() {
g.write('(*')
}
g.expr(node.left)
if node.left_type.is_ptr() {
g.write(')')
}
g.write('[0]), ')
if node.left_type.is_ptr() { if node.left_type.is_ptr() {
g.write('*') g.write('*')
} }