From a82cdecfde7ddbb66d5937d91ea4a9fe5b397888 Mon Sep 17 00:00:00 2001 From: jbevain Date: Fri, 5 Jun 2009 13:12:52 +0000 Subject: [PATCH] 2009-06-05 Jb Evain * Mono.Linker.Steps/ResolveFromXmlStep.cs: give us more possibilities to detail the xml descriptors. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@135523 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- tools/linker/ChangeLog | 5 +++ .../linker/Mono.Linker.Steps/ResolveFromXmlStep.cs | 52 +++++++++++++++++----- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/tools/linker/ChangeLog b/tools/linker/ChangeLog index dec6a49336..1f0b0f402a 100644 --- a/tools/linker/ChangeLog +++ b/tools/linker/ChangeLog @@ -1,3 +1,8 @@ +2009-06-05 Jb Evain + + * Mono.Linker.Steps/ResolveFromXmlStep.cs: give us more + possibilities to detail the xml descriptors. + 2009-06-04 Jb Evain * Mono.Linker.Steps/ResolveFromXmlStep.cs: fix handling diff --git a/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs b/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs index 087aa9bde8..8dd15ebcfc 100644 --- a/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs +++ b/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs @@ -147,16 +147,18 @@ namespace Mono.Linker.Steps { switch (preserve) { case TypePreserve.Nothing: - if (nav.HasChildren) { - MarkSelectedFields (nav, type); - MarkSelectedMethods (nav, type); - } else + if (!nav.HasChildren) Annotations.SetPreserve (type, TypePreserve.All); break; default: Annotations.SetPreserve (type, preserve); break; } + + if (nav.HasChildren) { + MarkSelectedFields (nav, type); + MarkSelectedMethods (nav, type); + } } void MarkSelectedFields (XPathNavigator nav, TypeDefinition type) @@ -222,16 +224,44 @@ namespace Mono.Linker.Steps { void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator) { while (iterator.MoveNext()) { - string signature = GetSignature (iterator.Current); - MethodDefinition meth = GetMethod (type, signature); - if (meth != null) { - Annotations.Mark (meth); - Annotations.SetAction (meth, MethodAction.Parse); - } else - AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature)); + if (GetAttribute (iterator.Current, "signature") != null) + ProcessMethodSignature (type, iterator.Current); + + if (GetAttribute (iterator.Current, "name") != null) + ProcessMethodName (type, iterator.Current); } } + void ProcessMethodSignature (TypeDefinition type, XPathNavigator nav) + { + string signature = GetSignature (nav); + MethodDefinition meth = GetMethod (type, signature); + MarkMethod (meth, signature); + } + + private void MarkMethod (MethodDefinition method, string signature) + { + if (method != null) { + Annotations.Mark (method); + Annotations.SetAction (method, MethodAction.Parse); + } else + AddUnresolveMarker (string.Format ("T: {0}; M: {1}", method.DeclaringType, signature)); + } + + void ProcessMethodName (TypeDefinition type, XPathNavigator nav) + { + string name = GetAttribute (nav, "name"); + if (name == ".ctor" || name == ".cctor" && type.HasConstructors) + foreach (MethodDefinition ctor in type.Constructors) + if (name == ctor.Name) + MarkMethod (ctor, name); + + if (type.HasMethods) + foreach (MethodDefinition method in type.Methods) + if (name == method.Name) + MarkMethod (method, name); + } + static MethodDefinition GetMethod (TypeDefinition type, string signature) { if (type.HasMethods) -- 2.11.4.GIT