IC: bugfix (#17533)

* cleanups
* IC: bugfix
This commit is contained in:
Andreas Rumpf 2021-03-27 12:21:57 +01:00 • committed by GitHub
commit cf5ce7616b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -28,6 +28,7 @@ type
PackedModule* = object ## the parts of a PackedEncoder that are part of the .rod file
definedSymbols: string
moduleFlags: TSymFlags
includes: seq[(LitId, string)] # first entry is the module filename itself
imports: seq[LitId] # the modules this module depends on
toReplay: PackedTree # pragmas and VM specific state to replay.
@ -139,6 +140,7 @@ proc initEncoder*(c: var PackedEncoder; m: var PackedModule; moduleSym: PSym; co
m.sh = Shared()
c.thisModule = moduleSym.itemId.module
c.config = config
m.moduleFlags = moduleSym.flags
m.bodies = newTreeFrom(m.topLevel)
m.toReplay = newTreeFrom(m.topLevel)
@ -511,6 +513,7 @@ proc loadRodFile*(filename: AbsoluteFile; m: var PackedModule; config: ConfigRef
f.loadSection configSection
f.loadPrim m.definedSymbols
f.loadPrim m.moduleFlags
f.loadPrim m.cfg
if f.err == ok and not configIdentical(m, config) and not ignoreConfig:
@ -581,6 +584,7 @@ proc saveRodFile*(filename: AbsoluteFile; encoder: var PackedEncoder; m: var Pac
f.storeHeader()
f.storeSection configSection
f.storePrim m.definedSymbols
f.storePrim m.moduleFlags
f.storePrim m.cfg
template storeSeqSection(section, data) {.dirty.} =
@ -909,8 +913,7 @@ proc setupLookupTables(g: var PackedModuleGraph; conf: ConfigRef; cache: IdentCa
info: newLineInfo(fileIdx, 1, 1),
position: int(fileIdx))
m.module.owner = newPackage(conf, cache, fileIdx)
if fileIdx == conf.projectMainIdx2:
m.module.flags.incl sfMainModule
m.module.flags = m.fromDisk.moduleFlags
proc loadToReplayNodes(g: var PackedModuleGraph; conf: ConfigRef; cache: IdentCache;
fileIdx: FileIndex; m: var LoadedModule) =