private HashSet <ILogicalConstruct> GetLogicalConstructsInRange(BlockRange blockRange, out ILogicalConstruct theCommonParent)
        {
            HashSet <ILogicalConstruct>    children      = new HashSet <ILogicalConstruct>();
            HashSet <ISingleEntrySubGraph> blocksParents = new HashSet <ISingleEntrySubGraph>();

            int rangeBegin = blockRange.Start.First.Offset;
            int rangeEnd   = blockRange.End.First.Offset;

            for (int i = 0; i < context.CFG.Blocks.Length; i++)
            {
                InstructionBlock currentBlock = context.CFG.Blocks[i];
                if (currentBlock.First.Offset >= rangeBegin && currentBlock.First.Offset <= rangeEnd)
                {
                    CFGBlockLogicalConstruct[] cfgConstructs = context.CFGBlockToLogicalConstructMap[currentBlock];

                    for (int j = 0; j < cfgConstructs.Length; j++)
                    {
                        blocksParents.Add((ILogicalConstruct)cfgConstructs[j].Parent);
                        children.Add(cfgConstructs[j]);
                    }
                }
            }

            if (blocksParents.Count == 1)
            {
                theCommonParent = (ILogicalConstruct)blocksParents.ToArray <ISingleEntrySubGraph>()[0];

                return(children);
            }
            //TODO: CCheck whether the parent logical construct of of each CFGBlockLogicalConstruct that belongs to the exception handling block,
            //(i.e. each member of blocksParents) contains as children ONLY blocks that belong to the exception handling block (i.e. blocks that are in blockRange).

            theCommonParent = (ILogicalConstruct)LogicalFlowUtilities.FindFirstCommonParent(blocksParents);

            HashSet <ILogicalConstruct> result = new HashSet <ILogicalConstruct>();

            foreach (ILogicalConstruct child in children)
            {
                ILogicalConstruct desiredNode;
                LogicalFlowUtilities.TryGetParentConstructWithGivenParent(child, theCommonParent, out desiredNode);
                result.Add(desiredNode);
            }

            if (theCommonParent is ExceptionHandlingLogicalConstruct)
            {
                result.Clear();
                result.Add(theCommonParent);
                theCommonParent = theCommonParent.Parent as ILogicalConstruct;
            }

            return(result);
        }
 private HashSet <ILogicalConstruct> GetLogicalConstructsInRange(BlockRange blockRange, out ILogicalConstruct theCommonParent)
 {
     V_0 = new HashSet <ILogicalConstruct>();
     V_1 = new HashSet <ISingleEntrySubGraph>();
     V_2 = blockRange.Start.get_First().get_Offset();
     V_3 = blockRange.End.get_First().get_Offset();
     V_5 = 0;
     while (V_5 < (int)this.context.get_CFG().get_Blocks().Length)
     {
         V_6 = this.context.get_CFG().get_Blocks()[V_5];
         if (V_6.get_First().get_Offset() >= V_2 && V_6.get_First().get_Offset() <= V_3)
         {
             V_7 = this.context.get_CFGBlockToLogicalConstructMap().get_Item(V_6);
             V_8 = 0;
             while (V_8 < (int)V_7.Length)
             {
                 dummyVar0 = V_1.Add((ILogicalConstruct)V_7[V_8].get_Parent());
                 dummyVar1 = V_0.Add(V_7[V_8]);
                 V_8       = V_8 + 1;
             }
         }
         V_5 = V_5 + 1;
     }
     if (V_1.get_Count() == 1)
     {
         theCommonParent = (ILogicalConstruct)V_1.ToArray <ISingleEntrySubGraph>()[0];
         return(V_0);
     }
     theCommonParent = (ILogicalConstruct)LogicalFlowUtilities.FindFirstCommonParent(V_1);
     V_4             = new HashSet <ILogicalConstruct>();
     V_9             = V_0.GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             dummyVar2 = LogicalFlowUtilities.TryGetParentConstructWithGivenParent(V_9.get_Current(), theCommonParent, out V_10);
             dummyVar3 = V_4.Add(V_10);
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     if (theCommonParent as ExceptionHandlingLogicalConstruct != null)
     {
         V_4.Clear();
         dummyVar4       = V_4.Add(theCommonParent);
         theCommonParent = theCommonParent.get_Parent() as ILogicalConstruct;
     }
     return(V_4);
 }