diff --git a/src/IKVM.Reflection/Type.cs b/src/IKVM.Reflection/Type.cs index d5d1466bf6..b3763120cc 100644 --- a/src/IKVM.Reflection/Type.cs +++ b/src/IKVM.Reflection/Type.cs @@ -695,7 +695,7 @@ T[] GetMembers(BindingFlags flags) if ((flags & BindingFlags.DeclaredOnly) == 0) { - for (Type type = BaseType; type != null; type = type.BaseType) + for (var type = BaseType; type != null; type = type.BaseType) { type.CheckBaked(); @@ -1739,9 +1739,15 @@ public bool IsSubclassOf(Type type) return false; } - // This returns true if this type directly (i.e. not inherited from the base class) implements the interface. - // Note that a complicating factor is that the interface itself can be implemented by an interface that extends it. - private bool IsDirectlyImplementedInterface(Type interfaceType) + /// + /// This returns true if this type directly (i.e. not inherited from the base class) implements the interface. + /// + /// + /// Note that a complicating factor is that the interface itself can be implemented by an interface that extends it. + /// + /// + /// + bool IsDirectlyImplementedInterface(Type interfaceType) { foreach (var iface in __GetDeclaredInterfaces()) if (interfaceType.IsAssignableFrom(iface)) @@ -1766,6 +1772,7 @@ public InterfaceMapping GetInterfaceMap(Type interfaceType) void FillInInterfaceMethods(Type interfaceType, MethodInfo[] interfaceMethods, MethodInfo[] targetMethods) { FillInExplicitInterfaceMethods(interfaceMethods, targetMethods); + var direct = IsDirectlyImplementedInterface(interfaceType); if (direct) FillInImplicitInterfaceMethods(interfaceMethods, targetMethods); @@ -1782,7 +1789,7 @@ void FillInInterfaceMethods(Type interfaceType, MethodInfo[] interfaceMethods, M type.FillInImplicitInterfaceMethods(interfaceMethods, targetMethods); } - private void FillInImplicitInterfaceMethods(MethodInfo[] interfaceMethods, MethodInfo[] targetMethods) + void FillInImplicitInterfaceMethods(MethodInfo[] interfaceMethods, MethodInfo[] targetMethods) { MethodBase[] methods = null; @@ -1943,7 +1950,7 @@ public MethodBase __CreateMissingMethod(string name, CallingConventions callingC return CreateMissingMethod(name, callingConvention, returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, parameterTypes.Length)); } - private MethodBase CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers) + MethodBase CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers) { var sig = new MethodSignature(returnType ?? Module.universe.System_Void, Util.Copy(parameterTypes), customModifiers, callingConvention, 0); var method = new MissingMethod(this, name, sig);