Procházet zdrojové kódy

Remove TypeCode in a few places, there is one place where its actually useful (ConstantExpression.Emit) and I dont feel like rewriting that one

svn path=/trunk/mcs/; revision=93232
Miguel de Icaza před 18 roky
rodič
revize
aeff6b77be

+ 1 - 6
mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs

@@ -97,12 +97,7 @@ namespace System.Linq.Expressions {
 			if (t.IsPointer)
 				return IsUnsigned (t.GetElementType ());
 
-			TypeCode tc = Type.GetTypeCode (t);
-			return tc == TypeCode.UInt16 ||
-				tc == TypeCode.UInt32 ||
-				tc == TypeCode.UInt64 ||
-				tc == TypeCode.Byte;
-
+			return t == typeof (ushort) || t == typeof (uint) || t == typeof (ulong) || t == typeof (byte);
 		}
 				
 		internal override void Emit (EmitContext ec)

+ 5 - 15
mcs/class/System.Core/System.Linq.Expressions/Expression.cs

@@ -75,17 +75,11 @@ namespace System.Linq.Expressions {
 #region Binary Expressions
 		static bool IsInt (Type t)
 		{
-			switch (Type.GetTypeCode (t)) {
-			case TypeCode.Byte:
-			case TypeCode.SByte:
-			case TypeCode.Int16:
-			case TypeCode.UInt16:
-			case TypeCode.Int32:
-			case TypeCode.UInt32:
-			case TypeCode.Int64:
-			case TypeCode.UInt64:
+			if (t == typeof (byte) || t == typeof (sbyte) ||
+			    t == typeof (short) || t == typeof (ushort) ||
+			    t == typeof (int) || t == typeof (uint) ||
+			    t == typeof (long) || t == typeof (ulong))
 				return true;
-			}
 
 			return false;
 		}
@@ -95,12 +89,8 @@ namespace System.Linq.Expressions {
 			if (IsInt (t))
 				return true;
 
-			switch (Type.GetTypeCode (t)) {
-			case TypeCode.Single:
-			case TypeCode.Double:
-			case TypeCode.Decimal:
+			if (t == typeof (float) || t == typeof (double) || t == typeof (decimal))
 				return true;
-			}
 
 			return false;
 		}