@@ -1456,11 +1456,25 @@ module ModuleCallGraphs = struct
14561456 >> | fun if_called -> { if_called }
14571457 end
14581458
1459+ module JsonDefineCallees = struct
1460+ type t = { define_targets : JsonCallTarget .t list }
1461+
1462+ let from_json json =
1463+ let open Core.Result.Monad_infix in
1464+ let parse_call_target_list targets =
1465+ targets |> List. map ~f: JsonCallTarget. from_json |> Result. all
1466+ in
1467+ JsonUtil. get_list_member json " define_targets"
1468+ >> = parse_call_target_list
1469+ >> | fun define_targets -> { define_targets }
1470+ end
1471+
14591472 module JsonExpressionCallees = struct
14601473 type t =
14611474 | Call of JsonCallCallees .t
14621475 | Identifier of JsonIdentifierCallees .t
14631476 | AttributeAccess of JsonAttributeAccessCallees .t
1477+ | Define of JsonDefineCallees .t
14641478
14651479 let from_json json =
14661480 let open Core.Result.Monad_infix in
@@ -1473,6 +1487,8 @@ module ModuleCallGraphs = struct
14731487 | `Assoc [(" AttributeAccess" , attribute_access_callees)] ->
14741488 JsonAttributeAccessCallees. from_json attribute_access_callees
14751489 >> | fun attribute_access_callees -> AttributeAccess attribute_access_callees
1490+ | `Assoc [(" Define" , define_callees)] ->
1491+ JsonDefineCallees. from_json define_callees >> | fun define_callees -> Define define_callees
14761492 | _ ->
14771493 Error (FormatError. UnexpectedJsonType { json; message = " expected expression callees" })
14781494 end
@@ -4099,13 +4115,21 @@ module ReadOnly = struct
40994115 if_called;
41004116 }
41014117 in
4118+ let instantiate_define_callees { JsonDefineCallees. define_targets } =
4119+ {
4120+ CallGraph.DefineCallees. define_targets = List. map ~f: instantiate_call_target define_targets;
4121+ decorated_targets = [] ;
4122+ }
4123+ in
41024124 let instantiate_expression_callees = function
41034125 | JsonExpressionCallees. Call callees ->
41044126 ExpressionCallees. Call (instantiate_call_callees callees)
41054127 | JsonExpressionCallees. Identifier callees ->
41064128 ExpressionCallees. Identifier (instantiate_identifier_callees callees)
41074129 | JsonExpressionCallees. AttributeAccess callees ->
41084130 ExpressionCallees. AttributeAccess (instantiate_attribute_access_callees callees)
4131+ | JsonExpressionCallees. Define callees ->
4132+ ExpressionCallees. Define (instantiate_define_callees callees)
41094133 in
41104134 let instantiate_call_edge ~key :location ~data :callees call_graph =
41114135 let callees = instantiate_expression_callees callees in
0 commit comments