コード例 #1
0
 private bool CheckVariableCaching(IfStatement theIf)
 {
     V_0 = theIf.get_Condition() as BinaryExpression;
     if (V_0.get_Operator() != 9 || V_0.get_Right().get_CodeNodeType() != 22 || (V_0.get_Right() as LiteralExpression).get_Value() != null)
     {
         return(false);
     }
     V_1 = (V_0.get_Left() as VariableReferenceExpression).get_Variable();
     if (!this.initializationsToRemove.ContainsKey(V_1))
     {
         return(false);
     }
     if (this.cachingVersion == RemoveDelegateCachingStep.DelegateCachingVersion.V1)
     {
         stackVariable25 = 0;
     }
     else
     {
         stackVariable25 = 1;
     }
     V_2 = stackVariable25;
     V_3 = (theIf.get_Then().get_Statements().get_Item(V_2) as ExpressionStatement).get_Expression() as BinaryExpression;
     if (V_3 == null || !V_3.get_IsAssignmentExpression() || V_3.get_Left().get_CodeNodeType() != 26 || (object)(V_3.get_Left() as VariableReferenceExpression).get_Variable() != (object)V_1)
     {
         return(false);
     }
     if (this.variableToReplacingExpressionMap.ContainsKey(V_1))
     {
         throw new Exception("A caching variable cannot be assigned more than once.");
     }
     V_4 = V_1.get_VariableType().Resolve();
     if (V_4 == null || V_4.get_BaseType() == null || String.op_Inequality(V_4.get_BaseType().get_FullName(), "System.MulticastDelegate"))
     {
         return(false);
     }
     this.variableToReplacingExpressionMap.set_Item(V_1, V_3.get_Right());
     return(true);
 }