method vannotation =
let return_type ty =
change_result_type := false;
match ty with
| Ctype rt when isStructOrUnionType rt ->
begin
change_result_type := true;
let ty = Ctype(mkTRef rt) in
new_result_type := ty;
ty
end
| Ctype _ | Ltype _ | Lvar _ | Linteger | Lreal | Larrow _ -> ty
in
let rec annot = function
(*
| Dpredicate_reads(_name,_poly,params,_)
| Dpredicate_def(_name,_poly,params,_)
| Dinductive_def(_name,_poly,params,_) ->
List.iter var params;
DoChildren
| Dlogic_reads(info,poly,params,rt,tlocs) ->
List.iter var params;
let rt = return_type rt in
ChangeDoChildrenPost
(Dlogic_reads(info,poly,params,rt,tlocs), fun x -> x)
| Dlogic_def(name,poly,params,rt,t) ->
List.iter var params;
let rt = return_type rt in
ChangeDoChildrenPost
(Dlogic_def(name,poly,params,rt,t), fun x -> x)
| Dlogic_axiomatic(name,poly,params,rt,axioms) ->
List.iter var params;
let rt = return_type rt in
ChangeDoChildrenPost
(Dlogic_axiomatic(name,poly,params,rt,axioms), fun x -> x)
*)
| Dfun_or_pred li ->
List.iter var li.l_profile;
begin
match li.l_type with
| None -> DoChildren
| Some rt ->
let li' = { li with l_type = Some (return_type rt)} in
ChangeDoChildrenPost (Dfun_or_pred li', fun x -> x)
end
| Dtype_annot annot ->
begin match (List.hd annot.l_profile).lv_type with
| Ctype ty when isStructOrUnionType ty ->
change_this_type := true;
this_name := (List.hd annot.l_profile).lv_name;
let annot = { annot with
l_profile = [{ (List.hd annot.l_profile) with
lv_type = Ctype(mkTRef ty)}];
}
in
ChangeDoChildrenPost
(Dtype_annot annot, fun x -> change_this_type := false; x)
| Ctype _ | Ltype _ | Lvar _ | Linteger | Lreal | Larrow _ ->
DoChildren
end
| Dtype _ | Dlemma _ | Dinvariant _ -> DoChildren
| Daxiomatic _ -> DoChildren (* FIXME: correct ? *)
in annot