Author: raja
Date: 2005-04-15 11:14:32 -0400 (Fri, 15 Apr 2005)
New Revision: 43047
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/typemanager.cs
Log:
Fix cs0208-7.cs and cs0208-8.cs.
* typemanager.cs (IsUnmanagedType): Arrays are not allowed
(cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
error reporting to point out the reason a struct is not unmanaged.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2005-04-15 14:54:33 UTC (rev 43046)
+++ trunk/mcs/mcs/ChangeLog 2005-04-15 15:14:32 UTC (rev 43047)
@@ -1,3 +1,10 @@
+2005-04-15 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix cs0208-7.cs and cs0208-8.cs.
+ * typemanager.cs (IsUnmanagedType): Arrays are not allowed
+ (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve
+ error reporting to point out the reason a struct is not unmanaged.
+
2005-04-13 Atsushi Enomoto <[EMAIL PROTECTED]>
* doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and
Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs 2005-04-15 14:54:33 UTC (rev 43046)
+++ trunk/mcs/mcs/typemanager.cs 2005-04-15 15:14:32 UTC (rev 43047)
@@ -1523,27 +1523,22 @@
public static bool IsUnmanagedType (Type t)
{
// builtins that are not unmanaged types
- if (t == TypeManager.object_type || t ==
TypeManager.string_type){
- Console.WriteLine ("A fucking string");
+ if (t == TypeManager.object_type || t ==
TypeManager.string_type)
return false;
- }
if (IsBuiltinOrEnum (t))
return true;
+ // Someone did the work of checking if the ElementType of t is
unmanaged. Let's not repeat it.
if (t.IsPointer)
return true;
+ // Arrays are disallowed, even if we mark them with
[MarshalAs(UnmanagedType.ByValArray, ...)]
if (t.IsArray)
- return IsUnmanagedType (t.GetElementType ());
+ return false;
- if (IsDelegateType (t))
- return true;
-
- if (!IsValueType (t)){
- Console.WriteLine ("No value type: " + t.FullName);
+ if (!IsValueType (t))
return false;
- }
if (t is TypeBuilder){
TypeContainer tc = LookupTypeContainer (t);
@@ -1556,7 +1551,7 @@
if (f.MemberType == null)
continue;
if (!IsUnmanagedType (f.MemberType)){
- Console.WriteLine ("RECU on F: " +
f.MemberType.FullName + " On " + t.FullName);
+ Report.SymbolRelatedToPreviousError
(f.Location, CSharpName (t) + "." + f.Name);
return false;
}
}
@@ -1565,12 +1560,12 @@
FieldInfo [] fields = t.GetFields (BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance);
- foreach (FieldInfo f in fields)
+ foreach (FieldInfo f in fields){
if (!IsUnmanagedType (f.FieldType)){
- Console.WriteLine ("No value type Field: " +
f.FieldType.FullName);
-
+ Report.SymbolRelatedToPreviousError (f);
return false;
}
+ }
return true;
}
@@ -2270,10 +2265,6 @@
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))
- return true;
-
Report.Error (
208, loc,
"Cannot take the address or size of a variable of a
managed type ('" +
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches