Author: martin
Date: 2005-04-19 09:47:29 -0400 (Tue, 19 Apr 2005)
New Revision: 43253
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/typemanager.cs
Log:
**** Merged r42559 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-04-19 13:45:44 UTC (rev 43252)
+++ trunk/mcs/gmcs/ChangeLog 2005-04-19 13:47:29 UTC (rev 43253)
@@ -1,3 +1,11 @@
+2005-04-05 John Luke <[EMAIL PROTECTED]>
+ Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #62232.
+ * typemanager.cs (IsUnmanagedType): Check non-public fields of a
+ struct too. Return false quicker in a few cases.
+ (VerifyUnManaged): Use it.
+
2005-04-05 Raja R Harinath <[EMAIL PROTECTED]>
Fix #74041.
Modified: trunk/mcs/gmcs/typemanager.cs
===================================================================
--- trunk/mcs/gmcs/typemanager.cs 2005-04-19 13:45:44 UTC (rev 43252)
+++ trunk/mcs/gmcs/typemanager.cs 2005-04-19 13:47:29 UTC (rev 43253)
@@ -1647,10 +1647,11 @@
//
public static bool IsUnmanagedType (Type t)
{
- if (IsBuiltinType (t) && t != TypeManager.object_type && t !=
TypeManager.string_type)
- return true;
+ // builtins that are not unmanaged types
+ if (t == TypeManager.object_type || t ==
TypeManager.string_type)
+ return false;
- if (IsEnumType (t))
+ if (IsBuiltinOrEnum (t))
return true;
if (t.IsPointer)
@@ -1674,14 +1675,12 @@
return true;
}
- FieldInfo [] fields = t.GetFields ();
-
- foreach (FieldInfo f in fields){
- if (f.IsStatic)
- continue;
+ FieldInfo [] fields = t.GetFields (BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance);
+
+ foreach (FieldInfo f in fields)
if (!IsUnmanagedType (f.FieldType))
return false;
- }
+
return true;
}
@@ -2450,18 +2449,11 @@
/// </summary>
public static bool VerifyUnManaged (Type t, Location loc)
{
- if (t.IsValueType || t.IsPointer){
- //
- // FIXME: this is more complex, we actually need to
- // make sure that the type does not contain any
- // classes itself
- //
+ if (IsUnmanagedType (t))
return true;
- }
+ // We need this explicit check here to make it work when
compiling corlib.
if (!RootContext.StdLib && (t == TypeManager.decimal_type))
- // We need this explicit check here to make it work when
- // compiling corlib.
return true;
Report.Error (
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches