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

v panic debug information

This commit is contained in:
joe-conigliaro
2019-07-30 23:08:14 +10:00
committed by Alexander Medvednikov
parent 07ed320110
commit 5e57d099d7
2 changed files with 23 additions and 0 deletions

View File

@ -752,6 +752,16 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn {
p.check(.rpar)
return f
}
// add debug information to panic when -debug arg is passed
if p.v.pref.is_debug && f.name == 'panic' {
mod_name := p.mod.replace('_dot_', '.')
fn_name := p.cur_fn.name.replace('${p.mod}__', '')
file_path := p.file_path.replace('\\', '\\\\') // escape \
p.cgen.resetln(p.cgen.cur_line.replace(
'v_panic (',
'_panic_debug ($p.scanner.line_nr, tos2("$file_path"), tos2("$mod_name"), tos2("$fn_name"), '
))
}
// Receiver - first arg
for i, arg in f.args {
// println('$i) arg=$arg.name')