Author: jbevain
Date: 2007-07-22 16:00:37 -0400 (Sun, 22 Jul 2007)
New Revision: 82452
Modified:
trunk/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs
Log:
refactor to use GetOriginalType
Modified: trunk/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs
===================================================================
--- trunk/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs 2007-07-22
20:00:18 UTC (rev 82451)
+++ trunk/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs 2007-07-22
20:00:37 UTC (rev 82452)
@@ -60,6 +60,8 @@
public TypeDefinition Resolve (TypeReference type)
{
+ type = type.GetOriginalType ();
+
if (type is TypeDefinition)
return (TypeDefinition) type;
@@ -78,7 +80,7 @@
public FieldDefinition Resolve (FieldReference field)
{
- TypeDefinition type = Resolve (GetDeclaringType
(field.DeclaringType));
+ TypeDefinition type = Resolve (field.DeclaringType);
return GetField (type.Fields, field);
}
@@ -99,27 +101,20 @@
public MethodDefinition Resolve (MethodReference method)
{
- TypeDefinition type = Resolve (GetDeclaringType
(method.DeclaringType));
+ TypeDefinition type = Resolve (method.DeclaringType);
+ method = method.GetOriginalMethod ();
if (method.Name == MethodDefinition.Cctor ||
method.Name == MethodDefinition.Ctor)
return GetMethod (type.Constructors, method);
else
return GetMethod (type, method);
}
- static TypeReference GetDeclaringType (TypeReference type)
- {
- TypeReference t = type;
- while (t is TypeSpecification)
- t = ((TypeSpecification) t).ElementType;
- 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));
+ type = Resolve (type.BaseType);
else
return method;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches