From 86f2d0adccb971bbc6cb3fe35feb416098776dcb Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sat, 27 Jul 2019 10:23:14 +0200 Subject: [PATCH] IR: minor refactoring (cherry picked from commit ceb1a1b6884b28f3f3f88a4be5663d7f0b1f1155) --- compiler/passes.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/passes.nim b/compiler/passes.nim index 378c61f97d..88443e989f 100644 --- a/compiler/passes.nim +++ b/compiler/passes.nim @@ -121,6 +121,9 @@ proc prepareConfigNotes(graph: ModuleGraph; module: PSym) = if graph.config.mainPackageNotes == {}: graph.config.mainPackageNotes = graph.config.notes graph.config.notes = graph.config.foreignPackageNotes +proc moduleHasChanged*(graph: ModuleGraph; module: PSym): bool {.inline.} = + result = module.id >= 0 + proc processModule*(graph: ModuleGraph; module: PSym, stream: PLLStream): bool {.discardable.} = if graph.stopCompile(): return true var @@ -129,7 +132,7 @@ proc processModule*(graph: ModuleGraph; module: PSym, stream: PLLStream): bool { s: PLLStream fileIdx = module.fileIdx prepareConfigNotes(graph, module) - if module.id < 0: + if not moduleHasChanged(graph, module): # new module caching mechanism: for i in 0 ..< graph.passes.len: if not isNil(graph.passes[i].open) and not graph.passes[i].isFrontend: