mirror of
https://github.com/vlang/v.git
synced 2025-09-14 15:02:33 +03:00
compiler: no need to optimize println on Windows
this fixes string interpolation
This commit is contained in:
parent
e592485395
commit
f3d6bc9146
2 changed files with 15 additions and 11 deletions
|
@ -2395,12 +2395,14 @@ fn (p mut Parser) string_expr() {
|
|||
return
|
||||
}
|
||||
// println: don't allocate a new string, just print it.
|
||||
cur_line := p.cgen.cur_line.trim_space()
|
||||
if cur_line.contains('println (') && p.tok != .plus &&
|
||||
!cur_line.contains('string_add') && !cur_line.contains('eprintln') {
|
||||
p.cgen.resetln(cur_line.replace('println (', 'printf('))
|
||||
p.gen('$format\\n$args')
|
||||
return
|
||||
$if !windows {
|
||||
cur_line := p.cgen.cur_line.trim_space()
|
||||
if cur_line.contains('println (') && p.tok != .plus &&
|
||||
!cur_line.contains('string_add') && !cur_line.contains('eprintln') {
|
||||
p.cgen.resetln(cur_line.replace('println (', 'printf('))
|
||||
p.gen('$format\\n$args')
|
||||
return
|
||||
}
|
||||
}
|
||||
// '$age'! means the user wants this to be a tmp string (uses global buffer, no allocation,
|
||||
// won't be used again)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue