--- /dev/null
+// CS0619: `Program.TestEventArgs' is obsolete: `FooBar'
+// Line: 10
+
+using System;
+
+namespace Program
+{
+ public class TestClass
+ {
+ public EventHandler<TestEventArgs> Foo;
+ }
+
+ [Obsolete(Messages.Test, true)]
+ public sealed class TestEventArgs : EventArgs
+ {
+ }
+}
+
+namespace Program
+{
+ public static class Messages
+ {
+ public const string Test = "FooBar";
+ }
+}
\ No newline at end of file
return;
foreach (var member in members) {
- var pbm = member as PropertyBasedMember;
- if (pbm != null) {
+ var pbm = member as MemberBase;
+ if (pbm != null)
pbm.PrepareEmit ();
- continue;
- }
-
- var mc = member as MethodCore;
- if (mc != null) {
- mc.PrepareEmit ();
- continue;
- }
-
- var c = member as Const;
- if (c != null)
- c.DefineValue ();
}
base.PrepareEmit ();
get {
return type_expr;
}
+ set {
+ type_expr = value;
+ }
}
#endregion
return Parent.GetSignatureForDocumentation () + "." + MemberName.Basename;
}
+ public virtual void PrepareEmit ()
+ {
+ if (member_type != null && type_expr != null)
+ member_type.CheckObsoleteness (this, type_expr.Location);
+ }
+
protected virtual bool ResolveMemberType ()
{
if (member_type != null)
{
visitor.Visit (this);
}
+
+ public override void PrepareEmit ()
+ {
+ base.PrepareEmit ();
+ DefineValue ();
+ }
}
public class ConstSpec : FieldSpec
InvokeBuilder.PrepareEmit ();
if (BeginInvokeBuilder != null) {
+ BeginInvokeBuilder.TypeExpression = null;
+ EndInvokeBuilder.TypeExpression = null;
BeginInvokeBuilder.PrepareEmit ();
EndInvokeBuilder.PrepareEmit ();
}
// Obsolete checks cannot be done when resolving base context as they
// require type dependencies to be set but we are in process of resolving them
//
- if (!(mc is TypeDefinition.BaseContext) && !(mc is UsingAliasNamespace.AliasContext)) {
- type.CheckObsoleteness (mc, fne.StartLocation);
+ if (mc is ResolveContext) {
+ var oa = type.GetAttributeObsolete ();
+ if (oa != null && !mc.IsObsolete)
+ AttributeTester.Report_ObsoleteMessage (oa, type.GetSignatureForError (), fne.Location, mc.Module.Compiler.Report);
}
return type;
return s + parameters.GetSignatureForDocumentation ();
}
- public virtual void PrepareEmit ()
+ public override void PrepareEmit ()
{
+ base.PrepareEmit ();
parameters.ResolveDefaultValues (this);
}
for (int i = 0; i < parameters.Length; ++i) {
Parameter p = (Parameter) parameters [i];
+ if (p.Type != null)
+ p.Type.CheckObsoleteness (m, p.Location);
+
//
// Try not to enter default values resolution if there are is not any default value possible
//
}
}
- public abstract void PrepareEmit ();
-
protected override bool VerifyClsCompliance ()
{
if (!base.VerifyClsCompliance ())
public override void PrepareEmit ()
{
+ base.PrepareEmit ();
+
add.PrepareEmit ();
remove.PrepareEmit ();
public override void PrepareEmit ()
{
- parameters.ResolveDefaultValues (this);
-
base.PrepareEmit ();
+ parameters.ResolveDefaultValues (this);
}
protected override bool VerifyClsCompliance ()
#endregion
+ public override void CheckObsoleteness (IMemberContext mc, Location loc)
+ {
+ Element.CheckObsoleteness (mc, loc);
+ }
+
public override ObsoleteAttribute GetAttributeObsolete ()
{
return Element.GetAttributeObsolete ();