private void DetachFromLogicalTree(CFGBlockLogicalConstruct node)
 {
     if (node.get_CFGPredecessors().get_Count() > 0 || node.get_CFGSuccessors().get_Count() > 0)
     {
         throw new Exception("This node cannot be detached from the logical tree.");
     }
     dummyVar0 = node.get_Parent().get_Children().Remove(node);
     V_0       = this.logicalContext.get_CFGBlockToLogicalConstructMap().get_Item(node.get_TheBlock());
     if ((int)V_0.Length == 1)
     {
         if (V_0[0] != node)
         {
             throw new Exception("Logical tree is inconsistent.");
         }
         dummyVar1 = this.logicalContext.get_CFGBlockToLogicalConstructMap().Remove(node.get_TheBlock());
     }
     V_1 = new CFGBlockLogicalConstruct[(int)V_0.Length - 1];
     V_2 = 0;
     V_3 = 0;
     while (V_2 < (int)V_0.Length)
     {
         if (V_0[V_2] != node)
         {
             if (V_3 == (int)V_0.Length)
             {
                 throw new Exception("Logical tree is inconsistent.");
             }
             V_1[V_3] = V_0[V_2];
         }
         else
         {
             V_3 = V_3 - 1;
         }
         V_2 = V_2 + 1;
         V_3 = V_3 + 1;
     }
     this.logicalContext.get_CFGBlockToLogicalConstructMap().set_Item(node.get_TheBlock(), V_1);
     return;
 }
        private bool TryProcessConditionalDisposeHandler(YieldExceptionHandlerInfo yieldExceptionHandler, CFGBlockLogicalConstruct startBlock)
        {
            if (this.finallyBlocks.get_Count() > 0)
            {
                return(false);
            }
            if (startBlock as PartialCFGBlockLogicalConstruct == null || startBlock.get_CFGSuccessors().get_Count() != 1)
            {
                return(false);
            }
            if (startBlock.get_LogicalConstructExpressions().get_Count() == 0)
            {
                return(false);
            }
            V_0 = startBlock.get_LogicalConstructExpressions().get_Item(0) as BinaryExpression;
            if (V_0 == null || !V_0.get_IsAssignmentExpression() || V_0.get_Left().get_CodeNodeType() != 30 || (V_0.get_Left() as FieldReferenceExpression).get_Field().Resolve() != this.stateFieldRef || V_0.get_Right().get_CodeNodeType() != 22 || (Int32)(V_0.get_Right() as LiteralExpression).get_Value() != yieldExceptionHandler.get_NextState())
            {
                return(false);
            }
            if (startBlock.get_LogicalConstructExpressions().get_Count() != 2 || yieldExceptionHandler.get_HandlerType() != 2)
            {
                if (startBlock.get_LogicalConstructExpressions().get_Count() != 1 || yieldExceptionHandler.get_HandlerType() != 1)
                {
                    return(false);
                }
            }
            else
            {
                V_6 = startBlock.get_LogicalConstructExpressions().get_Item(1) as BinaryExpression;
                if (V_6 == null || !V_6.get_IsAssignmentExpression() || V_6.get_Left().get_CodeNodeType() != 30 || (object)(V_6.get_Left() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_DisposableField() || V_6.get_Right().get_CodeNodeType() != 33 || (V_6.get_Right() as SafeCastExpression).get_Expression().get_CodeNodeType() != 30 || (object)((V_6.get_Right() as SafeCastExpression).get_Expression() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_EnumeratorField())
                {
                    return(false);
                }
            }
            V_2 = startBlock.get_CFGSuccessors().GetEnumerator();
            V_7 = V_2;
            try
            {
                dummyVar0 = V_2.MoveNext();
                V_1       = V_2.get_Current();
            }
            finally
            {
                if (V_7 != null)
                {
                    V_7.Dispose();
                }
            }
            if (V_1.get_LogicalConstructExpressions().get_Count() != 1)
            {
                return(false);
            }
            V_3 = V_1.get_LogicalConstructExpressions().get_Item(0) as BinaryExpression;
            if (V_3 == null || V_3.get_Operator() != 9 || V_3.get_Left().get_CodeNodeType() != 30 || (object)(V_3.get_Left() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_DisposableField() || V_3.get_Right().get_CodeNodeType() != 22 || (V_3.get_Right() as LiteralExpression).get_Value() != null)
            {
                return(false);
            }
            V_4 = null;
            V_8 = V_1.get_CFGSuccessors().GetEnumerator();
            try
            {
                while (V_8.MoveNext())
                {
                    V_9 = V_8.get_Current() as CFGBlockLogicalConstruct;
                    if (V_9 == null || V_9.get_CFGPredecessors().get_Count() != 1)
                    {
                        continue;
                    }
                    V_4 = V_9;
                    goto Label0;
                }
            }
            finally
            {
                ((IDisposable)V_8).Dispose();
            }
Label0:
            if (V_4 == null || V_4.get_LogicalConstructExpressions().get_Count() != 1)
            {
                return(false);
            }
            V_5 = V_4.get_LogicalConstructExpressions().get_Item(0) as MethodInvocationExpression;
            if (V_5 == null || !V_5.get_VirtualCall() || V_5.get_MethodExpression().get_Target().get_CodeNodeType() != 30 || (object)(V_5.get_MethodExpression().get_Target() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_DisposableField() || String.op_Inequality(V_5.get_MethodExpression().get_Method().get_Name(), "Dispose"))
            {
                return(false);
            }
            this.finallyEntryBlock = startBlock;
            dummyVar1             = this.finallyBlocks.Add(startBlock);
            this.conditionBlock   = V_1;
            dummyVar2             = this.finallyBlocks.Add(V_1);
            this.disposeCallBlock = V_4;
            dummyVar3             = this.finallyBlocks.Add(V_4);
            return(true);
        }
 private CFGBlockLogicalConstruct ProcessFinallyNode(CFGBlockLogicalConstruct finallyBlockEntry, CFGBlockLogicalConstruct finallyBlockEnd)
 {
     V_1 = finallyBlockEntry.get_SameParentPredecessors().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = (ILogicalConstruct)V_1.get_Current();
             if (this.newTryBody.Contains(V_2))
             {
                 continue;
             }
             throw new Exception("Invalid entry to the finally block");
         }
     }
     finally
     {
         ((IDisposable)V_1).Dispose();
     }
     V_3 = finallyBlockEnd.get_CFGSuccessors().GetEnumerator();
     try
     {
         dummyVar0 = V_3.MoveNext();
         V_0       = V_3.get_Current();
         if (V_3.MoveNext())
         {
             throw new Exception("Invalid count of successors");
         }
     }
     finally
     {
         if (V_3 != null)
         {
             V_3.Dispose();
         }
     }
     V_4 = (new HashSet <CFGBlockLogicalConstruct>(finallyBlockEntry.get_CFGPredecessors())).GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             if (InstructionBlock.op_Inequality(V_5.get_TheBlock(), finallyBlockEntry.get_TheBlock()) && (int)V_5.get_TheBlock().get_Successors().Length > 1)
             {
                 this.ProcessMultiWayCFGPredecessor(finallyBlockEntry, V_5.get_TheBlock(), V_0.get_TheBlock());
             }
             V_6 = V_5;
             while (V_6 != finallyBlockEntry.get_Parent())
             {
                 dummyVar1 = V_6.RemoveFromSuccessors(finallyBlockEntry);
                 V_6.AddToSuccessors(V_0);
                 V_6 = V_6.get_Parent() as LogicalConstructBase;
             }
             V_0.AddToPredecessors(V_5);
             dummyVar2 = finallyBlockEntry.RemoveFromPredecessors(V_5);
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     dummyVar3 = V_0.RemoveFromPredecessors(finallyBlockEnd);
     dummyVar4 = finallyBlockEnd.RemoveFromSuccessors(V_0);
     return(V_0);
 }