diff options
author | Marek Safar <marek.safar@gmail.com> | 2009-08-07 14:49:24 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2009-08-07 14:49:24 +0400 |
commit | 25cb5c4338f5727bec5390ccd4ca95148ff0299b (patch) | |
tree | 6d99c06db0dfe15a7e1943427b6c7d8bcb16c4e5 | |
parent | ed47ca25ea569943bcfd4800a515196482bc170e (diff) |
2009-08-07 Marek Safar <marek.safar@gmail.com>
* CSharpInvokeBinder.cs, CSharpGetIndexBinder.cs, Extensions.cs,
CSharpArgumentInfo.cs, CSharpInvokeMemberBinder.cs,
CSharpSetIndexBinder.cs: Skip overhead arguments.
svn path=/trunk/mcs/; revision=139560
7 files changed, 19 insertions, 11 deletions
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs index 0c13307963c..83b6fc204b5 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs @@ -27,7 +27,9 @@ // using System; +using System.Dynamic; using System.Collections.Generic; +using System.Linq; namespace Microsoft.CSharp.RuntimeBinder { @@ -64,5 +66,11 @@ namespace Microsoft.CSharp.RuntimeBinder public string Name { get { return name; } } + + internal static CallInfo CreateCallInfo (IEnumerable<CSharpArgumentInfo> argumentInfo, int skipCount) + { + var named = from arg in argumentInfo.Skip (skipCount) where arg.IsNamed select arg.Name; + return new CallInfo (Math.Max (0, argumentInfo.Count () - skipCount), named); + } } } diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs index 164dd6a4a3b..4fd665e16d5 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs @@ -39,7 +39,7 @@ namespace Microsoft.CSharp.RuntimeBinder Type callingContext; public CSharpGetIndexBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) - : base (argumentInfo.ToCallInfo ()) + : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1)) { this.callingContext = callingContext; this.argumentInfo = argumentInfo.ToReadOnly (); diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs index 775e627efbf..2f81f144bfa 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs @@ -40,7 +40,7 @@ namespace Microsoft.CSharp.RuntimeBinder Type callingContext; public CSharpInvokeBinder (CSharpCallFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) - : base (argumentInfo.ToCallInfo ()) + : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1)) { this.flags = flags; this.callingContext = callingContext; diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs index 560b9610a2d..15e57c5c2bb 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs @@ -41,7 +41,7 @@ namespace Microsoft.CSharp.RuntimeBinder Type callingContext; public CSharpInvokeMemberBinder (CSharpCallFlags flags, string name, Type callingContext, IEnumerable<Type> typeArguments, IEnumerable<CSharpArgumentInfo> argumentInfo) - : base (name, false, argumentInfo.ToCallInfo ()) + : base (name, false, CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1)) { this.flags = flags; this.callingContext = callingContext; diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs index d04b79b1325..70f74571930 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs @@ -39,7 +39,7 @@ namespace Microsoft.CSharp.RuntimeBinder Type callingContext; public CSharpSetIndexBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) - : base (argumentInfo.ToCallInfo ()) + : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 2)) { this.callingContext = callingContext; this.argumentInfo = argumentInfo.ToReadOnly (); diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog index b6c801a3468..79a2633dac7 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog @@ -1,3 +1,9 @@ +2009-08-07 Marek Safar <marek.safar@gmail.com> + + * CSharpInvokeBinder.cs, CSharpGetIndexBinder.cs, Extensions.cs, + CSharpArgumentInfo.cs, CSharpInvokeMemberBinder.cs, + CSharpSetIndexBinder.cs: Skip overhead arguments. + 2009-08-04 Marek Safar <marek.safar@gmail.com> * RuntimeBinderInternalCompilerException.cs, diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs index c62cdedc3af..2cc17347863 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs @@ -41,12 +41,6 @@ namespace Microsoft.CSharp.RuntimeBinder return col == null ? new ReadOnlyCollectionBuilder<T> (0) : new ReadOnlyCollectionBuilder<T> (col); - } - - public static CallInfo ToCallInfo (this IEnumerable<CSharpArgumentInfo> argumentInfo) - { - var named = from arg in argumentInfo where arg.IsNamed select arg.Name; - return new CallInfo (argumentInfo.Count (), named); - } + } } } |