diff options
Diffstat (limited to 'compiler/cgendata.nim')
-rw-r--r-- | compiler/cgendata.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index 565399ead..be087095f 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -10,7 +10,7 @@ ## This module contains the data structures for the C code generation phase. import - ast, astalgo, ropes, passes, options, intsets, lists, platform, sighashes, + ast, astalgo, ropes, passes, options, intsets, platform, sighashes, tables, ndi from msgs import TLineInfo @@ -130,7 +130,7 @@ type forwTypeCache*: TypeCache # cache for forward declarations of types declaredThings*: IntSet # things we have declared in this .c file declaredProtos*: IntSet # prototypes we have declared in this .c file - headerFiles*: TLinkedList # needed headers to include + headerFiles*: seq[string] # needed headers to include typeInfoMarker*: TypeCache # needed for generating type information initProc*: BProc # code for init procedure postInitProc*: BProc # code to be executed after the init proc @@ -148,9 +148,13 @@ type g*: BModuleList ndi*: NdiFile +proc includeHeader*(this: BModule; header: string) = + if not this.headerFiles.contains header: + this.headerFiles.add header + proc s*(p: BProc, s: TCProcSection): var Rope {.inline.} = # section in the current block - result = p.blocks[p.blocks.len - 1].sections[s] + result = p.blocks[^1].sections[s] proc procSec*(p: BProc, s: TCProcSection): var Rope {.inline.} = # top level proc sections |