chore: use toExpr

cc @Kha
This commit is contained in:
Leonardo de Moura 2020-01-19 11:43:03 -08:00
parent 6e1d70aaf2
commit 312ea061b1

View file

@ -825,14 +825,9 @@ fun stx _ => do
@[builtinTermElab char] def elabChar : TermElab :=
fun stx expectedType? => elabRawCharLit (stx.getArg 0) expectedType?
def reflectName : Name → Expr
| Name.anonymous => Lean.mkConst `Lean.Name.anonymous
| Name.str n s _ => mkApp2 (Lean.mkConst `Lean.mkNameStr) (reflectName n) (mkStrLit s)
| Name.num n i _ => mkApp2 (Lean.mkConst `Lean.mkNameNum) (reflectName n) (mkNatLit i)
@[builtinTermElab quotedName] def elabQuotedName : TermElab :=
fun stx _ => match_syntax stx with
| `(`$n) => pure $ reflectName n.getId
| `(`$n) => pure $ toExpr n.getId
| _ => throwUnsupportedSyntax
end Term