summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>1997-06-12 15:25:01 +0000
committerDamien Doligez <damien.doligez-inria.fr>1997-06-12 15:25:01 +0000
commit4eeb35cc6735bb376b6c2888e5c00a994f20a28a (patch)
tree5c74d1ce8870a30a012283ed5ca4b5f90e11d98f
parent944ddc7ecdab975ed5fffffc6aa25c98a70a30bb (diff)
Fix de let rec dans ocamlc -g
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1585 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--bytecomp/bytegen.ml18
-rw-r--r--bytecomp/translcore.ml2
2 files changed, 9 insertions, 11 deletions
diff --git a/bytecomp/bytegen.ml b/bytecomp/bytegen.ml
index 8052c8446..f2b2956b0 100644
--- a/bytecomp/bytegen.ml
+++ b/bytecomp/bytegen.ml
@@ -98,18 +98,14 @@ let add_const_unit = function
(**** Auxiliary for compiling "let rec" ****)
let rec size_of_lambda = function
- Lfunction(kind, params, body) as funct ->
+ | Lfunction(kind, params, body) as funct ->
1 + IdentSet.cardinal(free_variables funct)
- | Lprim(Pmakeblock(tag, mut), args) ->
- List.length args
- | Lprim(Pmakearray kind, args) ->
- List.length args
- | Llet(str, id, arg, body) ->
- size_of_lambda body
- | Lletrec(bindings, body) ->
- size_of_lambda body
- | _ ->
- fatal_error "Bytegen.size_of_lambda"
+ | Lprim(Pmakeblock(tag, mut), args) -> List.length args
+ | Lprim(Pmakearray kind, args) -> List.length args
+ | Llet(str, id, arg, body) -> size_of_lambda body
+ | Lletrec(bindings, body) -> size_of_lambda body
+ | Levent (lam, _) -> size_of_lambda lam
+ | _ -> fatal_error "Bytegen.size_of_lambda"
(**** Compilation of a lambda expression ****)
diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml
index be890b39f..cf2b78820 100644
--- a/bytecomp/translcore.ml
+++ b/bytecomp/translcore.ml
@@ -260,6 +260,7 @@ let check_recursive_lambda idlist lam =
| Llet(str, id, arg, body) -> check arg & check_top body
| Lletrec(bindings, body) ->
List.for_all (fun (id, arg) -> check arg) bindings & check_top body
+ | Levent (lam, _) -> check_top lam
| _ -> false
and check = function
Lvar _ -> true
@@ -270,6 +271,7 @@ let check_recursive_lambda idlist lam =
List.for_all (fun (id, arg) -> check arg) bindings & check body
| Lprim(Pmakeblock(tag, mut), args) -> List.for_all check args
| Lprim(Pmakearray kind, args) -> List.for_all check args
+ | Levent (lam, _) -> check lam
| lam ->
let fv = free_variables lam in
List.for_all (fun id -> not(IdentSet.mem id fv)) idlist