1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix ./tracev examples/hello_world.v

This commit is contained in:
Delyan Angelov 2022-10-14 19:27:12 +03:00
parent 6bf2ad1ff0
commit 49c12e4d1c
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -7,7 +7,11 @@ import v.util
fn (mut g Gen) write(s string) {
$if trace_gen ? {
eprintln('gen file: ${g.file.path:-30} | last_fn_c_name: ${g.last_fn_c_name:-45} | write: $s')
if g.file == unsafe { nil } {
eprintln('gen file: <nil> | last_fn_c_name: ${g.last_fn_c_name:-45} | write: $s')
} else {
eprintln('gen file: ${g.file.path:-30} | last_fn_c_name: ${g.last_fn_c_name:-45} | write: $s')
}
}
if g.indent > 0 && g.empty_line {
g.out.write_string(util.tabs(g.indent))
@ -20,7 +24,11 @@ fn (mut g Gen) write(s string) {
fn (mut g Gen) writeln(s string) {
$if trace_gen ? {
eprintln('gen file: ${g.file.path:-30} | last_fn_c_name: ${g.last_fn_c_name:-45} | writeln: $s')
if g.file == unsafe { nil } {
eprintln('gen file: <nil> | last_fn_c_name: ${g.last_fn_c_name:-45} | writeln: $s')
} else {
eprintln('gen file: ${g.file.path:-30} | last_fn_c_name: ${g.last_fn_c_name:-45} | writeln: $s')
}
}
if g.indent > 0 && g.empty_line {
g.out.write_string(util.tabs(g.indent))