| Newsgroups |
gmane.comp.gnome.mono.patches |
| Message-ID |
<000001419d31a0cb-0ae17c8c-7664-4c21-9a32-3f1e96f22eae-000000@email.amazonses.com> |
Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/e0b711beaf43...0e040e2244c4
Commit: 0e040e2244c4eb9cbf98babc0e4d5c51d66e5637
Author: Marek Safar <[email protected]> (marek-safar)
Date: 2013-10-09 12:27:19 GMT
URL: https://github.com/mono/mono/commit/0e040e2244c4eb9cbf98babc0e4d5c51d66e5637
anonymous: move counters to TypeContainer
With the anonymous counters on ModuleContainer,
anonymous method and type names will be generated
in a way that depends on the order of the sources
passed to mcs. This can cause undesirable API
and IL differences.
Moving the counters to TypeContainer instead
avoids this issue.
Changed paths:
M mcs/mcs/anonymous.cs
M mcs/mcs/class.cs
M mcs/mcs/module.cs
M mcs/tests/ver-il-net_4_5.xml
Modified: mcs/mcs/anonymous.cs
===================================================================
@@ -244,11 +244,11 @@ protected override void CloneTo (CloneContext clonectx, Statement target)
AnonymousMethodStorey hoisted_this_parent;
public AnonymousMethodStorey (ExplicitBlock block, TypeDefinition parent, MemberBase host, TypeParameters tparams, string name, MemberKind kind)
- : base (parent, MakeMemberName (host, name, parent.Module.CounterAnonymousContainers, tparams, block.StartLocation),
+ : base (parent, MakeMemberName (host, name, parent.PartialContainer.CounterAnonymousContainers, tparams, block.StartLocation),
tparams, 0, kind)
{
OriginalSourceBlock = block;
- ID = parent.Module.CounterAnonymousContainers++;
+ ID = parent.PartialContainer.CounterAnonymousContainers++;
}
public void AddCapturedThisField (EmitContext ec, AnonymousMethodStorey parent)
@@ -1718,7 +1718,7 @@ AnonymousMethodMethod DoCreateMethodHost (EmitContext ec)
parent = ec.CurrentTypeDefinition.Parent.PartialContainer;
string name = CompilerGeneratedContainer.MakeName (parent != storey ? block_name : null,
- "m", null, ec.Module.CounterAnonymousMethods++);
+ "m", null, parent.PartialContainer.CounterAnonymousMethods++);
MemberName member_name;
if (storey == null && ec.CurrentTypeParameters != null) {
@@ -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.Module.CounterAnonymousTypes++;
+ string name = ClassNamePrefix + parent.PartialContainer.CounterAnonymousTypes++;
ParametersCompiled all_parameters;
TypeParameters tparams = null;
Modified: mcs/mcs/class.cs
===================================================================
@@ -53,6 +53,11 @@ 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; }
+
protected TypeContainer (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
: base (parent, name, attrs)
{
Modified: mcs/mcs/module.cs
===================================================================
@@ -186,11 +186,6 @@ public ModuleContainer (CompilerContext context)
}
}
- public int CounterAnonymousTypes { get; set; }
- public int CounterAnonymousMethods { get; set; }
- public int CounterAnonymousContainers { get; set; }
- public int CounterSwitchTypes { get; set; }
-
public AssemblyDefinition DeclaringAssembly {
get {
return assembly;
Modified: mcs/tests/ver-il-net_4_5.xml
===================================================================
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches