[mono/mono] 6e5cd4b5: Anonymous type are shared across module hence need module counters.

"Marek Safar ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001419e62e2b7-0a964e41-148e-466b-af07-a78ff25140c5-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/6b71c737901a...6e5cd4b5cf87

   Commit: 6e5cd4b5cf87d29e4be8981f39013839adeb9bb0
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-09 18:01:44 GMT
      URL: https://github.com/mono/mono/commit/6e5cd4b5cf87d29e4be8981f39013839adeb9bb0

Anonymous type are shared across module hence need module counters.

Changed paths:
  M mcs/mcs/anonymous.cs
  M mcs/mcs/class.cs
  M mcs/mcs/ikvm.cs
  M mcs/mcs/module.cs

Modified: mcs/mcs/anonymous.cs
===================================================================
@@ -1906,7 +1906,7 @@ private AnonymousTypeClass (ModuleContainer parent, MemberName name, IList<Anony
 
 		public static AnonymousTypeClass Create (TypeContainer parent, IList<AnonymousTypeParameter> parameters, Location loc)
 		{
-			string name = ClassNamePrefix + parent.PartialContainer.CounterAnonymousTypes++;
+			string name = ClassNamePrefix + parent.Module.CounterAnonymousTypes++;
 
 			ParametersCompiled all_parameters;
 			TypeParameters tparams = null;

Modified: mcs/mcs/class.cs
===================================================================
@@ -53,7 +53,6 @@ public abstract class TypeContainer : MemberCore
 
 		protected bool is_defined;
 
-		public int CounterAnonymousTypes { get; set; }
 		public int CounterAnonymousMethods { get; set; }
 		public int CounterAnonymousContainers { get; set; }
 		public int CounterSwitchTypes { get; set; }

Modified: mcs/mcs/ikvm.cs
===================================================================
@@ -91,12 +91,12 @@ protected override bool HasVolatileModifier (MetaType[] modifiers)
 
 		public void ImportAssembly (Assembly assembly, RootNamespace targetNamespace)
 		{
-			// It can be used more than once when importing same assembly
-			// into 2 or more global aliases
-			// TODO: Should be just Add
-			GetAssemblyDefinition (assembly);
-
 			try {
+				// It can be used more than once when importing same assembly
+				// into 2 or more global aliases
+				// TODO: Should be just Add
+				GetAssemblyDefinition (assembly);
+
 				var all_types = assembly.GetTypes ();
 				ImportTypes (all_types, targetNamespace, true);
 

Modified: mcs/mcs/module.cs
===================================================================
@@ -186,6 +186,8 @@ public ModuleContainer (CompilerContext context)
 			}
 		}
 
+		public int CounterAnonymousTypes { get; set; }
+
 		public AssemblyDefinition DeclaringAssembly {
 			get {
 				return assembly;


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.