public MethodSig <RoParameter> SpecializeMethodSig(IRoMethodBase roMethodBase) { MetadataReader reader = Reader; MethodDefinition methodDefinition = MethodDefinition; MethodSignature <RoType> sig = methodDefinition.DecodeSignature(_module, roMethodBase.TypeContext); int numParameters = sig.RequiredParameterCount; MethodSig <RoParameter> methodSig = new MethodSig <RoParameter>(numParameters); foreach (ParameterHandle ph in methodDefinition.GetParameters()) { Parameter p = ph.GetParameter(reader); int position = p.SequenceNumber - 1; Type parameterType = position == -1 ? sig.ReturnType : sig.ParameterTypes[position]; methodSig[position] = new EcmaFatMethodParameter(roMethodBase, position, parameterType, ph); } for (int position = -1; position < numParameters; position++) { Type parameterType = position == -1 ? sig.ReturnType : sig.ParameterTypes[position]; if (methodSig[position] == null) { methodSig[position] = new RoThinMethodParameter(roMethodBase, position, parameterType); } } return(methodSig); }
protected RoMethodParameter(IRoMethodBase roMethodBase, int position, Type parameterType) : base(roMethodBase.MethodBase, position) { Debug.Assert(roMethodBase != null); Debug.Assert(parameterType != null); _parameterType = parameterType; }
internal EcmaFatMethodParameter(IRoMethodBase roMethodBase, int position, Type parameterType, ParameterHandle handle) : base(roMethodBase, position, parameterType) { Debug.Assert(roMethodBase != null); Debug.Assert(parameterType != null); Debug.Assert(!handle.IsNil); _handle = handle; Debug.Assert(roMethodBase.MethodBase.Module is EcmaModule); _module = (EcmaModule)(roMethodBase.MethodBase.Module); _neverAccessThisExceptThroughParameterProperty = handle.GetParameter(Reader); }
// // Common helper for ConstructorInfo.ToString() and MethodInfo.ToString() // public static string ToString(this IRoMethodBase roMethodBase, MethodSig <string> methodSigStrings) { TypeContext typeContext = roMethodBase.TypeContext; StringBuilder sb = new StringBuilder(); sb.Append(methodSigStrings[-1]); sb.Append(' '); sb.Append(roMethodBase.MethodBase.Name); Type[] genericMethodArguments = typeContext.GenericMethodArguments; int count = genericMethodArguments == null ? 0 : genericMethodArguments.Length; if (count != 0) { sb.Append('['); for (int gpi = 0; gpi < count; gpi++) { if (gpi != 0) { sb.Append(','); } sb.Append(genericMethodArguments[gpi].ToString()); } sb.Append(']'); } sb.Append('('); for (int position = 0; position < methodSigStrings.Parameters.Length; position++) { if (position != 0) { sb.Append(", "); } sb.Append(methodSigStrings[position]); } sb.Append(')'); return(sb.ToString()); }
internal RoThinMethodParameter(IRoMethodBase roMethodBase, int position, Type parameterType) : base(roMethodBase, position, parameterType) { Debug.Assert(roMethodBase != null); Debug.Assert(parameterType != null); }
internal abstract MethodSig <RoParameter> SpecializeMethodSig(IRoMethodBase member);
// Used by RoConstructedGenericMethod to construct instantiated versions of method properties. internal sealed override MethodSig <RoParameter> SpecializeMethodSig(IRoMethodBase member) => _decoder.SpecializeMethodSig(member);
internal EcmaMethodBody(IRoMethodBase roMethodBase, MethodBodyBlock methodBodyBlock) : base() { _roMethodBase = roMethodBase; _neverAccessThisExceptThroughBlockProperty = methodBodyBlock; }