internal class GenericInstanceKey {
Type gtd;
internal Type[] args;
+ int hash_code;
internal GenericInstanceKey (Type gtd, Type[] args)
{
this.gtd = gtd;
this.args = args;
+
+ hash_code = gtd.GetHashCode ();
+ for (int i = 0; i < args.Length; ++i)
+ hash_code ^= args [i].GetHashCode ();
}
static bool IsBoundedVector (Type type) {
public override int GetHashCode ()
{
- int hash = gtd.GetHashCode ();
- for (int i = 0; i < args.Length; ++i)
- hash ^= args [i].GetHashCode ();
- return hash;
+ return hash_code;
}
}
+2010-04-08 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * AssemblyBuilder.cs (GenericInstanceKey): Precalculate
+ GenericInstanceKey hash code since this can cause infinite
+ recursion when inflating "Foo<T> : Bar<Foo<T>>" parent.
+
+ * TypeBuilder.cs (IsSubclassOf): Don't delegate to base class
+ since the unmanaged information can be out of sync.
+
+ * TypeBuilder.cs (UnderlyingSystemType): Invert the test order
+ since IsEnum now is potentialy more expensive.
+
+ Fixes #594728.
+
2010-04-06 Marek Safar <marek.safar@gmail.com>
* ModuleBuilder.cs: Use Dictionary.
get { return nesting_type; }
}
-/* public override bool IsSubclassOf (Type c)
+ [ComVisible (true)]
+ public override bool IsSubclassOf (Type c)
{
Type t;
if (c == null)
t = t.BaseType;
}
return false;
- }*/
+ }
public override Type UnderlyingSystemType {
get {
if (is_created)
return created.UnderlyingSystemType;
- if (IsEnum && !IsCompilerContext) {
+ if (!IsCompilerContext && IsEnum) {
if (underlying_type != null)
return underlying_type;
throw new InvalidOperationException (
return base.IsAssignableFrom (c);
}
- [ComVisible (true)]
- [MonoTODO]
- public override bool IsSubclassOf (Type c)
- {
- return base.IsSubclassOf (c);
- }
-
[MonoTODO ("arrays")]
internal bool IsAssignableTo (Type c)
{