gen: correct indirection difference between reciever and object (#8903)
parent
d78c9476e9
commit
79edff5c6c
|
@ -647,7 +647,21 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
|
||||||
if !node.left_type.has_flag(.shared_f) {
|
if !node.left_type.has_flag(.shared_f) {
|
||||||
g.write('/*rec*/*')
|
g.write('/*rec*/*')
|
||||||
}
|
}
|
||||||
|
} else if !is_range_slice && node.from_embed_type == 0 && node.name != 'str' {
|
||||||
|
diff := node.left_type.nr_muls() - node.receiver_type.nr_muls()
|
||||||
|
if diff < 0 {
|
||||||
|
// TODO
|
||||||
|
// g.write('&')
|
||||||
|
} else if diff > 0 {
|
||||||
|
g.write('/*diff=$diff*/')
|
||||||
|
g.write([]byte{len: diff, init: `*`}.bytestr())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if node.left_type.idx() != node.receiver_type.idx() {
|
||||||
|
// println('${g.typ(node.left_type)} ${g.typ(node.receiver_type)}')
|
||||||
|
// }
|
||||||
|
|
||||||
if g.is_autofree && node.free_receiver && !g.inside_lambda && !g.is_builtin_mod {
|
if g.is_autofree && node.free_receiver && !g.inside_lambda && !g.is_builtin_mod {
|
||||||
// The receiver expression needs to be freed, use the temp var.
|
// The receiver expression needs to be freed, use the temp var.
|
||||||
fn_name := node.name.replace('.', '_')
|
fn_name := node.name.replace('.', '_')
|
||||||
|
|
Loading…
Reference in New Issue