2022-05-19 22:36:21 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2022 Henrik Böving. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Authors: Henrik Böving
|
|
|
|
-/
|
|
|
|
import Lean
|
|
|
|
|
|
|
|
import DocGen4.Process.Base
|
|
|
|
import DocGen4.Process.NameInfo
|
|
|
|
|
|
|
|
namespace DocGen4.Process
|
|
|
|
|
|
|
|
open Lean Meta
|
|
|
|
|
|
|
|
def OpaqueInfo.ofOpaqueVal (v : OpaqueVal) : MetaM OpaqueInfo := do
|
|
|
|
let info ← Info.ofConstantVal v.toConstantVal
|
2022-07-23 11:37:17 +00:00
|
|
|
let value ← prettyPrintTerm v.value
|
2022-05-19 22:36:21 +00:00
|
|
|
let env ← getEnv
|
|
|
|
let isPartial := env.find? (Compiler.mkUnsafeRecName v.name) |>.isSome
|
2022-07-23 11:37:17 +00:00
|
|
|
let definitionSafety :=
|
|
|
|
if isPartial then
|
|
|
|
DefinitionSafety.partial
|
|
|
|
else if v.isUnsafe then
|
|
|
|
DefinitionSafety.unsafe
|
|
|
|
else
|
|
|
|
DefinitionSafety.safe
|
2023-01-01 18:30:28 +00:00
|
|
|
return {
|
2022-07-23 11:37:17 +00:00
|
|
|
toInfo := info,
|
|
|
|
value,
|
|
|
|
definitionSafety
|
|
|
|
}
|
2022-05-19 22:36:21 +00:00
|
|
|
|
|
|
|
end DocGen4.Process
|