Skip to content

Commit

Permalink
Include function type annotations in the callgraph analysis
Browse files Browse the repository at this point in the history
Fixes #187
  • Loading branch information
bacam committed Nov 24, 2022
1 parent 10b7ffc commit 16d5461
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/callgraph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,15 @@ let add_def_to_graph graph def =
| _ ->
Reporting.unreachable l __POS__ "Unexpected definition in outcome block"
in


let scan_fundef_tannot self (FD_aux (FD_function (_, Typ_annot_opt_aux (tannotopt, _), _), _)) =
match tannotopt with
| Typ_annot_opt_none -> ()
| Typ_annot_opt_some (typq, typ) ->
scan_typquant self typq;
IdSet.iter (fun typ_id -> graph := G.add_edge self (Type typ_id) !graph) (typ_ids typ)
in

begin match def with
| DEF_spec (VS_aux (VS_val_spec (TypSchm_aux (TypSchm_ts (typq, (Typ_aux (Typ_bidir _, _) as typ)), _), id, _, _), _)) ->
graph := G.add_edges (Mapping id) [] !graph;
Expand All @@ -319,6 +327,7 @@ let add_def_to_graph graph def =
| DEF_fundef fdef ->
let id = id_of_fundef fdef in
graph := G.add_edges (Function id) [] !graph;
scan_fundef_tannot (Function id) fdef;
ignore (rewrite_fun (rewriters (Function id)) fdef)
| DEF_mapdef mdef ->
let id = id_of_mapdef mdef in
Expand Down

0 comments on commit 16d5461

Please sign in to comment.