PR#0004828 fixed

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9305 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Luc Maranget 2009-06-23 09:35:12 +00:00
parent 3b672bfed3
commit f8107f9061
1 changed files with 26 additions and 1 deletions

View File

@ -2650,7 +2650,7 @@ let compile_flattened repr partial ctx _ pmh = match pmh with
compile_orhandlers (compile_match repr partial) lam total ctx hs
| PmVar _ -> assert false
let for_multiple_match loc paraml pat_act_list partial =
let do_for_multiple_match loc paraml pat_act_list partial =
let repr = None in
let partial = check_partial pat_act_list partial in
let raise_num,pm1 =
@ -2704,3 +2704,28 @@ let for_multiple_match loc paraml pat_act_list partial =
end
with Unused ->
assert false (* ; partial_function loc () *)
(* #PR4828: Believe it or not, the 'paraml' argument below
may not be side effect free. *)
let arg_to_var arg cls = match arg with
| Lvar v -> v,arg
| _ ->
let v = name_pattern "match" cls in
v,Lvar v
let rec param_to_var param = match param with
| Lvar v -> v,None
| _ -> Ident.create "match",Some param
let bind_opt (v,eo) k = match eo with
| None -> k
| Some e -> Lambda.bind Strict v e k
let for_multiple_match loc paraml pat_act_list partial =
let v_paraml = List.map param_to_var paraml in
let paraml = List.map (fun (v,_) -> Lvar v) v_paraml in
List.fold_right bind_opt v_paraml
(do_for_multiple_match loc paraml pat_act_list partial)