[Mono-dev] [Mono-patches] r94530 - trunk/mcs/class/System.Core/System.Linq.Expressions

olivier dufour olivier.duff at gmail.com
Fri Feb 1 19:01:36 EST 2008


When I say no fix on svn, I talk about the first patch. So it date of 5
days.
You have misunderstood...

I have try to find all cosmetic things ( remove/Add space, reorder test to
avoir to repeat things...)

Here is my patch:

Index: Expression.cs
===================================================================
--- Expression.cs    (révision 94574)
+++ Expression.cs    (copie de travail)
@@ -1059,10 +1059,10 @@
                 throw new ArgumentNullException ("addMethod");
             if (arguments == null)
                 throw new ArgumentNullException ("arguments");
-            if (addMethod.Name.ToLowerInvariant() != "add")//case
insensitive
+            if (addMethod.Name.ToLowerInvariant () != "add")//case
insensitive
                 throw new ArgumentException ("addMethod");
             if (addMethod.IsStatic)
-                throw new ArgumentException ("addMethod must be an instance
method", "addMethod");
+                throw new ArgumentException ("AddMethod must be an instance
method", "addMethod");

             var args = arguments.ToReadOnlyCollection ();

@@ -1170,7 +1170,7 @@
             if (expression.Type.IsSubclassOf (typeof(Expression<object>)))
{//not sure here
                 delegateObj =
((Expression<System.Delegate>)expression).Compile
();//not sure here too
             } else if (expression.type.IsSubclassOf (typeof(System.Delegate)))
{
-                delegateObj = (System.Delegate)Activator.CreateInstance(
expression.type);
+                delegateObj = (System.Delegate)Activator.CreateInstance (
expression.type);
             } else
                 throw new ArgumentException ("expression");

@@ -1257,7 +1257,7 @@
             else
                 throw new ArgumentException ("Member must be a field or a
property");

-            if (!mbrType.IsSubclassOf(typeof(System.Collections.IEnumerable)))

+            if (!mbrType.IsSubclassOf (typeof (
System.Collections.IEnumerable)))
                 throw new ArgumentException ("Member must inherite from
IEnumerable");

             return new MemberListBinding (member,
initializers.ToReadOnlyCollection ());
@@ -1281,20 +1281,21 @@
                 ParameterInfo[] parameters;
                 if (propertyAccessor.Name.StartsWith ("get_")) {
                     parameters = propertyAccessor.GetParameters ();
-                    if (parameters.Length != 0)
-                        throw new ArgumentException ("PropertyAccessor must
be a property accessor");
-                    propType = propertyAccessor.ReturnType;
+                    if (parameters.Length == 0)
+                        propType = propertyAccessor.ReturnType;
                 } else if (propertyAccessor.Name.StartsWith ("set_")) {
                     parameters = propertyAccessor.GetParameters ();
-                    if (parameters.Length != 1)
-                        throw new ArgumentException ("PropertyAccessor must
be a property accessor");
-                    propType = parameters[0].ParameterType;
+                    if (parameters.Length == 1)
+                        propType = parameters [0].ParameterType;
                 }
-                if (!propType.IsSubclassOf(typeof (
System.Collections.IEnumerable)))
-                    throw new ArgumentException ("The type of the property
of propertyAccessor must implement IEnumerable");
-                return new MemberListBinding (propertyAccessor,
initializers.ToReadOnlyCollection());
+                if (propType != null)
+                {
+                    if (!propType.IsSubclassOf(typeof (
System.Collections.IEnumerable)))
+                        throw new ArgumentException ("The type of the
property of propertyAccessor must implement IEnumerable");
+                    return new MemberListBinding (propertyAccessor,
initializers.ToReadOnlyCollection());
+                }
             }
-            throw new ArgumentException ("propertyAccessor must be a
property accessor");
+            throw new ArgumentException ("PropertyAccessor must be a
property accessor");
         }

         [MonoTODO]


2008/2/2, Jb Evain <jb at nurv.fr>:
>
> On 2/2/08, olivier dufour <olivier.duff at gmail.com> wrote:
> > I have seen no fix on svn.
>
> I have other things to do on a friday night than correcting your mistakes.
>
> > So, I do not see where I am wrong and not following the code convention.
>
> Then I can't help much.
>
> > All the expression class contain readonly things with only getter an
> nothing
> > to set it. In all other expression inherited class we have the same
> > behaviour and same system. So it is quite easy to add what is missing.
>
> And you managed to propose wrong constructors in the patch you sent to
> the list. So it's maybe not that easy you know?
>
> Anyway, I don't see much interest in pursuing this conversation.
>
> --
> Jb Evain  <jb at nurv.fr>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080202/074a9b35/attachment.html 


More information about the Mono-devel-list mailing list