mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gen: fix pointer_str_test.v
This commit is contained in:
parent
0de70e8b2c
commit
047e982318
@ -8,7 +8,6 @@ const (
|
||||
skip_test_files = [
|
||||
'vlib/v/tests/enum_bitfield_test.v',
|
||||
'vlib/v/tests/pointers_test.v',
|
||||
'vlib/v/tests/pointers_str_test.v',
|
||||
'vlib/net/http/http_httpbin_test.v',
|
||||
]
|
||||
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('/*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() {
|
||||
// The receiver is a reference, but the caller provided a value
|
||||
// Add `&` automatically.
|
||||
// TODO same logic in call_args()
|
||||
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.expr(node.left)
|
||||
|
Loading…
Reference in New Issue
Block a user