let rec collect_refparams kf loc arr_vars ref_vars sep_terms = function
| x::xs ->
begin
match kind_of_formal x with
| Formal_Value ->
collect_refparams kf loc arr_vars ref_vars sep_terms xs
| Formal_Array _ ->
collect_refparams kf loc (x::arr_vars) ref_vars sep_terms xs
| Formal_Ref n ->
let t = Logic_const.tvar ~loc (Cil.cvar_to_lvar x) in
let sep_terms = collect_sepstars loc n t sep_terms in
collect_refparams kf loc arr_vars (x::ref_vars) sep_terms xs
end
| [] ->
begin
match List.rev arr_vars , List.rev ref_vars with
| [] , _ -> ()
| [_] , [] -> ()
| xs , [] ->
Wp_parameters.warning
"For function %s,@ array reference parameters %a@ must be disjoint at call site"
(Kernel_function.get_name kf) pp_formals xs
| xs , ys ->
Wp_parameters.warning
"For function %s, reference parameters@ %a and %a@ must be disjoint at call site"
(Kernel_function.get_name kf) pp_formals xs pp_formals ys
end ;
match sep_terms with
| [] | [_] -> None
| ts -> Some(Logic_const.new_predicate (Logic_const.pseparated ts))