var c_args = CSharpBinder.CreateCompilerArguments (argumentInfo.Skip (1), args);
expr = new Compiler.Invocation (expr, c_args);
- var restrictions = CSharpBinder.CreateRestrictionsOnTarget (target).Merge (
- CSharpBinder.CreateRestrictionsOnTarget (args));
+ if ((flags & CSharpBinderFlags.ResultDiscarded) == 0)
+ expr = new Compiler.Cast (new Compiler.TypeExpression (TypeImporter.Import (ReturnType), Compiler.Location.Null), expr);
+ else
+ expr = new Compiler.DynamicResultCast (TypeImporter.Import (ReturnType), expr);
- return CSharpBinder.Bind (this, expr, callingContext, restrictions, errorSuggestion);
+ var binder = new CSharpBinder (this, expr, errorSuggestion);
+ binder.AddRestrictions (target);
+ binder.AddRestrictions (args);
+
+ return binder.Bind (callingContext, target);
}
}
}