Author: marek
Date: 2005-09-26 12:56:47 -0400 (Mon, 26 Sep 2005)
New Revision: 50790
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/attribute.cs
trunk/mcs/mcs/class.cs
trunk/mcs/mcs/const.cs
trunk/mcs/mcs/decl.cs
trunk/mcs/mcs/delegate.cs
trunk/mcs/mcs/ecore.cs
trunk/mcs/mcs/enum.cs
trunk/mcs/mcs/expression.cs
trunk/mcs/mcs/iterators.cs
trunk/mcs/mcs/statement.cs
Log:
2005-09-26 Marek Safar <[EMAIL PROTECTED]>
* attribute.cs (Attribute.Resolve): Check Obsolete attribute for
attributes.
* class.cs (GeneratedBaseInitializer): New class for customization
compiler generated initializers.
(MemberBase.DoDefine): Check Obsolete attribute here.
(FieldMember.DoDefine): Ditto.
* const.cs (ExternalConstant.CreateDecimal): Builder for decimal
constants.
* decl.cs (MemberCore.EmitContext): Returns valid current ec.
(MemberCore.GetObsoleteAttribute): Removed argument.
(MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
(MemberCore.CheckObsoleteType): New helper.
* delegate.cs,
* enum.cs,
* statement.cs: Updates after MemberCore changes.
* ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
(FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
* expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
obsolete attribute for compiler construct.
(As.DoResolve): Cache result.
* iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/ChangeLog 2005-09-26 16:56:47 UTC (rev 50790)
@@ -1,3 +1,34 @@
+2005-09-26 Marek Safar <[EMAIL PROTECTED]>
+
+ * attribute.cs (Attribute.Resolve): Check Obsolete attribute for
+ attributes.
+
+ * class.cs (GeneratedBaseInitializer): New class for customization
+ compiler generated initializers.
+ (MemberBase.DoDefine): Check Obsolete attribute here.
+ (FieldMember.DoDefine): Ditto.
+
+ * const.cs (ExternalConstant.CreateDecimal): Builder for decimal
+ constants.
+
+ * decl.cs (MemberCore.EmitContext): Returns valid current ec.
+ (MemberCore.GetObsoleteAttribute): Removed argument.
+ (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic.
+ (MemberCore.CheckObsoleteType): New helper.
+
+ * delegate.cs,
+ * enum.cs,
+ * statement.cs: Updates after MemberCore changes.
+
+ * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here.
+ (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks.
+
+ * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check
+ obsolete attribute for compiler construct.
+ (As.DoResolve): Cache result.
+
+ * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer.
+
2005-09-26 Raja R Harinath <[EMAIL PROTECTED]>
Fix #76133.
Modified: trunk/mcs/mcs/attribute.cs
===================================================================
--- trunk/mcs/mcs/attribute.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/attribute.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -302,6 +302,11 @@
return null;
}
+ ObsoleteAttribute obsolete_attr =
AttributeTester.GetObsoleteAttribute (Type);
+ if (obsolete_attr != null) {
+ AttributeTester.Report_ObsoleteMessage
(obsolete_attr, TypeManager.CSharpName (Type), Location);
+ }
+
if (Arguments == null) {
object o = att_cache [Type];
if (o != null) {
@@ -1661,11 +1666,12 @@
if (attribute.Length == 1)
result =
(ObsoleteAttribute)attribute [0];
} else {
- result = type_ds.GetObsoleteAttribute
(type_ds);
+ result = type_ds.GetObsoleteAttribute
();
}
}
- analyzed_types_obsolete.Add (type, result == null ?
FALSE : result);
+ // Cannot use .Add because of corlib bootstrap
+ analyzed_types_obsolete [type] = result == null ? FALSE
: result;
return result;
}
Modified: trunk/mcs/mcs/class.cs
===================================================================
--- trunk/mcs/mcs/class.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/class.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -946,7 +946,7 @@
c = new Constructor (constructor_parent, Basename, mods,
Parameters.EmptyReadOnlyParameters,
- new ConstructorBaseInitializer
(null, Location),
+ new GeneratedBaseInitializer
(Location),
Location);
AddConstructor (c);
@@ -1257,6 +1257,9 @@
if ((Kind == Kind.Struct) && TypeManager.value_type ==
null)
throw new Exception ();
+ // Avoid attributes check when parent is not set
+ TypeResolveEmitContext.TestObsoleteMethodUsage = false;
+
if (base_type != null) {
// FIXME: I think this should be ...ResolveType
(Parent.EmitContext).
// However, if Parent ==
RootContext.Tree.Types, its NamespaceEntry will be null.
@@ -1272,9 +1275,18 @@
return null;
}
- if (ptype != null)
+ if (ptype != null) {
TypeBuilder.SetParent (ptype);
+ }
+ // Attribute is undefined at the begining of corlib
compilation
+ if (TypeManager.obsolete_attribute_type != null) {
+ TypeResolveEmitContext.TestObsoleteMethodUsage
= GetObsoleteAttribute () == null;
+ if (ptype != null &&
TypeResolveEmitContext.TestObsoleteMethodUsage) {
+ CheckObsoleteType (base_type);
+ }
+ }
+
// add interfaces that were not added at type creation
if (iface_exprs != null) {
// FIXME: I think this should be
...ExpandInterfaces (Parent.EmitContext, ...).
@@ -2460,19 +2472,7 @@
return false;
}
- protected override void VerifyObsoleteAttribute()
- {
- CheckUsageOfObsoleteAttribute (ptype);
- if (ifaces == null)
- return;
-
- foreach (Type iface in ifaces) {
- CheckUsageOfObsoleteAttribute (iface);
- }
- }
-
-
//
// IMemberContainer
//
@@ -3571,17 +3571,6 @@
get { return "M:"; }
}
- protected override void VerifyObsoleteAttribute()
- {
- base.VerifyObsoleteAttribute ();
-
- if (parameter_types == null)
- return;
-
- foreach (Type type in parameter_types) {
- CheckUsageOfObsoleteAttribute (type);
- }
- }
}
public class SourceMethod : ISourceMethod
@@ -4040,11 +4029,6 @@
return ec;
}
- public ObsoleteAttribute GetObsoleteAttribute ()
- {
- return GetObsoleteAttribute (Parent);
- }
-
/// <summary>
/// Returns true if method has conditional attribute and the
conditions is not defined (method is excluded).
/// </summary>
@@ -4179,7 +4163,7 @@
return true;
}
- public void Emit (EmitContext ec)
+ public virtual void Emit (EmitContext ec)
{
if (base_constructor != null){
ec.Mark (loc, false);
@@ -4198,6 +4182,21 @@
}
}
+ class GeneratedBaseInitializer: ConstructorBaseInitializer {
+ public GeneratedBaseInitializer (Location loc):
+ base (null, loc)
+ {
+ }
+
+ public override void Emit(EmitContext ec)
+ {
+ bool old = ec.TestObsoleteMethodUsage;
+ ec.TestObsoleteMethodUsage = false;
+ base.Emit (ec);
+ ec.TestObsoleteMethodUsage = old;
+ }
+ }
+
public class ConstructorThisInitializer : ConstructorInitializer {
public ConstructorThisInitializer (ArrayList argument_list,
Location l) :
base (argument_list, l)
@@ -4400,7 +4399,7 @@
if ((ModFlags & Modifiers.STATIC) == 0){
if (Parent.Kind == Kind.Class && Initializer ==
null)
- Initializer = new
ConstructorBaseInitializer (null, Location);
+ Initializer = new
GeneratedBaseInitializer (Location);
//
@@ -4434,7 +4433,7 @@
}
}
if (Initializer != null) {
- if (GetObsoleteAttribute () != null ||
Parent.GetObsoleteAttribute (Parent) != null)
+ if (GetObsoleteAttribute () != null ||
Parent.GetObsoleteAttribute () != null)
ec.TestObsoleteMethodUsage = false;
Initializer.Emit (ec);
@@ -4536,11 +4535,6 @@
return new EmitContext (Parent, Location, ig_, null,
ModFlags, true);
}
- public ObsoleteAttribute GetObsoleteAttribute ()
- {
- return GetObsoleteAttribute (Parent);
- }
-
public bool IsExcluded(EmitContext ec)
{
return false;
@@ -4818,7 +4812,7 @@
else
ec = method.CreateEmitContext (container, null);
- if (method.GetObsoleteAttribute () != null ||
container.GetObsoleteAttribute (container) != null)
+ if (method.GetObsoleteAttribute () != null ||
container.GetObsoleteAttribute () != null)
ec.TestObsoleteMethodUsage = false;
Attributes OptAttributes = method.OptAttributes;
@@ -4941,8 +4935,9 @@
ec.InUnsafe = InUnsafe;
Type = Type.ResolveAsTypeTerminal (ec,
false);
ec.InUnsafe = old_unsafe;
-
- member_type = Type == null ? null :
Type.Type;
+ if (Type != null) {
+ member_type = Type.Type;
+ }
}
return member_type;
}
@@ -5065,6 +5060,8 @@
if (MemberType == null)
return false;
+ CheckObsoleteType (Type);
+
if ((Parent.ModFlags & Modifiers.SEALED) != 0 &&
(ModFlags &
(Modifiers.VIRTUAL|Modifiers.ABSTRACT)) != 0) {
Report.Error (549, Location, "New
virtual member `{0}' is declared in a sealed class `{1}'",
@@ -5151,10 +5148,6 @@
return false;
}
- protected override void VerifyObsoleteAttribute()
- {
- CheckUsageOfObsoleteAttribute (MemberType);
- }
}
//
@@ -5364,9 +5357,11 @@
if (ec == null)
throw new InternalErrorException
("FieldMember.Define called too early");
- if (MemberType == null)
+ if (MemberType == null || Type == null)
return false;
+ CheckObsoleteType (Type);
+
if (MemberType == TypeManager.void_type) {
Report.Error (1547, Location, "Keyword 'void'
cannot be used in this context");
return false;
@@ -5796,7 +5791,6 @@
}
}
- public abstract ObsoleteAttribute GetObsoleteAttribute ();
public abstract Type[] ParameterTypes { get; }
public abstract Type ReturnType { get; }
public abstract EmitContext CreateEmitContext(TypeContainer tc,
ILGenerator ig);
@@ -5911,10 +5905,6 @@
get { throw new InvalidOperationException ("Unexpected
attempt to get doc comment from " + this.GetType () + "."); }
}
- protected override void VerifyObsoleteAttribute()
- {
- }
-
}
//
@@ -6147,7 +6137,7 @@
public override ObsoleteAttribute GetObsoleteAttribute
()
{
- return method.GetObsoleteAttribute
(method.Parent);
+ return method.GetObsoleteAttribute ();
}
public override string GetSignatureForError()
@@ -6851,7 +6841,7 @@
public override ObsoleteAttribute GetObsoleteAttribute
()
{
- return method.GetObsoleteAttribute
(method.Parent);
+ return method.GetObsoleteAttribute ();
}
public override string[] ValidAttributeTargets {
Modified: trunk/mcs/mcs/const.cs
===================================================================
--- trunk/mcs/mcs/const.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/const.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -168,6 +168,32 @@
this.fi = fi;
}
+ private ExternalConstant (FieldInfo fi, Constant value):
+ this (fi)
+ {
+ this.value = value;
+ }
+
+ //
+ // Decimal constants cannot be encoded in the constant blob,
and thus are marked
+ // as IsInitOnly ('readonly' in C# parlance). We get its value
from the
+ // DecimalConstantAttribute metadata.
+ //
+ public static IConstant CreateDecimal (FieldInfo fi)
+ {
+ if (fi is FieldBuilder)
+ return null;
+
+ object[] attrs = fi.GetCustomAttributes
(TypeManager.decimal_constant_attribute_type, false);
+ if (attrs.Length != 1)
+ return null;
+
+ IConstant ic = new ExternalConstant (fi,
+ new DecimalConstant
(((System.Runtime.CompilerServices.DecimalConstantAttribute) attrs [0]).Value,
Location.Null));
+
+ return ic;
+ }
+
#region IConstant Members
public void CheckObsoleteness (Location loc)
Modified: trunk/mcs/mcs/decl.cs
===================================================================
--- trunk/mcs/mcs/decl.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/decl.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -294,21 +294,6 @@
cached_name = null;
}
- /// <summary>
- /// Tests presence of ObsoleteAttribute and report proper error
- /// </summary>
- protected void CheckUsageOfObsoleteAttribute (Type type)
- {
- if (type == null)
- return;
-
- ObsoleteAttribute obsolete_attr =
AttributeTester.GetObsoleteAttribute (type);
- if (obsolete_attr == null)
- return;
-
- AttributeTester.Report_ObsoleteMessage (obsolete_attr,
type.FullName, Location);
- }
-
public abstract bool Define ();
//
@@ -327,16 +312,19 @@
/// </summary>
public virtual void Emit ()
{
- // Hack with Parent == null is for EnumMember
- if (Parent == null || (GetObsoleteAttribute (Parent) ==
null && Parent.GetObsoleteAttribute (Parent) == null))
- VerifyObsoleteAttribute ();
-
if (!RootContext.VerifyClsCompliance)
return;
VerifyClsCompliance (Parent);
}
+ public virtual EmitContext EmitContext
+ {
+ get {
+ return Parent.EmitContext;
+ }
+ }
+
public bool InUnsafe {
get {
return ((ModFlags & Modifiers.UNSAFE) != 0) ||
Parent.UnsafeContext;
@@ -375,7 +363,7 @@
/// <summary>
/// Returns instance of ObsoleteAttribute for this MemberCore
/// </summary>
- public ObsoleteAttribute GetObsoleteAttribute (DeclSpace ds)
+ public virtual ObsoleteAttribute GetObsoleteAttribute ()
{
// ((flags & (Flags.Obsolete_Undetected |
Flags.Obsolete)) == 0) is slower, but why ?
if ((caching_flags & Flags.Obsolete_Undetected) == 0 &&
(caching_flags & Flags.Obsolete) == 0) {
@@ -388,11 +376,11 @@
return null;
Attribute obsolete_attr = OptAttributes.Search (
- TypeManager.obsolete_attribute_type,
ds.EmitContext);
+ TypeManager.obsolete_attribute_type,
EmitContext);
if (obsolete_attr == null)
return null;
- ObsoleteAttribute obsolete =
obsolete_attr.GetObsoleteAttribute (ds.EmitContext);
+ ObsoleteAttribute obsolete =
obsolete_attr.GetObsoleteAttribute (EmitContext);
if (obsolete == null)
return null;
@@ -403,9 +391,12 @@
/// <summary>
/// Checks for ObsoleteAttribute presence. It's used for
testing of all non-types elements
/// </summary>
- public void CheckObsoleteness (Location loc)
+ public virtual void CheckObsoleteness (Location loc)
{
- ObsoleteAttribute oa = GetObsoleteAttribute (Parent);
+ if (Parent != null)
+ Parent.CheckObsoleteness (loc);
+
+ ObsoleteAttribute oa = GetObsoleteAttribute ();
if (oa == null) {
return;
}
@@ -413,6 +404,18 @@
AttributeTester.Report_ObsoleteMessage (oa,
GetSignatureForError (), loc);
}
+ protected void CheckObsoleteType (Expression type)
+ {
+ ObsoleteAttribute obsolete_attr =
AttributeTester.GetObsoleteAttribute (type.Type);
+ if (obsolete_attr == null)
+ return;
+
+ if (GetObsoleteAttribute () != null ||
Parent.GetObsoleteAttribute () != null)
+ return;
+
+ AttributeTester.Report_ObsoleteMessage (obsolete_attr,
TypeManager.CSharpName (type.Type), type.Location);
+ }
+
/// <summary>
/// Analyze whether CLS-Compliant verification must be execute
for this MemberCore.
/// </summary>
@@ -514,8 +517,6 @@
return true;
}
- protected abstract void VerifyObsoleteAttribute ();
-
//
// Raised (and passed an XmlElement that contains the comment)
// when GenerateDocComment is writing documentation expectedly.
@@ -576,8 +577,10 @@
// The emit context for toplevel objects.
protected EmitContext ec;
- public EmitContext EmitContext {
- get { return ec; }
+ public override EmitContext EmitContext {
+ get {
+ return ec;
+ }
}
static string[] attribute_targets = new string [] { "type" };
Modified: trunk/mcs/mcs/delegate.cs
===================================================================
--- trunk/mcs/mcs/delegate.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/delegate.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -179,14 +179,16 @@
return false;
}
- ReturnType = ReturnType.ResolveAsTypeTerminal (ec,
false);
- if (ReturnType == null)
- return false;
+ ReturnType = ReturnType.ResolveAsTypeTerminal (ec,
false);
+ if (ReturnType == null)
+ return false;
- ret_type = ReturnType.Type;
+ ret_type = ReturnType.Type;
if (ret_type == null)
return false;
+ CheckObsoleteType (ReturnType);
+
if (!Parent.AsAccessible (ret_type, ModFlags)) {
Report.Error (58, Location,
"Inconsistent accessibility:
return type `" +
@@ -669,14 +671,6 @@
get { return "T:"; }
}
- protected override void VerifyObsoleteAttribute()
- {
- CheckUsageOfObsoleteAttribute (ret_type);
-
- foreach (Type type in param_types) {
- CheckUsageOfObsoleteAttribute (type);
- }
- }
}
//
Modified: trunk/mcs/mcs/ecore.cs
===================================================================
--- trunk/mcs/mcs/ecore.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/ecore.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -145,18 +145,6 @@
// Not nice but we have broken hierarchy
public virtual void CheckMarshallByRefAccess (Type container) {}
- /// <summary>
- /// Tests presence of ObsoleteAttribute and report proper error
- /// </summary>
- protected void CheckObsoleteAttribute (Type type)
- {
- ObsoleteAttribute obsolete_attr =
AttributeTester.GetObsoleteAttribute (type);
- if (obsolete_attr == null)
- return;
-
- AttributeTester.Report_ObsoleteMessage (obsolete_attr,
type.FullName, loc);
- }
-
public virtual string GetSignatureForError ()
{
return TypeManager.CSharpName (type);
@@ -270,6 +258,7 @@
return null;
}
+ te.loc = loc;
return te;
}
@@ -2106,12 +2095,19 @@
public abstract TypeExpr DoResolveAsTypeStep (EmitContext ec);
- public virtual Type ResolveType (EmitContext ec)
+ public Type ResolveType (EmitContext ec)
{
TypeExpr t = ResolveAsTypeTerminal (ec, false);
if (t == null)
return null;
+ if (ec.TestObsoleteMethodUsage) {
+ ObsoleteAttribute obsolete_attr =
AttributeTester.GetObsoleteAttribute (t.Type);
+ if (obsolete_attr != null) {
+ AttributeTester.Report_ObsoleteMessage
(obsolete_attr, Name, Location);
+ }
+ }
+
return t.Type;
}
@@ -2640,10 +2636,19 @@
public override Expression ResolveMemberAccess (EmitContext ec,
Expression left, Location loc,
SimpleName
original)
{
- if (FieldInfo.IsLiteral) {
+ Type t = FieldInfo.FieldType;
+
+ if (FieldInfo.IsLiteral || (FieldInfo.IsInitOnly && t
== TypeManager.decimal_type)) {
IConstant ic = TypeManager.GetConstant
(FieldInfo);
if (ic == null) {
- ic = new ExternalConstant (FieldInfo);
+ if (FieldInfo.IsLiteral) {
+ ic = new ExternalConstant
(FieldInfo);
+ } else {
+ ic =
ExternalConstant.CreateDecimal (FieldInfo);
+ if (ic == null) {
+ return
base.ResolveMemberAccess (ec, left, loc, original);
+ }
+ }
TypeManager.RegisterConstant
(FieldInfo, ic);
}
@@ -2659,22 +2664,7 @@
return ic.Value;
}
-
- bool is_emitted = FieldInfo is FieldBuilder;
- Type t = FieldInfo.FieldType;
- //
- // Decimal constants cannot be encoded in the constant
blob, and thus are marked
- // as IsInitOnly ('readonly' in C# parlance). We get
its value from the
- // DecimalConstantAttribute metadata.
- //
- //TODO: incorporate in GetContant otherwise we miss all
error checks + obsoleteness check
- if (FieldInfo.IsInitOnly && !is_emitted && t ==
TypeManager.decimal_type) {
- object[] attrs = FieldInfo.GetCustomAttributes
(TypeManager.decimal_constant_attribute_type, false);
- if (attrs.Length == 1)
- return new DecimalConstant
(((System.Runtime.CompilerServices.DecimalConstantAttribute) attrs [0]).Value,
Location.Null);
- }
-
if (t.IsPointer && !ec.InUnsafe) {
UnsafeError (loc);
return null;
@@ -2723,7 +2713,7 @@
return null;
}
- if (!in_initializer) {
+ if (!in_initializer && !ec.IsFieldInitializer) {
ObsoleteAttribute oa;
FieldBase f = TypeManager.GetField (FieldInfo);
if (f != null) {
Modified: trunk/mcs/mcs/enum.cs
===================================================================
--- trunk/mcs/mcs/enum.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/enum.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -83,6 +83,19 @@
return true;
}
+ // Because parent is TypeContainer and we have DeclSpace only
+ public override void CheckObsoleteness (Location loc)
+ {
+ parent_enum.CheckObsoleteness (loc);
+
+ ObsoleteAttribute oa = GetObsoleteAttribute ();
+ if (oa == null) {
+ return;
+ }
+
+ AttributeTester.Report_ObsoleteMessage (oa,
GetSignatureForError (), loc);
+ }
+
public bool ResolveValue ()
{
if (value != null)
@@ -171,11 +184,6 @@
return base.VerifyClsCompliance (parent_enum);
}
- // There is no base type
- protected override void VerifyObsoleteAttribute()
- {
- }
-
public override string DocCommentHeader {
get { return "F:"; }
}
@@ -380,11 +388,6 @@
}
}
- protected override void VerifyObsoleteAttribute()
- {
- // UnderlyingType is never obsolete
- }
-
//
// Generates xml doc comments (if any), and if required,
// handle warning report.
Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/expression.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -1050,8 +1050,6 @@
return null;
probe_type = texpr.ResolveType (ec);
- CheckObsoleteAttribute (probe_type);
-
expr = expr.Resolve (ec);
if (expr == null)
return null;
@@ -1200,6 +1198,7 @@
}
bool do_isinst = false;
+ Expression resolved_type;
public override void Emit (EmitContext ec)
{
@@ -1220,10 +1219,12 @@
public override Expression DoResolve (EmitContext ec)
{
- Expression e = base.DoResolve (ec);
+ if (resolved_type == null) {
+ resolved_type = base.DoResolve (ec);
- if (e == null)
- return null;
+ if (resolved_type == null)
+ return null;
+ }
type = probe_type;
eclass = ExprClass.Value;
@@ -1236,7 +1237,7 @@
}
- e = Convert.ImplicitConversion (ec, expr, probe_type,
loc);
+ Expression e = Convert.ImplicitConversion (ec, expr,
probe_type, loc);
if (e != null){
expr = e;
do_isinst = false;
@@ -1813,8 +1814,6 @@
type = target.ResolveType (ec);
- CheckObsoleteAttribute (type);
-
if (type.IsAbstract && type.IsSealed) {
Report.Error (716, loc, "Cannot convert to
static type `{0}'", TypeManager.CSharpName (type));
return null;
@@ -3915,11 +3914,7 @@
override public Expression DoResolveLValue (EmitContext ec,
Expression right_side)
{
- Expression ret = DoResolveBase (ec, right_side);
- if (ret != null)
- CheckObsoleteAttribute (ret.Type);
-
- return ret;
+ return DoResolveBase (ec, right_side);
}
public bool VerifyFixed ()
@@ -6088,9 +6083,7 @@
return c;
}
- CheckObsoleteAttribute (type);
-
- if (TypeManager.IsDelegateType (type)) {
+ if (TypeManager.IsDelegateType (type)) {
RequestedType = (new NewDelegate (type,
Arguments, loc)).Resolve (ec);
if (RequestedType != null)
if (!(RequestedType is
DelegateCreation))
@@ -6518,7 +6511,7 @@
// Lookup the type
//
TypeExpr array_type_expr;
- array_type_expr = new ComposedCast
(requested_base_type, array_qualifier.ToString (), loc);
+ array_type_expr = new ComposedCast
(requested_base_type, array_qualifier.ToString ());
array_type_expr = array_type_expr.ResolveAsTypeTerminal
(ec, false);
if (array_type_expr == null)
return false;
@@ -7258,7 +7251,6 @@
UnsafeError (loc);
return null;
}
- CheckObsoleteAttribute (typearg);
type = TypeManager.type_type;
// Even though what is returned is a type object, it's
treated as a value by the compiler.
@@ -7329,8 +7321,6 @@
return null;
}
- CheckObsoleteAttribute (type_queried);
-
if (!TypeManager.VerifyUnManaged (type_queried, loc)){
return null;
}
@@ -7438,14 +7428,15 @@
/// Implements the member access expression
/// </summary>
public class MemberAccess : Expression {
- public readonly string Identifier; // TODO: LocatedToken
+ public readonly string Identifier;
Expression expr;
+ // TODO: Location can be removed
public MemberAccess (Expression expr, string id, Location l)
{
this.expr = expr;
Identifier = id;
- loc = l;
+ loc = expr.Location;
}
public Expression Expr {
@@ -8768,7 +8759,10 @@
if (lexpr == null)
return null;
+ bool old = ec.TestObsoleteMethodUsage;
+ ec.TestObsoleteMethodUsage = false;
Type ltype = lexpr.ResolveType (ec);
+ ec.TestObsoleteMethodUsage = old;
if ((ltype == TypeManager.void_type) && (dim != "*")) {
Report.Error (1547, Location,
Modified: trunk/mcs/mcs/iterators.cs
===================================================================
--- trunk/mcs/mcs/iterators.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/iterators.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -556,7 +556,7 @@
ctor = new Constructor (
this, Name, Modifiers.PUBLIC, ctor_params,
- new ConstructorBaseInitializer (null, Location),
+ new GeneratedBaseInitializer (Location),
Location);
AddConstructor (ctor);
Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs 2005-09-26 16:49:25 UTC (rev 50789)
+++ trunk/mcs/mcs/statement.cs 2005-09-26 16:56:47 UTC (rev 50790)
@@ -55,16 +55,7 @@
return ok;
}
-
- protected void CheckObsolete (Type type)
- {
- ObsoleteAttribute obsolete_attr =
AttributeTester.GetObsoleteAttribute (type);
- if (obsolete_attr == null)
- return;
-
- AttributeTester.Report_ObsoleteMessage (obsolete_attr,
type.FullName, loc);
- }
-
+
/// <summary>
/// Return value indicates whether all code paths emitted
return.
/// </summary>
@@ -3374,8 +3365,6 @@
expr_type = texpr.ResolveType (ec);
- CheckObsolete (expr_type);
-
data = new Emitter [declarators.Count];
if (!expr_type.IsPointer){
@@ -3594,8 +3583,6 @@
type = te.ResolveType (ec);
- CheckObsolete (type);
-
if (type != TypeManager.exception_type
&& !type.IsSubclassOf (TypeManager.exception_type)){
Error (155, "The type caught or
thrown must be derived from System.Exception");
return false;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches