summary refs log tree commit diff stats
path: root/lib/pure/ioselects
Commit message (Expand)AuthorAgeFilesLines
...
* Resolve #4606cheatfate2016-08-121-0/+4
* Simplify SharedArray.cheatfate2016-07-051-1/+1
* Patch one more path problemcheatfate2016-07-054-0/+1611
committer Andreas Rumpf <andreas@andreas-desktop> 2009-12-07 01:23:19 +0100 version 0.8.5: added Nimrod version of the compiler' href='/ahoang/Nim/commit/rod/passaux.nim?h=devel&id=e254741541b0389dfb0b675116c76a6a144b90b7'>e25474154 ^
3005955d2 ^
e25474154 ^
d68181246 ^
29db0d858 ^
e25474154 ^
9e6fb3f69 ^


e25474154 ^

14e6ff678 ^
d68181246 ^

e25474154 ^
92b8fac94 ^
d68181246 ^
3005955d2 ^


4b0ba5e3f ^
d68181246 ^
091c1b307 ^
e25474154 ^
d68181246 ^
36e25a684 ^
03724c295 ^
d68181246 ^
e25474154 ^
d68181246 ^
92b8fac94 ^
d68181246 ^

3005955d2 ^
d68181246 ^
c51763915 ^
d68181246 ^
73c6efdf6 ^
e25474154 ^
091c1b307 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

 
                            
                                         




                                                   
                                       
 
      
                                                              
 


                                                                                

                                                       
                                      

                                                             
            
                                                                 
                     


                                                                              
                                                       
 
                                                                           
 
                                                
            
                                                            
                                                          
             
                
                                                                      

                                     
                                 
                                                                      
                                                             
       
           
 

                                                                 
#
#
#           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

from modulegraphs import ModuleGraph

proc verboseOpen(graph: ModuleGraph; s: PSym; cache: IdentCache): 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 =
  result = n
  if context != nil: internalError("logpass: context is not nil")
  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.gFrontendId)

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

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
  case n.kind
  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:
      var s = n.sons[namePos].sym
      if sfDeadCodeElim notin getModule(s).flags and not astNeeded(s):
        s.ast.sons[bodyPos] = ast.emptyNode # free the memory
  else:
    discard

const cleanupPass* = makePass(process = cleanUp, close = cleanUp)