[Mono-devel-list] monop support for operator overloading

Ben Maurer bmaurer at ximian.com
Mon Dec 13 16:17:34 EST 2004


On Mon, 2004-12-13 at 16:02 -0500, Dan Winship wrote:
>                 
> +               foreach (MemberInfo mi in t.GetMembers (flags)) {
> +                       if (!(mi is MethodInfo) || !(mi.Name.StartsWith ("op_")))
> +                               continue;
> +
> +                       if (first)
> +                               o.WriteLine ();
> +                       first = false;
> +                       
> +                       OutlineOperator ((MethodInfo)mi);
> +                       
> +                       o.WriteLine ();
> +               }
> +
> +               first = true;

Is there any reason you didn't use GetMethods here? (that would avoid a
few casts and a few lines of logic).

Also, you should say:

if ((m.Attributes & MethodAttributes.SpecialName) == 0)
      continue;
if (!mi.Name.StartsWith ("op_"))
      continue;

As part of being an operator is having SpecialName set.

Other than that, please feel free to commit.

-- Ben




More information about the Mono-devel-list mailing list