Author: jbevain
Date: 2007-06-06 05:24:30 -0400 (Wed, 06 Jun 2007)
New Revision: 78709

Modified:
   trunk/cecil/linker/ChangeLog
   trunk/cecil/linker/Mono.Linker/CustomResolver.cs
Log:
2007-06-06  Jb Evain  <[EMAIL PROTECTED]>

        * Mono.Linker/CustomResolver.cs:
                When a method is not found, go down
                the class hierarchy to find it.


Modified: trunk/cecil/linker/ChangeLog
===================================================================
--- trunk/cecil/linker/ChangeLog        2007-06-06 08:02:20 UTC (rev 78708)
+++ trunk/cecil/linker/ChangeLog        2007-06-06 09:24:30 UTC (rev 78709)
@@ -1,3 +1,9 @@
+2007-06-06  Jb Evain  <[EMAIL PROTECTED]>
+
+       * Mono.Linker/CustomResolver.cs:
+               When a method is not found, go down
+               the class hierarchy to find it.
+
 2007-06-05  Jb Evain  <[EMAIL PROTECTED]>
 
        * Tests/Mono.Linker.Tests/IntegrationTestFixture.cs:

Modified: trunk/cecil/linker/Mono.Linker/CustomResolver.cs
===================================================================
--- trunk/cecil/linker/Mono.Linker/CustomResolver.cs    2007-06-06 08:02:20 UTC 
(rev 78708)
+++ trunk/cecil/linker/Mono.Linker/CustomResolver.cs    2007-06-06 09:24:30 UTC 
(rev 78709)
@@ -81,7 +81,7 @@
                        if (method.Name == MethodDefinition.Cctor || 
method.Name == MethodDefinition.Ctor)
                                return GetMethod (type.Constructors, method);
                        else
-                               return GetMethod (type.Methods, method);
+                               return GetMethod (type, method);
                }
 
                static TypeReference GetDeclaringType (TypeReference type)
@@ -92,6 +92,19 @@
                        return t;
                }
 
+               MethodDefinition GetMethod (TypeDefinition type, 
MethodReference reference)
+               {
+                       while (type != null) {
+                               MethodDefinition method = GetMethod 
(type.Methods, reference);
+                               if (method == null)
+                                       type = Resolve (GetDeclaringType 
(type.BaseType));
+                               else
+                                       return method;
+                       }
+
+                       return null;
+               }
+
                static MethodDefinition GetMethod (ICollection collection, 
MethodReference reference)
                {
                        foreach (MethodDefinition meth in collection) {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to