Skip to content
Snippets Groups Projects
Commit 4a11df0a authored by Erwan Jahier's avatar Erwan Jahier
Browse files

fixing the ec backend (cont): unfold operators on tuples.

i.e., transform

      x,y = (0,1) -> (a,b);

into

      x = 0 -> a;
      y = 1 -> b;
parent 8b2170c1
No related branches found
No related tags found
No related merge requests found
......@@ -290,13 +290,27 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list)
if not !Global.ec then
[{ src = lxm ; it = (left_list, ve) }]
else
(* we only need to break tuple in this mode ...
(* we only need to break tuples in this mode ...
Note that this work only if the node expansion has already been done!
(otherwise, we would not have the same number of items in the left and
in the rigth part)
*)
let rec aux ve = (* flatten val exp*)
match ve with
| CallByPosEff ({it=TUPLE}, OperEff vel) -> List.flatten (List.map aux vel)
| _ -> [ve]
| CallByPosEff ({it= TUPLE}, OperEff vel) -> List.flatten (List.map aux vel)
| CallByPosEff (unop, OperEff [ve1]) ->
let ve1l = aux ve1 in
List.map
(fun ve1 -> CallByPosEff (unop, OperEff [ve1]))
ve1l
| CallByPosEff (binop, OperEff [ve1;ve2]) ->
let ve1l, ve2l = aux ve1, aux ve2 in
List.map2
(fun ve1 ve2 -> CallByPosEff (binop, OperEff [ve1;ve2]))
ve1l
ve2l
| _ -> [ve]
in
let vel = aux ve in
if (List.length vel <> List.length left_list) then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment