**** Merged r44386 from MCS ****
authorMartin Baulig <martin@novell.com>
Tue, 17 May 2005 10:07:51 +0000 (10:07 -0000)
committerMartin Baulig <martin@novell.com>
Tue, 17 May 2005 10:07:51 +0000 (10:07 -0000)
svn path=/trunk/mcs/; revision=44616

mcs/gmcs/ChangeLog
mcs/gmcs/class.cs

index 7d47e37a877ecca62d3e2fc22dac995ec64b2cf4..5e7a6ce66fccdf6f50ec6f85724b15d29de7e4a0 100644 (file)
        * typemanager.cs (Closure): Copy this from MCS and merge all the
        GMCS-specific changes into it.
 
+2005-05-11  Marek Safar  <marek.safar@seznam.cz>
+
+       Fix #74863.
+       
+       * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed.
+       (Constructor.GetObsoleteAttribute): Implemented correctly.
+
 2005-05-10  Martin Baulig  <martin@ximian.com>
 
        * generic.cs (Constraints.Resolve): Report CS0246 if we cannot
index b12444ecf6b13cab3e7b1f2f79c6ae6cf7b3f8a1..d0ec2b68e83c111b38f23c736b4804a875c26079 100644 (file)
@@ -4521,68 +4521,6 @@ namespace Mono.CSharp {
                                        Invocation.EmitCall (ec, true, false, ec.GetThis (loc), base_constructor, argument_list, loc);
                        }
                }
-
-               /// <summary>
-               /// Method search for base ctor. (We do not cache it).
-               /// </summary>
-               Constructor GetOverloadedConstructor (TypeContainer tc)
-               {
-                       if (tc.InstanceConstructors == null)
-                               return null;
-
-                       foreach (Constructor c in tc.InstanceConstructors) {
-                               if (Arguments == null) {
-                                       if (c.ParameterTypes.Length == 0)
-                                               return c;
-
-                                       continue;
-                               }
-
-                               bool ok = true;
-
-                               int count = c.ParameterInfo.Count;
-
-                               if ((count > 0) &&
-                                   c.ParameterInfo.ParameterModifier (count - 1) == Parameter.Modifier.PARAMS) {
-                                       for (int i = 0; i < count-1; i++)
-                                               if ((i >= Arguments.Count) ||
-                                                   (c.ParameterTypes [i] != ((Argument)Arguments [i]).Type)) {
-                                                       ok = false;
-                                                       break;
-                                               }
-                               } else {
-                                       if (c.ParameterTypes.Length != Arguments.Count)
-                                               continue;
-
-                                       for (int i = 0; i < Arguments.Count; ++i)
-                                               if (c.ParameterTypes [i] != ((Argument)Arguments [i]).Type) {
-                                                       ok = false;
-                                                       break;
-                                               }
-                               }
-
-                               if (!ok)
-                                       continue;
-
-                               return c;
-                       }
-
-                       return null;
-               }
-
-               //TODO: implement caching when it will be necessary
-               public virtual void CheckObsoleteAttribute (TypeContainer tc, Location loc)
-               {
-                       Constructor ctor = GetOverloadedConstructor (tc);
-                       if (ctor == null)
-                               return;
-
-                       ObsoleteAttribute oa = ctor.GetObsoleteAttribute (tc);
-                       if (oa == null)
-                               return;
-
-                       AttributeTester.Report_ObsoleteMessage (oa, ctor.GetSignatureForError (), loc);
-               }
        }
 
        public class ConstructorBaseInitializer : ConstructorInitializer {
@@ -4590,24 +4528,6 @@ namespace Mono.CSharp {
                        base (argument_list, l)
                {
                }
-
-               public override void CheckObsoleteAttribute(TypeContainer tc, Location loc) {
-                       if (base_constructor == null)
-                               return;
-
-                       TypeContainer type_ds = TypeManager.LookupTypeContainer (tc.TypeBuilder.BaseType);
-                       if (type_ds == null) {
-                               ObsoleteAttribute oa = AttributeTester.GetMemberObsoleteAttribute (base_constructor);
-
-                               if (oa != null)
-                                       AttributeTester.Report_ObsoleteMessage (oa, TypeManager.CSharpSignature (base_constructor), loc);
-
-                               return;
-                       }
-
-                       base.CheckObsoleteAttribute (type_ds, loc);
-               }
-
        }
 
        public class ConstructorThisInitializer : ConstructorInitializer {
@@ -4867,10 +4787,9 @@ namespace Mono.CSharp {
                                }
                        }
                        if (Initializer != null) {
-                               if (GetObsoleteAttribute (Parent) == null && Parent.GetObsoleteAttribute (Parent) == null)
-                                       Initializer.CheckObsoleteAttribute (Parent, Location);
-                               else
+                               if (GetObsoleteAttribute () != null || Parent.GetObsoleteAttribute (Parent) != null)
                                        ec.TestObsoleteMethodUsage = false;
+
                                Initializer.Emit (ec);
                        }
                        
@@ -4967,7 +4886,7 @@ namespace Mono.CSharp {
 
                public ObsoleteAttribute GetObsoleteAttribute ()
                {
-                       return null;
+                       return GetObsoleteAttribute (Parent);
                }
 
                public bool IsExcluded(EmitContext ec)