diff options
Diffstat (limited to 'compiler/rodread.nim')
-rw-r--r-- | compiler/rodread.nim | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rodread.nim b/compiler/rodread.nim index 2546aa77a..dfa8fc52b 100644 --- a/compiler/rodread.nim +++ b/compiler/rodread.nim @@ -795,7 +795,7 @@ proc getReader(moduleId: int): PRodReader = # 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 .. <gMods.len: + for i in 0 ..< gMods.len: result = gMods[i].rd if result != nil and result.moduleID == moduleId: return result return nil @@ -861,12 +861,11 @@ proc loadMethods(r: PRodReader) = if r.s[r.pos] == ' ': inc(r.pos) proc getHash*(fileIdx: int32): SecureHash = - internalAssert fileIdx >= 0 and fileIdx < gMods.len - - if gMods[fileIdx].hashDone: + if fileIdx <% gMods.len and gMods[fileIdx].hashDone: return gMods[fileIdx].hash result = secureHashFile(fileIdx.toFullPath) + if fileIdx >= gMods.len: setLen(gMods, fileIdx+1) gMods[fileIdx].hash = result template growCache*(cache, pos) = @@ -912,7 +911,7 @@ proc checkDep(fileIdx: int32; cache: IdentCache): TReasonForRecompile = proc handleSymbolFile*(module: PSym; cache: IdentCache): PRodReader = let fileIdx = module.fileIdx - if optSymbolFiles notin gGlobalOptions: + if gSymbolFiles in {disabledSf, writeOnlySf}: module.id = getID() return nil idgen.loadMaxIds(options.gProjectPath / options.gProjectName) |