Convert list to sequence in `Procdesc.get_siblings`

Reviewed By: ddino

Differential Revision: D8723595

fbshipit-source-id: a9564b7
master
Ezgi Çiçek 7 years ago committed by Facebook Github Bot
parent 2cb96c356a
commit 718f81ac77

@ -101,9 +101,9 @@ module Node = struct
(** Get siblings *)
let get_siblings node =
get_preds node
|> List.fold_left ~init:[] ~f:(fun acc parent ->
|> List.fold_left ~init:Sequence.empty ~f:(fun acc parent ->
let siblings = get_succs parent |> List.filter ~f:(fun n -> not (equal node n)) in
List.rev_append siblings acc )
Sequence.append (Sequence.of_list siblings) acc )
(** Get the node kind *)

@ -84,7 +84,7 @@ module Node : sig
val get_preds : t -> t list
(** Get the predecessor nodes of the current node *)
val get_siblings : t -> t list
val get_siblings : t -> t Sequence.t
(** Get siblings of the current node *)
val get_proc_name : t -> Typ.Procname.t

@ -102,7 +102,7 @@ let remove_prune_node_pairs exit_nodes guard_nodes =
except_exit_nodes
|> Control.GuardNodes.filter (fun node ->
is_prune node
&& Procdesc.Node.get_siblings node |> List.hd
&& Procdesc.Node.get_siblings node |> Sequence.hd
|> Option.value_map ~default:false ~f:(fun sibling ->
not (Control.GuardNodes.mem sibling except_exit_nodes) ) )
|> Control.GuardNodes.union exit_nodes

Loading…
Cancel
Save