field types, nested types, cleanup
[mono.git] / mcs / tools / corcompare / MissingField.cs
1 // Mono.Util.CorCompare.MissingField
2 //
3 // Author(s):
4 //   Nick Drochak (ndrochak@gol.com)
5 //
6 // (C) 2001-2002 Nick Drochak
7
8 using System;
9 using System.Reflection;
10
11 namespace Mono.Util.CorCompare {
12
13         /// <summary>
14         ///     Represents a class event that is completely missing
15         /// </summary>
16         /// <remarks>
17         ///     created by - Nick
18         ///     created on - 2/24/2002 10:43:57 PM
19         /// </remarks>
20         class MissingField : MissingMember {
21                 // e.g. <method name="Equals" status="missing"/>
22                 public MissingField (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
23
24                 public override string Type {
25                         get {
26                                 return "field";
27                         }
28                 }
29
30                 public override NodeStatus Analyze ()
31                 {
32                         base.Analyze ();
33
34                         if (mInfoMono != null && mInfoMS != null)
35                         {
36                                 FieldInfo fiMono = (FieldInfo) mInfoMono;
37                                 FieldInfo fiMS   = (FieldInfo) mInfoMS;
38
39                                 AddFakeAttribute (fiMono.IsNotSerialized, fiMS.IsNotSerialized, "System.NonSerializedAttribute");
40                                 AddFakeAttribute (fiMono.IsPinvokeImpl, fiMS.IsPinvokeImpl, "System.PInvokeImplAttribute");
41
42                                 AddFlagWarning (fiMono.IsStatic, fiMS.IsStatic, "static");
43                                 AddFlagWarning (fiMono.IsLiteral, fiMS.IsLiteral, "const");
44                                 AddFlagWarning (fiMono.IsInitOnly, fiMS.IsInitOnly, "readonly");
45
46                                 string strTypeMono = fiMono.FieldType.FullName;
47                                 string strTypeMS   =   fiMS.FieldType.FullName;
48                                 if (strTypeMono != strTypeMS)
49                                 {
50                                         Status.AddWarning ("Invalid type: is '"+strTypeMono+"', should be '"+strTypeMS+"'");
51                                 }
52                         }
53                         return m_nodeStatus;
54                 }
55         }
56 }