2009-08-07 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Fri, 7 Aug 2009 10:49:24 +0000 (10:49 -0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 7 Aug 2009 10:49:24 +0000 (10:49 -0000)
* CSharpInvokeBinder.cs, CSharpGetIndexBinder.cs, Extensions.cs,
CSharpArgumentInfo.cs, CSharpInvokeMemberBinder.cs,
CSharpSetIndexBinder.cs: Skip overhead arguments.

svn path=/trunk/mcs/; revision=139560

mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs

index 0c13307963c2383b4ae21d2c0fd1530c6c685dcb..83b6fc204b570fcb3e579bd4bf5af7fde6e5720e 100644 (file)
@@ -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);
+               }
        }
 }
index 164dd6a4a3bf7424295fdd9d946b9eb4aa9f7369..4fd665e16d5da6d75cf05f26668bcb880dd0b913 100644 (file)
@@ -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 ();
index 775e627efbf52bbfae30f2daa862c83860fbc622..2f81f144bfa8111b40609554d2009188a4dbb618 100644 (file)
@@ -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;
index 560b9610a2dc25f340b07fce91019aacf1d1a650..15e57c5c2bb62fd29c2bd80cc28b8b2f4b01384e 100644 (file)
@@ -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;
index d04b79b1325fb6c3b3b4ac792731afd2e0e6f246..70f7457193036e0bc79d04dffb6de06391ce8e81 100644 (file)
@@ -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 ();
index b6c801a3468a6505843727e5fd69fc9d2f39ae86..79a2633dac744b7e15b1b6cebdcfedf53cc89bce 100644 (file)
@@ -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,
index c62cdedc3afbf63ae2012cc280b33ef7b990f984..2cc173478634e079cc586c7ee39e06df682bf2a6 100644 (file)
@@ -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);
-               }
+               }       
        }
 }