[mono/mono] f4dfcba6: [linker] Allow overriding MarkCustomAttribute and expose the MarkDefaultConstructor feature to subclasses

"Sebastien Pouliot ([email protected])" <[email protected]> Tue, 19 Nov 2013 13:43:06 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001427099a1ea-853eb14b-74dd-431f-8224-a7de07ecb627-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/18299f080fff...f4dfcba64c4a

   Commit: f4dfcba64c4a8d6937e051083c911325d6227a00
   Author: Sebastien Pouliot <[email protected]> (spouliot)
     Date: 2013-11-19 13:41:57 GMT
      URL: https://github.com/mono/mono/commit/f4dfcba64c4a8d6937e051083c911325d6227a00

[linker] Allow overriding MarkCustomAttribute and expose the MarkDefaultConstructor feature to subclasses

Changed paths:
  M mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs

Modified: mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
===================================================================
@@ -189,7 +189,7 @@ void MarkCustomAttributes (ICustomAttributeProvider provider)
 				MarkCustomAttribute (ca);
 		}
 
-		void MarkCustomAttribute (CustomAttribute ca)
+		protected virtual void MarkCustomAttribute (CustomAttribute ca)
 		{
 			MarkMethod (ca.Constructor);
 
@@ -346,10 +346,7 @@ void MarkScope (IMetadataScope scope)
 
 		protected virtual void MarkSerializable (TypeDefinition type)
 		{
-			if (!type.HasMethods)
-				return;
-
-			MarkMethodsIf (type.Methods, IsDefaultConstructorPredicate);
+			MarkDefaultConstructor (type);
 			MarkMethodsIf (type.Methods, IsSpecialSerializationConstructorPredicate);
 		}
 
@@ -582,6 +579,14 @@ static bool IsConstructor (MethodDefinition method)
 			return method.IsConstructor && !method.IsStatic;
 		}
 
+		protected void MarkDefaultConstructor (TypeDefinition type)
+		{
+			if ((type == null) || !type.HasMethods)
+				return;
+
+			MarkMethodsIf (type.Methods, IsDefaultConstructorPredicate);
+		}
+
 		static MethodPredicate IsStaticConstructorPredicate = new MethodPredicate (IsStaticConstructor);
 
 		static bool IsStaticConstructor (MethodDefinition method)


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches