25using System.Collections.Generic;
38 public sealed override MemberTypes MemberType
40 get {
return MemberTypes.Method; }
43 public abstract Type ReturnType {
get; }
46 public virtual MethodInfo MakeGenericMethod(params
Type[] typeArguments)
48 throw new NotSupportedException(this.GetType().FullName);
51 public virtual MethodInfo GetGenericMethodDefinition()
53 throw new NotSupportedException(this.GetType().FullName);
56 public override string ToString()
58 var sb =
new StringBuilder();
59 sb.Append(ReturnType.Name).Append(
' ').Append(this.
Name);
67 foreach (var arg
in GetGenericArguments())
69 sb.Append(sep).Append(arg);
79 foreach (var arg
in GetParameters())
81 sb.Append(sep).Append(arg.ParameterType);
89 internal bool IsNewSlot
91 get {
return (Attributes & MethodAttributes.NewSlot) != 0; }
99 for (var type = DeclaringType.BaseType; type !=
null && !match.IsNewSlot; type = type.BaseType)
101 var method = type.FindMethod(
Name, MethodSignature) as
MethodInfo;
102 if (method !=
null && method.IsVirtual)
110 public virtual MethodInfo[] __GetMethodImpls()
112 throw new NotSupportedException();
115 public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out
string importName, out
string importScope)
117 return Module.__TryGetImplMap(GetCurrentToken(), out mappingFlags, out importName, out importScope);
122 return new ConstructorInfoImpl(
this);
125 Type IGenericContext.GetGenericTypeArgument(
int index)
127 return this.DeclaringType.GetGenericTypeArgument(index);
130 Type IGenericContext.GetGenericMethodArgument(
int index)
132 return GetGenericMethodArgument(index);
135 internal virtual Type GetGenericMethodArgument(
int index)
137 throw new InvalidOperationException();
140 internal virtual int GetGenericMethodArgumentCount()
142 throw new InvalidOperationException();
145 internal override MethodInfo GetMethodOnTypeDefinition()
150 Type IGenericBinder.BindTypeParameter(
Type type)
152 return this.DeclaringType.GetGenericTypeArgument(type.GenericParameterPosition);
155 Type IGenericBinder.BindMethodParameter(
Type type)
157 return GetGenericMethodArgument(type.GenericParameterPosition);
162 return new GenericMethodInstance(this.DeclaringType.BindTypeParameters(type),
this,
null);
168 internal virtual bool HasThis
170 get {
return !IsStatic; }
175 return new MethodInfoWithReflectedType(type,
this);
178 internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(
Type attributeType)
181 var list =
new List<CustomAttributeData>();
183 if ((Attributes & MethodAttributes.PinvokeImpl) != 0 && (attributeType ==
null || attributeType.IsAssignableFrom(module.Universe.System_Runtime_InteropServices_DllImportAttribute)))
184 if (__TryGetImplMap(out var flags, out var importName, out var importScope))
185 list.Add(CustomAttributeData.CreateDllImportPseudoCustomAttribute(module, flags, importName, importScope, GetMethodImplementationFlags()));
187 if ((GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) != 0 && (attributeType ==
null || attributeType.IsAssignableFrom(module.Universe.System_Runtime_InteropServices_PreserveSigAttribute)))
188 list.Add(CustomAttributeData.CreatePreserveSigPseudoCustomAttribute(module));
IKVM.Reflection.Module Module
IKVM.Reflection.Type Type
IKVM.Reflection.ConstructorInfo ConstructorInfo
IKVM.Reflection.MemberInfo MemberInfo
IKVM.Reflection.MethodInfo MethodInfo
IKVM.Reflection.ParameterInfo ParameterInfo
IKVM.Reflection.MethodBase MethodBase
global::java.lang.invoke.LambdaForm.Name Name