2002-11-19 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 19 Nov 2002 22:32:19 +0000 (22:32 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 19 Nov 2002 22:32:19 +0000 (22:32 -0000)
* statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
GotoCase.Resolve): Use Peel on EmpytCasts.

* ecore.cs (EmptyCast): drop child, add Peel method.

svn path=/trunk/mcs/; revision=9095

mcs/mcs/ChangeLog
mcs/mcs/ecore.cs
mcs/mcs/statement.cs

index 203de541f63e53ebfc5e7733fa1b520346b57820..4faa49297e4a3494acd7b19863ac731078695d37 100755 (executable)
@@ -1,3 +1,10 @@
+2002-11-19  Miguel de Icaza  <miguel@ximian.com>
+
+       * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
+       GotoCase.Resolve): Use Peel on EmpytCasts.
+
+       * ecore.cs (EmptyCast): drop child, add Peel method.
+
 2002-11-17  Martin Baulig  <martin@ximian.com>
 
        * ecore.cs (EmptyCast.Child): New public property.
index b0d1c9ef09cfe312644b2af040590789931bb0cc..dab630d3f170e8fe761a923e28cea519e34f81c8 100755 (executable)
@@ -2875,8 +2875,11 @@ namespace Mono.CSharp {
                        this.child = child;
                }
 
-               public Expression Child {
-                       get { return child; }
+               public Expression Peel ()
+               {
+                       if (child is EmptyCast)
+                               return ((EmptyCast) child).Peel ();
+                       return child;
                }
 
                public override Expression DoResolve (EmitContext ec)
index d8b5673e11e8e935c2d9c79f89e3cf1c53911f2b..9714d9107ec62bed8e9680cfdb7a69818679f4ea 100755 (executable)
@@ -843,7 +843,7 @@ namespace Mono.CSharp {
                                return false;
 
                        if (expr is EmptyCast)
-                               expr = ((EmptyCast) expr).Child;
+                               expr = ((EmptyCast) expr).Peel ();
 
                        if (!(expr is Constant)){
                                Report.Error (159, loc, "Target expression for goto case is not constant");
@@ -2995,7 +2995,7 @@ namespace Mono.CSharp {
                                                continue;
 
                                        if (e is EmptyCast)
-                                               e = ((EmptyCast) e).Child;
+                                               e = ((EmptyCast) e).Peel ();
 
                                        if (!(e is Constant)){
                                                Report.Error (133, vi.Location,
@@ -3180,7 +3180,7 @@ namespace Mono.CSharp {
                                return false;
 
                        if (e is EmptyCast)
-                               e = ((EmptyCast) e).Child;
+                               e = ((EmptyCast) e).Peel ();
 
                        if (!(e is Constant)){
                                Console.WriteLine ("Value is: " + label);