Skip to content

Commit

Permalink
cgen: fix missing line breaks in generated code with closure IIFE, wh…
Browse files Browse the repository at this point in the history
…en compiled with '-g' (fix #20306) (#20316)
  • Loading branch information
shove70 authored Dec 31, 2023
1 parent 9694024 commit cc250ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions examples/viewer/view.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import sokol.gfx
import sokol.sgl
import sokol.sapp
import stbi
import szip
import compress.szip
import strings

// Help text
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/viewer/zip_container.v
Original file line number Diff line number Diff line change
Expand Up @@ -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}]')
Expand Down
3 changes: 3 additions & 0 deletions vlib/v/gen/c/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cc250ba

Please sign in to comment.