* Makefile (centum_tests): Add Mono.Security and
[mono.git] / mcs / gmcs / decl.cs
index 8c8344258ff9ee063dea0c74bd3df31c2eefac07..28b142c1030c71d98c0bdeb09260671bb897225b 100644 (file)
@@ -713,22 +713,6 @@ namespace Mono.CSharp {
                        return (MemberCore)defined_names [name];
                }
 
-               bool in_transit = false;
-               
-               /// <summary>
-               ///   This function is used to catch recursive definitions
-               ///   in declarations.
-               /// </summary>
-               public bool InTransit {
-                       get {
-                               return in_transit;
-                       }
-
-                       set {
-                               in_transit = value;
-                       }
-               }
-               
                // 
                // root_types contains all the types.  All TopLevel types
                // hence have a parent that points to `root_types', that is
@@ -765,6 +749,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               protected virtual TypeAttributes TypeAttr {
+                       get {
+                               return CodeGen.Module.DefaultCharSetType;
+                       }
+               }
+
                /// <remarks>
                ///  Should be overriten by the appropriate declaration space
                /// </remarks>
@@ -1765,52 +1755,34 @@ namespace Mono.CSharp {
                                        method_hash.Add (name, list);
                                }
 
-                               if (member.IsVirtual &&
-                                   (member.Attributes & MethodAttributes.NewSlot) == 0) {
-                                       MethodInfo base_method = ((MethodInfo) member).GetBaseDefinition ();
+                               MethodInfo curr = (MethodInfo) member;
+                               while (curr.IsVirtual && (curr.Attributes & MethodAttributes.NewSlot) == 0) {
+                                       MethodInfo base_method = curr.GetBaseDefinition ();
 
-                                       if (base_method == member) {
+                                       if (base_method == curr) {
                                                //
                                                // Both mcs and CSC 1.1 seem to emit a somewhat broken
                                                // ...Invoke () function for delegates: it's missing a 'newslot'.
                                                // CSC 2.0 emits a 'newslot' for a delegate's Invoke.
                                                //
-                                               if (member.Name != "Invoke" ||
-                                                   !TypeManager.IsDelegateType (type)) {
-                                                       Report.SymbolRelatedToPreviousError (base_method);
-                                                       Report.Warning (-28, 
-                                                               "The method '{0}' is marked 'override'," + 
-                                                               " but doesn't appear to override any virtual or abstract method:" + 
-                                                               " it may be ignored during overload resolution",
-                                                               TypeManager.CSharpSignature (base_method));
-                                               }
-                                               goto skip;
-                                       }
-
-                                       for (;;) {
-                                               list.Add (new CacheEntry (null, base_method, MemberTypes.Method, bf));
-                                               if ((base_method.Attributes & MethodAttributes.NewSlot) != 0)
+                                               // Also, CSC 1.1 appears to emit 'Finalize' without a newslot.
+                                               //
+                                               if ((curr.Name == "Invoke" && TypeManager.IsDelegateType (curr.DeclaringType)) ||
+                                                   (curr.Name == "Finalize" && curr.GetParameters().Length == 0 && curr.DeclaringType == TypeManager.object_type))
                                                        break;
 
-                                               //
-                                               // Shouldn't get here.  Mono appears to be buggy.
-                                               //
-                                               MethodInfo new_base_method = base_method.GetBaseDefinition ();
-                                               if (new_base_method == base_method) {
-                                                       Report.SymbolRelatedToPreviousError (base_method);
-                                                       Report.Warning (-28, 
-                                                               "The method '{0}' is marked 'override'," +
-                                                               " but doesn't appear to overrided any virtual or abstract method:" + 
+                                               Report.SymbolRelatedToPreviousError (base_method);
+                                               Report.Warning (-28, 
+                                                               "The method '{0}' is marked 'override'," + 
+                                                               " but doesn't appear to override any virtual or abstract method:" + 
                                                                " it may be ignored during overload resolution",
                                                                TypeManager.CSharpSignature (base_method));
-                                                       break;
-                                               }
-                                               base_method = new_base_method;
+                                               break;
                                        }
-
-
+                                       
+                                       list.Add (new CacheEntry (null, base_method, MemberTypes.Method, bf));
+                                       curr = base_method;
                                }
-                       skip:
 
                                // Unfortunately, the elements returned by Type.GetMethods() aren't
                                // sorted so we need to do this check for every member.