From c6991977a0afe6bb3c9b6c0cc5fd138e48603c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pasteur?= Date: Mon, 18 Apr 2011 09:52:03 +0200 Subject: [PATCH] Missing case in normalize Distribute also static tuples --- .../heptagon/transformations/normalize.ml | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/compiler/heptagon/transformations/normalize.ml b/compiler/heptagon/transformations/normalize.ml index 2406610..1681333 100644 --- a/compiler/heptagon/transformations/normalize.ml +++ b/compiler/heptagon/transformations/normalize.ml @@ -238,18 +238,23 @@ and merge context e x c_e_list = (* applies distribution rules *) (* [(p1,...,pn) = (e1,...,en)] into [p1 = e1;...;pn = en] *) and distribute ((d_list, eq_list) as context) eq pat e = - match pat, e.e_desc with - | Etuplepat(pat_list), Eapp({ a_op = Etuple }, e_list, _) -> - let mk_eq pat e = - mk_equation ~stateful:eq.eq_stateful (Eeq (pat, e)) - in - let dis context eq = match eq.eq_desc with - | Eeq (pat, e) -> distribute context eq pat e - | _ -> assert false - in - let eqs = List.map2 mk_eq pat_list e_list in - List.fold_left dis context eqs - | _ -> d_list, eq :: eq_list + let dist_e_list pat_list e_list = + let mk_eq pat e = + mk_equation ~stateful:eq.eq_stateful (Eeq (pat, e)) + in + let dis context eq = match eq.eq_desc with + | Eeq (pat, e) -> distribute context eq pat e + | _ -> assert false + in + let eqs = List.map2 mk_eq pat_list e_list in + List.fold_left dis context eqs + in + match pat, e.e_desc with + | Etuplepat(pat_list), Eapp({ a_op = Etuple }, e_list, _) -> + dist_e_list pat_list e_list + | Etuplepat(pat_list), Econst { se_desc = Stuple se_list } -> + dist_e_list pat_list (exp_list_of_static_exp_list se_list) + | _ -> d_list, eq :: eq_list and translate_eq context eq = match eq.eq_desc with | Eeq (pat, e) ->