Browse Source

2008-01-21 Jb Evain <[email protected]>

	* Expression.cs, UnaryExpression.cs, BinaryExpression.cs:
	Move the IsUnsigned helper from BinaryExpression to Expression,
	so it can be used in UnaryExpression.


svn path=/trunk/mcs/; revision=93387
Jb Evain 18 years ago
parent
commit
619e5002f0

+ 0 - 8
mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs

@@ -97,14 +97,6 @@ namespace System.Linq.Expressions {
 			this.is_lifted = is_lifted;
 		}
 
-		static bool IsUnsigned (Type t)
-		{
-			if (t.IsPointer)
-				return IsUnsigned (t.GetElementType ());
-
-			return t == typeof (ushort) || t == typeof (uint) || t == typeof (ulong) || t == typeof (byte);
-		}
-
 		static void EmitMethod ()
 		{
 			throw new NotImplementedException ("Support for MethodInfo-based BinaryExpressions not yet supported");

+ 6 - 0
mcs/class/System.Core/System.Linq.Expressions/ChangeLog

@@ -1,3 +1,9 @@
+2008-01-21  Jb Evain  <[email protected]>
+
+	* Expression.cs, UnaryExpression.cs, BinaryExpression.cs:
+	Move the IsUnsigned helper from BinaryExpression to Expression,
+	so it can be used in UnaryExpression.
+
 2008-01-21  Miguel de Icaza  <[email protected]>
 
 	* Start code generation for nullables, currently this generates

+ 8 - 0
mcs/class/System.Core/System.Linq.Expressions/Expression.cs

@@ -1385,6 +1385,14 @@ namespace System.Linq.Expressions {
 			return type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>);
 		}
 
+		protected static bool IsUnsigned (Type t)
+		{
+			if (t.IsPointer)
+				return IsUnsigned (t.GetElementType ());
+
+			return t == typeof (ushort) || t == typeof (uint) || t == typeof (ulong) || t == typeof (byte);
+		}
+
 		//
 		// returns the T in a a Nullable<T> type.
 		//

+ 7 - 0
mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs

@@ -28,6 +28,7 @@
 
 using System;
 using System.Reflection;
+using System.Reflection.Emit;
 
 namespace System.Linq.Expressions {
 
@@ -75,6 +76,12 @@ namespace System.Linq.Expressions {
 
 		internal override void Emit (EmitContext ec)
 		{
+			var il = ec.ig;
+
+			operand.Emit (ec);
+
+			bool is_unsigned = IsUnsigned (operand.Type);
+
 			throw new NotImplementedException ();
 		}
 	}