array: minor fixes
parent
511a3d3901
commit
ff6e0df0a5
|
@ -862,10 +862,10 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn {
|
||||||
// Reference
|
// Reference
|
||||||
// TODO ptr hacks. DOOM hacks, fix please.
|
// TODO ptr hacks. DOOM hacks, fix please.
|
||||||
if !got.contains('*') && expected.contains('*') && got != 'voidptr' {
|
if !got.contains('*') && expected.contains('*') && got != 'voidptr' {
|
||||||
// Special case for mutable arrays. We can't & function results,
|
// Special case for mutable arrays. We can't `&` function results,
|
||||||
// have to use `(array[]){ expr }` hack.
|
// have to use `(array[]){ expr }` hack.
|
||||||
if expected.starts_with('array_') && expected.ends_with('*') {
|
if expected.starts_with('array_') && expected.ends_with('*') {
|
||||||
p.cgen.set_placeholder(ph, '& /*111*/ (array_int[]){')
|
p.cgen.set_placeholder(ph, '& /*111*/ (array[]){')
|
||||||
p.gen('} ')
|
p.gen('} ')
|
||||||
}
|
}
|
||||||
// println('\ne:"$expected" got:"$got"')
|
// println('\ne:"$expected" got:"$got"')
|
||||||
|
|
|
@ -186,6 +186,8 @@ fn test_mut_slice() {
|
||||||
mut n := [1,2,3]
|
mut n := [1,2,3]
|
||||||
modify(mut n.left(2))
|
modify(mut n.left(2))
|
||||||
assert n[0] == 777
|
assert n[0] == 777
|
||||||
|
modify(mut n.right(2))
|
||||||
|
assert n[2] == 777
|
||||||
println(n)
|
println(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue