diff --git a/src/Core/Hash.idr b/src/Core/Hash.idr index b5fec2f..aa624f1 100644 --- a/src/Core/Hash.idr +++ b/src/Core/Hash.idr @@ -62,7 +62,7 @@ Hashable String where export Hashable Name where hashWithSalt h (MN s _) = hashWithSalt h s - hashWithSalt h (Resolved i) = i + hashWithSalt h (Resolved i) = hashWithSalt h i hashWithSalt h n = hashWithSalt h (show n) export diff --git a/src/Idris/ProcessIdr.idr b/src/Idris/ProcessIdr.idr index 397d42c..336397d 100644 --- a/src/Idris/ProcessIdr.idr +++ b/src/Idris/ProcessIdr.idr @@ -70,8 +70,6 @@ readModule top loc vis reexp imp as extendAs imp as syn defs <- get Ctxt - when top $ put Ctxt (record { importHashes $= ((as, hash) ::) } defs) - modNS <- getNS when vis $ setVisible imp traverse_ (\ mimp => @@ -241,6 +239,12 @@ processMod srcf ttcf msg mod sourcecode setNS ns errs <- logTime "Processing decls" $ processDecls (decls mod) + + -- Save the import hashes for the imports we just read. + -- If they haven't changed next time, and the source + -- file hasn't changed, no need to rebuild. + defs <- get Ctxt + put Ctxt (record { importHashes = hs } defs) pure (Just errs)) (\err => pure (Just [err]))