From 6d64a6e42c7b43a703d942d232ca2a73d9d42f31 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 8 Apr 2013 14:27:55 +0200 Subject: [PATCH] next steps to make symbol files work again --- compiler/main.nim | 3 ++- compiler/rodread.nim | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/main.nim b/compiler/main.nim index acd9105146..3bb4ad3995 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 6673456fb9..d0a63cd996 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 ..