Merge pull request #901 from Blewzman/FixAggregateExceptionGetBaseException
[mono.git] / mcs / class / corlib / System.Reflection.Emit / OpCode.cs
index a496505d04faf5cc79b775ab7c9d8a084928f37d..e6cdf10b73785b36f1489c055c1de78dbf98cab8 100644 (file)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-using System;
-using System.Reflection;
-using System.Reflection.Emit;
+#if !FULL_AOT_RUNTIME || IOS_REFLECTION
+
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
 
-#if NET_2_0
        [ComVisible (true)]
-#endif
        public struct OpCode {
 
                internal byte op1, op2;
@@ -63,7 +60,7 @@ namespace System.Reflection.Emit {
 
                public override int GetHashCode ()
                {
-                       return Value;
+                       return Name.GetHashCode ();
                }
 
                public override bool Equals (Object obj)
@@ -76,12 +73,10 @@ namespace System.Reflection.Emit {
                        return v.op1 == op1 && v.op2 == op2;
                }
 
-#if NET_2_0
                public bool Equals (OpCode obj)
                {
                        return obj.op1 == op1 && obj.op2 == op2;
                }
-#endif
 
                public override string ToString ()
                {
@@ -144,5 +139,16 @@ namespace System.Reflection.Emit {
                                }
                        }
                }
+
+               public static bool operator == (OpCode a, OpCode b)
+               {
+                       return a.op1 == b.op1 && a.op2 == b.op2;
+               }
+
+               public static bool operator != (OpCode a, OpCode b)
+               {
+                       return a.op1 != b.op1 || a.op2 != b.op2;
+               }
        }
 } 
+#endif