fix normalize_mem

This commit is contained in:
Léonard Gérard 2011-04-27 14:28:45 +02:00
parent 00cb203dd9
commit b8ee46d58f
2 changed files with 11 additions and 1 deletions

View file

@ -46,6 +46,11 @@ let rec vd_mem n = function
| [] -> false
| vd::l -> vd.v_ident = n or (vd_mem n l)
(** @return a signature arguments from the vardecs *)
let args_of_var_decs vds =
List.map (fun vd -> Signature.mk_arg (Some (name vd.v_ident)) vd.v_type) vds
(** @return whether [ty] corresponds to a record type. *)
let is_record_type ty = match ty with
| Tid n ->

View file

@ -30,7 +30,12 @@ let eq _ (locals, eqs, outs) eq = match eq.eq_lhs, eq.eq_rhs.e_desc with
let node funs acc nd =
let nd, (v, eqs, o) = Mls_mapfold.node_dec funs (nd.n_local, [], nd.n_output) nd in
{ nd with n_local = v; n_equs = List.rev eqs; n_output = o }, acc
(* update the signature of the node *)
let f = Modules.find_value nd.n_name in
let f = { f with Signature.node_outputs = Mls_utils.args_of_var_decs o } in
Modules.replace_value nd.n_name f;
(* return updated node *)
{ nd with n_local = v; n_equs = List.rev eqs; n_output = o }, acc
let program p =
let funs = { Mls_mapfold.defaults with eq = eq; node_dec = node } in