svn path=/branches/martin/anonymous-methods2/mcs/; revision=68208
authorMartin Baulig <martin@novell.com>
Mon, 20 Nov 2006 18:52:58 +0000 (18:52 -0000)
committerMartin Baulig <martin@novell.com>
Mon, 20 Nov 2006 18:52:58 +0000 (18:52 -0000)
mcs/mcs/anonymous.cs

index 1d92b557a1fa25b41a44a4ac56e82f72368ceff7..dcbee8c4532320d22ece4b15fb74ed3ea948ff2a 100644 (file)
@@ -172,10 +172,28 @@ namespace Mono.CSharp {
                        ToplevelBlock toplevel = block.Toplevel;
                        AnonymousContainer ac = toplevel.AnonymousContainer;
 
-                       if (ac != null)
-                               return new ScopeInfo (block, ac.Host);
-                       else
+                       Report.Debug (128, "CREATE SCOPE", block, toplevel, ac);
+
+                       if (ac == null)
                                return new ScopeInfo (block, toplevel.RootScope.Parent);
+
+                       Report.Debug (128, "CREATE SCOPE #1", ac, ac.Host, ac.Scope, ac.Block,
+                                     ac.Container, ac.ContainerAnonymousMethod,
+                                     ac.Location);
+
+                       Block b;
+                       ScopeInfo parent = null;
+
+                       for (b = ac.Block; b != null; b = b.Parent) {
+                               if (b.ScopeInfo != null) {
+                                       parent = b.ScopeInfo;
+                                       break;
+                               }
+                       }
+
+                       Report.Debug (128, "CREATRE SCOPE #1", parent);
+
+                       return new ScopeInfo (block, parent);
                }
 
                protected ScopeInfo (Block block, TypeContainer parent)
@@ -665,11 +683,31 @@ namespace Mono.CSharp {
 #endif
                                        ec.ig.Emit (OpCodes.Stloc, scope_instance);
 
+#if FIXME
+                               if (Scope.ID == 5) {
+                                       ec.ig.Emit (OpCodes.Neg);
+                                       ec.ig.Emit (OpCodes.Neg);
+                                       ec.ig.Emit (OpCodes.Neg);
+                                       ec.ig.Emit (OpCodes.Neg);
+                                       ec.ig.Emit (OpCodes.Neg);
+                               }
+#endif
+
                                foreach (CapturedScope scope in Scope.scopes.Values) {
                                        Report.Debug (128, "EMIT SCOPE INIT #5", this, Scope,
                                                      scope.Scope, scope.ChildScope);
                                        DoEmit (ec);
+#if FIXME
+                                       if (Scope.ID == 5)
+                                               ec.ig.Emit (OpCodes.Not);
+#endif
+                                       ScopeInfo.EmitScopeInstance (ec, scope.ChildScope,
+                                                                    ec.CurrentBlock.Toplevel);
+#if FIXME
                                        scope.ChildScope.EmitScopeInstance (ec);
+                                       if (Scope.ID == 5)
+                                               ec.ig.Emit (OpCodes.Pop);
+#endif
                                        scope.EmitAssign (ec);
                                }
                        }