mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gen,checker: implement g.trace/2 and c.trace/2, similar to p.trace/2
This commit is contained in:
parent
263fb7d7a8
commit
c4c4b9c7b1
@ -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:
|
||||
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user