Ejemplo n.º 1
0
 private bool IsThreadSafeAutoImplOperation(MethodDefinition methodDef, string operationName)
 {
     if (!this.CheckMethodAndDecompile(methodDef, out V_0) || V_0.get_Statements().get_Count() != 3)
     {
         return(false);
     }
     V_1 = null;
     V_2 = null;
     if (!V_0.get_Statements().get_Item(0).IsAssignmentStatement())
     {
         return(false);
     }
     V_3 = (V_0.get_Statements().get_Item(0) as ExpressionStatement).get_Expression() as BinaryExpression;
     if (V_3.get_Left().get_CodeNodeType() != 26 || V_3.get_Right().get_CodeNodeType() != 30 || (object)(V_3.get_Right() as FieldReferenceExpression).get_Field().Resolve() != (object)this.eventField)
     {
         return(false);
     }
     V_1 = (V_3.get_Left() as VariableReferenceExpression).get_Variable();
     if (V_0.get_Statements().get_Item(1).get_CodeNodeType() != 8 || V_0.get_Statements().get_Item(2).get_CodeNodeType() != 5 || (V_0.get_Statements().get_Item(2) as ExpressionStatement).get_Expression().get_CodeNodeType() != 57)
     {
         return(false);
     }
     V_4 = V_0.get_Statements().get_Item(1) as DoWhileStatement;
     V_5 = V_4.get_Condition();
     if (V_5.get_CodeNodeType() == 23 && (V_5 as UnaryExpression).get_Operator() == 11)
     {
         V_5 = (V_5 as UnaryExpression).get_Operand();
     }
     if (V_5.get_CodeNodeType() != 24)
     {
         return(false);
     }
     stackVariable78 = V_5 as BinaryExpression;
     V_6             = stackVariable78.get_Left() as ExplicitCastExpression;
     V_7             = stackVariable78.get_Right() as ExplicitCastExpression;
     if (stackVariable78.get_Operator() != 10 || V_6 == null || String.op_Inequality(V_6.get_TargetType().get_Name(), "Object") || V_6.get_Expression().get_CodeNodeType() != 26 || V_7 == null || V_7.get_Expression().get_CodeNodeType() != 26 || String.op_Inequality(V_7.get_TargetType().get_Name(), "Object"))
     {
         return(false);
     }
     if ((object)(V_6.get_Expression() as VariableReferenceExpression).get_Variable() != (object)V_1)
     {
         return(false);
     }
     V_2 = (V_7.get_Expression() as VariableReferenceExpression).get_Variable();
     return(this.CheckLoopBody(V_4.get_Body(), V_1, V_2, operationName));
 }
 public static bool TryMatch(BlockStatement filter, out VariableDeclarationExpression variableDeclaration, out Expression filterExpression)
 {
     variableDeclaration = null;
     filterExpression    = null;
     if (!CatchClausesFilterPattern.TryMatchVariableDeclaration(filter, out variableDeclaration))
     {
         return(false);
     }
     if (filter.get_Statements().get_Count() != 3)
     {
         return(false);
     }
     V_0 = filter.get_Statements().get_Item(1) as IfStatement;
     if (V_0 == null)
     {
         return(false);
     }
     V_1 = null;
     V_2 = null;
     if ((V_0.get_Condition() as BinaryExpression).get_Operator() != 10)
     {
         V_1 = V_0.get_Else();
         V_2 = V_0.get_Then();
     }
     else
     {
         V_1 = V_0.get_Then();
         V_2 = V_0.get_Else();
     }
     V_3 = null;
     V_4 = null;
     if (V_1.get_Statements().get_Count() != 1 && V_1.get_Statements().get_Count() != 2 && V_1.get_Statements().get_Count() != 3 || V_2.get_Statements().get_Count() != 1)
     {
         return(false);
     }
     if (V_1.get_Statements().get_Count() != 2)
     {
         if (V_1.get_Statements().get_Count() == 3)
         {
             V_8 = V_1.get_Statements().get_Item(0) as ExpressionStatement;
             V_9 = V_1.get_Statements().get_Item(1) as ExpressionStatement;
             if (V_8 == null || V_9 == null)
             {
                 return(false);
             }
             if (V_8.get_Expression().get_CodeNodeType() != 24 || V_9.get_Expression().get_CodeNodeType() != 19)
             {
                 if (V_8.get_Expression().get_CodeNodeType() != 19 || V_9.get_Expression().get_CodeNodeType() != 24)
                 {
                     return(false);
                 }
                 V_4 = V_8;
                 V_3 = V_9;
             }
             else
             {
                 V_3 = V_8;
                 V_4 = V_9;
             }
         }
     }
     else
     {
         V_7 = V_1.get_Statements().get_Item(0) as ExpressionStatement;
         if (V_7 == null)
         {
             return(false);
         }
         if (V_7.get_Expression().get_CodeNodeType() != 24)
         {
             if (V_7.get_Expression().get_CodeNodeType() != 19)
             {
                 return(false);
             }
             V_4 = V_7;
         }
         else
         {
             V_3 = V_7;
         }
     }
     if (V_3 != null)
     {
         V_10 = V_3.get_Expression() as BinaryExpression;
         if (V_10 == null || !V_10.get_IsAssignmentExpression() || String.op_Inequality(V_10.get_ExpressionType().get_FullName(), variableDeclaration.get_ExpressionType().get_FullName()))
         {
             return(false);
         }
         stackVariable98 = V_10.get_Left() as VariableReferenceExpression;
         V_11            = V_10.get_Right() as VariableReferenceExpression;
         if (stackVariable98 == null || V_11 == null)
         {
             return(false);
         }
     }
     if (V_4 != null)
     {
         V_12 = V_4.get_Expression() as MethodInvocationExpression;
         if (V_12 == null || String.op_Inequality(V_12.get_MethodExpression().get_Method().get_FullName(), "System.Void Microsoft.VisualBasic.CompilerServices.ProjectData::SetProjectError(System.Exception)"))
         {
             return(false);
         }
     }
     V_5 = filter.get_Statements().get_Item(2) as ExpressionStatement;
     if (V_5 == null)
     {
         return(false);
     }
     V_6 = V_5.get_Expression() as VariableReferenceExpression;
     if (V_6 == null)
     {
         return(false);
     }
     if (!CatchClausesFilterPattern.TryMatchFilterExpression(V_0, variableDeclaration.get_Variable().get_VariableType(), V_6, out filterExpression))
     {
         return(false);
     }
     return(true);
 }