Exemple #1
0
 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);
 }