mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: call string method in C funtion parameter
This commit is contained in:
parent
2880baa1bc
commit
8fe46d5db5
@ -2501,7 +2501,11 @@ fn (p mut Parser) string_expr() {
|
||||
p.fgen('\'$str\'')
|
||||
f := format_str(str)
|
||||
// `C.puts('hi')` => `puts("hi");`
|
||||
if p.calling_c || (p.pref.translated && p.mod == 'main') {
|
||||
/*
|
||||
Calling a C function sometimes requires a call to a string method
|
||||
C.fun('ssss'.to_wide()) => fun(string_to_wide(tos2((byte*)('ssss'))))
|
||||
*/
|
||||
if (p.calling_c && p.peek() != .dot) || (p.pref.translated && p.mod == 'main') {
|
||||
p.gen('"$f"')
|
||||
}
|
||||
else if p.is_sql {
|
||||
|
Loading…
Reference in New Issue
Block a user