interactive debugging

This commit is contained in:
Emily Hudson 2019-07-26 15:45:16 +01:00 committed by Alexander Medvednikov
parent 8b195ba32a
commit 90bb48db5d
4 changed files with 27 additions and 14 deletions

View file

@ -24,14 +24,17 @@ struct CGen {
//buf strings.Builder
is_user bool
mut:
run Pass
nogen bool
tmp_line string
cur_line string
prev_line string
is_tmp bool
fn_main string
stash string
run Pass
nogen bool
tmp_line string
cur_line string
prev_line string
is_tmp bool
fn_main string
stash string
file string
line int
line_directives bool
}
fn new_cgen(out_name_c string) *CGen {
@ -44,7 +47,7 @@ fn new_cgen(out_name_c string) *CGen {
out_path: path
out: out
//buf: strings.new_builder(10000)
lines: _make(0, 1000, sizeof(string))
lines: _make(0, 1000, sizeof(string))
}
return gen
}
@ -59,6 +62,9 @@ fn (g mut CGen) genln(s string) {
}
g.cur_line = '$g.cur_line $s'
if g.cur_line != '' {
if g.line_directives && g.cur_line.trim_space() != '' {
g.lines << '#line $g.line "$g.file"'
}
g.lines << g.cur_line
g.prev_line = g.cur_line
g.cur_line = ''