protected bool CheckAbstractAndExtern (bool has_block)
{
if (Parent.PartialContainer.Kind == MemberKind.Interface)
return true;
if (has_block) {
if ((ModFlags & Modifiers.EXTERN) != 0) {
Report.Error (179, Location, "`{0}' cannot declare a body because it is marked extern",
GetSignatureForError ());
return false;
}
if ((ModFlags & Modifiers.ABSTRACT) != 0) {
Report.Error (500, Location, "`{0}' cannot declare a body because it is marked abstract",
GetSignatureForError ());
return false;
}
} else {
if ((ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN | Modifiers.PARTIAL)) == 0 && !(Parent is Delegate)) {
if (RootContext.Version >= LanguageVersion.V_3) {
Property.PropertyMethod pm = this as Property.PropertyMethod;
if (pm is Indexer.GetIndexerMethod || pm is Indexer.SetIndexerMethod)
pm = null;
if (pm != null && pm.Property.AccessorSecond == null) {
Report.Error (840, Location,
"`{0}' must have a body because it is not marked abstract or extern. The property can be automatically implemented when you define both accessors",
GetSignatureForError ());
return false;
}
}
Report.Error (501, Location, "`{0}' must have a body because it is not marked abstract, extern, or partial",
GetSignatureForError ());
return false;
}
}
return true;
}