Author: martin
Date: 2006-11-18 12:18:09 -0500 (Sat, 18 Nov 2006)
New Revision: 68126

Modified:
   branches/martin/anonymous-methods2/mcs/anonymous.cs
   branches/martin/anonymous-methods2/mcs/statement.cs
Log:


Modified: branches/martin/anonymous-methods2/mcs/anonymous.cs
===================================================================
--- branches/martin/anonymous-methods2/mcs/anonymous.cs 2006-11-18 16:40:43 UTC 
(rev 68125)
+++ branches/martin/anonymous-methods2/mcs/anonymous.cs 2006-11-18 17:18:09 UTC 
(rev 68126)
@@ -324,6 +324,8 @@
                {
                        CheckMembersDefined ();
                        Report.Debug (128, "CAPTURE SCOPE", this, child, 
child.TypeBuilder);
+                       if (child == this)
+                               throw new InternalErrorException ();
                        if (child.host_scope != null)
                                throw new InternalErrorException ();
                        child.host_scope = this;
@@ -1448,23 +1450,31 @@
 
                        Block b;
                        scope = RootScope;
+                       Report.Debug (128, "CREATE METHOD HOST #0", this, 
RootScope, Block, container);
                        for (b = Block; b != null; b = b.Parent) {
+                               Report.Debug (128, "CREATE METHOD HOST #1",
+                                             this, RootScope, Block, b, 
b.ScopeInfo);
                                if (b.ScopeInfo != null) {
                                        scope = b.ScopeInfo;
                                        break;
                                }
                        }
 
-                       Report.Debug (128, "CREATE METHOD HOST", this, 
RootScope, scope);
+                       Report.Debug (128, "CREATE METHOD HOST", this, 
RootScope, scope,
+                                     Block, Location);
 
                        scope.CheckMembersDefined ();
 
                        ArrayList scopes = new ArrayList ();
-                       for (b = b.Parent; b != null; b = b.Parent) {
-                               if (b.ScopeInfo != null)
-                                       scopes.Add (b.ScopeInfo);
-                               if (b == container)
-                                       break;
+                       if (b != container) {
+                               for (b = b.Parent; b != null; b = b.Parent) {
+                                       Report.Debug (128, "CREATE METHOD HOST 
#2",
+                                                     this, b, b.ScopeInfo, 
container);
+                                       if (b.ScopeInfo != null)
+                                               scopes.Add (b.ScopeInfo);
+                                       if (b == container)
+                                               break;
+                               }
                        }
 
                        foreach (ScopeInfo si in scopes) {
@@ -1480,7 +1490,7 @@
                        if (scope.DefineType () == null)
                                throw new InternalErrorException ();
 
-                       Report.Debug (128, "CREATE METHOD HOST #1", this, 
RootScope, scope, scopes);
+                       Report.Debug (128, "CREATE METHOD HOST #3", this, 
RootScope, scope, scopes);
 
                        return new AnonymousMethodMethod (
                                this, scope, generic_method, new TypeExpression 
(ReturnType, Location),

Modified: branches/martin/anonymous-methods2/mcs/statement.cs
===================================================================
--- branches/martin/anonymous-methods2/mcs/statement.cs 2006-11-18 16:40:43 UTC 
(rev 68125)
+++ branches/martin/anonymous-methods2/mcs/statement.cs 2006-11-18 17:18:09 UTC 
(rev 68126)
@@ -2387,10 +2387,13 @@
                        if (root_scope != null)
                                return root_scope;
 
-                       if (Container != null)
+                       if (Container != null) {
+                               Report.Debug (128, "TOPLEVEL CREATE ROOT 
SCOPE", this, Container,
+                                             Container.root_scope, 
AnonymousContainer,
+                                             Container.AnonymousContainer);
                                root_scope = new RootScopeInfo (
                                        this, Container.root_scope, null, 
StartLocation);
-                       else
+                       } else
                                root_scope = new RootScopeInfo (
                                        this, host, generic, StartLocation);
 

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

Reply via email to