X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fgmcs%2Fdecl.cs;h=9d564c596611616a05f573430f3de7cb4d81a4cc;hb=1a55b75d68ee7926651ae988a6b00412b7f40c22;hp=bc16801ed49a1538e4604a22aca59ee5535c9856;hpb=1bf952e7879a1827267f3677010cd4f89445f747;p=mono.git
diff --git a/mcs/gmcs/decl.cs b/mcs/gmcs/decl.cs
index bc16801ed49..9d564c59661 100644
--- a/mcs/gmcs/decl.cs
+++ b/mcs/gmcs/decl.cs
@@ -298,7 +298,7 @@ namespace Mono.CSharp {
/// Base representation for members. This is used to keep track
/// of Name, Location and Modifier flags, and handling Attributes.
///
- public abstract class MemberCore : Attributable {
+ public abstract class MemberCore : Attributable, IResolveContext {
///
/// Public name
///
@@ -359,10 +359,10 @@ namespace Mono.CSharp {
IsUsed = 1 << 11,
IsAssigned = 1 << 12 // Field is assigned
}
-
+
///
/// MemberCore flags at first detected then cached
- ///
+ ///
internal Flags caching_flags;
public MemberCore (DeclSpace parent, MemberName name, Attributes attrs)
@@ -457,11 +457,11 @@ namespace Mono.CSharp {
return null;
Attribute obsolete_attr = OptAttributes.Search (
- TypeManager.obsolete_attribute_type, EmitContext);
+ TypeManager.obsolete_attribute_type);
if (obsolete_attr == null)
return null;
- ObsoleteAttribute obsolete = obsolete_attr.GetObsoleteAttribute (EmitContext);
+ ObsoleteAttribute obsolete = obsolete_attr.GetObsoleteAttribute ();
if (obsolete == null)
return null;
@@ -500,12 +500,12 @@ namespace Mono.CSharp {
///
/// Analyze whether CLS-Compliant verification must be execute for this MemberCore.
///
- public override bool IsClsComplianceRequired (DeclSpace container)
+ public override bool IsClsComplianceRequired ()
{
if ((caching_flags & Flags.ClsCompliance_Undetected) == 0)
return (caching_flags & Flags.ClsCompliant) != 0;
- if (GetClsCompliantAttributeValue (container) && IsExposedFromAssembly (container)) {
+ if (GetClsCompliantAttributeValue (Parent) && IsExposedFromAssembly (Parent)) {
caching_flags &= ~Flags.ClsCompliance_Undetected;
caching_flags |= Flags.ClsCompliant;
return true;
@@ -539,10 +539,10 @@ namespace Mono.CSharp {
{
if (OptAttributes != null) {
Attribute cls_attribute = OptAttributes.Search (
- TypeManager.cls_compliant_attribute_type, ds.EmitContext);
+ TypeManager.cls_compliant_attribute_type);
if (cls_attribute != null) {
caching_flags |= Flags.HasClsCompliantAttribute;
- return cls_attribute.GetClsCompliantAttributeValue (ds.EmitContext);
+ return cls_attribute.GetClsCompliantAttributeValue ();
}
}
return ds.GetClsCompliantAttributeValue ();
@@ -573,7 +573,7 @@ namespace Mono.CSharp {
///
protected virtual bool VerifyClsCompliance (DeclSpace ds)
{
- if (!IsClsComplianceRequired (ds)) {
+ if (!IsClsComplianceRequired ()) {
if (HasClsCompliantAttribute && RootContext.WarningLevel >= 2) {
if (!IsExposedFromAssembly (ds))
Report.Warning (3019, 2, Location, "CLS compliance checking will not be performed on `{0}' because it is not visible from outside this assembly", GetSignatureForError ());
@@ -626,6 +626,40 @@ namespace Mono.CSharp {
{
DocUtil.GenerateDocComment (this, ds);
}
+
+ public override IResolveContext ResolveContext {
+ get {
+ return this;
+ }
+ }
+
+ #region IResolveContext Members
+
+ public virtual DeclSpace DeclContainer {
+ get {
+ return Parent;
+ }
+ }
+
+ public bool IsInObsoleteScope {
+ get {
+ if (GetObsoleteAttribute () != null)
+ return true;
+
+ return Parent == null ? false : Parent.IsInObsoleteScope;
+ }
+ }
+
+ public bool IsInUnsafeScope {
+ get {
+ if ((ModFlags & Modifiers.UNSAFE) != 0)
+ return true;
+
+ return Parent == null ? false : Parent.IsInUnsafeScope;
+ }
+ }
+
+ #endregion
}
///
@@ -704,6 +738,12 @@ namespace Mono.CSharp {
count_type_params += parent.count_type_params;
}
+ public override DeclSpace DeclContainer {
+ get {
+ return this;
+ }
+ }
+
///
/// Adds the member to defined_names table. It tests for duplications and enclosing name conflicts
///
@@ -869,7 +909,7 @@ namespace Mono.CSharp {
TypeResolveEmitContext.ResolvingTypeTree = true;
if (this is GenericMethod)
TypeResolveEmitContext.ContainerType = Parent.TypeBuilder;
- return e.ResolveAsTypeTerminal (TypeResolveEmitContext);
+ return e.ResolveAsTypeTerminal (TypeResolveEmitContext, silent);
}
public bool CheckAccessLevel (Type check_type)
@@ -1169,10 +1209,10 @@ namespace Mono.CSharp {
caching_flags &= ~Flags.HasCompliantAttribute_Undetected;
if (OptAttributes != null) {
- Attribute cls_attribute = OptAttributes.Search (TypeManager.cls_compliant_attribute_type, ec);
+ Attribute cls_attribute = OptAttributes.Search (TypeManager.cls_compliant_attribute_type);
if (cls_attribute != null) {
caching_flags |= Flags.HasClsCompliantAttribute;
- if (cls_attribute.GetClsCompliantAttributeValue (ec)) {
+ if (cls_attribute.GetClsCompliantAttributeValue ()) {
caching_flags |= Flags.ClsCompliantAttributeTrue;
return true;
}
@@ -1717,8 +1757,8 @@ namespace Mono.CSharp {
// We need to call AddMembers() with a single member type at a time
// to get the member type part of CacheEntry.EntryType right.
if (!container.IsInterface) {
- AddMembers (MemberTypes.Constructor, container);
- AddMembers (MemberTypes.Field, container);
+ AddMembers (MemberTypes.Constructor, container);
+ AddMembers (MemberTypes.Field, container);
}
AddMembers (MemberTypes.Method, container);
AddMembers (MemberTypes.Property, container);
@@ -1917,8 +1957,8 @@ namespace Mono.CSharp {
protected class CacheEntry {
public readonly IMemberContainer Container;
- public EntryType EntryType;
- public MemberInfo Member;
+ public readonly EntryType EntryType;
+ public readonly MemberInfo Member;
public CacheEntry (IMemberContainer container, MemberInfo member,
MemberTypes mt, BindingFlags bf)
@@ -1983,7 +2023,7 @@ namespace Mono.CSharp {
static MemberInfo [] emptyMemberInfo = new MemberInfo [0];
public MemberInfo [] FindMembers (MemberTypes mt, BindingFlags bf, string name,
- MemberFilter filter, object criteria)
+ MemberFilter filter, object criteria)
{
if (using_global)
throw new Exception ();
@@ -2375,7 +2415,7 @@ namespace Mono.CSharp {
// TODO: now we are ignoring CLSCompliance(false) on method from other assembly which is buggy.
// However it is exactly what csc does.
- if (md != null && !md.IsClsComplianceRequired (method.Parent))
+ if (md != null && !md.IsClsComplianceRequired ())
continue;
Report.SymbolRelatedToPreviousError (entry.Member);