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
|
|
|
|
import DocGen4.Process.DefinitionInfo
|
|
|
|
|
|
|
|
namespace DocGen4.Process
|
|
|
|
|
|
|
|
open Lean Meta
|
|
|
|
|
|
|
|
def InstanceInfo.ofDefinitionVal (v : DefinitionVal) : MetaM InstanceInfo := do
|
|
|
|
let info ← DefinitionInfo.ofDefinitionVal v
|
|
|
|
let some className := getClassName (←getEnv) v.type | unreachable!
|
|
|
|
if let some instAttr ← getDefaultInstance v.name className then
|
2022-07-22 12:48:36 +00:00
|
|
|
pure $ InstanceInfo.mk { info with attrs := info.attrs.push instAttr } className
|
2022-05-19 22:36:21 +00:00
|
|
|
else
|
2022-07-22 12:48:36 +00:00
|
|
|
pure $ InstanceInfo.mk info className
|
2022-05-19 22:36:21 +00:00
|
|
|
|
|
|
|
end DocGen4.Process
|