summary refs log tree commit diff stats
path: root/compiler/passaux.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/passaux.nim')
-rw-r--r--compiler/passaux.nim26
1 files changed, 14 insertions, 12 deletions
diff --git a/compiler/passaux.nim b/compiler/passaux.nim
index 2065d5893..af507d210 100644
--- a/compiler/passaux.nim
+++ b/compiler/passaux.nim
@@ -10,22 +10,24 @@
 ## implements some little helper passes
 
 import
-  strutils, ast, astalgo, passes, idents, msgs, options, idgen
+  ast, passes, msgs, options, lineinfos
 
-from modulegraphs import ModuleGraph
+from modulegraphs import ModuleGraph, PPassContext
 
-proc verboseOpen(graph: ModuleGraph; s: PSym; cache: IdentCache): PPassContext =
-  #MessageOut('compiling ' + s.name.s);
-  result = nil                # we don't need a context
-  rawMessage(hintProcessing, s.name.s)
+type
+  VerboseRef = ref object of PPassContext
+    config: ConfigRef
+
+proc verboseOpen(graph: ModuleGraph; s: PSym; idgen: IdGenerator): PPassContext =
+  # xxx consider either removing this or keeping for documentation for how to add a pass
+  result = VerboseRef(config: graph.config, idgen: idgen)
+
+import std/objectdollar
 
 proc verboseProcess(context: PPassContext, n: PNode): PNode =
+  # called from `process` in `processTopLevelStmt`.
   result = n
-  if context != nil: internalError("logpass: context is not nil")
-  if gVerbosity == 3:
-    # system.nim deactivates all hints, for verbosity:3 we want the processing
-    # messages nonetheless, so we activate them again unconditionally:
-    incl(msgs.gNotes, hintProcessing)
-    message(n.info, hintProcessing, $idgen.gFrontendId)
+  let v = VerboseRef(context)
+  message(v.config, n.info, hintProcessingStmt, $v.idgen[])
 
 const verbosePass* = makePass(open = verboseOpen, process = verboseProcess)