From: Radek Doulik Date: Tue, 27 Oct 2015 17:23:41 +0000 (+0100) Subject: [linker] match type pattern with nested types X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=0bebfa7eba99151a670e87ae0dbf8dca3ec8694f;p=mono.git [linker] match type pattern with nested types - this way the following xml will match all the types in the assembly MyAssembly before this change it will only match the types defined in main module and none of the nested types --- diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs index a0fe3934cac..6a797c16e4e 100644 --- a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs +++ b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs @@ -129,15 +129,24 @@ namespace Mono.Linker.Steps { return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)")); } + void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav) + { + if (regex.Match (type.FullName).Success) + ProcessType (type, nav); + + if (!type.HasNestedTypes) + return; + + foreach (var nt in type.NestedTypes) + MatchType (nt, regex, nav); + } + void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav) { Regex regex = CreateRegexFromPattern (fullname); foreach (TypeDefinition type in assembly.MainModule.Types) { - if (!regex.Match (type.FullName).Success) - continue; - - ProcessType (type, nav); + MatchType (type, regex, nav); } }