+2004-09-14 Marek Safar <marek.safar@seznam.cz>
+
+ Fixed bug #61902
+ * codegen.cs (TestObsoleteMethodUsage): Trace when method is
+ called and is obsolete then this member suppress message
+ when call is inside next [Obsolete] method or type.
+
+ * expression.cs: Use TestObsoleteMethodUsage member.
+
2004-09-14 Martin Baulig <martin@ximian.com>
* cs-parser.jay: Sync a bit with the GMCS version.
}
}
if (Initializer != null) {
- Initializer.CheckObsoleteAttribute (Parent, Location);
+ if (GetObsoleteAttribute (Parent) == null && Parent.GetObsoleteAttribute (Parent.Parent) == null)
+ Initializer.CheckObsoleteAttribute (Parent, Location);
+ else
+ ec.TestObsoleteMethodUsage = false;
Initializer.Emit (ec);
}
else
ec = method.CreateEmitContext (container, null);
+ if (method.GetObsoleteAttribute () != null || container.GetObsoleteAttribute (container.Parent) != null)
+ ec.TestObsoleteMethodUsage = false;
+
Location loc = method.Location;
Attributes OptAttributes = method.OptAttributes;
/// </summary>
public bool InEnumContext;
+ /// <summary>
+ /// Trace when method is called and is obsolete then this member suppress message
+ /// when call is inside next [Obsolete] method or type.
+ /// </summary>
+ public bool TestObsoleteMethodUsage = true;
+
public Iterator CurrentIterator;
FlowBranching current_flow_branching;
/// </summary>
public virtual void Emit ()
{
- VerifyObsoleteAttribute ();
+ // Hack with Parent == null is for EnumMember
+ if (Parent == null || (GetObsoleteAttribute (Parent) == null && Parent.GetObsoleteAttribute (Parent.Parent) == null))
+ VerifyObsoleteAttribute ();
if (!RootContext.VerifyClsCompliance)
return;
public void Emit (EmitContext ec)
{
- base.Emit ();
-
if (OptAttributes != null)
OptAttributes.Emit (ec, this);
method = TypeManager.void_array_copyto_array_int;
}
- //
- // This checks ObsoleteAttribute on the method and on the declaring type
- //
- ObsoleteAttribute oa = AttributeTester.GetMethodObsoleteAttribute (method);
- if (oa != null)
- AttributeTester.Report_ObsoleteMessage (oa, TypeManager.CSharpSignature (method), loc);
+ if (ec.TestObsoleteMethodUsage) {
+ //
+ // This checks ObsoleteAttribute on the method and on the declaring type
+ //
+ ObsoleteAttribute oa = AttributeTester.GetMethodObsoleteAttribute (method);
+ if (oa != null)
+ AttributeTester.Report_ObsoleteMessage (oa, TypeManager.CSharpSignature (method), loc);
- oa = AttributeTester.GetObsoleteAttribute (method.DeclaringType);
- if (oa != null) {
- AttributeTester.Report_ObsoleteMessage (oa, method.DeclaringType.FullName, loc);
+ oa = AttributeTester.GetObsoleteAttribute (method.DeclaringType);
+ if (oa != null) {
+ AttributeTester.Report_ObsoleteMessage (oa, method.DeclaringType.FullName, loc);
+ }
}
if (IsMethodExcluded (method, ec))