Do not introduce useless variable in [reset every]

This commit is contained in:
Léonard Gérard 2011-11-02 23:53:54 +01:00
parent dfc0077859
commit 0222d11b2d
1 changed files with 5 additions and 1 deletions

View File

@ -95,8 +95,12 @@ let block funs (res,_) b =
Hept_mapfold.block funs (res,b.b_stateful) b
(* Transform reset blocks in blocks with reseted exps,
create a var to store the reset condition evaluation. *)
create a var to store the reset condition evaluation if not already a var. *)
let eqdesc funs (res,stateful) = function
| Ereset(b, ({ e_desc = Evar x } as e)) ->
let r = if stateful then merge_resets res (Some e) else res in
let b, _ = Hept_mapfold.block_it funs (r,stateful) b in
Eblock(b), (res,stateful)
| Ereset(b, e) ->
if stateful then (
let e, _ = Hept_mapfold.exp_it funs (res,stateful) e in