Mono.CSharp.MemberCore.VerifyClsCompliance C# (CSharp) Method

VerifyClsCompliance() protected method

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.
protected VerifyClsCompliance ( ) : bool
return bool
		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.Kind == MemberKind.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.Parent != null && !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.PartialContainer.IsClsComplianceRequired ())
					return false;
			}

			if (member_name.Name [0] == '_') {
				Report.Warning (3008, 1, Location, "Identifier `{0}' is not CLS-compliant", GetSignatureForError () );
			}

			return true;
		}