internal static CFGBlockLogicalConstruct FindGuardedBlockCFGFollowNode(ExceptionHandlingLogicalConstruct construct, HashSet <CFGBlockLogicalConstruct> outOfconsideration) { V_0 = new Dictionary <CFGBlockLogicalConstruct, uint>(); GuardedBlocksFollowNodesFinder.AddSuccessorsToCount(construct.get_Try(), V_0); V_1 = 1; if (construct as TryCatchFilterLogicalConstruct == null) { if (construct as TryFaultLogicalConstruct == null) { if (construct as TryFinallyLogicalConstruct != null) { GuardedBlocksFollowNodesFinder.AddSuccessorsToCount((construct as TryFinallyLogicalConstruct).get_Finally(), V_0); V_1 = V_1 + 1; } } else { GuardedBlocksFollowNodesFinder.AddSuccessorsToCount((construct as TryFaultLogicalConstruct).get_Fault(), V_0); V_1 = V_1 + 1; } } else { V_5 = (construct as TryCatchFilterLogicalConstruct).get_Handlers(); V_6 = 0; while (V_6 < (int)V_5.Length) { GuardedBlocksFollowNodesFinder.AddSuccessorsToCount(V_5[V_6], V_0); V_1 = V_1 + 1; V_6 = V_6 + 1; } } V_7 = outOfconsideration.GetEnumerator(); try { while (V_7.MoveNext()) { V_8 = V_7.get_Current(); if (!V_0.ContainsKey(V_8)) { continue; } dummyVar0 = V_0.Remove(V_8); } } finally { ((IDisposable)V_7).Dispose(); } if (V_0.get_Count() == 0) { return(null); } V_2 = new HashSet <CFGBlockLogicalConstruct>(); V_3 = V_0.get_Keys().FirstOrDefault <CFGBlockLogicalConstruct>(); dummyVar1 = V_2.Add(V_3); V_4 = V_0.get_Item(V_3); V_9 = V_0.get_Keys().GetEnumerator(); try { while (V_9.MoveNext()) { V_10 = V_9.get_Current(); if (V_0.get_Item(V_10) <= V_4) { if (V_0.get_Item(V_10) != V_4) { continue; } dummyVar3 = V_2.Add(V_10); } else { V_4 = V_0.get_Item(V_10); V_2.Clear(); dummyVar2 = V_2.Add(V_10); } } } finally { ((IDisposable)V_9).Dispose(); } if (V_2.get_Count() == 1) { return(V_2.FirstOrDefault <CFGBlockLogicalConstruct>()); } V_11 = new HashSet <CFGBlockLogicalConstruct>(); V_12 = 0; V_7 = V_2.GetEnumerator(); try { while (V_7.MoveNext()) { V_14 = V_7.get_Current(); V_15 = 0; V_16 = construct.get_CFGBlocks(); V_17 = V_14.get_CFGPredecessors().GetEnumerator(); try { while (V_17.MoveNext()) { V_18 = V_17.get_Current(); if (!V_16.Contains(V_18)) { continue; } V_15 = V_15 + 1; } } finally { ((IDisposable)V_17).Dispose(); } if (V_15 < V_12) { continue; } if (V_15 > V_12) { V_12 = V_15; V_11.Clear(); } dummyVar4 = V_11.Add(V_14); } } finally { ((IDisposable)V_7).Dispose(); } V_13 = V_11.FirstOrDefault <CFGBlockLogicalConstruct>(); if (V_13.get_Index() < construct.get_Entry().get_Index()) { V_19 = null; V_7 = V_11.GetEnumerator(); try { while (V_7.MoveNext()) { V_20 = V_7.get_Current(); if (V_20.get_Index() <= construct.get_Entry().get_Index() || V_19 != null && V_19.get_Index() < V_20.get_Index()) { continue; } V_19 = V_20; } } finally { ((IDisposable)V_7).Dispose(); } if (V_19 != null) { V_13 = V_19; } } return(V_13); }
private bool TryTransformTernary(ConditionExpression ternary, out Expression transformed) { transformed = null; V_2 = ternary.get_Then() as LiteralExpression; V_3 = ternary.get_Else() as LiteralExpression; if (V_2 != null && V_3 != null) { V_14 = false; V_15 = false; if (!String.op_Equality(V_2.get_ExpressionType().get_FullName(), "System.Int32") || !String.op_Equality(V_3.get_ExpressionType().get_FullName(), "System.Int32")) { if (String.op_Equality(V_2.get_ExpressionType().get_FullName(), "System.Boolean") && String.op_Equality(V_3.get_ExpressionType().get_FullName(), "System.Boolean")) { V_18 = (Boolean)V_2.get_Value(); V_19 = (Boolean)V_3.get_Value(); if (!V_18 && V_19 || V_18 && !V_19) { V_14 = true; if (!V_18 && V_19) { V_15 = true; } } } } else { V_16 = (Int32)V_2.get_Value(); V_17 = (Int32)V_3.get_Value(); if (V_16 == 0 && V_17 == 1 || V_16 == 1 && V_17 == 0) { V_14 = true; if (V_16 == 0 && V_17 == 1) { V_15 = true; } } } if (V_14) { if (!V_15) { transformed = this.Transform(ternary.get_Condition()); } else { transformed = this.Transform(Negator.Negate(ternary.get_Condition(), this.typeSystem)); } return(true); } } if (V_2 == null) { if (V_3 == null) { V_20 = ternary.get_Then() as ExplicitCastExpression; V_21 = ternary.get_Else() as ExplicitCastExpression; if (V_20 == null || V_21 == null || !String.op_Equality(V_20.get_TargetType().get_FullName(), "System.Int32") || !String.op_Equality(V_20.get_Expression().get_ExpressionType().get_FullName(), "System.Boolean") || !String.op_Equality(V_21.get_TargetType().get_FullName(), "System.Int32") || !String.op_Equality(V_21.get_Expression().get_ExpressionType().get_FullName(), "System.Boolean")) { return(false); } ternary.set_Then(V_20.get_Expression()); ternary.set_Else(V_21.get_Expression()); transformed = ternary; return(true); } V_0 = V_3; V_1 = false; } else { V_0 = V_2; V_1 = true; } if (!String.op_Equality(V_0.get_ExpressionType().get_FullName(), "System.Int32")) { if (!String.op_Equality(V_0.get_ExpressionType().get_FullName(), "System.Boolean")) { return(false); } V_4 = (Boolean)V_0.get_Value(); } else { if ((Int32)V_0.get_Value() != 0) { stackVariable163 = true; } else { stackVariable163 = false; } V_4 = stackVariable163; } V_6 = null; V_7 = null; V_6 = this.Transform(ternary.get_Condition()); if (!V_1) { V_8 = ternary.get_Then(); } else { V_8 = ternary.get_Else(); } V_9 = V_8 as ConditionExpression; V_10 = V_8 as ExplicitCastExpression; V_11 = null; V_12 = false; if (V_9 == null && V_10 == null || String.op_Inequality(V_10.get_TargetType().get_FullName(), "System.Int32") || String.op_Inequality(V_10.get_Expression().get_ExpressionType().get_FullName(), "System.Boolean") && !this.IsBinaryExpression(V_8, out V_11, out V_12) && String.op_Inequality(V_8.get_ExpressionType().get_FullName(), "System.Boolean")) { return(false); } V_13 = false; if (V_10 == null) { if (V_11 == null) { if (V_9 != null && this.TryTransformTernary(V_9, out V_7)) { V_13 = true; } } else { V_22 = TransformCatchClausesFilterExpressionStep.GetBinaryExpression(V_12, V_11); if (this.TryTransformBinary(V_22)) { V_7 = TransformCatchClausesFilterExpressionStep.GetResultExpression(V_12, V_11, V_22); V_13 = true; } } } else { V_7 = V_10.get_Expression(); V_13 = true; } if (!V_13) { V_7 = V_8; } if (V_6 == null || V_7 == null) { return(false); } if (!V_4) { V_5 = 12; if (V_1) { stackVariable97 = Negator.Negate(V_6, this.typeSystem); } else { stackVariable97 = V_6; } V_6 = stackVariable97; } else { V_5 = 11; if (V_1) { stackVariable111 = V_6; } else { stackVariable111 = Negator.Negate(V_6, this.typeSystem); } V_6 = stackVariable111; } transformed = new BinaryExpression(V_5, V_6, V_7, this.typeSystem, ternary.get_MappedInstructions(), false); return(true); }