- return null;
- }
-
- Type invoke_mb_retval = ((MethodInfo) invoke_mb).ReturnType;
- Type mb_retval = ((MethodInfo) mb).ReturnType;
- if (TypeManager.TypeToCoreType (invoke_mb_retval) == TypeManager.TypeToCoreType (mb_retval))
- return mb;
-
- //if (!IsTypeCovariant (mb_retval, invoke_mb_retval))
- // return null;
-
- if (RootContext.Version == LanguageVersion.ISO_1)
- return null;
-
- return mb;
- }
-
- // <summary>
- // Verifies whether the invocation arguments are compatible with the
- // delegate's target method
- // </summary>
- public static bool VerifyApplicability (EmitContext ec, Type delegate_type,
- ArrayList args, Location loc)
- {
- int arg_count;
-
- if (args == null)
- arg_count = 0;
- else
- arg_count = args.Count;
-
- MethodBase mb = GetInvokeMethod (ec.ContainerType, delegate_type);
- MethodGroupExpr me = new MethodGroupExpr (new MemberInfo [] { mb }, delegate_type, loc);
-
- AParametersCollection pd = TypeManager.GetParameterData (mb);
-
- int pd_count = pd.Count;
-
- bool params_method = pd.HasParams;
- bool is_params_applicable = false;
- bool is_applicable = me.IsApplicable (ec, args, arg_count, ref mb, ref is_params_applicable) == 0;
-
- if (!is_applicable && !params_method && arg_count != pd_count) {
- Report.Error (1593, loc, "Delegate `{0}' does not take `{1}' arguments",
- TypeManager.CSharpName (delegate_type), arg_count.ToString ());
- return false;
- }
-
- return me.VerifyArgumentsCompat (
- ec, ref args, arg_count, mb,
- is_params_applicable || (!is_applicable && params_method),
- false, loc);
- }
-
- public static string FullDelegateDesc (MethodBase invoke_method)