Files
Nim/compiler/passaux.nim
Andreas Rumpf 226595515c explicit ID generation for easier IC (#15559)
* refactoring: idents don't need inheritance
* refactoring: adding an IdGenerator (part 1)
* refactoring: adding an IdGenerator (part 2)
* refactoring: adding an IdGenerator (part 3)
* refactoring: adding an IdGenerator (part 4)
* refactoring: adding an IdGenerator (part 5)
* refactoring: adding an IdGenerator (part 5)
* IdGenerator must be a ref type; hello world works again
* make bootstrapping work again
* progress: add back the 'exactReplica' ideas
* added back the missing exactReplica hacks
* make tcompilerapi work again
* make important packages green
* attempt to fix the build for 32 bit machines (probably need a better solution here)
2020-10-25 08:50:47 +01:00

36 lines
1.1 KiB
Nim

#
#
# 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
ast, passes, idents, msgs, options, lineinfos
from modulegraphs import ModuleGraph, PPassContext
type
VerboseRef = ref object of PPassContext
config: ConfigRef
proc verboseOpen(graph: ModuleGraph; s: PSym; idgen: IdGenerator): PPassContext =
#MessageOut('compiling ' + s.name.s);
result = VerboseRef(config: graph.config, idgen: idgen)
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 (but honor cmdlineNotes)
v.config.setNote(hintProcessing)
message(v.config, n.info, hintProcessing, $v.idgen[])
const verbosePass* = makePass(open = verboseOpen, process = verboseProcess)