passaux.nim 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #
  2. #
  3. # The Nim Compiler
  4. # (c) Copyright 2012 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. ## implements some little helper passes
  10. import
  11. ast, passes, idents, msgs, options, idgen, lineinfos
  12. from modulegraphs import ModuleGraph, PPassContext
  13. type
  14. VerboseRef = ref object of PPassContext
  15. config: ConfigRef
  16. proc verboseOpen(graph: ModuleGraph; s: PSym): PPassContext =
  17. #MessageOut('compiling ' + s.name.s);
  18. result = VerboseRef(config: graph.config)
  19. rawMessage(graph.config, hintProcessing, s.name.s)
  20. proc verboseProcess(context: PPassContext, n: PNode): PNode =
  21. result = n
  22. let v = VerboseRef(context)
  23. if v.config.verbosity == 3:
  24. # system.nim deactivates all hints, for verbosity:3 we want the processing
  25. # messages nonetheless, so we activate them again (but honor cmdlineNotes)
  26. v.config.setNote(hintProcessing)
  27. message(v.config, n.info, hintProcessing, $idgen.gFrontEndId)
  28. const verbosePass* = makePass(open = verboseOpen, process = verboseProcess)