matching: use toplevel_handler in for_tupled_function
This appears to change the function behavior with respect to the Unused exception, but we believe that the change is correct. It makes the code more consistent with other toplevel compilation functions.master
parent
7d777f20af
commit
67ba8c36cc
|
@ -3662,23 +3662,14 @@ let for_let ~scopes loc param pat body =
|
||||||
(* Easy case since variables are available *)
|
(* Easy case since variables are available *)
|
||||||
let for_tupled_function ~scopes loc paraml pats_act_list partial =
|
let for_tupled_function ~scopes loc paraml pats_act_list partial =
|
||||||
let partial = check_partial_list pats_act_list partial in
|
let partial = check_partial_list pats_act_list partial in
|
||||||
let raise_num = next_raise_count () in
|
let args = List.map (fun id -> (Lvar id, Strict)) paraml in
|
||||||
let omega_params = [ Patterns.omega_list paraml ] in
|
let handler =
|
||||||
let pm =
|
toplevel_handler ~scopes loc ~failer:Raise_match_failure
|
||||||
{ cases = pats_act_list;
|
partial args pats_act_list in
|
||||||
args = List.map (fun id -> (Lvar id, Strict)) paraml;
|
handler (fun partial pm ->
|
||||||
default = Default_environment.(cons omega_params raise_num empty)
|
|
||||||
}
|
|
||||||
in
|
|
||||||
try
|
|
||||||
let lambda, total =
|
|
||||||
compile_match ~scopes None partial
|
compile_match ~scopes None partial
|
||||||
(Context.start (List.length paraml)) pm
|
(Context.start (List.length paraml)) pm
|
||||||
in
|
)
|
||||||
check_total ~scopes loc ~failer:Raise_match_failure
|
|
||||||
total lambda raise_num
|
|
||||||
with Unused ->
|
|
||||||
failure_handler ~scopes loc ~failer:Raise_match_failure ()
|
|
||||||
|
|
||||||
let flatten_pattern size p =
|
let flatten_pattern size p =
|
||||||
match p.pat_desc with
|
match p.pat_desc with
|
||||||
|
|
Loading…
Reference in New Issue