Merge branch 'master' of github.com:mono/mono
[mono.git] / mcs / class / Microsoft.CSharp / Microsoft.CSharp.RuntimeBinder / CSharpSetIndexBinder.cs
index e5da8410d70030e64ccc716b9f0807948376d9b9..a02ef82becb9ba3c948351a63db1fda723b8f47a 100644 (file)
@@ -55,20 +55,21 @@ namespace Microsoft.CSharp.RuntimeBinder
                                return errorSuggestion;
                        }
 
-                       var expr = CSharpBinder.CreateCompilerExpression (argumentInfo [0], target);
-                       var args = CSharpBinder.CreateCompilerArguments (argumentInfo.Skip (1), indexes);
-                       expr = new Compiler.ElementAccess (expr, args);
+                       var ctx = DynamicContext.Create ();
+                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
+                       var args = ctx.CreateCompilerArguments (argumentInfo.Skip (1), indexes);
+                       expr = new Compiler.ElementAccess (expr, args, Compiler.Location.Null);
 
-                       var source = CSharpBinder.CreateCompilerExpression (argumentInfo [indexes.Length + 1], value);
+                       var source = ctx.CreateCompilerExpression (argumentInfo [indexes.Length + 1], value);
                        expr = new Compiler.SimpleAssign (expr, source);
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (TypeImporter.Import (ReturnType), Compiler.Location.Null), expr);
+                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
 
                        var binder = new CSharpBinder (this, expr, errorSuggestion);
                        binder.AddRestrictions (target);
                        binder.AddRestrictions (value);
                        binder.AddRestrictions (indexes);
 
-                       return binder.Bind (callingContext, target);
+                       return binder.Bind (ctx, callingContext);
                }
        }
 }