Clean unused values from pattern matching

This commit is contained in:
Théophile Bastian 2018-02-16 18:25:09 +01:00
parent a194e327d0
commit 58cc468ca3

View file

@ -35,16 +35,8 @@ let rec has_calls (t: S.term): bool = match t with
(* A lambda itself may contain calls, but this call is not evaluated at (* A lambda itself may contain calls, but this call is not evaluated at
* declaration time *) * declaration time *)
| S.App _ -> true | S.App _ -> true
| S.IfZero (cond, tIf, tElse) -> | S.IfZero _ -> true (* Cannot optimize that with the current languages *)
(* Cannot optimize continuation creation | S.Print _ -> true (* Cannot optimize that with the current languages *)
List.exists has_calls [cond; tIf; tElse]
*)
true
| S.Print value ->
(* Cannot optimize continuation creation
has_calls value
*)
true
| S.Let (_, value, next) -> | S.Let (_, value, next) ->
List.exists has_calls [value; next] List.exists has_calls [value; next]