From b6aecf9869982d5d37dfef292790c19528e78de6 Mon Sep 17 00:00:00 2001 From: Brice Gelineau Date: Thu, 7 Jul 2011 16:18:25 +0200 Subject: [PATCH] Bugfix for reset calls in C --- compiler/obc/c/cgen.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index 4e6b896..960d7ec 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -556,8 +556,14 @@ let rec cstm_of_act out_env var_env obj_env act = let on = obj_ref_name o in let obj = assoc_obj on obj_env in let classn = cname_of_qn obj.o_class in - [Csexpr (Cfun_call (classn ^ "_reset", - [Caddrof (Cfield (Cderef (Cvar "self"), local_qn (name on)))]))] + let field = Cfield (Cderef (Cvar "self"), local_qn (name on)) in + (match o with + | Oobj _ -> + [Csexpr (Cfun_call (classn ^ "_reset", [Caddrof field]))] + | Oarray (_, p) -> + [Csexpr (Cfun_call (classn ^ "_reset", + [Caddrof (Carray(field, cexpr_of_pattern out_env var_env p))]))] + ) (** Step functions applications can return multiple values, so we use a local structure to hold the results, before allocating to our