Project

General

Profile

Revision 2822cf55 src/corelang.ml

View differences:

src/corelang.ml
891 891
and get_node_calls nodes node =
892 892
  List.fold_left (fun accu eq -> Utils.ISet.union (get_eq_calls nodes eq) accu) Utils.ISet.empty node.node_eqs
893 893

  
894
let rec get_expr_vars vars e =
895
  get_expr_desc_vars vars e.expr_desc
896
and get_expr_desc_vars vars expr_desc =
897
  match expr_desc with
898
  | Expr_const _ -> vars
899
  | Expr_ident x -> Utils.ISet.add x vars
900
  | Expr_tuple el
901
  | Expr_array el -> List.fold_left get_expr_vars vars el
902
  | Expr_pre e1 -> get_expr_vars vars e1
903
  | Expr_when (e1, c, _) -> get_expr_vars (Utils.ISet.add c vars) e1 
904
  | Expr_access (e1, d) 
905
  | Expr_power (e1, d)   -> List.fold_left get_expr_vars vars [e1; expr_of_dimension d]
906
  | Expr_ite (c, t, e) -> List.fold_left get_expr_vars vars [c; t; e]
907
  | Expr_arrow (e1, e2) 
908
  | Expr_fby (e1, e2) -> List.fold_left get_expr_vars vars [e1; e2]
909
  | Expr_merge (c, hl) -> List.fold_left (fun vars (_, h) -> get_expr_vars vars h) (Utils.ISet.add c vars) hl
910
  | Expr_appl (_, arg, None)   -> get_expr_vars vars arg
911
  | Expr_appl (_, arg, Some (r,_)) -> get_expr_vars (Utils.ISet.add r vars) arg
912

  
894 913

  
895 914
let rec expr_has_arrows e =
896 915
  expr_desc_has_arrows e.expr_desc

Also available in: Unified diff