2010-06-04 Jb Evain <jbevain@novell.com>
[mcs.git] / mcs / delegate.cs
blob7c56de66b44b15e70558cb51893d19d36d76f7af
1 //
2 // delegate.cs: Delegate Handler
3 //
4 // Authors:
5 // Ravi Pratap (ravi@ximian.com)
6 // Miguel de Icaza (miguel@ximian.com)
7 // Marek Safar (marek.safar@gmail.com)
8 //
9 // Dual licensed under the terms of the MIT X11 or GNU GPL
11 // Copyright 2001 Ximian, Inc (http://www.ximian.com)
12 // Copyright 2003-2009 Novell, Inc (http://www.novell.com)
15 using System;
16 using System.Reflection;
17 using System.Reflection.Emit;
18 using System.Collections.Generic;
20 namespace Mono.CSharp {
23 // Delegate container implementation
25 public class Delegate : TypeContainer
27 FullNamedExpression ReturnType;
28 public readonly ParametersCompiled Parameters;
30 Constructor Constructor;
31 Method InvokeBuilder;
32 Method BeginInvokeBuilder;
33 Method EndInvokeBuilder;
35 static readonly string[] attribute_targets = new string [] { "type", "return" };
37 public static readonly string InvokeMethodName = "Invoke";
39 Expression instance_expr;
40 ReturnParameter return_attributes;
42 const Modifiers MethodModifiers = Modifiers.PUBLIC | Modifiers.VIRTUAL;
44 const Modifiers AllowedModifiers =
45 Modifiers.NEW |
46 Modifiers.PUBLIC |
47 Modifiers.PROTECTED |
48 Modifiers.INTERNAL |
49 Modifiers.UNSAFE |
50 Modifiers.PRIVATE;
52 public Delegate (NamespaceEntry ns, DeclSpace parent, FullNamedExpression type,
53 Modifiers mod_flags, MemberName name, ParametersCompiled param_list,
54 Attributes attrs)
55 : base (ns, parent, name, attrs, MemberKind.Delegate)
58 this.ReturnType = type;
59 ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags,
60 IsTopLevel ? Modifiers.INTERNAL :
61 Modifiers.PRIVATE, name.Location, Report);
62 Parameters = param_list;
63 spec = new TypeSpec (Kind, null, this, null, ModFlags | Modifiers.SEALED);
66 public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
68 if (a.Target == AttributeTargets.ReturnValue) {
69 if (return_attributes == null)
70 return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
72 return_attributes.ApplyAttributeBuilder (a, ctor, cdata, pa);
73 return;
76 base.ApplyAttributeBuilder (a, ctor, cdata, pa);
79 public override AttributeTargets AttributeTargets {
80 get {
81 return AttributeTargets.Delegate;
85 public override TypeSpec BaseType {
86 get {
87 return TypeManager.multicast_delegate_type;
91 protected override bool DoDefineMembers ()
93 var ctor_parameters = ParametersCompiled.CreateFullyResolved (
94 new [] {
95 new Parameter (new TypeExpression (TypeManager.object_type, Location), "object", Parameter.Modifier.NONE, null, Location),
96 new Parameter (new TypeExpression (TypeManager.intptr_type, Location), "method", Parameter.Modifier.NONE, null, Location)
98 new [] {
99 TypeManager.object_type,
100 TypeManager.intptr_type
104 Constructor = new Constructor (this, System.Reflection.ConstructorInfo.ConstructorName,
105 Modifiers.PUBLIC, null, ctor_parameters, null, Location);
106 Constructor.Define ();
109 // Here the various methods like Invoke, BeginInvoke etc are defined
111 // First, call the `out of band' special method for
112 // defining recursively any types we need:
114 var p = Parameters;
116 if (!p.Resolve (this))
117 return false;
120 // Invoke method
123 // Check accessibility
124 foreach (var partype in p.Types) {
125 if (!IsAccessibleAs (partype)) {
126 Report.SymbolRelatedToPreviousError (partype);
127 Report.Error (59, Location,
128 "Inconsistent accessibility: parameter type `{0}' is less accessible than delegate `{1}'",
129 TypeManager.CSharpName (partype), GetSignatureForError ());
133 ReturnType = ReturnType.ResolveAsTypeTerminal (this, false);
134 if (ReturnType == null)
135 return false;
137 var ret_type = ReturnType.Type;
140 // We don't have to check any others because they are all
141 // guaranteed to be accessible - they are standard types.
143 if (!IsAccessibleAs (ret_type)) {
144 Report.SymbolRelatedToPreviousError (ret_type);
145 Report.Error (58, Location,
146 "Inconsistent accessibility: return type `" +
147 TypeManager.CSharpName (ret_type) + "' is less " +
148 "accessible than delegate `" + GetSignatureForError () + "'");
149 return false;
152 CheckProtectedModifier ();
154 if (RootContext.StdLib && TypeManager.IsSpecialType (ret_type)) {
155 Method.Error1599 (Location, ret_type, Report);
156 return false;
159 TypeManager.CheckTypeVariance (ret_type, Variance.Covariant, this);
161 InvokeBuilder = new Method (this, null, ReturnType, MethodModifiers, new MemberName (InvokeMethodName), p, null);
162 InvokeBuilder.Define ();
165 // Don't emit async method for compiler generated delegates (e.g. dynamic site containers)
167 if (TypeManager.iasyncresult_type != null && TypeManager.asynccallback_type != null && !IsCompilerGenerated) {
168 DefineAsyncMethods (Parameters.CallingConvention);
171 return true;
174 void DefineAsyncMethods (CallingConventions cc)
177 // BeginInvoke
179 Parameter[] compiled = new Parameter[Parameters.Count];
180 for (int i = 0; i < compiled.Length; ++i)
181 compiled[i] = new Parameter (new TypeExpression (Parameters.Types[i], Location),
182 Parameters.FixedParameters[i].Name,
183 Parameters.FixedParameters[i].ModFlags & (Parameter.Modifier.REF | Parameter.Modifier.OUT),
184 null, Location);
186 ParametersCompiled async_parameters = new ParametersCompiled (Compiler, compiled);
188 async_parameters = ParametersCompiled.MergeGenerated (Compiler, async_parameters, false,
189 new Parameter[] {
190 new Parameter (new TypeExpression (TypeManager.asynccallback_type, Location), "callback", Parameter.Modifier.NONE, null, Location),
191 new Parameter (new TypeExpression (TypeManager.object_type, Location), "object", Parameter.Modifier.NONE, null, Location)
193 new [] {
194 TypeManager.asynccallback_type,
195 TypeManager.object_type
199 BeginInvokeBuilder = new Method (this, null,
200 new TypeExpression (TypeManager.iasyncresult_type, Location), MethodModifiers,
201 new MemberName ("BeginInvoke"), async_parameters, null);
202 BeginInvokeBuilder.Define ();
205 // EndInvoke is a bit more interesting, all the parameters labeled as
206 // out or ref have to be duplicated here.
210 // Define parameters, and count out/ref parameters
212 ParametersCompiled end_parameters;
213 int out_params = 0;
215 foreach (Parameter p in Parameters.FixedParameters) {
216 if ((p.ModFlags & Parameter.Modifier.ISBYREF) != 0)
217 ++out_params;
220 if (out_params > 0) {
221 var end_param_types = new TypeSpec [out_params];
222 Parameter[] end_params = new Parameter[out_params];
224 int param = 0;
225 for (int i = 0; i < Parameters.FixedParameters.Length; ++i) {
226 Parameter p = Parameters [i];
227 if ((p.ModFlags & Parameter.Modifier.ISBYREF) == 0)
228 continue;
230 end_param_types[param] = Parameters.Types[i];
231 end_params[param] = p;
232 ++param;
234 end_parameters = ParametersCompiled.CreateFullyResolved (end_params, end_param_types);
235 } else {
236 end_parameters = ParametersCompiled.EmptyReadOnlyParameters;
239 end_parameters = ParametersCompiled.MergeGenerated (Compiler, end_parameters, false,
240 new Parameter (
241 new TypeExpression (TypeManager.iasyncresult_type, Location),
242 "result", Parameter.Modifier.NONE, null, Location),
243 TypeManager.iasyncresult_type);
246 // Create method, define parameters, register parameters with type system
248 EndInvokeBuilder = new Method (this, null, ReturnType, MethodModifiers, new MemberName ("EndInvoke"), end_parameters, null);
249 EndInvokeBuilder.Define ();
252 public override void DefineConstants ()
254 if (!Parameters.IsEmpty && Parameters[Parameters.Count - 1].HasDefaultValue) {
255 var rc = new ResolveContext (this);
256 Parameters.ResolveDefaultValues (rc);
260 public override void EmitType ()
262 if (ReturnType.Type == InternalType.Dynamic) {
263 return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
264 PredefinedAttributes.Get.Dynamic.EmitAttribute (return_attributes.Builder);
265 } else {
266 var trans_flags = TypeManager.HasDynamicTypeUsed (ReturnType.Type);
267 if (trans_flags != null) {
268 var pa = PredefinedAttributes.Get.DynamicTransform;
269 if (pa.Constructor != null || pa.ResolveConstructor (Location, ArrayContainer.MakeType (TypeManager.bool_type))) {
270 return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
271 return_attributes.Builder.SetCustomAttribute (
272 new CustomAttributeBuilder (pa.Constructor, new object [] { trans_flags }));
277 Parameters.ApplyAttributes (InvokeBuilder.MethodBuilder);
279 Constructor.ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
280 InvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
282 if (BeginInvokeBuilder != null) {
283 BeginInvokeBuilder.ParameterInfo.ApplyAttributes (BeginInvokeBuilder.MethodBuilder);
285 BeginInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
286 EndInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
289 if (OptAttributes != null) {
290 OptAttributes.Emit ();
293 base.Emit ();
296 protected override TypeAttributes TypeAttr {
297 get {
298 return ModifiersExtensions.TypeAttr (ModFlags, IsTopLevel) |
299 TypeAttributes.Class | TypeAttributes.Sealed |
300 base.TypeAttr;
304 public override string[] ValidAttributeTargets {
305 get {
306 return attribute_targets;
310 //TODO: duplicate
311 protected override bool VerifyClsCompliance ()
313 if (!base.VerifyClsCompliance ()) {
314 return false;
317 Parameters.VerifyClsCompliance (this);
319 if (!ReturnType.Type.IsCLSCompliant ()) {
320 Report.Warning (3002, 1, Location, "Return type of `{0}' is not CLS-compliant",
321 GetSignatureForError ());
323 return true;
327 public static MethodSpec GetConstructor (CompilerContext ctx, TypeSpec container_type, TypeSpec delType)
329 var ctor = MemberCache.FindMember (delType, MemberFilter.Constructor (null), BindingRestriction.DeclaredOnly);
330 return (MethodSpec) ctor;
334 // Returns the "Invoke" from a delegate type
336 public static MethodSpec GetInvokeMethod (CompilerContext ctx, TypeSpec delType)
338 var invoke = MemberCache.FindMember (delType,
339 MemberFilter.Method (InvokeMethodName, 0, null, null),
340 BindingRestriction.DeclaredOnly);
342 return (MethodSpec) invoke;
345 public static AParametersCollection GetParameters (CompilerContext ctx, TypeSpec delType)
347 var invoke_mb = GetInvokeMethod (ctx, delType);
348 return invoke_mb.Parameters;
352 // 15.2 Delegate compatibility
354 public static bool IsTypeCovariant (Expression a, TypeSpec b)
357 // For each value parameter (a parameter with no ref or out modifier), an
358 // identity conversion or implicit reference conversion exists from the
359 // parameter type in D to the corresponding parameter type in M
361 if (a.Type == b)
362 return true;
364 if (RootContext.Version == LanguageVersion.ISO_1)
365 return false;
367 return Convert.ImplicitReferenceConversionExists (a, b);
370 public static string FullDelegateDesc (MethodSpec invoke_method)
372 return TypeManager.GetFullNameSignature (invoke_method).Replace (".Invoke", "");
375 public Expression InstanceExpression {
376 get {
377 return instance_expr;
379 set {
380 instance_expr = value;
386 // Base class for `NewDelegate' and `ImplicitDelegateCreation'
388 public abstract class DelegateCreation : Expression, MethodGroupExpr.IErrorHandler
390 protected MethodSpec constructor_method;
391 protected MethodGroupExpr method_group;
393 public static Arguments CreateDelegateMethodArguments (AParametersCollection pd, TypeSpec[] types, Location loc)
395 Arguments delegate_arguments = new Arguments (pd.Count);
396 for (int i = 0; i < pd.Count; ++i) {
397 Argument.AType atype_modifier;
398 switch (pd.FixedParameters [i].ModFlags) {
399 case Parameter.Modifier.REF:
400 atype_modifier = Argument.AType.Ref;
401 break;
402 case Parameter.Modifier.OUT:
403 atype_modifier = Argument.AType.Out;
404 break;
405 default:
406 atype_modifier = 0;
407 break;
410 delegate_arguments.Add (new Argument (new TypeExpression (types [i], loc), atype_modifier));
413 return delegate_arguments;
416 public override Expression CreateExpressionTree (ResolveContext ec)
418 MemberAccess ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
420 Arguments args = new Arguments (3);
421 args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
422 args.Add (new Argument (new NullLiteral (loc)));
423 args.Add (new Argument (method_group.CreateExpressionTree (ec)));
424 Expression e = new Invocation (ma, args).Resolve (ec);
425 if (e == null)
426 return null;
428 e = Convert.ExplicitConversion (ec, e, type, loc);
429 if (e == null)
430 return null;
432 return e.CreateExpressionTree (ec);
435 protected override Expression DoResolve (ResolveContext ec)
437 constructor_method = Delegate.GetConstructor (ec.Compiler, ec.CurrentType, type);
439 var invoke_method = Delegate.GetInvokeMethod (ec.Compiler, type);
440 method_group.DelegateType = type;
441 method_group.CustomErrorHandler = this;
443 Arguments arguments = CreateDelegateMethodArguments (invoke_method.Parameters, invoke_method.Parameters.Types, loc);
444 method_group = method_group.OverloadResolve (ec, ref arguments, false, loc);
445 if (method_group == null)
446 return null;
448 var delegate_method = method_group.BestCandidate;
450 if (TypeManager.IsNullableType (delegate_method.DeclaringType)) {
451 ec.Report.Error (1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type",
452 delegate_method.GetSignatureForError ());
453 return null;
456 Invocation.IsSpecialMethodInvocation (ec, delegate_method, loc);
458 ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr;
459 if (emg != null) {
460 method_group.InstanceExpression = emg.ExtensionExpression;
461 TypeSpec e_type = emg.ExtensionExpression.Type;
462 if (TypeManager.IsValueType (e_type)) {
463 ec.Report.Error (1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates",
464 delegate_method.GetSignatureForError (), TypeManager.CSharpName (e_type));
468 TypeSpec rt = delegate_method.ReturnType;
469 Expression ret_expr = new TypeExpression (rt, loc);
470 if (!Delegate.IsTypeCovariant (ret_expr, invoke_method.ReturnType)) {
471 Error_ConversionFailed (ec, delegate_method, ret_expr);
474 if (delegate_method.IsConditionallyExcluded (loc)) {
475 ec.Report.SymbolRelatedToPreviousError (delegate_method);
476 MethodOrOperator m = delegate_method.MemberDefinition as MethodOrOperator;
477 if (m != null && m.IsPartialDefinition) {
478 ec.Report.Error (762, loc, "Cannot create delegate from partial method declaration `{0}'",
479 delegate_method.GetSignatureForError ());
480 } else {
481 ec.Report.Error (1618, loc, "Cannot create delegate with `{0}' because it has a Conditional attribute",
482 TypeManager.CSharpSignature (delegate_method));
486 var expr = method_group.InstanceExpression;
487 if (expr != null && (expr.Type.IsGenericParameter || !TypeManager.IsReferenceType (expr.Type)))
488 method_group.InstanceExpression = new BoxedCast (expr, TypeManager.object_type);
490 eclass = ExprClass.Value;
491 return this;
494 public override void Emit (EmitContext ec)
496 if (method_group.InstanceExpression == null)
497 ec.Emit (OpCodes.Ldnull);
498 else
499 method_group.InstanceExpression.Emit (ec);
501 var delegate_method = method_group.BestCandidate;
503 // Any delegate must be sealed
504 if (!delegate_method.DeclaringType.IsDelegate && delegate_method.IsVirtual && !method_group.IsBase) {
505 ec.Emit (OpCodes.Dup);
506 ec.Emit (OpCodes.Ldvirtftn, delegate_method);
507 } else {
508 ec.Emit (OpCodes.Ldftn, delegate_method);
511 ec.Emit (OpCodes.Newobj, constructor_method);
514 void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression return_type)
516 var invoke_method = Delegate.GetInvokeMethod (ec.Compiler, type);
517 string member_name = method_group.InstanceExpression != null ?
518 Delegate.FullDelegateDesc (method) :
519 TypeManager.GetFullNameSignature (method);
521 ec.Report.SymbolRelatedToPreviousError (type);
522 ec.Report.SymbolRelatedToPreviousError (method);
523 if (RootContext.Version == LanguageVersion.ISO_1) {
524 ec.Report.Error (410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type",
525 TypeManager.CSharpName (method.ReturnType), member_name,
526 TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method));
527 return;
529 if (return_type == null) {
530 ec.Report.Error (123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters",
531 member_name, Delegate.FullDelegateDesc (invoke_method));
532 return;
535 ec.Report.Error (407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type",
536 return_type.GetSignatureForError (), member_name,
537 TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method));
540 public static bool ImplicitStandardConversionExists (ResolveContext ec, MethodGroupExpr mg, TypeSpec target_type)
542 if (target_type == TypeManager.delegate_type || target_type == TypeManager.multicast_delegate_type)
543 return false;
545 mg.DelegateType = target_type;
546 var invoke = Delegate.GetInvokeMethod (ec.Compiler, target_type);
548 Arguments arguments = CreateDelegateMethodArguments (invoke.Parameters, invoke.Parameters.Types, mg.Location);
549 return mg.OverloadResolve (ec, ref arguments, true, mg.Location) != null;
552 #region IErrorHandler Members
554 public bool NoExactMatch (ResolveContext ec, MethodSpec method)
556 if (method.IsGeneric)
557 return false;
559 Error_ConversionFailed (ec, method, null);
560 return true;
563 public bool AmbiguousCall (ResolveContext ec, MethodSpec ambiguous)
565 return false;
568 #endregion
572 // Created from the conversion code
574 public class ImplicitDelegateCreation : DelegateCreation
576 ImplicitDelegateCreation (TypeSpec t, MethodGroupExpr mg, Location l)
578 type = t;
579 this.method_group = mg;
580 loc = l;
583 static public Expression Create (ResolveContext ec, MethodGroupExpr mge,
584 TypeSpec target_type, Location loc)
586 ImplicitDelegateCreation d = new ImplicitDelegateCreation (target_type, mge, loc);
587 return d.DoResolve (ec);
592 // A delegate-creation-expression, invoked from the `New' class
594 public class NewDelegate : DelegateCreation
596 public Arguments Arguments;
599 // This constructor is invoked from the `New' expression
601 public NewDelegate (TypeSpec type, Arguments Arguments, Location loc)
603 this.type = type;
604 this.Arguments = Arguments;
605 this.loc = loc;
608 protected override Expression DoResolve (ResolveContext ec)
610 if (Arguments == null || Arguments.Count != 1) {
611 ec.Report.Error (149, loc, "Method name expected");
612 return null;
615 Argument a = Arguments [0];
616 if (!a.ResolveMethodGroup (ec))
617 return null;
619 Expression e = a.Expr;
621 AnonymousMethodExpression ame = e as AnonymousMethodExpression;
622 if (ame != null && RootContext.Version != LanguageVersion.ISO_1) {
623 e = ame.Compatible (ec, type);
624 if (e == null)
625 return null;
627 return e.Resolve (ec);
630 method_group = e as MethodGroupExpr;
631 if (method_group == null) {
632 if (e.Type == InternalType.Dynamic) {
633 e = Convert.ImplicitConversionRequired (ec, e, type, loc);
634 } else if (!e.Type.IsDelegate) {
635 e.Error_UnexpectedKind (ec, ResolveFlags.MethodGroup | ResolveFlags.Type, loc);
636 return null;
640 // An argument is not a method but another delegate
642 method_group = new MethodGroupExpr (Delegate.GetInvokeMethod (ec.Compiler, e.Type), e.Type, loc);
643 method_group.InstanceExpression = e;
646 return base.DoResolve (ec);
651 // Invocation converted to delegate Invoke call
653 class DelegateInvocation : ExpressionStatement
655 readonly Expression InstanceExpr;
656 Arguments arguments;
657 MethodSpec method;
659 public DelegateInvocation (Expression instance_expr, Arguments args, Location loc)
661 this.InstanceExpr = instance_expr;
662 this.arguments = args;
663 this.loc = loc;
666 public override Expression CreateExpressionTree (ResolveContext ec)
668 Arguments args = Arguments.CreateForExpressionTree (ec, this.arguments,
669 InstanceExpr.CreateExpressionTree (ec));
671 return CreateExpressionFactoryCall (ec, "Invoke", args);
674 protected override Expression DoResolve (ResolveContext ec)
676 if (InstanceExpr is EventExpr) {
677 ((EventExpr) InstanceExpr).Error_CannotAssign (ec);
678 return null;
681 TypeSpec del_type = InstanceExpr.Type;
682 if (del_type == null)
683 return null;
685 method = Delegate.GetInvokeMethod (ec.Compiler, del_type);
686 var mb = method;
687 var me = new MethodGroupExpr (mb, del_type, loc);
688 me.InstanceExpression = InstanceExpr;
690 AParametersCollection pd = mb.Parameters;
691 int pd_count = pd.Count;
693 int arg_count = arguments == null ? 0 : arguments.Count;
695 bool params_method = pd.HasParams;
696 bool is_params_applicable = false;
697 bool is_applicable = me.IsApplicable (ec, ref arguments, arg_count, ref mb, ref is_params_applicable) == 0;
698 if (arguments != null)
699 arg_count = arguments.Count;
701 if (!is_applicable && !params_method && arg_count != pd_count) {
702 ec.Report.Error (1593, loc, "Delegate `{0}' does not take `{1}' arguments",
703 TypeManager.CSharpName (del_type), arg_count.ToString ());
704 } else if (arguments == null || !arguments.HasDynamic) {
705 me.VerifyArgumentsCompat (ec, ref arguments, arg_count, mb,
706 is_params_applicable || (!is_applicable && params_method), false, loc);
709 type = method.ReturnType;
710 eclass = ExprClass.Value;
711 return this;
714 public override void Emit (EmitContext ec)
717 // Invocation on delegates call the virtual Invoke member
718 // so we are always `instance' calls
720 Invocation.EmitCall (ec, false, InstanceExpr, method, arguments, loc);
723 public override void EmitStatement (EmitContext ec)
725 Emit (ec);
727 // Pop the return value if there is one
729 if (type != TypeManager.void_type)
730 ec.Emit (OpCodes.Pop);
733 public override System.Linq.Expressions.Expression MakeExpression (BuilderContext ctx)
735 return Invocation.MakeExpression (ctx, InstanceExpr, method, arguments);