tester cleanup; enable some rod tests

This commit is contained in:
Araq 2016-08-27 13:38:39 +02:00
commit 68e30d7d52
6 changed files with 31 additions and 25 deletions

View file

@ -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?

View file

@ -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)

View file

@ -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!

View file

@ -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: