diff --git a/compiler/minils/mls_utils.ml b/compiler/minils/mls_utils.ml index 16f9623..6844894 100644 --- a/compiler/minils/mls_utils.ml +++ b/compiler/minils/mls_utils.ml @@ -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 -> diff --git a/compiler/minils/transformations/normalize_mem.ml b/compiler/minils/transformations/normalize_mem.ml index 2a4d9cb..1d902fa 100644 --- a/compiler/minils/transformations/normalize_mem.ml +++ b/compiler/minils/transformations/normalize_mem.ml @@ -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