passaux.nim 1.0 KB

1234567891011121314151617181920212223242526272829303132
  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. strutils, ast, astalgo, passes, idents, msgs, options, idgen
  12. from modulegraphs import ModuleGraph
  13. proc verboseOpen(graph: ModuleGraph; s: PSym; cache: IdentCache): PPassContext =
  14. #MessageOut('compiling ' + s.name.s);
  15. result = nil # we don't need a context
  16. rawMessage(hintProcessing, s.name.s)
  17. proc verboseProcess(context: PPassContext, n: PNode): PNode =
  18. result = n
  19. if context != nil: internalError("logpass: context is not nil")
  20. if gVerbosity == 3:
  21. # system.nim deactivates all hints, for verbosity:3 we want the processing
  22. # messages nonetheless, so we activate them again unconditionally:
  23. incl(msgs.gNotes, hintProcessing)
  24. message(n.info, hintProcessing, $idgen.gFrontendId)
  25. const verbosePass* = makePass(open = verboseOpen, process = verboseProcess)