Light CPS: cleaner error when lightening non-value

This commit is contained in:
Théophile Bastian 2018-02-16 16:06:36 +01:00
parent 804f2e7c5b
commit dd3c7e6786

View file

@ -6,6 +6,8 @@ module T = Tail
exception NotValue of S.term
(** ^ Raised when trying to use a non-value term as such *)
exception NotLightCPSable of S.term
let freshId =
(** Generates a fresh variable name string *)
let cId = ref 0 in
@ -113,7 +115,8 @@ and light_term varName valExpr valHint next =
self, [lamVar; lamCont],
cps_term_inner lamBody lamCont None),
next)
| S.App _ | S.Print _ | S.IfZero _ -> assert false
| S.App _ | S.Print _ | S.IfZero _ ->
raise (NotLightCPSable valExpr)
)