From dd3c7e67866150a7ca87c21ba5876576eb4efea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Fri, 16 Feb 2018 16:06:36 +0100 Subject: [PATCH] Light CPS: cleaner error when lightening non-value --- src/CPS.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CPS.ml b/src/CPS.ml index 77eaca0..0714e87 100644 --- a/src/CPS.ml +++ b/src/CPS.ml @@ -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) )