Add EntityFramework (not same as System.Data.Entity)
[mono.git] / mcs / class / Microsoft.CSharp / Microsoft.CSharp.RuntimeBinder / CSharpGetIndexBinder.cs
index ec2f91d940c12ef63625c1721e80bdd10d31e542..367cc22b70e1a63c50a50fc53a577e506f153cf3 100644 (file)
@@ -55,13 +55,17 @@ 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);
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (ReturnType, Compiler.Location.Null), expr);
+                       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);
+                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
 
-                       var restrictions = CSharpBinder.CreateRestrictionsOnTarget (target).Merge (CSharpBinder.CreateRestrictionsOnTarget (indexes));
-                       return CSharpBinder.Bind (this, expr, callingContext, restrictions, errorSuggestion);
+                       var binder = new CSharpBinder (this, expr, errorSuggestion);
+                       binder.AddRestrictions (target);
+                       binder.AddRestrictions (indexes);
+
+                       return binder.Bind (ctx, callingContext);
                }
        }
 }