diff options
author | Mike Voorhees <mrvoorhe@users.noreply.github.com> | 2017-03-17 21:56:37 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-03-17 21:56:37 +0300 |
commit | 3e5ad49a1072f1ec4403fc614cedc49936d51486 (patch) | |
tree | 49f15cb808ac88297cc7a82f0aeee2e09634cd6e /linker | |
parent | 4c49bea86e854ac9c4391efd5e7e54a764be5998 (diff) |
Mark step continue with (#37)
Diffstat (limited to 'linker')
-rw-r--r-- | linker/Mono.Linker.Steps/MarkStep.cs | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/linker/Mono.Linker.Steps/MarkStep.cs b/linker/Mono.Linker.Steps/MarkStep.cs index b6c1e291d..9b2692588 100644 --- a/linker/Mono.Linker.Steps/MarkStep.cs +++ b/linker/Mono.Linker.Steps/MarkStep.cs @@ -231,20 +231,24 @@ namespace Mono.Linker.Steps { protected virtual void MarkCustomAttribute (CustomAttribute ca) { Annotations.Push (ca); - MarkMethod (ca.Constructor); + try { + MarkMethod (ca.Constructor); - MarkCustomAttributeArguments (ca); + MarkCustomAttributeArguments (ca); - TypeReference constructor_type = ca.Constructor.DeclaringType; - TypeDefinition type = constructor_type.Resolve (); - if (type == null) { + TypeReference constructor_type = ca.Constructor.DeclaringType; + TypeDefinition type = constructor_type.Resolve (); + + if (type == null) { + HandleUnresolvedType (constructor_type); + return; + } + + MarkCustomAttributeProperties (ca, type); + MarkCustomAttributeFields (ca, type); + } finally { Annotations.Pop (); - throw new ResolutionException (constructor_type); } - - MarkCustomAttributeProperties (ca, type); - MarkCustomAttributeFields (ca, type); - Annotations.Pop (); } protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider) @@ -524,8 +528,10 @@ namespace Mono.Linker.Steps { TypeDefinition type = ResolveTypeDefinition (reference); - if (type == null) - throw new ResolutionException (reference); + if (type == null) { + HandleUnresolvedType (reference); + return null; + } if (CheckProcessed (type)) return null; @@ -963,17 +969,19 @@ namespace Mono.Linker.Steps { MethodDefinition method = ResolveMethodDefinition (reference); - if (method == null) { - Annotations.Pop (); - throw new ResolutionException (reference); - } - - if (Annotations.GetAction (method) == MethodAction.Nothing) - Annotations.SetAction (method, MethodAction.Parse); + try { + if (method == null) { + HandleUnresolvedMethod (reference); + return null; + } - EnqueueMethod (method); + if (Annotations.GetAction (method) == MethodAction.Nothing) + Annotations.SetAction (method, MethodAction.Parse); - Annotations.Pop (); + EnqueueMethod (method); + } finally { + Annotations.Pop (); + } Annotations.AddDependency (method); return method; @@ -1214,5 +1222,15 @@ namespace Mono.Linker.Steps { break; } } + + protected virtual void HandleUnresolvedType (TypeReference reference) + { + throw new ResolutionException (reference); + } + + protected virtual void HandleUnresolvedMethod (MethodReference reference) + { + throw new ResolutionException (reference); + } } } |