feat: deprecated attr

main
Henrik 2023-09-08 23:06:56 +02:00
parent 9efe8f1df7
commit 13fb60f8a3
1 changed files with 9 additions and 1 deletions

View File

@ -124,7 +124,15 @@ def getValues {attrKind : Type → Type} [ValueAttr attrKind] (decl : Name) (att
return res return res
def getEnumValues (decl : Name) : MetaM (Array String) := getValues decl enumAttributes def getEnumValues (decl : Name) : MetaM (Array String) := getValues decl enumAttributes
def getParametricValues (decl : Name) : MetaM (Array String) := getValues decl parametricAttributes def getParametricValues (decl : Name) : MetaM (Array String) := do
let mut uniform ← getValues decl parametricAttributes
-- This attribute contains an `Option Name` but we would like to pretty print it better
if let some depTag := Linter.deprecatedAttr.getParam? (← getEnv) decl then
let str := match depTag with
| some alt => s!"deprecated {alt.toString}"
| none => "deprecated"
uniform := uniform.push str
return uniform
def getDefaultInstance (decl : Name) (className : Name) : MetaM (Option String) := do def getDefaultInstance (decl : Name) (className : Name) : MetaM (Option String) := do
let insts ← getDefaultInstances className let insts ← getDefaultInstances className