2008-07-22 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / mcs / support.cs
index 9c461246e2e5b462218eb08e52457a4b03063eae..d70fddb234ffb7e9a3c7b0a01a5ae5db21935c45 100644 (file)
@@ -5,7 +5,8 @@
 // Author:
 //   Miguel de Icaza (miguel@ximian.com)
 //
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
+// Copyright 2001 Ximian, Inc (http://www.ximian.com)
+// Copyright 2003-2008 Novell, Inc
 //
 
 using System;
@@ -58,7 +59,7 @@ namespace Mono.CSharp {
 
                        types = new Type [count];
                        for (int i = 0; i < count; i++)
-                               types [i] = pi [i].ParameterType;
+                               types [i] = TypeManager.TypeToCoreType (pi [i].ParameterType);
 
                        // TODO: This (if) should be done one level higher to correctly use
                        // out caching facilities.
@@ -349,6 +350,20 @@ namespace Mono.CSharp {
                {
                        comparer = PtrComparer.Instance;
                }
+
+#if MS_COMPATIBLE
+               //
+               // Workaround System.InvalidOperationException for enums
+               //
+               protected override int GetHash (object key)
+               {
+                       TypeBuilder tb = key as TypeBuilder;
+                       if (tb != null && tb.BaseType == TypeManager.enum_type)
+                               key = tb.BaseType;
+
+                       return base.GetHash (key);
+               }
+#endif
        }
 
        /*