[pulse][minor] use List.concat_map in two places

Reviewed By: skcho

Differential Revision: D26818060

fbshipit-source-id: bd1ebc026
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent a7ada8d4af
commit 8db09e8e0a

@ -237,18 +237,13 @@ module PulseTransferFunctions = struct
L.d_printfln ~color:Pp.Orange "@\nExecuting injected instr:%a@\n@."
(Sil.pp_instr Pp.text ~print_types:true)
call_instr ;
List.fold
~f:(fun astates (astate : Domain.t) ->
List.concat_map astate_list ~f:(fun (astate : Domain.t) ->
match astate with
| ISLLatentMemoryError _ | AbortProgram _ | ExitProgram _ | LatentAbortProgram _ ->
astate :: astates
[astate]
| ContinueProgram astate ->
let astate =
dispatch_call analysis_data ret call_exp actuals location call_flags astate
|> PulseReport.report_results analysis_data
in
List.rev_append astate astates )
~init:[] astate_list
|> PulseReport.report_results analysis_data )
in
let dynamic_types_unreachable =
PulseOperations.get_dynamic_type_unreachable_values vars astate
@ -363,22 +358,17 @@ module PulseTransferFunctions = struct
|> PulseReport.report_results analysis_data
| Metadata (ExitScope (vars, location)) ->
let remove_vars vars astates =
List.fold
~f:(fun astates (astate : Domain.t) ->
List.concat_map astates ~f:(fun (astate : Domain.t) ->
match astate with
| ISLLatentMemoryError _ | AbortProgram _ | ExitProgram _ | LatentAbortProgram _ ->
astate :: astates
[astate]
| ContinueProgram astate ->
let astate =
( match PulseOperations.remove_vars tenv vars location astate with
| Ok astate ->
Ok [astate]
| Error _ as error ->
error )
|> PulseReport.report_list_result analysis_data
in
List.rev_append astate astates )
~init:[] astates
|> PulseReport.report_list_result analysis_data )
in
if Procname.is_java (Procdesc.get_proc_name proc_desc) then
remove_vars vars [ContinueProgram astate]

Loading…
Cancel
Save