- if (IsInterface) {
- ModFlags = Modifiers.PUBLIC |
- Modifiers.ABSTRACT |
- Modifiers.VIRTUAL | (ModFlags & Modifiers.UNSAFE) | (ModFlags & Modifiers.NEW);
-
- flags = MethodAttributes.Public |
- MethodAttributes.Abstract |
- MethodAttributes.HideBySig |
- MethodAttributes.NewSlot |
- MethodAttributes.Virtual;
- } else {
- if (!Parent.PartialContainer.MethodModifiersValid (this))
- return false;
-
- flags = Modifiers.MethodAttr (ModFlags);
- }
-
- if (IsExplicitImpl) {
- TypeExpr iface_texpr = MemberName.Left.GetTypeExpression ().ResolveAsTypeTerminal (this, false);
- if (iface_texpr == null)
- return false;
-
- if ((ModFlags & Modifiers.PARTIAL) != 0) {
- Report.Error (754, Location, "A partial method `{0}' cannot explicitly implement an interface",
- GetSignatureForError ());
- return false;
- }
-
- InterfaceType = iface_texpr.Type;
-
- if (!InterfaceType.IsInterface) {
- Report.Error (538, Location, "'{0}' in explicit interface declaration is not an interface", TypeManager.CSharpName (InterfaceType));
- return false;
- }
-
- if (!Parent.PartialContainer.VerifyImplements (this))
- return false;
-
- Modifiers.Check (Modifiers.AllowedExplicitImplFlags, explicit_mod_flags, 0, Location);
- }
-
- return true;
- }
-
- public override void Emit()
- {
- // for extern static method must be specified either DllImport attribute or MethodImplAttribute.
- // We are more strict than Microsoft and report CS0626 as error
- if ((ModFlags & Modifiers.EXTERN) != 0 && !is_external_implementation) {
- Report.Error (626, Location,
- "`{0}' is marked as an external but has no DllImport attribute. Consider adding a DllImport attribute to specify the external implementation",
- GetSignatureForError ());
- }
-
- base.Emit ();
- }