2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 9 Jan 2003 22:24:40 +0000 (22:24 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 9 Jan 2003 22:24:40 +0000 (22:24 -0000)
* ecore.cs:
* expression.cs:
* typemanager.cs: fixes to allow mcs compile corlib with the new
Type.IsSubclassOf fix.

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

mcs/mcs/ecore.cs
mcs/mcs/typemanager.cs

index 5aee561e6c791857d2ad92969926fdfbaebc6fc3..4c48be169021b516d942f69c349ca772a502f73b 100755 (executable)
@@ -791,12 +791,15 @@ namespace Mono.CSharp {
                                        return new EmptyCast (expr, target_type);
                                
                                // from any delegate type to System.Delegate
-                               if (expr_type.IsSubclassOf (TypeManager.delegate_type) &&
+                               if ((expr_type == TypeManager.delegate_type || 
+                                    expr_type.IsSubclassOf (TypeManager.delegate_type)) &&
                                    target_type == TypeManager.delegate_type)
                                        return new EmptyCast (expr, target_type);
                                        
                                // from any array-type or delegate type into System.ICloneable.
-                               if (expr_type.IsArray || expr_type.IsSubclassOf (TypeManager.delegate_type))
+                               if (expr_type.IsArray ||
+                                   expr_type == TypeManager.delegate_type ||
+                                   expr_type.IsSubclassOf (TypeManager.delegate_type))
                                        if (target_type == TypeManager.icloneable_type)
                                                return new EmptyCast (expr, target_type);
                                
@@ -1029,13 +1032,16 @@ namespace Mono.CSharp {
                                        return true;
                                
                                // from any delegate type to System.Delegate
-                               if (expr_type.IsSubclassOf (TypeManager.delegate_type) &&
+                               if ((expr_type == TypeManager.delegate_type ||
+                                    expr_type.IsSubclassOf (TypeManager.delegate_type)) &&
                                    target_type == TypeManager.delegate_type)
                                        if (target_type.IsAssignableFrom (expr_type))
                                                return true;
                                        
                                // from any array-type or delegate type into System.ICloneable.
-                               if (expr_type.IsArray || expr_type.IsSubclassOf (TypeManager.delegate_type))
+                               if (expr_type.IsArray ||
+                                   expr_type == TypeManager.delegate_type ||
+                                   expr_type.IsSubclassOf (TypeManager.delegate_type))
                                        if (target_type == TypeManager.icloneable_type)
                                                return true;
                                
@@ -1239,7 +1245,9 @@ namespace Mono.CSharp {
                                        return true;
                        }
                        
-                       if (target_type.IsSubclassOf (TypeManager.enum_type) && expr is IntLiteral){
+                       if ((target_type == TypeManager.enum_type ||
+                            target_type.IsSubclassOf (TypeManager.enum_type)) &&
+                            expr is IntLiteral){
                                IntLiteral i = (IntLiteral) expr;
 
                                if (i.Value == 0)
@@ -1703,7 +1711,9 @@ namespace Mono.CSharp {
                        if (e != null)
                                return e;
 
-                       if (target_type.IsSubclassOf (TypeManager.enum_type) && expr is IntLiteral){
+                       if ((target_type == TypeManager.enum_type ||
+                            target_type.IsSubclassOf (TypeManager.enum_type)) &&
+                           expr is IntLiteral){
                                IntLiteral i = (IntLiteral) expr;
 
                                if (i.Value == 0)
index f0794deabbf2b72fa566734bd344e604743f2c1d..997d6879e7b45a1ee0a2bd6b1ed81c1114e7bb87 100755 (executable)
@@ -1193,7 +1193,7 @@ public class TypeManager {
                // a TypeBuilder array will return a Type, not a TypeBuilder,
                // and we can not call FindMembers on this type.
                //
-               if (t.IsSubclassOf (TypeManager.array_type)) {
+               if (t == TypeManager.array_type || t.IsSubclassOf (TypeManager.array_type)) {
                        used_cache = true;
                        return TypeHandle.ArrayType.MemberCache.FindMembers (
                                mt, bf, name, FilterWithClosure_delegate, null);
@@ -1275,7 +1275,7 @@ public class TypeManager {
        
        public static bool IsEnumType (Type t)
        {
-               if (t.IsSubclassOf (TypeManager.enum_type))
+               if (t == TypeManager.enum_type || t.IsSubclassOf (TypeManager.enum_type))
                        return true;
                else
                        return false;