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

Split structures appearing inside expressions int the

"one_op_per_equation" mode.
parent f1cbf548
No related branches found
No related tags found
No related merge requests found
(** Time-stamp: <modified the 20/11/2008 (at 10:47) by Erwan Jahier> *)
(** Time-stamp: <modified the 20/11/2008 (at 14:32) by Erwan Jahier> *)
open Lxm
......@@ -143,6 +143,7 @@ and (split_val_exp : bool -> Eff.local_env -> Eff.val_exp -> Eff.val_exp * split
-> ve, ([],[])
| CallByNameEff (by_name_op_eff, fl) ->
let lxm = by_name_op_eff.src in
let fl, eql, vl =
List.fold_left
(fun (fl_acc, eql_acc, vl_acc) (fn, fv) ->
......@@ -152,8 +153,26 @@ and (split_val_exp : bool -> Eff.local_env -> Eff.val_exp -> Eff.val_exp * split
([],[],[])
fl
in
CallByNameEff (by_name_op_eff, List.rev fl), (eql, vl)
let rhs = CallByNameEff (by_name_op_eff, List.rev fl) in
if top_level then
rhs, (eql, vl)
else
(* create the var for the current call *)
let clk_l = EvalClock.get_val_exp_eff ve in
let typ_l = EvalType.val_exp_eff ve in
let nv_l = List.map2 (new_var node_env) typ_l clk_l in
let nve = match nv_l with
| [nv] -> CallByPosEff(
Lxm.flagit (Eff.IDENT (Ident.to_idref nv.var_name_eff)) lxm,
OperEff []
)
| _ -> assert false
in
let lpl = List.map (fun nv -> LeftVarEff(nv, lxm)) nv_l in
let eq = Lxm.flagit (lpl, rhs) lxm in
nve, (eql@[eq], vl@nv_l)
| CallByPosEff(by_pos_op_eff, OperEff vel) ->
(* recursively split the arguments *)
......
This diff is collapsed.
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