Merge pull request #948 from ermshiperete/bug-xamarin-2394
[mono.git] / mcs / class / corlib / System.Reflection.Emit / FieldToken.cs
index 71384e02492d3c4a182b13410d6c9ba0c7dd7a21..7c7135ee17225f65d8a7cf1279ca2f15fb598938 100644 (file)
@@ -25,6 +25,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
+using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
 
@@ -32,27 +34,19 @@ namespace System.Reflection.Emit {
        /// <summary>
        ///  Represents the Token returned by the metadata to represent a Field.
        /// </summary>
+       [ComVisible (true)]
        [Serializable]
        public struct FieldToken {
 
                internal int tokValue;
 
-               public static readonly FieldToken Empty;
-
-
-               static FieldToken ()
-               {
-                       Empty = new FieldToken ();
-               }
-
+               public static readonly FieldToken Empty = new FieldToken ();
 
                internal FieldToken (int val)
                {
                        tokValue = val;
                }
 
-
-
                /// <summary>
                /// </summary>
                public override bool Equals (object obj)
@@ -68,6 +62,21 @@ namespace System.Reflection.Emit {
                }
 
 
+               public bool Equals (FieldToken obj)
+               {
+                       return (this.tokValue == obj.tokValue);
+               }
+
+               public static bool operator == (FieldToken a, FieldToken b)
+               {
+                       return Equals (a, b);
+               }
+
+               public static bool operator != (FieldToken a, FieldToken b)
+               {
+                       return !Equals (a, b);
+               }
+
                /// <summary>
                ///  Tests whether the given object is an instance of
                ///  FieldToken and has the same token value.
@@ -91,3 +100,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif