2002-09-06 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Sat, 7 Sep 2002 00:49:26 +0000 (00:49 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 7 Sep 2002 00:49:26 +0000 (00:49 -0000)
* expression.cs (Cast): Simplified by using ResolveType instead of
manually resolving.

* statement.cs (Catch): Fix bug by using ResolveType.

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

mcs/mcs/ChangeLog
mcs/mcs/expression.cs
mcs/mcs/statement.cs

index ecb7ace71bf448b65c2b67122d641da82b82e445..0618431293c2f9ccd35431cdb7ded63d72a418b3 100755 (executable)
@@ -1,3 +1,10 @@
+2002-09-06  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (Cast): Simplified by using ResolveType instead of
+       manually resolving.
+
+       * statement.cs (Catch): Fix bug by using ResolveType.
+
 2002-09-06  Ravi Pratap  <ravi@ximian.com>
 
        * expression.cs (BetterConversion): Special case for when we have
index eedc0d88d40393da44e0d53f4f0b219a3bb4679d..b9a297e1cb0c3f859199dd2b26f27fb240cb71b0 100755 (executable)
@@ -1434,20 +1434,13 @@ namespace Mono.CSharp {
 
                        int errors = Report.Errors;
 
-                       target_type = target_type.Resolve (ec, ResolveFlags.Type);
+                       type = ec.DeclSpace.ResolveType (target_type, false, Location);
                        
-                       if (target_type == null){
-                               if (errors == Report.Errors)
-                                       Error (-10, "Can not resolve type");
+                       if (type == null)
                                return null;
-                       }
 
-                       type = target_type.Type;
                        eclass = ExprClass.Value;
                        
-                       if (type == null)
-                               return null;
-
                        if (expr is Constant){
                                Expression e = TryReduce (ec, type);
 
index c8a171ba9dfb99f76667cc37c5e3e422f873479c..26ac2b9c4811c40f1cf98b4997b94d2ef824f102 100755 (executable)
@@ -4172,11 +4172,12 @@ namespace Mono.CSharp {
                public readonly Block  Block;
                public readonly Location Location;
 
-               Expression type;
+               Expression type_expr;
+               Type type;
                
                public Catch (Expression type, string name, Block block, Location l)
                {
-                       this.type = type;
+                       type_expr = type;
                        Name = name;
                        Block = block;
                        Location = l;
@@ -4184,10 +4185,7 @@ namespace Mono.CSharp {
 
                public Type CatchType {
                        get {
-                               if (type == null)
-                                       throw new InvalidOperationException ();
-
-                               return type.Type;
+                               return type;
                        }
                }
 
@@ -4199,19 +4197,19 @@ namespace Mono.CSharp {
 
                public bool Resolve (EmitContext ec)
                {
-                       if (type != null) {
-                               type = type.DoResolve (ec);
+                       if (type_expr != null) {
+                               type = ec.DeclSpace.ResolveType (type_expr, false, Location);
                                if (type == null)
                                        return false;
 
-                               Type t = type.Type;
-                               if (t != TypeManager.exception_type && !t.IsSubclassOf (TypeManager.exception_type)){
+                               if (type != TypeManager.exception_type && !type.IsSubclassOf (TypeManager.exception_type)){
                                        Report.Error (155, Location,
                                                      "The type caught or thrown must be derived " +
                                                      "from System.Exception");
                                        return false;
                                }
-                       }
+                       } else
+                               type = null;
 
                        if (!Block.Resolve (ec))
                                return false;