Author: raja Date: 2006-09-22 09:54:51 -0400 (Fri, 22 Sep 2006) New Revision: 65815
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/decl.cs
trunk/mcs/mcs/typemanager.cs
Log:
Fix part of #79451
* typemanager.cs (Closure.Filter): Consider PrivateScope attributes.
* decl.cs (DeclSpace.FindMemberToOverride): Likewise. Reorganize
code slightly.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2006-09-22 13:46:09 UTC (rev 65814)
+++ trunk/mcs/mcs/ChangeLog 2006-09-22 13:54:51 UTC (rev 65815)
@@ -1,3 +1,10 @@
+2006-09-22 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix part of #79451
+ * typemanager.cs (Closure.Filter): Consider PrivateScope attributes.
+ * decl.cs (DeclSpace.FindMemberToOverride): Likewise. Reorganize
+ code slightly.
+
2006-09-22 Martin Baulig <[EMAIL PROTECTED]>
* ecore.cs: Merged with the gmcs version.
Modified: trunk/mcs/mcs/decl.cs
===================================================================
--- trunk/mcs/mcs/decl.cs 2006-09-22 13:46:09 UTC (rev 65814)
+++ trunk/mcs/mcs/decl.cs 2006-09-22 13:54:51 UTC (rev 65815)
@@ -2116,24 +2116,25 @@
// TODO: Almost duplicate !
// Check visibility
switch (fi.Attributes &
FieldAttributes.FieldAccessMask) {
- case FieldAttributes.Private:
- //
- // A private method is
Ok if we are a nested subtype.
- // The spec actually is
not very clear about this, see bug 52458.
- //
- if (invocationType !=
entry.Container.Type &
-
TypeManager.IsNestedChildOf (invocationType, entry.Container.Type))
- continue;
-
- break;
- case
FieldAttributes.FamANDAssem:
- case FieldAttributes.Assembly:
- //
- // Check for assembly
methods
- //
- if
(mi.DeclaringType.Assembly != CodeGen.Assembly.Builder)
- continue;
- break;
+ case FieldAttributes.PrivateScope:
+ continue;
+ case FieldAttributes.Private:
+ //
+ // A private method is Ok if we
are a nested subtype.
+ // The spec actually is not
very clear about this, see bug 52458.
+ //
+ if (!invocationType.Equals
(entry.Container.Type) &&
+
!TypeManager.IsNestedChildOf (invocationType, entry.Container.Type))
+ continue;
+ break;
+ case FieldAttributes.FamANDAssem:
+ case FieldAttributes.Assembly:
+ //
+ // Check for assembly methods
+ //
+ if (mi.DeclaringType.Assembly
!= CodeGen.Assembly.Builder)
+ continue;
+ break;
}
return entry.Member;
}
@@ -2144,23 +2145,24 @@
if (cmpAttrs.Length != paramTypes.Length)
continue;
- for (int j = cmpAttrs.Length - 1; j >= 0; j --)
{
+ int j;
+ for (j = 0; j < cmpAttrs.Length; ++j)
if (!TypeManager.IsEqual (paramTypes
[j], cmpAttrs [j]))
- goto next;
- }
+ break;
+ if (j < cmpAttrs.Length)
+ continue;
//
// check generic arguments for methods
//
if (mi != null) {
Type [] cmpGenArgs =
TypeManager.GetGenericArguments (mi);
- if ((genericMethod != null) &&
(cmpGenArgs.Length > 0)) {
- if
(genericMethod.TypeParameters.Length != cmpGenArgs.Length)
- goto next;
- } else if (!((genericMethod == null) &&
(cmpGenArgs.Length == 0)))
- goto next;
+ if (genericMethod == null &&
cmpGenArgs.Length != 0)
+ continue;
+ if (genericMethod != null &&
cmpGenArgs.Length != genericMethod.TypeParameters.Length)
+ continue;
}
-
+
//
// get one of the methods because this has the
visibility info.
//
@@ -2174,34 +2176,27 @@
// Check visibility
//
switch (mi.Attributes &
MethodAttributes.MemberAccessMask) {
+ case MethodAttributes.PrivateScope:
+ continue;
case MethodAttributes.Private:
//
// A private method is Ok if we are a
nested subtype.
// The spec actually is not very clear
about this, see bug 52458.
//
- if (invocationType.Equals
(entry.Container.Type) ||
- TypeManager.IsNestedChildOf
(invocationType, entry.Container.Type))
- return entry.Member;
-
+ if (!invocationType.Equals
(entry.Container.Type) &&
+ !TypeManager.IsNestedChildOf
(invocationType, entry.Container.Type))
+ continue;
break;
case MethodAttributes.FamANDAssem:
case MethodAttributes.Assembly:
//
// Check for assembly methods
//
- if (mi.DeclaringType.Assembly ==
CodeGen.Assembly.Builder)
- return entry.Member;
-
+ if (mi.DeclaringType.Assembly !=
CodeGen.Assembly.Builder)
+ continue;
break;
- default:
- //
- // A protected method is ok, because we
are overriding.
- // public is always ok.
- //
- return entry.Member;
}
- next:
- ;
+ return entry.Member;
}
return null;
Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs 2006-09-22 13:46:09 UTC (rev 65814)
+++ trunk/mcs/mcs/typemanager.cs 2006-09-22 13:54:51 UTC (rev 65815)
@@ -2992,7 +2992,10 @@
if (ma == MethodAttributes.Public)
return true;
-
+
+ if (ma == MethodAttributes.PrivateScope)
+ return false;
+
if (ma == MethodAttributes.Private)
return private_ok ||
IsPrivateAccessible
(invocation_type, m.DeclaringType) ||
@@ -3017,7 +3020,10 @@
if (fa == FieldAttributes.Public)
return true;
-
+
+ if (fa == FieldAttributes.PrivateScope)
+ return false;
+
if (fa == FieldAttributes.Private)
return private_ok ||
IsPrivateAccessible
(invocation_type, m.DeclaringType) ||
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
