improvements to hint:processing: show import stack, distinguish nims, show includes etc (#18372)

* improvements to hint:processing
* fix tests; do not show hintProcessing for nimscript unless given -d:nimHintProcessingNims
* fix trunner and avoid need for -d:nimHintProcessingNims
* fix some tests
This commit is contained in:
Timothee Cour 2021-06-29 22:16:31 -07:00 • committed by GitHub
commit 0483a5ffaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 19 deletions

View file

@ -19,18 +19,13 @@ type
config: ConfigRef
proc verboseOpen(graph: ModuleGraph; s: PSym; idgen: IdGenerator): PPassContext =
let conf = graph.config
result = VerboseRef(config: conf, idgen: idgen)
let path = toFilenameOption(conf, s.position.FileIndex, conf.filenameOption)
rawMessage(conf, hintProcessing, path)
# xxx consider either removing this or keeping for documentation for how to add a pass
result = VerboseRef(config: graph.config, idgen: idgen)
proc verboseProcess(context: PPassContext, n: PNode): PNode =
# called from `process` in `processTopLevelStmt`.
result = n
let v = VerboseRef(context)
if v.config.verbosity == 3:
# system.nim deactivates all hints, for verbosity:3 we want the processing
# messages nonetheless, so we activate them again (but honor cmdlineNotes)
v.config.setNote(hintProcessing)
message(v.config, n.info, hintProcessing, $v.idgen[])
message(v.config, n.info, hintProcessingStmt, $v.idgen[])
const verbosePass* = makePass(open = verboseOpen, process = verboseProcess)