Author: martin
Date: 2005-04-19 10:47:33 -0400 (Tue, 19 Apr 2005)
New Revision: 43258
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/class.cs
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/pending.cs
Log:
**** Merged r42635 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-04-19 13:55:08 UTC (rev 43257)
+++ trunk/mcs/gmcs/ChangeLog 2005-04-19 14:47:33 UTC (rev 43258)
@@ -1,3 +1,20 @@
+2005-04-07 Abin Thomas <[EMAIL PROTECTED]>
+ Anoob V E <[EMAIL PROTECTED]>
+ Harilal P R <[EMAIL PROTECTED]>
+
+ Fix #58413.
+ * pending.cs (TypeAndMethods.mods): New. Store the parameter
+ modifiers of pending methods.
+ (PendingImplementation.PendingImplementation): Initialize it.
+ Add Parameter.Modifier [][] mods and initialize it with ParameterData.
+ (PendingImplementation.InterFaceMethod): Repalce Type[] argument
+ with ParameterData. Add check for modifiers.
+ * class.cs (MethodData.Define): Update to changes.
+
+2005-04-07 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat.
+
2005-04-07 Marek Safar <[EMAIL PROTECTED]>
* class.cs (PropertyMethod.Define): Check private accessor in abstract
Modified: trunk/mcs/gmcs/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs 2005-04-19 13:55:08 UTC (rev 43257)
+++ trunk/mcs/gmcs/class.cs 2005-04-19 14:47:33 UTC (rev 43258)
@@ -4990,10 +4990,10 @@
if (container.Pending != null){
if (member is Indexer) // TODO: test it, but it
should work without this IF
implementing =
container.Pending.IsInterfaceIndexer (
- member.InterfaceType,
method.ReturnType, ParameterTypes);
+ member.InterfaceType,
method.ReturnType, ParameterInfo);
else
implementing =
container.Pending.IsInterfaceMethod (
- member.InterfaceType, name,
method.ReturnType, ParameterTypes);
+ member.InterfaceType, name,
method.ReturnType, ParameterInfo);
if (member.InterfaceType != null){
if (implementing == null){
@@ -5113,11 +5113,11 @@
if (member is Indexer) {
container.Pending.ImplementIndexer (
member.InterfaceType, builder,
method.ReturnType,
- ParameterTypes,
member.IsExplicitImpl);
+ ParameterInfo,
member.IsExplicitImpl);
} else
container.Pending.ImplementMethod (
member.InterfaceType, name,
method.ReturnType,
- ParameterTypes,
member.IsExplicitImpl);
+ ParameterInfo,
member.IsExplicitImpl);
if (member.IsExplicitImpl)
container.TypeBuilder.DefineMethodOverride (
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2005-04-19 13:55:08 UTC (rev 43257)
+++ trunk/mcs/gmcs/ecore.cs 2005-04-19 14:47:33 UTC (rev 43258)
@@ -185,34 +185,23 @@
//
// If only accessible to the current class or children
//
- if (ma == MethodAttributes.Private) {
- Type declaring_type = mi.DeclaringType;
+ if (ma == MethodAttributes.Private)
+ return invocation_type == mi.DeclaringType ||
+ TypeManager.IsNestedChildOf
(invocation_type, mi.DeclaringType);
- if (invocation_type != declaring_type)
- return TypeManager.IsNestedChildOf
(invocation_type, declaring_type);
-
- return true;
- }
- //
- // FamAndAssem requires that we not only derivate, but
we are on the
- // same assembly.
- //
- if (ma == MethodAttributes.FamANDAssem){
- return (mi.DeclaringType.Assembly !=
invocation_type.Assembly);
- }
-
- // Assembly and FamORAssem succeed if we're in the same
assembly.
- if ((ma == MethodAttributes.Assembly) || (ma ==
MethodAttributes.FamORAssem)){
- if (mi.DeclaringType.Assembly ==
invocation_type.Assembly)
+ if (mi.DeclaringType.Assembly ==
invocation_type.Assembly) {
+ if (ma == MethodAttributes.Assembly || ma ==
MethodAttributes.FamORAssem)
return true;
+ } else {
+ if (ma == MethodAttributes.Assembly || ma ==
MethodAttributes.FamANDAssem)
+ return false;
}
- // We already know that we aren't in the same assembly.
- if (ma == MethodAttributes.Assembly)
- return false;
-
// Family and FamANDAssem require that we derive.
- if ((ma == MethodAttributes.Family) || (ma ==
MethodAttributes.FamANDAssem) || (ma == MethodAttributes.FamORAssem)){
+ // FamORAssem requires that we derive if in different
assemblies.
+ if (ma == MethodAttributes.Family ||
+ ma == MethodAttributes.FamANDAssem ||
+ ma == MethodAttributes.FamORAssem) {
if (!TypeManager.IsNestedFamilyAccessible
(invocation_type, mi.DeclaringType))
return false;
@@ -3906,8 +3895,8 @@
}
bool must_do_cs1540_check;
- if (!(IsAccessorAccessible (ec.ContainerType,
add_accessor, out must_do_cs1540_check)
- && IsAccessorAccessible (ec.ContainerType,
remove_accessor, out must_do_cs1540_check))) {
+ if (!(IsAccessorAccessible (ec.ContainerType,
add_accessor, out must_do_cs1540_check) &&
+ IsAccessorAccessible (ec.ContainerType,
remove_accessor, out must_do_cs1540_check))) {
Report.Error (122, loc, "'{0}' is inaccessible
due to its protection level",
DeclaringType.Name + "." +
EventInfo.Name);
Modified: trunk/mcs/gmcs/pending.cs
===================================================================
--- trunk/mcs/gmcs/pending.cs 2005-04-19 13:55:08 UTC (rev 43257)
+++ trunk/mcs/gmcs/pending.cs 2005-04-19 14:47:33 UTC (rev 43258)
@@ -35,6 +35,9 @@
// of methods above.
public Type [][] args;
+ //This is used to store the modifiers of arguments
+ public Parameter.Modifier [][] mods;
+
//
// This flag on the method says `We found a match, but
// because it was private, we could not use the match
@@ -166,6 +169,7 @@
pending_implementations [i].optional =
missing.Optional;
pending_implementations [i].methods = mi;
pending_implementations [i].args = new Type
[count][];
+ pending_implementations [i].mods = new
Parameter.Modifier [count][];
pending_implementations [i].found = new bool
[count];
pending_implementations [i].need_proxy = new
MethodInfo [count];
string indexer_name =
TypeManager.IndexerPropertyName (t);
@@ -175,15 +179,24 @@
int j = 0;
foreach (MethodInfo m in mi){
- Type [] types;
-
+ pending_implementations [i].args [j] =
TypeManager.NoTypes;
+ pending_implementations [i].mods [j] =
null;
+
// If there is a previous error, just
ignore
if (m == null)
- types = TypeManager.NoTypes;
- else
- types =
TypeManager.GetArgumentTypes (m);
-
- pending_implementations [i].args [j] =
types;
+ continue;
+
+ pending_implementations [i].args [j] =
TypeManager.GetArgumentTypes (m);
+
+ ParameterData pd =
TypeManager.GetParameterData (m);
+
+ if (pd.Count > 0){
+ Parameter.Modifier [] pm = new
Parameter.Modifier [pd.Count];
+ for (int k = 0; k < pd.Count;
k++)
+ pm [k] =
pd.ParameterModifier (k);
+ pending_implementations
[i].mods [j] = pm;
+ }
+
j++;
}
i++;
@@ -197,6 +210,7 @@
abstract_methods.CopyTo
(pending_implementations [i].methods, 0);
pending_implementations [i].found = new bool
[count];
pending_implementations [i].args = new Type
[count][];
+ pending_implementations [i].mods = new
Parameter.Modifier [count][];
pending_implementations [i].type = type_builder;
string indexer_name =
TypeManager.IndexerPropertyName (type_builder);
@@ -208,8 +222,17 @@
MethodInfo mi = (MethodInfo) m;
Type [] types =
TypeManager.GetArgumentTypes (mi);
+ ParameterData pd =
TypeManager.GetParameterData (mi);
pending_implementations [i].args [j] =
types;
+ pending_implementations [i].mods [j] =
null;
+ if (pd.Count > 0){
+ Parameter.Modifier [] pm = new
Parameter.Modifier [pd.Count];
+ for (int k = 0; k < pd.Count;
k++)
+ pm [k] =
pd.ParameterModifier (k);
+ pending_implementations
[i].mods [j] = pm;
+ }
+
j++;
}
}
@@ -318,23 +341,23 @@
/// <summary>
/// Whether the specified method is an interface method
implementation
/// </summary>
- public MethodInfo IsInterfaceMethod (Type t, string name, Type
ret_type, Type [] args)
+ public MethodInfo IsInterfaceMethod (Type t, string name, Type
ret_type, ParameterData args)
{
return InterfaceMethod (t, name, ret_type, args,
Operation.Lookup, null);
}
- public MethodInfo IsInterfaceIndexer (Type t, Type ret_type,
Type [] args)
+ public MethodInfo IsInterfaceIndexer (Type t, Type ret_type,
ParameterData args)
{
return InterfaceMethod (t, null, ret_type, args,
Operation.Lookup, null);
}
- public void ImplementMethod (Type t, string name, Type
ret_type, Type [] args, bool clear_one)
+ public void ImplementMethod (Type t, string name, Type
ret_type, ParameterData args, bool clear_one)
{
InterfaceMethod (t, name, ret_type, args,
clear_one ? Operation.ClearOne :
Operation.ClearAll, null);
}
- public void ImplementIndexer (Type t, MethodInfo mi, Type
ret_type, Type [] args, bool clear_one)
+ public void ImplementIndexer (Type t, MethodInfo mi, Type
ret_type, ParameterData args, bool clear_one)
{
InterfaceMethod (t, null, ret_type, args,
clear_one ? Operation.ClearOne :
Operation.ClearAll, mi);
@@ -357,10 +380,10 @@
/// that was used in the interface, then we always need to
create a proxy for it.
///
/// </remarks>
- public MethodInfo InterfaceMethod (Type t, string name, Type
ret_type, Type [] args,
+ public MethodInfo InterfaceMethod (Type t, string name, Type
ret_type, ParameterData args,
Operation op, MethodInfo
need_proxy)
{
- int arg_len = args.Length;
+ int arg_len = args.Count;
if (pending_implementations == null)
return null;
@@ -405,16 +428,13 @@
if (tm.args [i].Length != arg_len)
continue;
- int j, top = args.Length;
- bool fail = false;
+ int j, top = args.Count;
- for (j = 0; j < top; j++){
- if (!TypeManager.IsEqual
(tm.args [i][j], args[j])){
- fail = true;
+ for (j = 0; j < top; j++)
+ if (!TypeManager.IsEqual
(tm.args [i][j], args.ParameterType (j)) ||
+ tm.mods [i][j] !=
args.ParameterModifier (j))
break;
- }
- }
- if (fail)
+ if (j != top)
continue;
if (op != Operation.Lookup){
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches