X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fdecl.cs;h=b173b7b71fba74ac7c662715847f2825ba20c4ef;hb=30cddad5fb4c3d290906a6e6c33ecd8b07d8b48c;hp=99476d291c7b671047ac0329a843ce900327812b;hpb=668fdf5e8af827701e5da2f30b3c5c37e021f805;p=mono.git diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs index 99476d291c7..b173b7b71fb 100644 --- a/mcs/mcs/decl.cs +++ b/mcs/mcs/decl.cs @@ -18,7 +18,7 @@ using System.Diagnostics; using System.Text; using Mono.CompilerServices.SymbolWriter; -#if NET_2_1 +#if MOBILE using XmlElement = System.Object; #else using System.Xml; @@ -290,7 +290,8 @@ namespace Mono.CSharp { HasInstanceConstructor = 1 << 16, HasUserOperators = 1 << 17, CanBeReused = 1 << 18, - InterfacesExpanded = 1 << 19 + InterfacesExpanded = 1 << 19, + HasInstanceField = 1 << 20 } /// @@ -508,16 +509,6 @@ namespace Mono.CSharp { return obsolete; } - /// - /// Checks for ObsoleteAttribute presence. It's used for testing of all non-types elements - /// - public virtual void CheckObsoleteness (Location loc) - { - ObsoleteAttribute oa = GetAttributeObsolete (); - if (oa != null) - AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, Report); - } - // // Checks whether the type P is as accessible as this member // @@ -534,6 +525,9 @@ namespace Mono.CSharp { while (TypeManager.HasElementType (p)) p = TypeManager.GetElementType (p); + if (p.BuiltinType != BuiltinTypeSpec.Type.None) + return true; + if (p.IsGenericParameter) return true; @@ -553,6 +547,10 @@ namespace Mono.CSharp { bool same_access_restrictions = false; for (MemberCore mc = this; !same_access_restrictions && mc != null && mc.Parent != null; mc = mc.Parent) { + var tc = mc as TypeContainer; + if (tc != null && tc.PartialContainer != null) + mc = tc.PartialContainer; + var al = mc.ModFlags & Modifiers.AccessibilityMask; switch (pAccess) { case Modifiers.INTERNAL: @@ -573,8 +571,11 @@ namespace Mono.CSharp { // protected type then the type is accessible // while (mc.Parent != null && mc.Parent.PartialContainer != null) { - if (mc.Parent.PartialContainer.IsBaseTypeDefinition (p_parent)) + if (mc.Parent.PartialContainer.IsBaseTypeDefinition (p_parent)) { same_access_restrictions = true; + break; + } + mc = mc.Parent; } } @@ -586,8 +587,15 @@ namespace Mono.CSharp { same_access_restrictions = p.MemberDefinition.IsInternalAsPublic (mc.Module.DeclaringAssembly); else if (al == (Modifiers.PROTECTED | Modifiers.INTERNAL)) same_access_restrictions = mc.Parent.PartialContainer.IsBaseTypeDefinition (p_parent) && p.MemberDefinition.IsInternalAsPublic (mc.Module.DeclaringAssembly); - else + else if (al == Modifiers.PROTECTED) goto case Modifiers.PROTECTED; + else if (al == Modifiers.PRIVATE) { + if (p.MemberDefinition.IsInternalAsPublic (mc.Module.DeclaringAssembly)) { + same_access_restrictions = true; + } else { + goto case Modifiers.PROTECTED; + } + } break; @@ -670,13 +678,13 @@ namespace Mono.CSharp { // Does extension methods look up to find a method which matches name and extensionType. // Search starts from this namespace and continues hierarchically up to top level. // - public ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity) + public ExtensionMethodCandidates LookupExtensionMethod (string name, int arity) { var m = Parent; do { var ns = m as NamespaceContainer; if (ns != null) - return ns.LookupExtensionMethod (this, extensionType, name, arity, 0); + return ns.LookupExtensionMethod (this, name, arity, 0); m = m.Parent; } while (m != null); @@ -918,6 +926,7 @@ namespace Mono.CSharp { MissingDependency = 1 << 5, HasDynamicElement = 1 << 6, ConstraintsChecked = 1 << 7, + HasNamedTupleElement = 1 << 8, IsAccessor = 1 << 9, // Method is an accessor IsGeneric = 1 << 10, // Member contains type arguments @@ -934,6 +943,7 @@ namespace Mono.CSharp { GenericIterateInterface = 1 << 21, GenericTask = 1 << 22, InterfacesImported = 1 << 23, + Tuple = 1 << 24 } // @@ -943,7 +953,7 @@ namespace Mono.CSharp { StateFlags.CLSCompliant | StateFlags.CLSCompliant_Undetected | StateFlags.Obsolete | StateFlags.Obsolete_Undetected | StateFlags.MissingDependency | StateFlags.MissingDependency_Undetected | - StateFlags.HasDynamicElement; + StateFlags.HasDynamicElement | StateFlags.HasNamedTupleElement; protected Modifiers modifiers; public StateFlags state; @@ -1061,6 +1071,16 @@ namespace Mono.CSharp { #endregion + public virtual void CheckObsoleteness (IMemberContext mc, Location loc) + { + var oa = GetAttributeObsolete (); + if (oa == null) + return; + + if (!mc.IsObsolete) + AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, mc.Module.Compiler.Report); + } + public virtual ObsoleteAttribute GetAttributeObsolete () { if ((state & (StateFlags.Obsolete | StateFlags.Obsolete_Undetected)) == 0)