[687282] Fixes cross references of nested anonymous methods which don't start at...
authorMarek Safar <marek.safar@gmail.com>
Tue, 19 Apr 2011 12:00:18 +0000 (13:00 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 19 Apr 2011 12:04:12 +0000 (13:04 +0100)
mcs/mcs/statement.cs

index 6f63b54f10b77f8f1c46dfc44de0e162dc3b3275..6a4f8add5484486d2366e00edfefd7c29ca992e8 100644 (file)
@@ -1758,7 +1758,7 @@ namespace Mono.CSharp {
 
                int? resolving_init_idx;
 
-               Block original;
+               protected Block original;
 
 #if DEBUG
                static int id;
@@ -2219,7 +2219,7 @@ namespace Mono.CSharp {
                                                        b.am_storey.AddParentStoreyReference (ec, am_storey);
 
                                                        // Stop propagation inside same top block
-                                                       if (b.ParametersBlock.am_storey == ParametersBlock.am_storey)
+                                                       if (b.ParametersBlock.Original == ParametersBlock.Original)
                                                                break;
 
                                                        b = b.ParametersBlock;
@@ -2379,6 +2379,9 @@ namespace Mono.CSharp {
                        ParametersBlock = this;
                }
 
+               //
+               // It's supposed to be used by method body implementation of anonymous methods
+               //
                protected ParametersBlock (ParametersBlock source, ParametersCompiled parameters)
                        : base (null, 0, source.StartLocation, source.EndLocation)
                {
@@ -2391,6 +2394,12 @@ namespace Mono.CSharp {
                        this.am_storey = source.am_storey;
 
                        ParametersBlock = this;
+
+                       //
+                       // Overwrite original for comparison purposes when linking cross references
+                       // between anonymous methods
+                       //
+                       original = source;
                }
 
                #region Properties