summary refs log tree commit diff stats
path: root/compiler/cgen.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-04-21 08:13:37 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-04-21 08:13:37 +0200
commit33b69f0ed0272a4792322d9a0fbaffd5bef2f6e9 (patch)
treef7d38c41d242024ea644cd855fa9b71eee7e8bd2 /compiler/cgen.nim
parent6667362c2f1cd0fc1fdb1dacb486528b928470d5 (diff)
downloadNim-33b69f0ed0272a4792322d9a0fbaffd5bef2f6e9.tar.gz
refactoring: make FileIndex a distinct type; make line information an uint16; fixes #7654
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r--compiler/cgen.nim12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 4d3cabd3a..9e1f9349f 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -223,7 +223,7 @@ proc genLineDir(p: BProc, t: PNode) =
               line.rope, makeCString(toFilename(tt.info)))
   elif ({optLineTrace, optStackTrace} * p.options ==
       {optLineTrace, optStackTrace}) and
-      (p.prc == nil or sfPure notin p.prc.flags) and tt.info.fileIndex >= 0:
+      (p.prc == nil or sfPure notin p.prc.flags) and tt.info.fileIndex != InvalidFileIDX:
     if freshLineInfo(p, tt.info):
       linefmt(p, cpsStmts, "nimln_($1, $2);$n",
               line.rope, tt.info.quotedFilename)
@@ -678,7 +678,7 @@ proc generateHeaders(m: BModule) =
 
 proc openNamespaceNim(): Rope =
   result.add("namespace Nim {" & tnl)
-  
+
 proc closeNamespaceNim(): Rope =
   result.add("}" & tnl)
 
@@ -1090,7 +1090,7 @@ proc genMainProc(m: BModule) =
   appcg(m, m.s[cfsProcs], nimMain,
         [m.g.mainModInit, initStackBottomCall, rope(m.labels)])
   if optNoMain notin gGlobalOptions:
-    if useNimNamespace: 
+    if useNimNamespace:
       m.s[cfsProcs].add closeNamespaceNim() & "using namespace Nim;" & tnl
 
     appcg(m, m.s[cfsProcs], otherMain, [])
@@ -1202,7 +1202,7 @@ proc genModule(m: BModule, cfile: Cfile): Rope =
     add(result, genSectionStart(i))
     add(result, m.s[i])
     add(result, genSectionEnd(i))
-    if useNimNamespace and i == cfsHeaders: result.add openNamespaceNim()    
+    if useNimNamespace and i == cfsHeaders: result.add openNamespaceNim()
   add(result, m.s[cfsInitProc])
   if useNimNamespace: result.add closeNamespaceNim()
 
@@ -1301,7 +1301,7 @@ proc resetCgenModules*(g: BModuleList) =
   for m in cgenModules(g): resetModule(m)
 
 proc rawNewModule(g: BModuleList; module: PSym): BModule =
-  result = rawNewModule(g, module, module.position.int32.toFullPath)
+  result = rawNewModule(g, module, module.position.FileIndex.toFullPath)
 
 proc newModule(g: BModuleList; module: PSym): BModule =
   # we should create only one cgen module for each module sym
@@ -1311,7 +1311,7 @@ proc newModule(g: BModuleList; module: PSym): BModule =
 
   if (optDeadCodeElim in gGlobalOptions):
     if (sfDeadCodeElim in module.flags):
-      internalError("added pending module twice: " & module.filename)
+      internalError("added pending module twice: " & toFilename(FileIndex module.position))
 
 template injectG(config) {.dirty.} =
   if graph.backend == nil: