diff options
author | Adam Strzelecki <ono@java.pl> | 2015-09-04 23:02:43 +0200 |
---|---|---|
committer | Adam Strzelecki <ono@java.pl> | 2015-09-04 23:03:22 +0200 |
commit | d68181246571de5799059cf6402f1c578cd9421c (patch) | |
tree | 2e09aaf2da9ba589a1604fdb8a955bf9774041d2 /compiler/passaux.nim | |
parent | 37fe21b64ac348e7412c524a8a6e05d4fe6f877c (diff) | |
download | Nim-d68181246571de5799059cf6402f1c578cd9421c.tar.gz |
compiler: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
Diffstat (limited to 'compiler/passaux.nim')
-rw-r--r-- | compiler/passaux.nim | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/compiler/passaux.nim b/compiler/passaux.nim index c3bafe7df..9b9fdca4e 100644 --- a/compiler/passaux.nim +++ b/compiler/passaux.nim @@ -9,38 +9,38 @@ ## implements some little helper passes -import +import strutils, ast, astalgo, passes, msgs, options, idgen proc verboseOpen(s: PSym): PPassContext = #MessageOut('compiling ' + s.name.s); result = nil # we don't need a context rawMessage(hintProcessing, s.name.s) - -proc verboseProcess(context: PPassContext, n: PNode): PNode = + +proc verboseProcess(context: PPassContext, n: PNode): PNode = result = n if context != nil: internalError("logpass: context is not nil") - if gVerbosity == 3: + 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.gBackendId) - + const verbosePass* = makePass(open = verboseOpen, process = verboseProcess) -proc cleanUp(c: PPassContext, n: PNode): PNode = +proc cleanUp(c: PPassContext, n: PNode): PNode = result = n # we cannot clean up if dead code elimination is activated - if optDeadCodeElim in gGlobalOptions or n == nil: return + if optDeadCodeElim in gGlobalOptions or n == nil: return case n.kind - of nkStmtList: + of nkStmtList: for i in countup(0, sonsLen(n) - 1): discard cleanUp(c, n.sons[i]) - of nkProcDef, nkMethodDef: - if n.sons[namePos].kind == nkSym: + of nkProcDef, nkMethodDef: + if n.sons[namePos].kind == nkSym: var s = n.sons[namePos].sym - if sfDeadCodeElim notin getModule(s).flags and not astNeeded(s): + if sfDeadCodeElim notin getModule(s).flags and not astNeeded(s): s.ast.sons[bodyPos] = ast.emptyNode # free the memory - else: + else: discard const cleanupPass* = makePass(process = cleanUp, close = cleanUp) |