Light CPS: cleaner error when lightening non-value
This commit is contained in:
parent
804f2e7c5b
commit
dd3c7e6786
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,8 @@ module T = Tail
|
||||||
exception NotValue of S.term
|
exception NotValue of S.term
|
||||||
(** ^ Raised when trying to use a non-value term as such *)
|
(** ^ Raised when trying to use a non-value term as such *)
|
||||||
|
|
||||||
|
exception NotLightCPSable of S.term
|
||||||
|
|
||||||
let freshId =
|
let freshId =
|
||||||
(** Generates a fresh variable name string *)
|
(** Generates a fresh variable name string *)
|
||||||
let cId = ref 0 in
|
let cId = ref 0 in
|
||||||
|
@ -113,7 +115,8 @@ and light_term varName valExpr valHint next =
|
||||||
self, [lamVar; lamCont],
|
self, [lamVar; lamCont],
|
||||||
cps_term_inner lamBody lamCont None),
|
cps_term_inner lamBody lamCont None),
|
||||||
next)
|
next)
|
||||||
| S.App _ | S.Print _ | S.IfZero _ -> assert false
|
| S.App _ | S.Print _ | S.IfZero _ ->
|
||||||
|
raise (NotLightCPSable valExpr)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue