if (TypeBuilder != null)
return TypeBuilder;
+ ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+
TypeAttributes attr = Modifiers.TypeAttr (ModFlags, IsTopLevel) |
TypeAttributes.Class | TypeAttributes.Sealed;
+ if (TypeManager.multicast_delegate_type == null)
+ Report.Error (-100, loc, "Internal error: delegate used before " +
+ "System.MulticastDelegate is resolved. This can only " +
+ "happen during corlib compilation, when using a delegate " +
+ "in any of the `core' classes. See bug #72015 for details.");
+
if (IsTopLevel) {
if (TypeManager.NamespaceClash (Name, Location))
return null;
{
MethodAttributes mattr;
int i;
- EmitContext ec = new EmitContext (this, this, Location, null,
- null, ModFlags, false);
+ ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
// FIXME: POSSIBLY make this static, as it is always constant
//
public override void Emit ()
{
if (OptAttributes != null) {
- EmitContext ec = new EmitContext (
- Parent, this, Location, null, null, ModFlags, false);
Parameters.LabelParameters (ec, InvokeBuilder, Location);
OptAttributes.Emit (ec, this);
}
for (int i = pd_count; i > 0; ) {
i--;
- if (invoke_pd.ParameterType (i) == pd.ParameterType (i) &&
- invoke_pd.ParameterModifier (i) == pd.ParameterModifier (i))
+ Type invoke_pd_type = invoke_pd.ParameterType (i);
+ Type pd_type = pd.ParameterType (i);
+ Parameter.Modifier invoke_pd_type_mod = invoke_pd.ParameterModifier (i);
+ Parameter.Modifier pd_type_mod = pd.ParameterModifier (i);
+
+ if (invoke_pd_type == pd_type &&
+ invoke_pd_type_mod == pd_type_mod)
continue;
- else {
- return null;
- }
+
+ if (invoke_pd_type.IsSubclassOf (pd_type) &&
+ invoke_pd_type_mod == pd_type_mod)
+ if (RootContext.Version == LanguageVersion.ISO_1) {
+ Report.FeatureIsNotStandardized (loc, "contravariance");
+ return null;
+ } else
+ continue;
+
+ return null;
}
- if (((MethodInfo) invoke_mb).ReturnType == ((MethodInfo) mb).ReturnType)
+ Type invoke_mb_retval = ((MethodInfo) invoke_mb).ReturnType;
+ Type mb_retval = ((MethodInfo) mb).ReturnType;
+ if (invoke_mb_retval == mb_retval)
return mb;
- else
- return null;
+
+ if (mb_retval.IsSubclassOf (invoke_mb_retval))
+ if (RootContext.Version == LanguageVersion.ISO_1) {
+ Report.FeatureIsNotStandardized (loc, "covariance");
+ return null;
+ }
+ else
+ return mb;
+
+ return null;
}
// <summary>
}
}
+ //
+ // Represents header string for documentation comment.
+ //
+ public override string DocCommentHeader {
+ get { return "T:"; }
+ }
+
protected override void VerifyObsoleteAttribute()
{
CheckUsageOfObsoleteAttribute (ret_type);
delegate_instance_expression = ec.GetThis (loc);
if (delegate_instance_expression != null && delegate_instance_expression.Type.IsValueType)
- delegate_instance_expression = new BoxedCast (mg.InstanceExpression);
+ delegate_instance_expression = new BoxedCast (delegate_instance_expression);
method_group = mg;
eclass = ExprClass.Value;
Expression e = a.Expr;
+ if (e is AnonymousMethod && RootContext.Version != LanguageVersion.ISO_1)
+ return ((AnonymousMethod) e).Compatible (ec, type, false);
+
MethodGroupExpr mg = e as MethodGroupExpr;
if (mg != null)
return ResolveMethodGroupExpr (ec, mg);
Type e_type = e.Type;
if (!TypeManager.IsDelegateType (e_type)) {
- e.Error_UnexpectedKind ("method", loc);
+ Report.Error (149, loc, "Method name expected");
return null;
}