+ public override void Accept (StructuralVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
+
+ public static Method Create (TypeDefinition parent, FullNamedExpression returnType, Modifiers mod,
+ MemberName name, ParametersCompiled parameters, Attributes attrs, bool hasConstraints)
+ {
+ var m = new Method (parent, returnType, mod, name, parameters, attrs);
+
+ if (hasConstraints && ((mod & Modifiers.OVERRIDE) != 0 || m.IsExplicitImpl)) {
+ m.Report.Error (460, m.Location,
+ "`{0}': Cannot specify constraints for overrides and explicit interface implementation methods",
+ m.GetSignatureForError ());
+ }
+
+ if ((mod & Modifiers.PARTIAL) != 0) {
+ const Modifiers invalid_partial_mod = Modifiers.AccessibilityMask | Modifiers.ABSTRACT | Modifiers.EXTERN |
+ Modifiers.NEW | Modifiers.OVERRIDE | Modifiers.SEALED | Modifiers.VIRTUAL;
+
+ if ((mod & invalid_partial_mod) != 0) {
+ m.Report.Error (750, m.Location,
+ "A partial method cannot define access modifier or any of abstract, extern, new, override, sealed, or virtual modifiers");
+ mod &= ~invalid_partial_mod;
+ }
+
+ if ((parent.ModFlags & Modifiers.PARTIAL) == 0) {
+ m.Report.Error (751, m.Location,
+ "A partial method must be declared within a partial class or partial struct");
+ }
+ }
+
+ if ((mod & Modifiers.STATIC) == 0 && parameters.HasExtensionMethodType) {
+ m.Report.Error (1105, m.Location, "`{0}': Extension methods must be declared static",
+ m.GetSignatureForError ());
+ }
+
+
+ return m;
+ }
+