@@ -23,6 +23,7 @@ open Expression
2323open Pyre
2424module TaintAccessPath = Analysis. TaintAccessPath
2525module PyrePysaLogic = Analysis. PyrePysaLogic
26+ module AstResult = PyrePysaApi. AstResult
2627
2728module JsonHelper = struct
2829 let add_optional name value to_json bindings =
@@ -192,7 +193,8 @@ module CallableToDecoratorsMap = struct
192193 let collect_decorators ~callables_to_definitions_map callable =
193194 callable
194195 |> Option. some_if (Target. is_normal callable)
195- >> = Target.CallablesSharedMemory.ReadOnly. get_signature callables_to_definitions_map
196+ >> | Target.CallablesSharedMemory.ReadOnly. get_signature callables_to_definitions_map
197+ >> = AstResult. to_option
196198 >> = fun { Target.CallableSignature. decorators; location = define_location ; _ } ->
197199 let decorators = decorators |> List. filter ~f: filter_decorator |> List. rev in
198200 if List. is_empty decorators then
@@ -2068,6 +2070,7 @@ struct
20682070 let resolve_module_path = Option. value ~default: (fun _ -> None ) resolve_module_path in
20692071 callable
20702072 |> Target.CallablesSharedMemory.ReadOnly. get_qualifier callables_to_definitions_map
2073+ |> AstResult. to_option
20712074 >> = resolve_module_path
20722075 >> | (function
20732076 | { RepositoryPath. filename = Some filename ; _ } ->
@@ -4300,6 +4303,7 @@ let resolve_callees
43004303 Target.CallablesSharedMemory.ReadOnly. get_signature
43014304 callables_to_definitions_map
43024305 callee.target
4306+ |> AstResult. to_option
43034307 >> | (fun { Target.CallableSignature. parameters; is_stub; _ } ->
43044308 is_stub
43054309 || not (List. exists parameters ~f: (parameter_has_annotation callable_class)))
@@ -5530,10 +5534,7 @@ module HigherOrderCallGraph = struct
55305534 Context. callables_to_definitions_map
55315535 target
55325536 with
5533- | None ->
5534- log " Cannot find define for callable `%a`" Target. pp_pretty_with_kind target;
5535- None
5536- | Some { Target.CallableSignature. is_stub; parameters; _ } ->
5537+ | AstResult. Some { Target.CallableSignature. is_stub; parameters; _ } ->
55375538 if is_stub then
55385539 let () = log " Callable `%a` is a stub" Target. pp_pretty_with_kind target in
55395540 None
@@ -5542,6 +5543,9 @@ module HigherOrderCallGraph = struct
55425543 (parameters
55435544 |> TaintAccessPath. normalize_parameters
55445545 |> List. map ~f: (fun { TaintAccessPath.NormalizedParameter. root; _ } -> root))
5546+ | _ ->
5547+ log " Cannot find define for callable `%a`" Target. pp_pretty_with_kind target;
5548+ None
55455549 in
55465550 let create_parameter_target_excluding_args_kwargs (parameter_target , (_ , argument_matches )) =
55475551 match argument_matches, parameter_target with
@@ -5692,7 +5696,7 @@ module HigherOrderCallGraph = struct
56925696 let stub_targets =
56935697 List. filter_map call_targets_from_callee ~f: (fun { CallTarget. target; _ } ->
56945698 let is_stub =
5695- Target.CallablesSharedMemory.ReadOnly. is_stub
5699+ Target.CallablesSharedMemory.ReadOnly. is_stub_like
56965700 Context. callables_to_definitions_map
56975701 target
56985702 |> Option. value ~default: false
@@ -6338,6 +6342,7 @@ module HigherOrderCallGraph = struct
63386342 (to avoid bloat), use this API to query the definition. *)
63396343 Target.CallablesSharedMemory.ReadOnly. get_captures
63406344 Context. callables_to_definitions_map
6345+ |> AstResult. to_option
63416346 | _ ->
63426347 Format. asprintf
63436348 " Expect a single `define_target` but got `[%s]`"
0 commit comments