cgen: fix missing line breaks in generated code with closure IIFE, when compiled with '-g' (fix #20306) (#20316)

This commit is contained in:
shove 2023-12-31 13:04:41 +08:00 committed by GitHub
parent 969402461f
commit cc250baf3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -16,7 +16,7 @@ import sokol.gfx
import sokol.sgl
import sokol.sapp
import stbi
import szip
import compress.szip
import strings
// Help text
@ -801,10 +801,10 @@ fn main() {
// App init
mut app := &App{
gg: 0
gg: unsafe { nil }
// zip fields
zip: 0
item_list: 0
zip: unsafe { nil }
item_list: unsafe { nil }
}
app.state = .scanning

View File

@ -9,7 +9,7 @@
* TODO:
**********************************************************************/
import sokol.gfx
import szip
import compress.szip
fn (mut il Item_list) scan_zip(path string, in_index int) ! {
println('Scanning ZIP [${path}]')

View File

@ -701,6 +701,9 @@ fn (mut g Gen) call_expr(node ast.CallExpr) {
g.expr(node.left)
g.writeln(';')
g.write(line)
if g.out.last_n(1) != '\n' {
g.writeln('')
}
g.write(tmp_var)
} else if node.or_block.kind == .absent {
g.expr(node.left)