perf: no need to register axioms outside of the module system (#8121)
This commit is contained in:
parent
87dccb9d1b
commit
f285867137
2 changed files with 10 additions and 2 deletions
|
|
@ -148,8 +148,12 @@ where
|
|||
let env ← (← getEnv).addDeclAux (← getOptions) decl (← read).cancelTk?
|
||||
|> ofExceptKernelException
|
||||
setEnv env
|
||||
for n in decl.getTopLevelNames do
|
||||
registerAxiomsForDecl n
|
||||
if env.header.isModule then
|
||||
-- Under the module system, must record axioms in environment extension now when we
|
||||
-- still have access to the declaration's body. We could skip this for non-opaque decls
|
||||
-- but for them, registering simply acts as a cache.
|
||||
for n in decl.getTopLevelNames do
|
||||
registerAxiomsForDecl n
|
||||
catch ex =>
|
||||
-- avoid follow-up errors by (trying to) add broken decl as axiom
|
||||
addAsAxiom
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ def collectAxioms [Monad m] [MonadEnv m] (constName : Name) : m (Array Name) :=
|
|||
let (_, s) := ((CollectAxioms.collect constName).run env).run {}
|
||||
pure s.axioms
|
||||
|
||||
/--
|
||||
Registers axioms used by the declaration in an environment extension so they can be retrieved even
|
||||
if some parts of the declaration's become inaccessible.
|
||||
-/
|
||||
def registerAxiomsForDecl (n : Name) : CoreM Unit := do
|
||||
let axioms ← collectAxioms n
|
||||
modifyEnv (exportedAxiomsExt.addEntry · (n, axioms))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue