fresh impl
authorJb Evain <jbevain@gmail.com>
Sun, 13 Jan 2008 22:16:25 +0000 (22:16 -0000)
committerJb Evain <jbevain@gmail.com>
Sun, 13 Jan 2008 22:16:25 +0000 (22:16 -0000)
svn path=/trunk/mcs/; revision=92823

28 files changed:
mcs/class/System.Core/System.Core.dll.sources
mcs/class/System.Core/System.Core_test.dll.sources
mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ChangeLog [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ConditionalExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ConstantExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ElementInit.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/Expression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ExpressionPrinter.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ExpressionType.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ExpressionVisitor.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/Expression_T.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/InvocationExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ListInitExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberAssignment.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberBinding.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberBindingType.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberInitExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberListBinding.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MemberMemberBinding.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/MethodCallExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/NewArrayExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/ParameterExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/TypeBinaryExpression.cs [new file with mode: 0644]
mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs [new file with mode: 0644]

index 25f954e46306f7121e9ec536879b8d18efe72d24..76686398126c0d89efe22d1bc06a00fe9a8ec11b 100644 (file)
@@ -34,9 +34,9 @@ System.Linq.Expressions/ConstantExpression.cs
 System.Linq.Expressions/ElementInit.cs
 System.Linq.Expressions/Expression.cs
 System.Linq.Expressions/Expression_T.cs
-System.Linq.Expressions/ExpressionCompiler.cs
+System.Linq.Expressions/ExpressionPrinter.cs
 System.Linq.Expressions/ExpressionType.cs
-System.Linq.Expressions/ExpressionUtil.cs
+System.Linq.Expressions/ExpressionVisitor.cs
 System.Linq.Expressions/InvocationExpression.cs
 System.Linq.Expressions/LambdaExpression.cs
 System.Linq.Expressions/ListInitExpression.cs
index ee2bb90082333da06ad58109877a241e70b3aca0..f514eb3be2e6278b0e035c2ddf68e9b352f86d19 100644 (file)
@@ -3,32 +3,6 @@ System/TimeZoneInfo.AdjustmentRuleTest.cs
 System/TimeZoneInfo.TransitionTimeTest.cs
 System.Collections.Generic/HashSetTest.cs
 System.Linq/EnumerableTest.cs
-System.Linq/QueryableTest.cs
 System.Linq.Expressions/ExpressionTest.cs
-System.Linq.Expressions/ExpressionTest_Add.cs
-System.Linq.Expressions/ExpressionTest_AddChecked.cs
-System.Linq.Expressions/ExpressionTest_And.cs
-System.Linq.Expressions/ExpressionTest_AndAlso.cs
-System.Linq.Expressions/ExpressionTest_ArrayIndex.cs
-System.Linq.Expressions/ExpressionTest_ArrayLength.cs
-System.Linq.Expressions/ExpressionTest_Bind.cs
-System.Linq.Expressions/ExpressionTest_Call.cs
 System.Linq.Expressions/ExpressionTest_Constant.cs
-System.Linq.Expressions/ExpressionTest_Divide.cs
-System.Linq.Expressions/ExpressionTest_ExclusiveOr.cs
-System.Linq.Expressions/ExpressionTest_Field.cs
-System.Linq.Expressions/ExpressionTest_LeftShift.cs
-System.Linq.Expressions/ExpressionTest_Modulo.cs
-System.Linq.Expressions/ExpressionTest_Multiply.cs
-System.Linq.Expressions/ExpressionTest_MultiplyChecked.cs
-System.Linq.Expressions/ExpressionTest_Or.cs
-System.Linq.Expressions/ExpressionTest_OrElse.cs
-System.Linq.Expressions/ExpressionTest_Property.cs
-System.Linq.Expressions/ExpressionTest_PropertyOrField.cs
-System.Linq.Expressions/ExpressionTest_Quote.cs
-System.Linq.Expressions/ExpressionTest_RightShift.cs
-System.Linq.Expressions/ExpressionTest_Subtract.cs
-System.Linq.Expressions/ExpressionTest_SubtractChecked.cs
-System.Linq.Expressions/ExpressionTest_TypeAs.cs
-System.Linq.Expressions/ExpressionTest_TypeIs.cs
 System.Linq.Expressions/ExpressionTest_Utils.cs
diff --git a/mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs
new file mode 100644 (file)
index 0000000..eee80b0
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// BinaryExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class BinaryExpression : Expression {
+
+               Expression left;
+               Expression right;
+               MethodInfo method;
+
+               public Expression Left {
+                       get { return left; }
+               }
+
+               public Expression Right {
+                       get { return right; }
+               }
+
+               public MethodInfo Method {
+                       get { return method; }
+               }
+
+               [MonoTODO]
+               public bool IsLifted {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public bool IsLiftedToNull {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public LambdaExpression Conversion {
+                       get {
+                               if (this.NodeType != ExpressionType.Coalesce)
+                                       return null;
+
+                               throw new System.NotImplementedException ();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ChangeLog b/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
new file mode 100644 (file)
index 0000000..0cc9970
--- /dev/null
@@ -0,0 +1,3 @@
+2008-01-13  Jb Evain  <jbevain@novell.com>
+
+       * *.cs: fresh implementation.
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ConditionalExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/ConditionalExpression.cs
new file mode 100644 (file)
index 0000000..03fe09f
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// ConditionalExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Linq.Expressions {
+
+       public sealed class ConditionalExpression : Expression {
+
+               Expression test;
+               Expression ifTrue;
+               Expression ifFalse;
+
+               public Expression Test {
+                       get { return test; }
+               }
+
+               public Expression IfTrue {
+                       get { return ifTrue; }
+               }
+
+               public Expression IfFalse {
+                       get { return ifFalse; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ConstantExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/ConstantExpression.cs
new file mode 100644 (file)
index 0000000..169f496
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// ConstantExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Linq.Expressions {
+
+       public sealed class ConstantExpression : Expression {
+
+               object value;
+
+               public object Value {
+                       get { return value; }
+               }
+
+               internal ConstantExpression (object value, Type type)
+                       : base (ExpressionType.Constant, type)
+               {
+                       this.value = value;
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ElementInit.cs b/mcs/class/System.Core/System.Linq.Expressions/ElementInit.cs
new file mode 100644 (file)
index 0000000..4c45c02
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// ElementInit.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class ElementInit {
+
+               MethodInfo add_method;
+               ReadOnlyCollection<Expression> arguments;
+
+               public MethodInfo AddMethod {
+                       get { return add_method; }
+               }
+
+               public ReadOnlyCollection<Expression> Arguments {
+                       get { return arguments; }
+               }
+
+               internal ElementInit (MethodInfo add_method, ReadOnlyCollection<Expression> arguments)
+               {
+                       this.add_method = add_method;
+                       this.arguments = arguments;
+               }
+
+               public override string ToString ()
+               {
+                       return ExpressionPrinter.ToString (this);
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/Expression.cs b/mcs/class/System.Core/System.Linq.Expressions/Expression.cs
new file mode 100644 (file)
index 0000000..e2d1ba8
--- /dev/null
@@ -0,0 +1,907 @@
+//
+// Expression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public abstract class Expression {
+
+               ExpressionType node_type;
+               Type type;
+
+               public ExpressionType NodeType {
+                       get { return node_type; }
+               }
+
+               public Type Type {
+                       get { return type; }
+               }
+
+               // TODO: remove when all Expression subtypes
+               // have their constructor implemented
+               protected Expression ()
+               {
+               }
+
+               protected Expression (ExpressionType node_type, Type type)
+               {
+                       this.node_type = node_type;
+                       this.type = type;
+               }
+
+               public override string ToString ()
+               {
+                       return ExpressionPrinter.ToString (this);
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Add (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Add (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression AddChecked (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression AddChecked (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression And (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression And (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression AndAlso (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression AndAlso (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression ArrayIndex (Expression left, params Expression [] indexes)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression ArrayIndex (Expression left, IEnumerable<Expression> indexes)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression ArrayIndex (Expression left, Expression index)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static UnaryExpression ArrayLength (Expression array)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (!array.Type.IsArray)
+                               throw new ArgumentException ("The type of the expression must me Array");
+                       if (array.Type.GetArrayRank () != 1)
+                               throw new ArgumentException ("The array must be a single dimensional array");
+
+                       return new UnaryExpression (ExpressionType.ArrayLength, array, typeof (int));
+               }
+
+               [MonoTODO]
+               public static MemberAssignment Bind (MemberInfo member, Expression expression)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberAssignment Bind (MethodInfo propertyAccessor, Expression expression)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression Call (Expression instance, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression Call (MethodInfo method, params Expression [] arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression Call (Expression instance, MethodInfo method, params Expression [] arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression Call (Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MethodCallExpression Call (Type type, string methodName, Type [] typeArguments, params Expression [] arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Coalesce (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Coalesce (Expression left, Expression right, LambdaExpression conversion)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ConditionalExpression Condition (Expression test, Expression ifTrue, Expression ifFalse)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static ConstantExpression Constant (object value)
+               {
+                       return Constant (value, value == null ? typeof (object) : value.GetType ());
+               }
+
+               public static ConstantExpression Constant (object value, Type type)
+               {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+                       if (value == null && type.IsValueType && !IsNullable (type))
+                               throw new ArgumentException ();
+
+                       // TODO: check assignability
+
+                       return new ConstantExpression (value, type);
+               }
+
+               [MonoTODO]
+               public static UnaryExpression Convert (Expression expression, Type type)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression Convert (Expression expression, Type type, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression ConvertChecked (Expression expression, Type type)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression ConvertChecked (Expression expression, Type type, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Divide (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Divide (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ElementInit ElementInit (MethodInfo addMethod, params Expression [] arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ElementInit ElementInit (MethodInfo addMethod, IEnumerable<Expression> arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Equal (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Equal (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression ExclusiveOr (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression ExclusiveOr (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression Field (Expression expression, FieldInfo field)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression Field (Expression expression, string fieldName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Type GetActionType (params Type [] typeArgs)
+               {
+                       if (typeArgs == null)
+                               throw new ArgumentNullException ("typeArgs");
+
+                       if (typeArgs.Length > 4)
+                               throw new ArgumentException ("No Action type of this arity");
+
+                       if (typeArgs.Length == 0)
+                               return typeof (Action);
+
+                       Type action = null;
+                       switch (typeArgs.Length) {
+                       case 1:
+                               action = typeof (Action<>);
+                               break;
+                       case 2:
+                               action = typeof (Action<,>);
+                               break;
+                       case 3:
+                               action = typeof (Action<,,>);
+                               break;
+                       case 4:
+                               action = typeof (Action<,,,>);
+                               break;
+                       }
+
+                       return action.MakeGenericType (typeArgs);
+               }
+
+               public static Type GetFuncType (params Type [] typeArgs)
+               {
+                       if (typeArgs == null)
+                               throw new ArgumentNullException ("typeArgs");
+
+                       if (typeArgs.Length < 1 || typeArgs.Length > 5)
+                               throw new ArgumentException ("No Func type of this arity");
+
+                       Type func = null;
+                       switch (typeArgs.Length) {
+                       case 1:
+                               func = typeof (Func<>);
+                               break;
+                       case 2:
+                               func = typeof (Func<,>);
+                               break;
+                       case 3:
+                               func = typeof (Func<,,>);
+                               break;
+                       case 4:
+                               func = typeof (Func<,,,>);
+                               break;
+                       case 5:
+                               func = typeof (Func<,,,,>);
+                               break;
+                       }
+
+                       return func.MakeGenericType (typeArgs);
+               }
+
+               [MonoTODO]
+               public static BinaryExpression GreaterThan (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression GreaterThan (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression GreaterThanOrEqual (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression GreaterThanOrEqual (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static InvocationExpression Invoke (Expression expression, params Expression [] arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static InvocationExpression Invoke (Expression expression, IEnumerable<Expression> arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static Expression<TDelegate> Lambda<TDelegate> (Expression body, params ParameterExpression [] parameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static Expression<TDelegate> Lambda<TDelegate> (Expression body, IEnumerable<ParameterExpression> parameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static LambdaExpression Lambda (Expression body, params ParameterExpression [] parameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static LambdaExpression Lambda (Type delegateType, Expression body, params ParameterExpression [] parameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static LambdaExpression Lambda (Type delegateType, Expression body, IEnumerable<ParameterExpression> parameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression LeftShift (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression LeftShift (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression LessThan (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression LessThan (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression LessThanOrEqual (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression LessThanOrEqual (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberListBinding ListBind (MemberInfo member, params ElementInit [] initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberListBinding ListBind (MemberInfo member, IEnumerable<ElementInit> initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberListBinding ListBind (MethodInfo propertyAccessor, params ElementInit [] initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberListBinding ListBind (MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ListInitExpression ListInit (NewExpression newExpression, params ElementInit [] initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ListInitExpression ListInit (NewExpression newExpression, IEnumerable<ElementInit> initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ListInitExpression ListInit (NewExpression newExpression, params Expression [] initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ListInitExpression ListInit (NewExpression newExpression, IEnumerable<Expression> initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ListInitExpression ListInit (NewExpression newExpression, MethodInfo addMethod, params Expression [] initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ListInitExpression ListInit (NewExpression newExpression, MethodInfo addMethod, IEnumerable<Expression> initializers)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression MakeMemberAccess (Expression expression, MemberInfo member)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static UnaryExpression MakeUnary (ExpressionType unaryType, Expression operand, Type type)
+               {
+                       return MakeUnary (unaryType, operand, null, null);
+               }
+
+               public static UnaryExpression MakeUnary (ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
+               {
+                       if (!IsUnaryOperator (unaryType))
+                               throw new ArgumentException ("Make unary expect an unary operator");
+                       if (operand == null)
+                               throw new ArgumentNullException ("operand");
+
+                       return new UnaryExpression (unaryType, operand, type != null ? type : operand.Type, method);
+               }
+
+               static bool IsUnaryOperator (ExpressionType type)
+               {
+                       switch (type) {
+                       case ExpressionType.ArrayLength:
+                       case ExpressionType.Convert:
+                       case ExpressionType.ConvertChecked:
+                       case ExpressionType.Negate:
+                       case ExpressionType.NegateChecked:
+                       case ExpressionType.Not:
+                       case ExpressionType.Quote:
+                       case ExpressionType.TypeAs:
+                       case ExpressionType.UnaryPlus:
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               [MonoTODO]
+               public static MemberMemberBinding MemberBind (MemberInfo member, params MemberBinding [] binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberMemberBinding MemberBind (MemberInfo member, IEnumerable<MemberBinding> binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberMemberBinding MemberBind (MethodInfo propertyAccessor, params MemberBinding [] binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberMemberBinding MemberBind (MethodInfo propertyAccessor, IEnumerable<MemberBinding> binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberInitExpression MemberInit (NewExpression newExpression, params MemberBinding [] binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberInitExpression MemberInit (NewExpression newExpression, IEnumerable<MemberBinding> binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Modulo (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Modulo (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Multiply (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Multiply (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression MultiplyChecked (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression MultiplyChecked (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression Negate (Expression expression)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression Negate (Expression expression, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression NegateChecked (Expression expression)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression NegateChecked (Expression expression, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression New (ConstructorInfo constructor)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression New (Type type)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression New (ConstructorInfo constructor, params Expression [] arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments, params MemberInfo [] members)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewArrayExpression NewArrayBounds (Type type, params Expression [] bounds)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewArrayExpression NewArrayBounds (Type type, IEnumerable<Expression> bounds)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression NewArrayInit (Type type, params Expression [] bounds)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static NewExpression NewArrayInit (Type type, IEnumerable<Expression> bounds)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression Not (Expression expression)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression Not (Expression expression, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression NotEqual (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression NotEqual (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Or (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Or (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression OrElse (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression OrElse (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ParameterExpression Parameter (Type type, string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Power (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Power (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression Property (Expression expression, MethodInfo propertyAccessor)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression Property (Expression expression, PropertyInfo property)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression Property (Expression expression, string propertyName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static MemberExpression PropertyOrField (Expression expression, string propertyOrFieldName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static UnaryExpression Quote (Expression expression)
+               {
+                       if (expression == null)
+                               throw new ArgumentNullException ("expression");
+
+                       return new UnaryExpression (ExpressionType.Quote, expression);
+               }
+
+               [MonoTODO]
+               public static BinaryExpression RightShift (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression RightShift (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Subtract (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression Subtract (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression SubtractChecked (Expression left, Expression right)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static BinaryExpression SubtractChecked (Expression left, Expression right, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static UnaryExpression TypeAs (Expression expression, Type type)
+               {
+                       if (expression == null)
+                               throw new ArgumentNullException ("expression");
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
+                       return new UnaryExpression (ExpressionType.TypeAs, expression, type);
+               }
+
+               [MonoTODO]
+               public static TypeBinaryExpression TypeIs (Expression expression, Type type)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression UnaryPlus (Expression expression)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static UnaryExpression UnaryPlus (Expression expression, MethodInfo method)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               static bool IsNullable (Type type)
+               {
+                       return type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>);
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ExpressionPrinter.cs b/mcs/class/System.Core/System.Linq.Expressions/ExpressionPrinter.cs
new file mode 100644 (file)
index 0000000..2669563
--- /dev/null
@@ -0,0 +1,262 @@
+//
+// ExpressionPrinter.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Text;
+
+namespace System.Linq.Expressions {
+
+       class ExpressionPrinter : ExpressionVisitor {
+
+               StringBuilder builder;
+
+               ExpressionPrinter (StringBuilder builder)
+               {
+                       this.builder = builder;
+               }
+
+               ExpressionPrinter () : this (new StringBuilder ())
+               {
+               }
+
+               public static string ToString (Expression expression)
+               {
+                       var printer = new ExpressionPrinter ();
+                       printer.Visit (expression);
+                       return printer.builder.ToString ();
+               }
+
+               public static string ToString (ElementInit init)
+               {
+                       var printer = new ExpressionPrinter ();
+                       printer.VisitElementInitializer (init);
+                       return printer.builder.ToString ();
+               }
+
+               public static string ToString (MemberBinding binding)
+               {
+                       var printer = new ExpressionPrinter ();
+                       printer.VisitBinding (binding);
+                       return printer.builder.ToString ();
+               }
+
+               void Print (string str)
+               {
+                       builder.Append (str);
+               }
+
+               void Print (object obj)
+               {
+                       builder.Append (obj);
+               }
+
+               void Print (string str, params object [] objs)
+               {
+                       builder.AppendFormat (str, objs);
+               }
+
+               protected override void VisitElementInitializer (ElementInit initializer)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitUnary (UnaryExpression unary)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               static string OperatorToString (BinaryExpression binary)
+               {
+                       switch (binary.NodeType) {
+                       case ExpressionType.Add:
+                       case ExpressionType.AddChecked:
+                               return "+";
+                       case ExpressionType.AndAlso:
+                               return "&&";
+                       case ExpressionType.Coalesce:
+                               return "??";
+                       case ExpressionType.Divide:
+                               return "/";
+                       case ExpressionType.Equal:
+                               return "==";
+                       case ExpressionType.ExclusiveOr:
+                               return "^";
+                       case ExpressionType.GreaterThan:
+                               return ">";
+                       case ExpressionType.GreaterThanOrEqual:
+                               return ">=";
+                       case ExpressionType.LeftShift:
+                               return "<<";
+                       case ExpressionType.LessThan:
+                               return "<";
+                       case ExpressionType.LessThanOrEqual:
+                               return "<=";
+                       case ExpressionType.Modulo:
+                               return "%";
+                       case ExpressionType.Multiply:
+                       case ExpressionType.MultiplyChecked:
+                               return "*";
+                       case ExpressionType.NotEqual:
+                               return "!=";
+                       case ExpressionType.OrElse:
+                               return "||";
+                       case ExpressionType.RightShift:
+                               return ">>";
+                       case ExpressionType.Subtract:
+                       case ExpressionType.SubtractChecked:
+                               return "-";
+                       case ExpressionType.And:
+                               return IsBoolean (binary) ? "And" : "&";
+                       case ExpressionType.Or:
+                               return IsBoolean (binary) ? "Or" : "|";
+                       default:
+                               return null;
+                       }
+               }
+
+               static bool IsBoolean (Expression expression)
+               {
+                       return expression.Type == typeof (bool) || expression.Type == typeof (bool?);
+               }
+
+               protected override void VisitBinary (BinaryExpression binary)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitTypeIs (TypeBinaryExpression type)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitConstant (ConstantExpression constant)
+               {
+                       var value = constant.Value;
+
+                       if (value == null) {
+                               Print ("null");
+                       } else if (value is string) {
+                               Print ("\"");
+                               Print (value);
+                               Print ("\"");
+                       } else if (!HasStringRepresentation (value)) {
+                               Print ("value(");
+                               Print (value);
+                               Print (")");
+                       } else
+                               Print (value);
+               }
+
+               static bool HasStringRepresentation (object obj)
+               {
+                       return obj.ToString () != obj.GetType ().ToString ();
+               }
+
+               protected override void VisitConditional (ConditionalExpression conditional)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitParameter (ParameterExpression parameter)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitMemberAccess (MemberExpression member)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitMethodCall (MethodCallExpression methodCall)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitExpressionList (ReadOnlyCollection<Expression> list)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitMemberAssignment (MemberAssignment assignment)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitMemberMemberBinding (MemberMemberBinding binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitMemberListBinding (MemberListBinding binding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitList<T> (ReadOnlyCollection<T> list, Action<T> visitor)
+               {
+                       for (int i = 0; i < list.Count; i++) {
+                               if (i > 0)
+                                       Print (", ");
+
+                               visitor (list [i]);
+                       }
+               }
+
+               protected override void VisitLambda (LambdaExpression lambda)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitNew (NewExpression nex)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitMemberInit (MemberInitExpression init)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitListInit (ListInitExpression init)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitNewArray (NewArrayExpression newArray)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void VisitInvocation (InvocationExpression invocation)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ExpressionType.cs b/mcs/class/System.Core/System.Linq.Expressions/ExpressionType.cs
new file mode 100644 (file)
index 0000000..4712c97
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// Expression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Linq.Expressions {
+
+       public enum ExpressionType {
+               Add,
+               AddChecked,
+               And,
+               AndAlso,
+               ArrayLength,
+               ArrayIndex,
+               Call,
+               Coalesce,
+               Conditional,
+               Constant,
+               Convert,
+               ConvertChecked,
+               Divide,
+               Equal,
+               ExclusiveOr,
+               GreaterThan,
+               GreaterThanOrEqual,
+               Invoke,
+               Lambda,
+               LeftShift,
+               LessThan,
+               LessThanOrEqual,
+               ListInit,
+               MemberAccess,
+               MemberInit,
+               Modulo,
+               Multiply,
+               MultiplyChecked,
+               Negate,
+               UnaryPlus,
+               NegateChecked,
+               New,
+               NewArrayInit,
+               NewArrayBounds,
+               Not,
+               NotEqual,
+               Or,
+               OrElse,
+               Parameter,
+               Power,
+               Quote,
+               RightShift,
+               Subtract,
+               SubtractChecked,
+               TypeAs,
+               TypeIs,
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ExpressionVisitor.cs b/mcs/class/System.Core/System.Linq.Expressions/ExpressionVisitor.cs
new file mode 100644 (file)
index 0000000..773a028
--- /dev/null
@@ -0,0 +1,258 @@
+//
+// ExpressionVisitor.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+
+namespace System.Linq.Expressions {
+
+       abstract class ExpressionVisitor {
+
+               protected ExpressionVisitor ()
+               {
+               }
+
+               protected virtual void Visit (Expression expression)
+               {
+                       if (expression == null)
+                               return;
+
+                       switch (expression.NodeType) {
+                       case ExpressionType.Negate:
+                       case ExpressionType.NegateChecked:
+                       case ExpressionType.Not:
+                       case ExpressionType.Convert:
+                       case ExpressionType.ConvertChecked:
+                       case ExpressionType.ArrayLength:
+                       case ExpressionType.Quote:
+                       case ExpressionType.TypeAs:
+                               VisitUnary ((UnaryExpression) expression);
+                               break;
+                       case ExpressionType.Add:
+                       case ExpressionType.AddChecked:
+                       case ExpressionType.Subtract:
+                       case ExpressionType.SubtractChecked:
+                       case ExpressionType.Multiply:
+                       case ExpressionType.MultiplyChecked:
+                       case ExpressionType.Divide:
+                       case ExpressionType.Modulo:
+                       case ExpressionType.And:
+                       case ExpressionType.AndAlso:
+                       case ExpressionType.Or:
+                       case ExpressionType.OrElse:
+                       case ExpressionType.LessThan:
+                       case ExpressionType.LessThanOrEqual:
+                       case ExpressionType.GreaterThan:
+                       case ExpressionType.GreaterThanOrEqual:
+                       case ExpressionType.Equal:
+                       case ExpressionType.NotEqual:
+                       case ExpressionType.Coalesce:
+                       case ExpressionType.ArrayIndex:
+                       case ExpressionType.RightShift:
+                       case ExpressionType.LeftShift:
+                       case ExpressionType.ExclusiveOr:
+                               VisitBinary ((BinaryExpression) expression);
+                               break;
+                       case ExpressionType.TypeIs:
+                               VisitTypeIs ((TypeBinaryExpression) expression);
+                               break;
+                       case ExpressionType.Conditional:
+                               VisitConditional ((ConditionalExpression) expression);
+                               break;
+                       case ExpressionType.Constant:
+                               VisitConstant ((ConstantExpression) expression);
+                               break;
+                       case ExpressionType.Parameter:
+                               VisitParameter ((ParameterExpression) expression);
+                               break;
+                       case ExpressionType.MemberAccess:
+                               VisitMemberAccess ((MemberExpression) expression);
+                               break;
+                       case ExpressionType.Call:
+                               VisitMethodCall ((MethodCallExpression) expression);
+                               break;
+                       case ExpressionType.Lambda:
+                               VisitLambda ((LambdaExpression) expression);
+                               break;
+                       case ExpressionType.New:
+                               VisitNew ((NewExpression) expression);
+                               break;
+                       case ExpressionType.NewArrayInit:
+                       case ExpressionType.NewArrayBounds:
+                               VisitNewArray ((NewArrayExpression) expression);
+                               break;
+                       case ExpressionType.Invoke:
+                               VisitInvocation ((InvocationExpression) expression);
+                               break;
+                       case ExpressionType.MemberInit:
+                               VisitMemberInit ((MemberInitExpression) expression);
+                               break;
+                       case ExpressionType.ListInit:
+                               VisitListInit ((ListInitExpression) expression);
+                               break;
+                       default:
+                               throw new ArgumentException (string.Format ("Unhandled expression type: '{0}'", expression.NodeType));
+                       }
+               }
+
+               protected virtual void VisitBinding (MemberBinding binding)
+               {
+                       switch (binding.BindingType) {
+                       case MemberBindingType.Assignment:
+                               VisitMemberAssignment ((MemberAssignment) binding);
+                               break;
+                       case MemberBindingType.MemberBinding:
+                               VisitMemberMemberBinding ((MemberMemberBinding) binding);
+                               break;
+                       case MemberBindingType.ListBinding:
+                               VisitMemberListBinding ((MemberListBinding) binding);
+                               break;
+                       default:
+                               throw new ArgumentException (string.Format ("Unhandled binding type '{0}'", binding.BindingType));
+                       }
+               }
+
+               protected virtual void VisitElementInitializer (ElementInit initializer)
+               {
+                       VisitExpressionList (initializer.Arguments);
+               }
+
+               protected virtual void VisitUnary (UnaryExpression unary)
+               {
+                       Visit (unary.Operand);
+               }
+
+               protected virtual void VisitBinary (BinaryExpression binary)
+               {
+                       Visit (binary.Left);
+                       Visit (binary.Right);
+                       Visit (binary.Conversion);
+               }
+
+               protected virtual void VisitTypeIs (TypeBinaryExpression type)
+               {
+                       Visit (type.Expression);
+               }
+
+               protected virtual void VisitConstant (ConstantExpression constant)
+               {
+               }
+
+               protected virtual void VisitConditional (ConditionalExpression conditional)
+               {
+                       Visit (conditional.Test);
+                       Visit (conditional.IfTrue);
+                       Visit (conditional.IfFalse);
+               }
+
+               protected virtual void VisitParameter (ParameterExpression parameter)
+               {
+               }
+
+               protected virtual void VisitMemberAccess (MemberExpression member)
+               {
+                       Visit (member.Expression);
+               }
+
+               protected virtual void VisitMethodCall (MethodCallExpression methodCall)
+               {
+                       Visit (methodCall.Object);
+                       VisitExpressionList (methodCall.Arguments);
+               }
+
+               protected virtual void VisitList<T> (ReadOnlyCollection<T> list, Action<T> visitor)
+               {
+                       foreach (T element in list) {
+                               visitor (element);
+                       }
+               }
+
+               protected virtual void VisitExpressionList (ReadOnlyCollection<Expression> list)
+               {
+                       VisitList (list, Visit);
+               }
+
+               protected virtual void VisitMemberAssignment (MemberAssignment assignment)
+               {
+                       Visit (assignment.Expression);
+               }
+
+               protected virtual void VisitMemberMemberBinding (MemberMemberBinding binding)
+               {
+                       VisitBindingList (binding.Bindings);
+               }
+
+               protected virtual void VisitMemberListBinding (MemberListBinding binding)
+               {
+                       VisitElementInitializerList (binding.Initializers);
+               }
+
+               protected virtual void VisitBindingList (ReadOnlyCollection<MemberBinding> list)
+               {
+                       VisitList (list, VisitBinding);
+               }
+
+               protected virtual void VisitElementInitializerList (ReadOnlyCollection<ElementInit> list)
+               {
+                       VisitList (list, VisitElementInitializer);
+               }
+
+               protected virtual void VisitLambda (LambdaExpression lambda)
+               {
+                       Visit (lambda.Body);
+               }
+
+               protected virtual void VisitNew (NewExpression nex)
+               {
+                       VisitExpressionList (nex.Arguments);
+               }
+
+               protected virtual void VisitMemberInit (MemberInitExpression init)
+               {
+                       VisitNew (init.NewExpression);
+                       VisitBindingList (init.Bindings);
+               }
+
+               protected virtual void VisitListInit (ListInitExpression init)
+               {
+                       VisitNew (init.NewExpression);
+                       VisitElementInitializerList (init.Initializers);
+               }
+
+               protected virtual void VisitNewArray (NewArrayExpression newArray)
+               {
+                       VisitExpressionList (newArray.Expressions);
+               }
+
+               protected virtual void VisitInvocation (InvocationExpression invocation)
+               {
+                       VisitExpressionList (invocation.Arguments);
+                       Visit (invocation.Expression);
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/Expression_T.cs b/mcs/class/System.Core/System.Linq.Expressions/Expression_T.cs
new file mode 100644 (file)
index 0000000..a39ca43
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// Expression_T.cs
+//
+// Author:
+//  Jb Evain (jbevain@novell.com)
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Linq.Expressions {
+
+       public sealed class Expression<TDelegate> : LambdaExpression {
+
+               [MonoTODO]
+               public new TDelegate Compile ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/InvocationExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/InvocationExpression.cs
new file mode 100644 (file)
index 0000000..dcb66b6
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// InvocationExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Text;
+
+namespace System.Linq.Expressions {
+
+       public sealed class InvocationExpression : Expression {
+
+               Expression lambda;
+               ReadOnlyCollection<Expression> arguments;
+
+               public Expression Expression {
+                       get { return lambda; }
+               }
+
+               public ReadOnlyCollection<Expression> Arguments {
+                       get { return arguments; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs
new file mode 100644 (file)
index 0000000..9350dae
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// LambdaExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+
+namespace System.Linq.Expressions {
+
+       public class LambdaExpression : Expression {
+
+               Expression body;
+               ReadOnlyCollection<ParameterExpression> parameters;
+
+               public Expression Body {
+                       get { return body; }
+               }
+
+               public ReadOnlyCollection<ParameterExpression> Parameters {
+                       get { return parameters; }
+               }
+
+               [MonoTODO]
+               public Delegate Compile ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ListInitExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/ListInitExpression.cs
new file mode 100644 (file)
index 0000000..9e92b4b
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// ListInitExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Text;
+
+namespace System.Linq.Expressions {
+
+       public sealed class ListInitExpression : Expression {
+
+               NewExpression new_expression;
+               ReadOnlyCollection<ElementInit> initializers;
+
+               public NewExpression NewExpression {
+                       get { return new_expression; }
+               }
+
+               public ReadOnlyCollection<ElementInit> Initializers {
+                       get { return initializers; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberAssignment.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberAssignment.cs
new file mode 100644 (file)
index 0000000..cf04a52
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// MemberAssignement.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace System.Linq.Expressions {
+
+       public sealed class MemberAssignment : MemberBinding {
+
+               Expression expression;
+
+               public Expression Expression {
+                       get { return expression; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberBinding.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberBinding.cs
new file mode 100644 (file)
index 0000000..e2433f6
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// MemberBinding.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public abstract class MemberBinding {
+
+               MemberBindingType binding_type;
+               MemberInfo member;
+
+               public MemberBindingType BindingType {
+                       get { return binding_type; }
+               }
+
+               public MemberInfo Member {
+                       get { return member; }
+               }
+
+               public override string ToString ()
+               {
+                       return ExpressionPrinter.ToString (this);
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberBindingType.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberBindingType.cs
new file mode 100644 (file)
index 0000000..934b5b6
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// MemberBindingType.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Linq.Expressions {
+
+       public enum MemberBindingType {
+               Assignment,
+               MemberBinding,
+               ListBinding
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberExpression.cs
new file mode 100644 (file)
index 0000000..4ed67b3
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// MemberExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace System.Linq.Expressions {
+
+       public sealed class MemberExpression : Expression {
+
+               Expression expression;
+               MemberInfo member;
+
+               public Expression Expression {
+                       get { return expression; }
+               }
+
+               public MemberInfo Member {
+                       get { return member; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberInitExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberInitExpression.cs
new file mode 100644 (file)
index 0000000..80963dd
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// MemberInitExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class MemberInitExpression : Expression {
+
+               NewExpression new_expression;
+               ReadOnlyCollection<MemberBinding> bindings;
+
+               public NewExpression NewExpression {
+                       get { return new_expression; }
+               }
+
+               public ReadOnlyCollection<MemberBinding> Bindings {
+                       get { return bindings; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberListBinding.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberListBinding.cs
new file mode 100644 (file)
index 0000000..3b25677
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// MemberListBinding.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class MemberListBinding : MemberBinding {
+
+               ReadOnlyCollection<ElementInit> initializers;
+
+               public ReadOnlyCollection<ElementInit> Initializers {
+                       get { return initializers; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MemberMemberBinding.cs b/mcs/class/System.Core/System.Linq.Expressions/MemberMemberBinding.cs
new file mode 100644 (file)
index 0000000..142e93b
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// MemberMemberExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class MemberMemberBinding : MemberBinding {
+
+               ReadOnlyCollection<MemberBinding> bindings;
+
+               public ReadOnlyCollection<MemberBinding> Bindings {
+                       get { return bindings; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/MethodCallExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/MethodCallExpression.cs
new file mode 100644 (file)
index 0000000..59e4822
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// MethodCallExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class MethodCallExpression : Expression {
+
+               Expression @object;
+               MethodInfo method;
+               ReadOnlyCollection<Expression> arguments;
+
+               public Expression Object {
+                       get { return @object; }
+               }
+
+               public MethodInfo Method {
+                       get { return method; }
+               }
+
+               public ReadOnlyCollection<Expression> Arguments {
+                       get { return arguments; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/NewArrayExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/NewArrayExpression.cs
new file mode 100644 (file)
index 0000000..3346715
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// NewArrayExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+
+namespace System.Linq.Expressions {
+
+       public sealed class NewArrayExpression : Expression {
+
+               ReadOnlyCollection<Expression> expressions;
+
+               public ReadOnlyCollection<Expression> Expressions {
+                       get { return expressions; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
new file mode 100644 (file)
index 0000000..08b6114
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// NewExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class NewExpression : Expression {
+
+               ConstructorInfo constructor;
+               ReadOnlyCollection<Expression> arguments;
+               ReadOnlyCollection<MemberInfo> members;
+
+               public ConstructorInfo Constructor {
+                       get { return constructor; }
+               }
+
+               public ReadOnlyCollection<Expression> Arguments {
+                       get { return arguments; }
+               }
+
+               public ReadOnlyCollection<MemberInfo> Members {
+                       get { return members; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ParameterExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/ParameterExpression.cs
new file mode 100644 (file)
index 0000000..185749b
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// ParameterExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Linq.Expressions {
+
+       public sealed class ParameterExpression : Expression {
+
+               string name;
+
+               public string Name {
+                       get { return name; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/TypeBinaryExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/TypeBinaryExpression.cs
new file mode 100644 (file)
index 0000000..1f6f16a
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// TypeBinaryExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Linq.Expressions {
+
+       public sealed class TypeBinaryExpression : Expression {
+
+               Expression expression;
+               Type type_operand;
+
+               public Expression Expression {
+                       get { return expression; }
+               }
+
+               public Type TypeOperand {
+                       get { return type_operand; }
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs b/mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs
new file mode 100644 (file)
index 0000000..0d55f8e
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// UnaryExpression.cs
+//
+// Author:
+//   Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Linq.Expressions {
+
+       public sealed class UnaryExpression : Expression {
+
+               Expression operand;
+               MethodInfo method;
+
+               public Expression Operand {
+                       get { return operand; }
+               }
+
+               public MethodInfo Method {
+                       get { return method; }
+               }
+
+               [MonoTODO]
+               public bool IsLifted {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public bool IsLiftedToNull {
+                       get { throw new NotImplementedException (); }
+               }
+
+               internal UnaryExpression (ExpressionType node_type, Expression operand)
+                       : base (node_type, operand.Type)
+               {
+                       this.operand = operand;
+               }
+
+               internal UnaryExpression (ExpressionType node_type, Expression operand, Type type)
+                       : base (node_type, type)
+               {
+                       this.operand = operand;
+               }
+
+               internal UnaryExpression (ExpressionType node_type, Expression operand, Type type, MethodInfo method)
+                       : base (node_type, type)
+               {
+                       this.operand = operand;
+                       this.method = method;
+               }
+       }
+}