public void VisitEnd(EndType end)
		{			
			if (m_needsCheck && m_hasBadField)
			{
				Reporter.TypeFailed(end.Type, CheckID, m_details);
			}
		}
		public void VisitEnd(EndType end)
		{		
			if (m_hasAdd && m_hasMinus && !m_hasEquals)
			{
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
		public void VisitEnd(EndType end)
		{		
			if (!m_disposable && m_hasDispose)
			{
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
		public void VisitEnd(EndType end)
		{			
			if (m_needsCheck && !m_hasCtor)
			{
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_isAbstract && m_hasPublicCtor)
			{
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
Exemple #6
0
		public void VisitEnd(EndType type)
		{
			if (m_needsCheck && m_foundZero && !m_foundNone)
			{
				Reporter.TypeFailed(type.Type, CheckID, string.Empty);
			}
		}
Exemple #7
0
		public void VisitEnd(EndType end)
		{
			if (m_needsCheck && m_foundCompare && !m_foundEquals)
			{
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_details.Length > 0)
			{
				Reporter.TypeFailed(end.Type, CheckID, m_details);
			}
		}
		public void VisitEnd(EndType end)
		{			
			if (m_details.Length > 0)
			{
				m_details = string.Format("Uses {0}", m_details);
				Reporter.TypeFailed(end.Type, CheckID, m_details);
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_needsCheck && !m_hasHandler)
			{
				Log.DebugLine(this, "no handler");
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
		public void VisitEnd(EndType end)
		{
			Unused.Value = end;
			
			if (m_needsCheck && m_failed)
			{
				Reporter.TypeFailed(m_type, CheckID, "Operator: " + m_details);
			}
		}
Exemple #12
0
		public void VisitEnd(EndType end)
		{
			Unused.Value = end;
			
			if (m_failed)
			{
				Reporter.TypeFailed(m_type, CheckID, string.Empty);
			}
		}
Exemple #13
0
		public void VisitEnd(EndType end)
		{
			if (m_badFields.Count > 0)
			{
				string details = "Fields: " + string.Join(" ", m_badFields.ToArray());
				Log.DebugLine(this, details);
				Reporter.TypeFailed(end.Type, CheckID, details);
			}
		}
Exemple #14
0
		public void VisitEnd(EndType end)
		{
			if (m_names.Length > 0)
			{
				string details = "Fields: " + m_names;
				Log.DebugLine(this, details);
			
				Reporter.TypeFailed(end.Type, CheckID, details);
			}
		}
		public void VisitEnd(EndType end)
		{								
			List<string> bad = new List<string>();
			DoGetMatches(bad, m_methods, "Methods: ");

			if (bad.Count == 1)
			{
				Log.DebugLine(this, bad[0]);
				Reporter.TypeFailed(end.Type, CheckID, bad[0]);
			}
		}
		public void VisitEnd(EndType end)
		{
			Unused.Value = end;
			
			if (m_name != null)
			{
				string details = "Member: " + m_name;
				Log.DebugLine(this, details);
				Reporter.TypeFailed(m_type, CheckID, details);
			}
		}
Exemple #17
0
		public void VisitEnd(EndType end)
		{
			if (m_visible.Count > 0)
			{
				string details;
				if (m_visible.Count == 1)
					details = m_visible[0] + " is visible";
				else
					details = string.Join(", ", m_visible.ToArray()) + " are visible";
				
				Reporter.TypeFailed(end.Type, CheckID, details);
			}
		}
		public void VisitEnd(EndType end)
		{
			Unused.Value = end;
			
			if (m_needsCheck)
			{
				MethodDefinition[] methods = m_type.Methods.GetMethod("op_Equality");
				if (methods.Length == 0)
				{
					Log.DebugLine(this, "no ==");				
					Reporter.TypeFailed(m_type, CheckID, string.Empty);
				}
			}
		}
Exemple #19
0
		public void VisitEnd(EndType type)
		{
			if (m_needsCheck && m_values.Count > 3)
			{
				m_values.Sort();
				
				for (int i = 1; i < m_values.Count; ++i)
				{
					if (m_values[i] != m_values[i - 1] + 1)
						return;
				}

				Reporter.TypeFailed(type.Type, CheckID, string.Empty);
			}
		}
		public void VisitEnd(EndType begin)
		{
			if (m_field != null)
			{
				TypeDefinition type = DoFindFinalizer();
				
				if (type == null || type.FullName == "System.Object")
				{
					Log.DebugLine(this, "no finalizer");	
					Reporter.TypeFailed(begin.Type, CheckID, string.Empty);
				}
				else if (!m_type.TypeOrBaseImplements("System.IDisposable", Cache))
				{
					Log.DebugLine(this, "not IDisposable");	
					Reporter.TypeFailed(begin.Type, CheckID, string.Empty);
				}
			}
		}
Exemple #21
0
        internal void Dispatch(TypeDefinition type)
        {
            DoSetExcluding(type.FullName);

            BeginType begin = new BeginType();

            begin.Type = type;
            DoVisit(begin);

            DoVisit(type);
            foreach (FieldDefinition field in type.Fields)
            {
                DoVisit(field);
            }

            foreach (EventDefinition evt in type.Events)
            {
                DoVisit(evt);
            }

            foreach (PropertyDefinition prop in type.Properties)
            {
                DoVisit(prop);
            }

            foreach (MethodDefinition method in type.Constructors)
            {
                DoVisit(method);
            }

            foreach (MethodDefinition method in type.Methods)
            {
                DoVisit(method);
            }

            EndType end = new EndType();

            end.Type = type;
            DoVisit(end);
        }
		public void VisitEnd(EndType end)
		{
			if (m_needsCheck)
			{
				string details = string.Empty;
				
				foreach (string name in m_optional)
				{
					if (m_getters.IndexOf(name) < 0 && m_setters.IndexOf(name) < 0)
						details = string.Format("Optional field {0} needs a getter and a setter. {1}", name, details);

					else if (m_getters.IndexOf(name) < 0 )
						details = string.Format("Optional field {0} needs a getter. {1}", name, details);

					else if (m_setters.IndexOf(name) < 0)
						details = string.Format("Optional field {0} needs a setter. {1}", name, details);
				}
				
				foreach (string name in m_required)
				{
					if (m_getters.IndexOf(name) < 0)
						details = string.Format("Required field {0} needs a getter. {1}", name, details);
				}
				
				if (details.Length > 0)
				{
					Log.DebugLine(this, details);
					Reporter.TypeFailed(end.Type, CheckID, details);
				}
			}
		}
		public void VisitEnd(EndType end)
		{
			if (!m_disposable && m_ownsField && m_details.Length > 0)
				Reporter.TypeFailed(end.Type, CheckID, "Field: " + m_details);
		}
Exemple #24
0
		public void VisitEnd(EndType end)
		{
			if (m_hasFinalizer && m_hasIntPtr && !m_hasKeepAlive)
			{			
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
			}
		}
Exemple #25
0
		public void VisitEnd(EndType type)
		{
			if (m_needsCheck && m_details.Length > 0)
			{
				Log.DebugLine(this, m_details);
				Reporter.TypeFailed(type.Type, CheckID, m_details);
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_needsCheck && m_values.Count > 2)
			{
				m_values.Sort();
				
				int numSequential = DoGetNumSequential();	
				Log.DebugLine(this, "numSequential: {0}", numSequential);				

				if (numSequential < m_values.Count && numSequential < 3)
				{
					List<long> masks = new List<long>();
					foreach (long value in m_values)
					{
						if (m_powers.IndexOf(value) < 0)
						{
							masks.Add(value);
						}
					}
					
					for (int i = 0; i < masks.Count; ++i)
					{
						for (int j = i+1; j < masks.Count; ++j)
						{
							if ((masks[i] & masks[j]) != 0)	// masks aren't disjoint so probably not a bitfield
							{
								Log.DebugLine(this, "{0:X} and {1:X} aren't disjoint", masks[i], masks[j]);				
								return;
							}
						}
					}
					
					Reporter.TypeFailed(end.Type, CheckID, string.Empty);
				}
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_needsCheck)
			{
				if (!m_foundInner || !m_foundSerialized)
				{
					Reporter.TypeFailed(end.Type, CheckID, string.Empty);
				}
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_needsCheck)
				m_table.Add(end.Type, m_refs);
		}
		public void VisitEnd(EndType end)
		{
			Unused.Value = end;
			
			if (m_needsCheck && m_details.Length > 0)
			{
				Reporter.TypeFailed(m_type, CheckID, m_details);
			}
		}
		public void VisitEnd(EndType end)
		{
			if (m_hasFinalizer && m_hasIntPtrField)
				Reporter.TypeFailed(end.Type, CheckID, string.Empty);
		}