summary refs log blame commit diff stats
path: root/compiler/passaux.nim
blob: 09f656d58f841baef48a354cc3ada18ba2da944b (plain) (tree)
1
2
3
4
5
6
7
8
9

 
                            
                                         




                                                   
                                       
 
      
                                                                         
 
                                                  
 
    
                                         

                     
                                                             
                                       

                                                    

                                                             
            
                             
                             

                                                                              

                                                                 
 
                                                                           
#
#
#           The Nim Compiler
#        (c) Copyright 2012 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## implements some little helper passes

import
  strutils, ast, astalgo, passes, idents, msgs, options, idgen, lineinfos

from modulegraphs import ModuleGraph, PPassContext

type
  VerboseRef = ref object of PPassContext
    config: ConfigRef

proc verboseOpen(graph: ModuleGraph; s: PSym): PPassContext =
  #MessageOut('compiling ' + s.name.s);
  result = VerboseRef(config: graph.config)
  rawMessage(graph.config, hintProcessing, s.name.s)

proc verboseProcess(context: PPassContext, n: PNode): PNode =
  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 unconditionally:
    incl(v.config.notes, hintProcessing)
    message(v.config, n.info, hintProcessing, $idgen.gFrontendId)

const verbosePass* = makePass(open = verboseOpen, process = verboseProcess)