All pastes #204986 Raw Edit

Unnamed

public text v1 · immutable
#204986 ·published 2006-10-16 12:42 UTC
rendered paste body
Index: BadRecursiveInvocationRule.cs
===================================================================
--- BadRecursiveInvocationRule.cs       (revision 66711)
+++ BadRecursiveInvocationRule.cs       (working copy)
@@ -42,6 +42,12 @@
                 string mDecl = method.DeclaringType.Name;
                 bool argsEqual =
                     (mref.Parameters.Count == method.Parameters.Count);
+                bool namesEqual = rName.Equals(mName);
+                // Don't need to compare declaring types if this is a
+                // virtual call and the recieving object is the same
+                bool typesEqual =
+                    insn.OpCode.Value == OpCodeConstants.Callvirt ||
+                    rDecl.Equals(mDecl);
                 if(argsEqual) {
                     for(int j = 0; j < mref.Parameters.Count; j++) {
                         ParameterDefinition p1 =
@@ -58,7 +64,7 @@
                             argsEqual = false;
                     }
                 }
-                if(rName.Equals(mName) && rDecl.Equals(mDecl) && argsEqual) {
+                if(namesEqual && typesEqual && argsEqual) {
                     if(LoadsVerbatimArgs(method, i)) {
                         MessageCollection messages = new MessageCollection();
                         string etype = method.DeclaringType.FullName;