[msbuild] Getting build error "Error initializing task XmlPeek: Not registered task...
[mono.git] / mcs / class / Microsoft.CSharp / Microsoft.CSharp.RuntimeBinder / CSharpSetIndexBinder.cs
index a02ef82becb9ba3c948351a63db1fda723b8f47a..ad2f51a1dbf85f2c62ffa6d9149fbf00a133694d 100644 (file)
@@ -36,12 +36,14 @@ namespace Microsoft.CSharp.RuntimeBinder
 {
        class CSharpSetIndexBinder : SetIndexBinder
        {
+               readonly CSharpBinderFlags flags;
                IList<CSharpArgumentInfo> argumentInfo;
                Type callingContext;
 
-               public CSharpSetIndexBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
+               public CSharpSetIndexBinder (CSharpBinderFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
                        : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 2))
                {
+                       this.flags = flags;
                        this.callingContext = callingContext;
                        this.argumentInfo = argumentInfo.ToReadOnly ();
                }
@@ -61,9 +63,18 @@ namespace Microsoft.CSharp.RuntimeBinder
                        expr = new Compiler.ElementAccess (expr, args, Compiler.Location.Null);
 
                        var source = ctx.CreateCompilerExpression (argumentInfo [indexes.Length + 1], value);
-                       expr = new Compiler.SimpleAssign (expr, source);
+
+                       // Same conversion as in SetMemberBinder
+                       if ((flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0) {
+                               expr = new Compiler.RuntimeExplicitAssign (expr, source);
+                       } else {
+                               expr = new Compiler.SimpleAssign (expr, source);
+                       }
                        expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
 
+                       if ((flags & CSharpBinderFlags.CheckedContext) != 0)
+                               expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
+
                        var binder = new CSharpBinder (this, expr, errorSuggestion);
                        binder.AddRestrictions (target);
                        binder.AddRestrictions (value);