summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-08-27 13:38:39 +0200
committerAraq <rumpf_a@web.de>2016-08-27 13:38:39 +0200
commit68e30d7d52d84578fbe0f6f1c2041b150251e800 (patch)
tree6dfb38147f00b940543a96b97c093053809ec7af /compiler
parent7630cd076bbdb9c3b1b851ffc6dc6a8ada07f4a6 (diff)
downloadNim-68e30d7d52d84578fbe0f6f1c2041b150251e800.tar.gz
tester cleanup; enable some rod tests
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgmeth.nim5
-rw-r--r--compiler/importer.nim2
-rw-r--r--compiler/nversion.nim2
-rw-r--r--compiler/rodwrite.nim15
4 files changed, 14 insertions, 10 deletions
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim
index 624c5b183..bcf0b535b 100644
--- a/compiler/cgmeth.nim
+++ b/compiler/cgmeth.nim
@@ -145,15 +145,16 @@ proc fixupDispatcher(meth, disp: PSym) =
         disp.typ.lockLevel = meth.typ.lockLevel
 
 proc methodDef*(s: PSym, fromCache: bool) =
-  var L = len(gMethods)
+  let L = len(gMethods)
   var witness: PSym
   for i in countup(0, L - 1):
-    var disp = gMethods[i].dispatcher
+    let disp = gMethods[i].dispatcher
     case sameMethodBucket(disp, s)
     of Yes:
       add(gMethods[i].methods, s)
       attachDispatcher(s, lastSon(disp.ast))
       fixupDispatcher(s, disp)
+      #echo "fixup ", disp.name.s, " ", disp.id
       when useEffectSystem: checkMethodEffects(disp, s)
       if sfBase in s.flags and gMethods[i].methods[0] != s:
         # already exists due to forwarding definition?
diff --git a/compiler/importer.nim b/compiler/importer.nim
index dd2c4d954..7e7130b85 100644
--- a/compiler/importer.nim
+++ b/compiler/importer.nim
@@ -163,7 +163,7 @@ proc myImportModule(c: PContext, n: PNode): PSym =
   var f = checkModuleName(n)
   if f != InvalidFileIDX:
     result = importModuleAs(n, gImportModule(c.module, f))
-    if result.info.fileIndex == n.info.fileIndex:
+    if result.info.fileIndex == c.module.info.fileIndex:
       localError(n.info, errGenerated, "A module cannot import itself")
     if sfDeprecated in result.flags:
       message(n.info, warnDeprecated, result.name.s)
diff --git a/compiler/nversion.nim b/compiler/nversion.nim
index 55e337969..d69e1e553 100644
--- a/compiler/nversion.nim
+++ b/compiler/nversion.nim
@@ -13,5 +13,5 @@
 const
   MaxSetElements* = 1 shl 16  # (2^16) to support unicode character sets?
   VersionAsString* = system.NimVersion
-  RodFileVersion* = "1218"       # modify this if the rod-format changes!
+  RodFileVersion* = "1221"       # modify this if the rod-format changes!
 
diff --git a/compiler/rodwrite.nim b/compiler/rodwrite.nim
index 557b1dabf..addbdade6 100644
--- a/compiler/rodwrite.nim
+++ b/compiler/rodwrite.nim
@@ -74,7 +74,7 @@ proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter =
   result.converters = ""
   result.methods = ""
   result.init = ""
-  result.origFile = module.info.toFilename
+  result.origFile = module.info.toFullPath
   result.data = newStringOfCap(12_000)
 
 proc addModDep(w: PRodWriter, dep: string; info: TLineInfo) =
@@ -100,6 +100,10 @@ proc pushType(w: PRodWriter, t: PType) =
 proc pushSym(w: PRodWriter, s: PSym) =
   # check so that the stack does not grow too large:
   if iiTableGet(w.index.tab, s.id) == InvalidKey:
+    when false:
+      if s.kind == skMethod:
+        echo "encoding ", s.id, " ", s.name.s
+        writeStackTrace()
     w.sstack.add(s)
 
 proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
@@ -119,7 +123,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
     result.add(',')
     encodeVInt(n.info.line, result)
     result.add(',')
-    encodeVInt(fileIdx(w, toFilename(n.info)), result)
+    encodeVInt(fileIdx(w, toFullPath(n.info)), result)
   elif fInfo.line != n.info.line:
     result.add('?')
     encodeVInt(n.info.col, result)
@@ -224,8 +228,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) =
   if t.lockLevel.ord != UnspecifiedLockLevel.ord:
     add(result, '\14')
     encodeVInt(t.lockLevel.int16, result)
-
-  if t.destructor != nil:
+  if t.destructor != nil and t.destructor.id != 0:
     add(result, '\15')
     encodeVInt(t.destructor.id, result)
     pushSym(w, t.destructor)
@@ -293,7 +296,7 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) =
   result.add(',')
   if s.info.line != -1'i16: encodeVInt(s.info.line, result)
   result.add(',')
-  encodeVInt(fileIdx(w, toFilename(s.info)), result)
+  encodeVInt(fileIdx(w, toFullPath(s.info)), result)
   if s.owner != nil:
     result.add('*')
     encodeVInt(s.owner.id, result)
@@ -607,7 +610,7 @@ proc process(c: PPassContext, n: PNode): PNode =
     for i in countup(0, sonsLen(n) - 1):
       addModDep(w, getModuleName(n.sons[i]), n.info)
     addStmt(w, n)
-  of nkFromStmt:
+  of nkFromStmt, nkImportExceptStmt:
     addModDep(w, getModuleName(n.sons[0]), n.info)
     addStmt(w, n)
   of nkIncludeStmt: