diff options
author | Marek Safar <marek.safar@gmail.com> | 2013-02-25 15:03:24 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2013-02-25 17:11:03 +0400 |
commit | d4fb0b0e4e26a3d53caf3b174ccacb57c1a37665 (patch) | |
tree | 7bd32fe9cc17aa0bc45212617c3bed1c0ed01c9c | |
parent | 02e0ddfe44685a4018b4bde1561acde3d6080fde (diff) |
Clean up params binder
-rw-r--r-- | mcs/class/corlib/System.Reflection/Binder.cs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/mcs/class/corlib/System.Reflection/Binder.cs b/mcs/class/corlib/System.Reflection/Binder.cs index dd50d97572b..6d186c73edd 100644 --- a/mcs/class/corlib/System.Reflection/Binder.cs +++ b/mcs/class/corlib/System.Reflection/Binder.cs @@ -501,31 +501,31 @@ namespace System.Reflection /* Try methods with ParamArray attribute */ if (arguments != null) { - bool isdefParamArray = false; - Type elementType = null; for (i = 0; i < match.Length; ++i) { m = match [i]; - ParameterInfo[] args = m.GetParameters (); - if (args.Length > types.Length + 1) - continue; - else if (args.Length == 0) + + var pi = m.GetParameters (); + if (pi.Length == 0 || pi.Length > types.Length + 1) continue; - isdefParamArray = Attribute.IsDefined (args [args.Length - 1], typeof (ParamArrayAttribute)); - if (!isdefParamArray) + + if (!Attribute.IsDefined (pi [pi.Length - 1], typeof (ParamArrayAttribute))) continue; - elementType = args [args.Length - 1].ParameterType.GetElementType (); + + var elementType = pi [pi.Length - 1].ParameterType.GetElementType (); for (j = 0; j < types.Length; ++j) { - if (j < (args.Length - 1) && types [j] != args [j].ParameterType) + if (j < (pi.Length - 1) && types [j] != pi [j].ParameterType) break; - else if (j >= (args.Length - 1) && types [j] != elementType) + + if (j >= (pi.Length - 1) && types [j] != elementType) break; } + if (j == types.Length) return m; } } - - if ((int)(bindingAttr & BindingFlags.ExactBinding) != 0) + + if ((bindingAttr & BindingFlags.ExactBinding) != 0) return null; MethodBase result = null; |