Project

General

Profile

Revision 54d032f5 src/corelang.ml

View differences:

src/corelang.ml
41 41
let mkclock loc d =
42 42
  { ck_dec_desc = d; ck_dec_loc = loc }
43 43

  
44
let mkvar_decl loc (id, ty_dec, ck_dec, is_const) =
44
let mkvar_decl loc ?(orig=false) (id, ty_dec, ck_dec, is_const) =
45 45
  { var_id = id;
46
    var_orig = orig;
46 47
    var_dec_type = ty_dec;
47 48
    var_dec_clock = ck_dec;
48 49
    var_dec_const = is_const;
......
61 62

  
62 63
let var_decl_of_const c =
63 64
  { var_id = c.const_id;
65
    var_orig = true;
64 66
    var_dec_type = { ty_dec_loc = c.const_loc; ty_dec_desc = Tydec_any };
65 67
    var_dec_clock = { ck_dec_loc = c.const_loc; ck_dec_desc = Ckdec_any };
66 68
    var_dec_const = true;
......
572 574
   | Expr_pre e' -> Expr_pre (expr_replace_var fvar e')
573 575
   | Expr_when (e', i, l)-> Expr_when (expr_replace_var fvar e', fvar i, l)
574 576
   | Expr_merge (i, hl) -> Expr_merge (fvar i, List.map (fun (t, h) -> (t, expr_replace_var fvar h)) hl)
575
   | Expr_appl (i, e', i') -> Expr_appl (i, expr_replace_var fvar e', Utils.option_map (fun (x, l) -> fvar x, l) i')
577
   | Expr_appl (i, e', i') -> Expr_appl (i, expr_replace_var fvar e', Utils.option_map (expr_replace_var fvar) i')
576 578

  
577 579
(* Applies the renaming function [fvar] to every rhs
578 580
   only when the corresponding lhs satisfies predicate [pvar] *)
......
631 633
   | Expr_merge (i, hl) -> 
632 634
     Expr_merge (f_var i, List.map (fun (t, h) -> (t, re h)) hl)
633 635
   | Expr_appl (i, e', i') -> 
634
     Expr_appl (f_node i, re e', Utils.option_map (fun (x, l) -> f_var x, l) i')
636
     Expr_appl (f_node i, re e', Utils.option_map re i')
635 637
  
636 638
 let rename_node_annot f_node f_var f_const expr  =
637 639
   expr
......
929 931
  | Expr_fby (e1, e2) -> List.fold_left get_expr_vars vars [e1; e2]
930 932
  | Expr_merge (c, hl) -> List.fold_left (fun vars (_, h) -> get_expr_vars vars h) (Utils.ISet.add c vars) hl
931 933
  | Expr_appl (_, arg, None)   -> get_expr_vars vars arg
932
  | Expr_appl (_, arg, Some (r,_)) -> get_expr_vars (Utils.ISet.add r vars) arg
934
  | Expr_appl (_, arg, Some r) -> List.fold_left get_expr_vars vars [arg; r]
933 935

  
934 936

  
935 937
let rec expr_has_arrows e =

Also available in: Unified diff