Negative header ids should be valid
[mono.git] / mcs / mcs / class.cs
index 216548b0c5c2e5c0ec50920dc29a642cf8c3ba9b..ffc0c44738e957775eebf9bc43618eb6fe7060a2 100644 (file)
@@ -346,12 +346,31 @@ namespace Mono.CSharp
                        return MemberName.GetSignatureForError ();
                }
 
+               public string GetSignatureForMetadata ()
+               {
+#if STATIC
+                       var name = TypeNameParser.Escape (MemberName.Basename);
+
+                       if (Parent is TypeDefinition) {
+                               return Parent.GetSignatureForMetadata () + "+" + name;
+                       }
+
+                       if (Parent != null && Parent.MemberName != null)
+                               return Parent.GetSignatureForMetadata () + "." + name;
+
+                       return name;
+#else
+                       throw new NotImplementedException ();
+#endif
+               }
+
                public virtual void RemoveContainer (TypeContainer cont)
                {
                        if (containers != null)
                                containers.Remove (cont);
 
-                       defined_names.Remove (cont.Basename);
+                       var tc = Parent == Module ? Module : this;
+                       tc.defined_names.Remove (cont.Basename);
                }
 
                public virtual void VerifyMembers ()
@@ -1821,13 +1840,20 @@ namespace Mono.CSharp
                                return;
 
                        string class_indexer_name = null;
-                       has_normal_indexers = true;
 
                        //
                        // Check normal indexers for consistent name, explicit interface implementation
                        // indexers are ignored
                        //
                        foreach (var indexer in indexers) {
+                               //
+                               // FindMembers can return unfiltered full hierarchy names
+                               //
+                               if (indexer.DeclaringType != spec)
+                                       continue;
+
+                               has_normal_indexers = true;
+
                                if (class_indexer_name == null) {
                                        indexer_name = class_indexer_name = indexer.Name;
                                        continue;
@@ -3295,7 +3321,7 @@ namespace Mono.CSharp
                {
                        // for extern static method must be specified either DllImport attribute or MethodImplAttribute.
                        // We are more strict than csc and report this as an error because SRE does not allow emit that
-                       if ((ModFlags & Modifiers.EXTERN) != 0 && !is_external_implementation) {
+                       if ((ModFlags & Modifiers.EXTERN) != 0 && !is_external_implementation && (OptAttributes == null || !OptAttributes.HasResolveError ())) {
                                if (this is Constructor) {
                                        Report.Warning (824, 1, Location,
                                                "Constructor `{0}' is marked `external' but has no external implementation specified", GetSignatureForError ());