compiler: stricter non-allocation condition for print optimization
parent
29e0396eca
commit
2507735596
|
@ -2536,8 +2536,7 @@ fn (p mut Parser) string_expr() {
|
||||||
// println: don't allocate a new string, just print it.
|
// println: don't allocate a new string, just print it.
|
||||||
$if !windows {
|
$if !windows {
|
||||||
cur_line := p.cgen.cur_line.trim_space()
|
cur_line := p.cgen.cur_line.trim_space()
|
||||||
if cur_line.contains('println (') && p.tok != .plus &&
|
if cur_line == 'println (' && p.tok != .plus {
|
||||||
!cur_line.contains('string_add') && !cur_line.contains('eprintln') {
|
|
||||||
p.cgen.resetln(cur_line.replace('println (', 'printf('))
|
p.cgen.resetln(cur_line.replace('println (', 'printf('))
|
||||||
p.gen('$format\\n$args')
|
p.gen('$format\\n$args')
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue