diff --git a/compiler/main.nim b/compiler/main.nim index acd910514..3bb4ad399 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -155,7 +155,8 @@ proc compileModule(fileIdx: int32, flags: TSymFlags): PSym = growCache gMemCacheData, fileIdx gMemCacheData[fileIdx].needsRecompile = Probing result = newModule(fileIdx) - var rd = handleSymbolFile(result) + #var rd = handleSymbolFile(result) + var rd: PRodReader result.flags = result.flags + flags if gCmd in {cmdCompileToC, cmdCompileToCpp, cmdCheck, cmdIdeTools}: rd = handleSymbolFile(result) diff --git a/compiler/rodread.nim b/compiler/rodread.nim index 6673456fb..d0a63cd99 100644 --- a/compiler/rodread.nim +++ b/compiler/rodread.nim @@ -729,8 +729,14 @@ proc findSomeWhere(id: int) = echo "found id ", id, " in ", gMods[i].filename proc getReader(moduleId: int): PRodReader = - InternalAssert moduleId >= 0 and moduleId < gMods.len - result = gMods[moduleId].rd + # we can't index 'gMods' here as it's indexed by a *file index* which is not + # the module ID! We could introduce a mapping ID->PRodReader but I'll leave + # this for later versions if benchmarking shows the linear search causes + # problems: + for i in 0 ..