if (!IsAccessibleAs (partype)) {
Report.SymbolRelatedToPreviousError (partype);
Report.Error (59, Location,
- "Inconsistent accessibility: parameter type `" +
- TypeManager.CSharpName (partype) + "' is less " +
- "accessible than delegate `" + GetSignatureForError () + "'");
+ "Inconsistent accessibility: parameter type `{0}' is less accessible than delegate `{1}'",
+ TypeManager.CSharpName (partype),
+ GetSignatureForError ());
return false;
}
}
Argument.AType atype_modifier;
Type atype = pd.Types [i];
switch (pd.FixedParameters [i].ModFlags) {
- case Parameter.Modifier.REF:
- atype_modifier = Argument.AType.Ref;
- //atype = atype.GetElementType ();
- break;
- case Parameter.Modifier.OUT:
- atype_modifier = Argument.AType.Out;
- //atype = atype.GetElementType ();
- break;
- case Parameter.Modifier.ARGLIST:
- // __arglist is not valid
- throw new InternalErrorException ("__arglist modifier");
- default:
- atype_modifier = Argument.AType.Expression;
- break;
+ case Parameter.Modifier.REF:
+ atype_modifier = Argument.AType.Ref;
+ //atype = atype.GetElementType ();
+ break;
+ case Parameter.Modifier.OUT:
+ atype_modifier = Argument.AType.Out;
+ //atype = atype.GetElementType ();
+ break;
+ case Parameter.Modifier.ARGLIST:
+ // __arglist is not valid
+ throw new InternalErrorException ("__arglist modifier");
+ default:
+ atype_modifier = Argument.AType.Expression;
+ break;
}
delegate_arguments.Add (new Argument (new TypeExpression (atype, loc), atype_modifier));
}
return null;
delegate_method = (MethodInfo) method_group;
+
+ if (TypeManager.IsNullableType (delegate_method.DeclaringType)) {
+ Report.Error (1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type",
+ TypeManager.GetFullNameSignature (delegate_method));
+ return null;
+ }
+
Invocation.IsSpecialMethodInvocation (delegate_method, loc);
ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr;
}
}
- if (TypeManager.IsNullableType (delegate_method.DeclaringType)) {
- Report.Error (1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type",
- TypeManager.GetFullNameSignature (delegate_method));
- }
-
DoResolveInstanceExpression (ec);
eclass = ExprClass.Value;
return this;
if (!delegate_method.DeclaringType.IsSealed && delegate_method.IsVirtual && !method_group.IsBase) {
ec.ig.Emit (OpCodes.Dup);
- ec.ig.Emit (OpCodes.Ldvirtftn, (MethodInfo) delegate_method);
- } else
- ec.ig.Emit (OpCodes.Ldftn, (MethodInfo) delegate_method);
+ ec.ig.Emit (OpCodes.Ldvirtftn, delegate_method);
+ } else {
+ ec.ig.Emit (OpCodes.Ldftn, delegate_method);
+ }
+
ec.ig.Emit (OpCodes.Newobj, constructor_method);
}