diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 911a90c4c5..3ec290ef12 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -469,7 +469,8 @@ pub: // That array is then passed to V's checker. pub struct File { pub: - path string // path of the source file + path string // absolute path of the source file - '/projects/v/file.v' + path_base string // file name - 'file.v' (useful for tracing) mod Module // the module of the source file (from `module xyz` at the top) global_scope &Scope pub mut: diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index f1a33cf973..f6af31448b 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -5298,3 +5298,9 @@ fn (mut c Checker) verify_all_vweb_routes() { } } } + +fn (mut c Checker) trace(fbase string, message string) { + if c.file.path_base == fbase { + println('> c.trace | ${fbase:-10s} | $message') + } +} diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 19ba147ca1..f4fadcabe7 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -5850,3 +5850,9 @@ pub fn get_guarded_include_text(iname string, imessage string) string { '.strip_margin() return res } + +fn (mut g Gen) trace(fbase string, message string) { + if g.file.path_base == fbase { + println('> g.trace | ${fbase:-10s} | $message') + } +} diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 7aef071a13..1b44ae2104 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -232,6 +232,7 @@ pub fn (mut p Parser) parse() ast.File { // return ast.File{ path: p.file_name + path_base: p.file_base mod: module_decl imports: p.ast_imports imported_symbols: p.imported_symbols