2009-07-14 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Tue, 14 Jul 2009 16:39:03 +0000 (16:39 -0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 14 Jul 2009 16:39:03 +0000 (16:39 -0000)
* CSharpInvokeBinder.cs, CSharpBinaryOperationBinder.cs,
CSharpGetMemberBinder.cs, CSharpGetIndexBinder.cs, Extensions.cs,
CSharpIsEventBinder.cs, CSharpUnaryOperationBinder.cs,
CSharpConvertBinder.cs, CSharpSetIndexBinder.cs,
CSharpInvokeMemberBinder.cs, CSharpSetMemberBinder.cs: New files.

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

13 files changed:
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs [new file with mode: 0644]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.dll.sources

diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs
new file mode 100644 (file)
index 0000000..6720b3a
--- /dev/null
@@ -0,0 +1,80 @@
+//
+// CSharpBinaryOperationBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Runtime.CompilerServices;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpBinaryOperationBinder : BinaryOperationBinder
+       {
+               IList<CSharpArgumentInfo> argumentInfo;
+               bool is_checked, is_member_access;
+               
+               public CSharpBinaryOperationBinder (ExpressionType operation, bool isChecked, bool isMemberAccess, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (operation)
+               {
+                       this.argumentInfo = new ReadOnlyCollectionBuilder<CSharpArgumentInfo> (argumentInfo);
+                       this.is_checked = isChecked;
+                       this.is_member_access = isMemberAccess;
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public bool IsChecked {
+                       get {
+                               return is_checked;
+                       }
+               }
+               
+               public bool IsMemberAccess {
+                       get {
+                               return is_member_access;
+                       }
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackBinaryOperation (DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs
new file mode 100644 (file)
index 0000000..c8d157e
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// CSharpConvertBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpConvertBinder : ConvertBinder
+       {
+               bool is_checked;
+
+               public CSharpConvertBinder (Type type, CSharpConversionKind conversionKind, bool isChecked)
+                       : base (type, conversionKind == CSharpConversionKind.ExplicitConversion)
+               {
+                       this.is_checked = isChecked;
+               }
+               
+               public CSharpConversionKind ConversionKind {
+                       get {
+                               return Explicit ? CSharpConversionKind.ExplicitConversion : CSharpConversionKind.ImplicitConversion;
+                       }
+               }               
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpConvertBinder;
+                       return other != null && other.Type == Type && other.Explicit == Explicit && other.is_checked == is_checked;
+               }
+
+               public bool IsChecked {
+                       get {
+                               return is_checked;
+                       }
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackConvert (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs
new file mode 100644 (file)
index 0000000..164dd6a
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// CSharpGetIndexBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpGetIndexBinder : GetIndexBinder
+       {
+               IList<CSharpArgumentInfo> argumentInfo;
+               Type callingContext;
+               
+               public CSharpGetIndexBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (argumentInfo.ToCallInfo ())
+               {
+                       this.callingContext = callingContext;
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public Type CallingContext {
+                       get {
+                               return callingContext;
+                       }
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpGetIndexBinder;
+                       return other != null && base.Equals (obj) && other.callingContext == callingContext && 
+                               other.argumentInfo.SequenceEqual (argumentInfo);
+               }
+
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackGetIndex (DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs
new file mode 100644 (file)
index 0000000..152b3cf
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// CSharpGetMemberBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpGetMemberBinder : GetMemberBinder
+       {
+               IList<CSharpArgumentInfo> argumentInfo;
+               Type callingContext;
+               
+               public CSharpGetMemberBinder (string name, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (name, false)
+               {
+                       this.callingContext = callingContext;
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public Type CallingContext {
+                       get {
+                               return callingContext;
+                       }
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpGetMemberBinder;
+                       return other != null && base.Equals (obj) && other.callingContext == callingContext && 
+                               other.argumentInfo.SequenceEqual (argumentInfo);
+               }
+
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackGetMember (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();                   
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs
new file mode 100644 (file)
index 0000000..775e627
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// CSharpInvokeBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpInvokeBinder : InvokeBinder
+       {
+               CSharpCallFlags flags;
+               IList<CSharpArgumentInfo> argumentInfo;
+               Type callingContext;
+               
+               public CSharpInvokeBinder (CSharpCallFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (argumentInfo.ToCallInfo ())
+               {
+                       this.flags = flags;
+                       this.callingContext = callingContext;
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public Type CallingContext {
+                       get {
+                               return callingContext;
+                       }
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpInvokeBinder;
+                       return other != null && base.Equals (obj) && other.flags == flags && other.callingContext == callingContext && 
+                               other.argumentInfo.SequenceEqual (argumentInfo);
+               }
+
+               public CSharpCallFlags Flags {
+                       get {
+                               return flags;
+                       }
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackInvoke (DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
index be93f91ecc550d197eaeb05ed7658728d17533f6..560b9610a2dc25f340b07fce91019aacf1d1a650 100644 (file)
@@ -30,7 +30,6 @@ using System;
 using System.Dynamic;
 using System.Collections.Generic;
 using System.Linq;
-using System.Runtime.CompilerServices;
 
 namespace Microsoft.CSharp.RuntimeBinder
 {
@@ -42,18 +41,12 @@ namespace Microsoft.CSharp.RuntimeBinder
                Type callingContext;
                
                public CSharpInvokeMemberBinder (CSharpCallFlags flags, string name, Type callingContext, IEnumerable<Type> typeArguments, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (name, false, CreateCallInfo (argumentInfo))
+                       : base (name, false, argumentInfo.ToCallInfo ())
                {
                        this.flags = flags;
                        this.callingContext = callingContext;
-                       this.argumentInfo = new ReadOnlyCollectionBuilder<CSharpArgumentInfo> (argumentInfo);
-                       this.typeArguments = new ReadOnlyCollectionBuilder<Type> (typeArguments);
-               }
-               
-               static CallInfo CreateCallInfo (IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       var named = from arg in argumentInfo where arg.IsNamed select arg.Name;
-                       return new CallInfo (argumentInfo.Count (), named);
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+                       this.typeArguments = typeArguments.ToReadOnly ();
                }
                
                public IList<CSharpArgumentInfo> ArgumentInfo {
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs
new file mode 100644 (file)
index 0000000..7fa1c20
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// CSharpIsEventBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpIsEventBinder : DynamicMetaObjectBinder
+       {
+               Type callingContext;
+               string name;
+               
+               public CSharpIsEventBinder (string name, Type callingContext)
+               {
+                       this.name = name;
+                       this.callingContext = callingContext;
+               }
+               
+               [MonoTODO]
+               public sealed override DynamicMetaObject Bind (DynamicMetaObject target, DynamicMetaObject[] args)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public Type CallingContext {
+                       get {
+                               return callingContext;
+                       }
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpIsEventBinder;
+                       return other != null && name == other.name && other.callingContext == callingContext;
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               public string Name {
+                       get {
+                               return name;
+                       }
+               }               
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs
new file mode 100644 (file)
index 0000000..d04b79b
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// CSharpSetIndexBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpSetIndexBinder : SetIndexBinder
+       {
+               IList<CSharpArgumentInfo> argumentInfo;
+               Type callingContext;
+               
+               public CSharpSetIndexBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (argumentInfo.ToCallInfo ())
+               {
+                       this.callingContext = callingContext;
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public Type CallingContext {
+                       get {
+                               return callingContext;
+                       }
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpSetIndexBinder;
+                       return other != null && base.Equals (obj) && other.callingContext == callingContext && 
+                               other.argumentInfo.SequenceEqual (argumentInfo);
+               }
+
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackSetIndex (DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs
new file mode 100644 (file)
index 0000000..ac6cee6
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// CSharpSetMemberBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpSetMemberBinder : SetMemberBinder
+       {
+               IList<CSharpArgumentInfo> argumentInfo;
+               Type callingContext;
+               
+               public CSharpSetMemberBinder (string name, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (name, false)
+               {
+                       this.callingContext = callingContext;
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public Type CallingContext {
+                       get {
+                               return callingContext;
+                       }
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       var other = obj as CSharpSetMemberBinder;
+                       return other != null && base.Equals (obj) && other.callingContext == callingContext && 
+                               other.argumentInfo.SequenceEqual (argumentInfo);
+               }
+
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackSetMember (DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();                   
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs
new file mode 100644 (file)
index 0000000..6ee4046
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// CSharpUnaryOperationBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       public class CSharpUnaryOperationBinder : UnaryOperationBinder
+       {
+               IList<CSharpArgumentInfo> argumentInfo;
+               bool is_checked;
+               
+               public CSharpUnaryOperationBinder (ExpressionType operation, bool isChecked, IEnumerable<CSharpArgumentInfo> argumentInfo)
+                       : base (operation)
+               {
+                       this.argumentInfo = argumentInfo.ToReadOnly ();
+                       this.is_checked = isChecked;
+               }
+               
+               public IList<CSharpArgumentInfo> ArgumentInfo {
+                       get {
+                               return argumentInfo;
+                       }
+               }
+
+               public bool IsChecked {
+                       get {
+                               return is_checked;
+                       }
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+               
+               [MonoTODO]
+               public override DynamicMetaObject FallbackUnaryOperation (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
index 2468c98a3fa1ba91d5c2959a82726de68d0b2dbc..5d6e797cec8a1f7244d127c49277bd1509bb9c3b 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-14  Marek Safar <marek.safar@gmail.com>
+
+       * CSharpInvokeBinder.cs, CSharpBinaryOperationBinder.cs,
+       CSharpGetMemberBinder.cs, CSharpGetIndexBinder.cs, Extensions.cs,
+       CSharpIsEventBinder.cs, CSharpUnaryOperationBinder.cs,
+       CSharpConvertBinder.cs, CSharpSetIndexBinder.cs,
+       CSharpInvokeMemberBinder.cs, CSharpSetMemberBinder.cs: New files.
+
 2009-07-02  Marek Safar <marek.safar@gmail.com>
 
        * CSharpConversionKind.cs, CSharpArgumentInfo.cs, 
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs
new file mode 100644 (file)
index 0000000..c62cded
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// CSharpInvokeMemberBinder.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Dynamic;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+
+namespace Microsoft.CSharp.RuntimeBinder
+{
+       static class Extensions
+       {
+               public static IList<T> ToReadOnly<T> (this IEnumerable<T> col)
+               {
+                       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);
+               }
+       }
+}
index 23bbef09a845763adf99c6e9cce258760cdfa177..71f0c51f34b92d59b594312ce1cd768ea37625f6 100644 (file)
@@ -4,6 +4,16 @@
 Assembly/AssemblyInfo.cs
 Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs
 Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfoFlags.cs
+Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs
 Microsoft.CSharp.RuntimeBinder/CSharpCallFlags.cs
 Microsoft.CSharp.RuntimeBinder/CSharpConversionKind.cs
+Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs
 Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs
+Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs
+Microsoft.CSharp.RuntimeBinder/Extensions.cs