Mono.CSharp.TypeContainer.VerifyMembers C# (CSharp) Method

VerifyMembers() public method

public VerifyMembers ( ) : void
return void
		public virtual void VerifyMembers ()
		{
			//
			// Check for internal or private fields that were never assigned
			//
			if (Report.WarningLevel >= 3) {
				if (RootContext.EnhancedWarnings) {
					CheckMemberUsage (properties, "property");
					CheckMemberUsage (methods, "method");
					CheckMemberUsage (constants, "constant");
				}

				if (fields != null){
					bool is_type_exposed = Kind == MemberKind.Struct || IsExposedFromAssembly ();
					foreach (FieldBase f in fields) {
						if ((f.ModFlags & Modifiers.AccessibilityMask) != Modifiers.PRIVATE) {
							if (is_type_exposed)
								continue;

							f.SetIsUsed ();
						}				
						
						if (!f.IsUsed){
							if ((f.caching_flags & Flags.IsAssigned) == 0)
								Report.Warning (169, 3, f.Location, "The private field `{0}' is never used", f.GetSignatureForError ());
							else {
								Report.Warning (414, 3, f.Location, "The private field `{0}' is assigned but its value is never used",
									f.GetSignatureForError ());
							}
							continue;
						}
						
						//
						// Only report 649 on level 4
						//
						if (Report.WarningLevel < 4)
							continue;
						
						if ((f.caching_flags & Flags.IsAssigned) != 0)
							continue;

						//
						// Don't be pendatic over serializable attributes
						//
						if (f.OptAttributes != null || PartialContainer.HasStructLayout)
							continue;
						
						Constant c = New.Constantify (f.MemberType, f.Location);
						Report.Warning (649, 4, f.Location, "Field `{0}' is never assigned to, and will always have its default value `{1}'",
							f.GetSignatureForError (), c == null ? "null" : c.GetValueAsLiteral ());
					}
				}
			}
		}