diff options
author | Eugene Rozenfeld <erozen@microsoft.com> | 2017-04-08 02:34:35 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-04-11 09:35:41 +0300 |
commit | 083acc58c5d5e121afb0907fe423909e0c529672 (patch) | |
tree | 6c6c94b132921df293463f0836832c3422dd0215 /linker | |
parent | dfe35426dce4a41f9bb8bf4ab7c67931ebb31401 (diff) |
Make several methods protected and add an extensibility points for MarkStep to allow derived classes to customize the behavior.
Diffstat (limited to 'linker')
-rw-r--r-- | linker/Mono.Linker.Steps/MarkStep.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/linker/Mono.Linker.Steps/MarkStep.cs b/linker/Mono.Linker.Steps/MarkStep.cs index b7b58acb1..f46cf9ce5 100644 --- a/linker/Mono.Linker.Steps/MarkStep.cs +++ b/linker/Mono.Linker.Steps/MarkStep.cs @@ -115,6 +115,7 @@ namespace Mono.Linker.Steps { while (!QueueIsEmpty ()) { ProcessQueue (); ProcessVirtualMethods (); + DoAdditionalProcessing (); } // deal with [TypeForwardedTo] pseudo-attributes @@ -599,6 +600,11 @@ namespace Mono.Linker.Steps { return type; } + // Allow subclassers to mark additional things in the main processing loop + protected virtual void DoAdditionalProcessing () + { + } + // Allow subclassers to mark additional things when marking a method protected virtual void DoAdditionalTypeProcessing (TypeDefinition method) { @@ -828,7 +834,7 @@ namespace Mono.Linker.Steps { static bool IsSpecialSerializationConstructor (MethodDefinition method) { - if (!IsConstructor (method)) + if (!IsInstanceConstructor (method)) return false; var parameters = method.Parameters; @@ -839,7 +845,7 @@ namespace Mono.Linker.Steps { parameters [1].ParameterType.Name == "StreamingContext"; } - void MarkMethodsIf (ICollection methods, Func<MethodDefinition, bool> predicate) + protected void MarkMethodsIf (ICollection methods, Func<MethodDefinition, bool> predicate) { foreach (MethodDefinition method in methods) if (predicate (method)) { @@ -851,10 +857,10 @@ namespace Mono.Linker.Steps { static bool IsDefaultConstructor (MethodDefinition method) { - return IsConstructor (method) && !method.HasParameters; + return IsInstanceConstructor (method) && !method.HasParameters; } - static bool IsConstructor (MethodDefinition method) + protected static bool IsInstanceConstructor (MethodDefinition method) { return method.IsConstructor && !method.IsStatic; } |