From 129cadb9b6f8b44a21fd52035b76ed59efad5b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Thu, 5 Jul 2018 03:26:48 -0700 Subject: [PATCH] "Be more lazy in get_siblings" Reviewed By: jvillard Differential Revision: D8732963 fbshipit-source-id: 0899a6d --- infer/src/IR/Procdesc.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/infer/src/IR/Procdesc.ml b/infer/src/IR/Procdesc.ml index 81600112e..b17713d35 100644 --- a/infer/src/IR/Procdesc.ml +++ b/infer/src/IR/Procdesc.ml @@ -101,9 +101,10 @@ module Node = struct (** Get siblings *) let get_siblings node = get_preds node - |> 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 - Sequence.append (Sequence.of_list siblings) acc ) + |> ISequence.gen_sequence_list ~f:(fun parent -> + get_succs parent |> Sequence.of_list |> Sequence.filter ~f:(fun n -> not (equal node n)) + |> Sequence.Generator.of_sequence ) + |> Sequence.Generator.run (** Get the node kind *)