bugfix for reset calls in C
This commit is contained in:
parent
f40dc66e57
commit
10115684d9
|
@ -560,20 +560,18 @@ let rec cstm_of_act out_env var_env obj_env act =
|
||||||
let on = obj_ref_name o in
|
let on = obj_ref_name o in
|
||||||
let obj = assoc_obj on obj_env in
|
let obj = assoc_obj on obj_env in
|
||||||
let classn = cname_of_qn obj.o_class in
|
let classn = cname_of_qn obj.o_class in
|
||||||
(match obj.o_size with
|
let field = Cfield (Cderef (Cvar "self"), local_qn (name on)) in
|
||||||
| None ->
|
(match o with
|
||||||
[Csexpr (Cfun_call (classn ^ "_reset",
|
| Oobj _ ->
|
||||||
[Caddrof (Cfield (Cderef (Cvar "self"), local_qn (name on)))]))]
|
[Csexpr (Cfun_call (classn ^ "_reset", [Caddrof field]))]
|
||||||
| Some size ->
|
| Oarray (_, pl) ->
|
||||||
let field = Cfield (Cderef (Cvar "self"), local_qn (name on)) in
|
let rec mk_loop pl field = match pl with
|
||||||
let rec mk_loop nl elt = match nl with
|
| [] ->
|
||||||
| [] -> [Csexpr (Cfun_call (classn ^ "_reset", [Caddrof elt] ))]
|
[Csexpr (Cfun_call (classn ^ "_reset", [Caddrof field]))]
|
||||||
| n::nl ->
|
| p::pl ->
|
||||||
let x = gen_symbol () in
|
mk_loop pl (Carray(field, cexpr_of_pattern out_env var_env p))
|
||||||
let elt = Carray(elt, Cvar x) in
|
in
|
||||||
[Cfor(x, Cconst (Ccint 0), cexpr_of_static_exp n, mk_loop nl elt)]
|
mk_loop pl field
|
||||||
in
|
|
||||||
mk_loop size field
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(** Step functions applications can return multiple values, so we use a
|
(** Step functions applications can return multiple values, so we use a
|
||||||
|
|
Loading…
Reference in a new issue