Skip to content

Commit

Permalink
Drop unused primitives for interface contract id conversion (digital-…
Browse files Browse the repository at this point in the history
…asset#12114)

changelog_begin
changelog_end
  • Loading branch information
akrmn authored Dec 13, 2021
1 parent 82465e2 commit caa8072
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,21 +426,6 @@ convertPrim _ "UTryCatch" ((TUnit :-> TUpdate t1) :-> (TBuiltin BTAnyException :
(mkVar "x")
(EVar (mkVar "c") `ETmApp` EVar (mkVar "x"))

convertPrim _ "UFromInterfaceContractId" (TContractId (TCon iface) :-> TUpdate (TOptional (TContractId (TCon tpid)))) =
ETmLam (mkVar "cid", TContractId (TCon iface)) $
if iface == tpid
then EUpdate $ UPure (TOptional (TContractId (TCon iface))) (ESome (TContractId (TCon iface)) $ EVar $ mkVar "cid")
else EUpdate $
UBind
(Binding (mkVar "iface", TCon iface) (EUpdate $ UFetchInterface iface (EVar $ mkVar "cid"))) $
EUpdate $ UPure (TOptional (TContractId (TCon tpid))) $ ECase (EFromInterface iface tpid (EVar $ mkVar "iface"))
[ CaseAlternative CPNone (ENone (TContractId (TCon tpid)))
, CaseAlternative (CPSome $ mkVar "_") (ESome (TContractId (TCon tpid)) (EBuiltin BECoerceContractId `ETyApp` TCon iface `ETyApp` TCon tpid `ETmApp` (EVar $ mkVar "cid")))
]

convertPrim _ "EToInterfaceContractId" (TContractId tpid :-> TContractId iface) =
EBuiltin BECoerceContractId `ETyApp` tpid `ETyApp` iface

convertPrim _ "EToInterface" (TCon tpid :-> TCon iface) =
ETmLam (mkVar "t", TCon tpid) $
if tpid == iface
Expand Down

0 comments on commit caa8072

Please sign in to comment.