Author: raja
Date: 2005-03-22 05:36:42 -0500 (Tue, 22 Mar 2005)
New Revision: 42090

Modified:
   trunk/mcs/errors/known-issues-mcs
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/statement.cs
Log:
Fix cs0128.cs
* statement.cs (Block.AddVariable): Ensure that we skip implicit
blocks before deciding whether the error is cs0136 or cs0128.


Modified: trunk/mcs/errors/known-issues-mcs
===================================================================
--- trunk/mcs/errors/known-issues-mcs   2005-03-22 10:30:18 UTC (rev 42089)
+++ trunk/mcs/errors/known-issues-mcs   2005-03-22 10:36:42 UTC (rev 42090)
@@ -15,7 +15,6 @@
 cs0119.cs
 cs0121-3.cs NO ERROR
 cs0122-12.cs
-cs0128.cs
 cs0156-2.cs
 cs0157-5.cs NO ERROR
 cs0192-2.cs

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-03-22 10:30:18 UTC (rev 42089)
+++ trunk/mcs/mcs/ChangeLog     2005-03-22 10:36:42 UTC (rev 42090)
@@ -1,5 +1,9 @@
 2005-03-22  Raja R Harinath  <[EMAIL PROTECTED]>
 
+       Fix cs0128.cs
+       * statement.cs (Block.AddVariable): Ensure that we skip implicit
+       blocks before deciding whether the error is cs0136 or cs0128.
+
        * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
        (using_alias_directive, using_namespace_directive): Pass
        MemberName, not an expression to Namespace.UsingAlias and 

Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs  2005-03-22 10:30:18 UTC (rev 42089)
+++ trunk/mcs/mcs/statement.cs  2005-03-22 10:36:42 UTC (rev 42090)
@@ -1508,9 +1508,16 @@
                        if (variables == null)
                                variables = new Hashtable ();
 
+                       Block cur = this;
+                       while (cur != null && cur.Implicit)
+                               cur = cur.Parent;
+
                        LocalInfo vi = GetLocalInfo (name);
                        if (vi != null) {
-                               if (vi.Block != this)
+                               Block var = vi.Block;
+                               while (var != null && var.Implicit)
+                                       var = var.Parent;
+                               if (var != cur)
                                        Report.Error (136, l, "A local variable 
named `" + name + "' " +
                                                      "cannot be declared in 
this scope since it would " +
                                                      "give a different meaning 
to `" + name + "', which " +
@@ -1549,9 +1556,6 @@
                        variables.Add (name, vi);
 
                        // Mark 'name' as "used by a child block" in every 
surrounding block
-                       Block cur = this;
-                       while (cur != null && cur.Implicit) 
-                               cur = cur.Parent;
                        if (cur != null)
                                for (Block par = cur.Parent; par != null; par = 
par.Parent)
                                        par.AddChildVariableName (name);

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

Reply via email to