more tests work

This commit is contained in:
Araq
2016-12-02 11:44:28 +01:00
parent d2cbf7f242
commit 42ae2064dd
5 changed files with 13 additions and 3 deletions

View File

@@ -43,7 +43,12 @@ proc idOrSig(m: BModule; s: PSym): Rope =
# signatures for exported routines are reliable enough to
# produce a unique name and this means produced C++ is more stable wrt
# Nim changes:
result = rope($hashProc(s))
let sig = hashProc(s)
result = rope($sig)
let counter = m.sigConflicts.getOrDefault(sig)
if counter != 0:
result.add "_" & rope counter
m.sigConflicts.inc(sig)
else:
result = "_" & rope s.id

View File

@@ -1099,6 +1099,7 @@ proc rawNewModule(module: PSym, filename: string): BModule =
result.forwTypeCache = initTable[SigHash, Rope]()
result.module = module
result.typeInfoMarker = initTable[SigHash, Rope]()
result.sigConflicts = initCountTable[SigHash]()
result.initProc = newProc(nil, result)
result.initProc.options = initProcOptions(result)
result.preInitProc = newPreInitProc(result)

View File

@@ -130,6 +130,7 @@ type
extensionLoaders*: array['0'..'9', Rope] # special procs for the
# OpenGL wrapper
injectStmt*: Rope
sigConflicts*: CountTable[SigHash]
var
mainModProcs*, mainModInit*, otherModsInit*, mainDatInit*: Rope

View File

@@ -557,7 +557,10 @@ proc typeBorrow(sym: PSym, n: PNode) =
incl(sym.typ.flags, tfBorrowDot)
proc markCompilerProc(s: PSym) =
makeExternExport(s, "$1", s.info)
# minor hack ahead: FlowVar is the only generic .compilerProc type which
# should not have an external name set:
if s.kind != skType or s.name.s != "FlowVar":
makeExternExport(s, "$1", s.info)
incl(s.flags, sfCompilerProc)
incl(s.flags, sfUsed)
registerCompilerProc(s)

View File

@@ -250,7 +250,7 @@ proc hashProc*(s: PSym): SigHash =
# so that createThread[void]() (aka generic specialization) gets a unique
# hash, we also hash the line information. This is pretty bad, but the best
# solution for now:
c &= s.info.line
#c &= s.info.line
md5Final c, result.Md5Digest
proc hashOwner*(s: PSym): SigHash =