/// <summary> /// Returns instance of ObsoleteAttribute for this MemberCore /// </summary> public virtual ObsoleteAttribute GetAttributeObsolete() { if ((caching_flags & (Flags.Obsolete_Undetected | Flags.Obsolete)) == 0) { return(null); } caching_flags &= ~Flags.Obsolete_Undetected; if (OptAttributes == null) { return(null); } Attribute obsolete_attr = OptAttributes.Search(Module.PredefinedAttributes.Obsolete); if (obsolete_attr == null) { return(null); } caching_flags |= Flags.Obsolete; ObsoleteAttribute obsolete = obsolete_attr.GetObsoleteAttribute(); if (obsolete == null) { return(null); } return(obsolete); }
/// <summary> /// The main virtual method for CLS-Compliant verifications. /// The method returns true if member is CLS-Compliant and false if member is not /// CLS-Compliant which means that CLS-Compliant tests are not necessary. A descendants override it /// and add their extra verifications. /// </summary> protected virtual bool VerifyClsCompliance() { if (HasClsCompliantAttribute) { if (!Module.DeclaringAssembly.HasCLSCompliantAttribute) { Attribute a = OptAttributes.Search (Module.PredefinedAttributes.CLSCompliant); if ((caching_flags & Flags.ClsCompliantAttributeFalse) != 0) { Report.Warning (3021, 2, a.Location, "`{0}' does not need a CLSCompliant attribute because the assembly is not marked as CLS-compliant", GetSignatureForError ()); } else { Report.Warning (3014, 1, a.Location, "`{0}' cannot be marked as CLS-compliant because the assembly is not marked as CLS-compliant", GetSignatureForError ()); } return false; } if (!IsExposedFromAssembly ()) { Attribute a = OptAttributes.Search (Module.PredefinedAttributes.CLSCompliant); Report.Warning (3019, 2, a.Location, "CLS compliance checking will not be performed on `{0}' because it is not visible from outside this assembly", GetSignatureForError ()); return false; } if ((caching_flags & Flags.ClsCompliantAttributeFalse) != 0) { if (Parent is Interface && Parent.IsClsComplianceRequired ()) { Report.Warning (3010, 1, Location, "`{0}': CLS-compliant interfaces must have only CLS-compliant members", GetSignatureForError ()); } else if (Parent.Kind == MemberKind.Class && (ModFlags & Modifiers.ABSTRACT) != 0 && Parent.IsClsComplianceRequired ()) { Report.Warning (3011, 1, Location, "`{0}': only CLS-compliant members can be abstract", GetSignatureForError ()); } return false; } if (Parent.Kind != MemberKind.Namespace && Parent.Kind != 0 && !Parent.IsClsComplianceRequired ()) { Attribute a = OptAttributes.Search (Module.PredefinedAttributes.CLSCompliant); Report.Warning (3018, 1, a.Location, "`{0}' cannot be marked as CLS-compliant because it is a member of non CLS-compliant type `{1}'", GetSignatureForError (), Parent.GetSignatureForError ()); return false; } } else { if (!IsExposedFromAssembly ()) return false; if (!Parent.IsClsComplianceRequired ()) return false; } if (member_name.Name [0] == '_') { Warning_IdentifierNotCompliant (); } if (member_name.TypeParameters != null) member_name.TypeParameters.VerifyClsCompliance (); return true; }
public Attribute ResolveAssemblyAttribute(PredefinedAttribute a_type) { Attribute a = OptAttributes.Search("assembly", a_type); if (a != null) { a.Resolve(); } return(a); }
Attribute ResolveModuleAttribute(PredefinedAttribute a_type) { Attribute a = OptAttributes.Search("module", a_type); if (a != null) { a.Resolve(); } return(a); }
protected Attribute ResolveAttribute(PredefinedAttribute a_type) { Attribute a = OptAttributes.Search(a_type); if (a != null) { a.Resolve(); } return(a); }