gen: fix pointer_str_test.v
parent
0de70e8b2c
commit
047e982318
|
@ -8,7 +8,6 @@ const (
|
||||||
skip_test_files = [
|
skip_test_files = [
|
||||||
'vlib/v/tests/enum_bitfield_test.v',
|
'vlib/v/tests/enum_bitfield_test.v',
|
||||||
'vlib/v/tests/pointers_test.v',
|
'vlib/v/tests/pointers_test.v',
|
||||||
'vlib/v/tests/pointers_str_test.v',
|
|
||||||
'vlib/net/http/http_httpbin_test.v',
|
'vlib/net/http/http_httpbin_test.v',
|
||||||
]
|
]
|
||||||
skip_on_musl = [
|
skip_on_musl = [
|
||||||
|
|
|
@ -364,13 +364,17 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
|
||||||
// g.write('/*${g.typ(node.receiver_type)}*/')
|
// g.write('/*${g.typ(node.receiver_type)}*/')
|
||||||
// g.write('/*expr_type=${g.typ(node.left_type)} rec type=${g.typ(node.receiver_type)}*/')
|
// g.write('/*expr_type=${g.typ(node.left_type)} rec type=${g.typ(node.receiver_type)}*/')
|
||||||
// }
|
// }
|
||||||
g.write('${name}(')
|
if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name == 'str' {
|
||||||
|
g.write('ptr_str(')
|
||||||
|
} else {
|
||||||
|
g.write('${name}(')
|
||||||
|
}
|
||||||
if node.receiver_type.is_ptr() && !node.left_type.is_ptr() {
|
if node.receiver_type.is_ptr() && !node.left_type.is_ptr() {
|
||||||
// The receiver is a reference, but the caller provided a value
|
// The receiver is a reference, but the caller provided a value
|
||||||
// Add `&` automatically.
|
// Add `&` automatically.
|
||||||
// TODO same logic in call_args()
|
// TODO same logic in call_args()
|
||||||
g.write('&')
|
g.write('&')
|
||||||
} else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() {
|
} else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name != 'str' {
|
||||||
g.write('/*rec*/*')
|
g.write('/*rec*/*')
|
||||||
}
|
}
|
||||||
g.expr(node.left)
|
g.expr(node.left)
|
||||||
|
|
Loading…
Reference in New Issue