Small fix.
authorMartin Baulig <martin@novell.com>
Wed, 29 Nov 2006 17:12:59 +0000 (17:12 -0000)
committerMartin Baulig <martin@novell.com>
Wed, 29 Nov 2006 17:12:59 +0000 (17:12 -0000)
svn path=/branches/martin/anonymous-methods2/mcs/; revision=68674

mcs/mcs/anonymous.cs

index 1b5b3837811c60d1c3e914a7fab01184b85c5375..8170ed9e7ffb95bc8ee36bfe03919ade1650e5dd 100644 (file)
@@ -327,8 +327,11 @@ namespace Mono.CSharp {
                        Report.Debug (128, "CAPTURE SCOPE", this, GetType (), child, child.GetType ());
                        if (child == this)
                                throw new InternalErrorException ();
-                       CapturedScope captured = new CapturedScope (this, child);
-                       captured_scopes.Add (child, captured);
+                       CapturedScope captured = (CapturedScope) captured_scopes [child];
+                       if (captured == null) {
+                               captured = new CapturedScope (this, child);
+                               captured_scopes.Add (child, captured);
+                       }
                        return captured;
                }