let userdef_ref_apply m fml loc =
debug "[userdef_ref_apply] calls with formal %a and loc %a"
pp_formal_simple fml pp_loc loc ;
begin
match fml, loc with
| Fpref 1, PRef p -> fun_load m p false
| Faref 1, ARef p -> fun_load m p true
| Fpref k, PRpar (p,r) ->
let n = k-r-1 in
if n = 0 then fun_load m p false
else
(
match p.p_type with
| None -> Wp_parameters.fatal
"[userdef_ref_apply] pure type"
| Some ty ->
let obj = object_of_n_pointed n ty in
V_pointer(obj, PRpar(pointed_of_n_path n p,n)))
| Faref k, ARpar(p,r) ->
let n = k-r-1 in
if n = 0 then fun_load m p true
else
(
match p.p_type with
| None -> Wp_parameters.fatal
"[userdef_ref_apply] pure type"
| Some ty ->
let obj = object_of_n_pointed n ty in
V_pointer(obj, ARpar(pointed_of_n_path n p,n)))
| f , l -> WpLog.fatal
"[userdef_ref_apply] calls with fml:%a and loc:%a"
pp_formal_simple f pp_loc l
end