public CilGenericMethod(IModuleTypeSystem moduleTypeSystem, CilRuntimeMethod method, MethodSignature signature, RuntimeType declaringType) : base(moduleTypeSystem, method.Token, declaringType) { this.genericMethod = method; this.Signature = signature; this.Attributes = method.Attributes; this.ImplAttributes = method.ImplAttributes; this.Rva = method.Rva; this.Parameters = method.Parameters; }
public CilGenericMethod(CilRuntimeMethod method, MethodSignature signature, ISignatureContext signatureContext) : base(method.Token, method.Module, method.DeclaringType) { this.genericMethod = method; this.signatureContext = signatureContext; this.Signature = signature; this.Attributes = method.Attributes; this.ImplAttributes = method.ImplAttributes; this.Rva = method.Rva; this.Parameters = method.Parameters; }
/// <summary> /// Loads all methods from the given metadata module. /// </summary> /// <param name="declaringType">The type, which declared the method.</param> /// <param name="first">The first method token to load.</param> /// <param name="last">The last method token to load (non-inclusive.)</param> /// <param name="offset">The offset into the method table to start loading methods From.</param> private void LoadMethods(RuntimeType declaringType, TokenTypes first, TokenTypes last, ref int offset) { if (first >= last) return; MethodDefRow methodDef, nextMethodDef = new MethodDefRow(); TokenTypes maxParam, maxMethod = metadata.GetMaxTokenValue(TokenTypes.MethodDef); methodDef = metadata.ReadMethodDefRow(first); for (TokenTypes token = first; token < last; token++) { if (token < maxMethod) { nextMethodDef = metadata.ReadMethodDefRow(token + 1); maxParam = nextMethodDef.ParamList; } else { maxParam = metadata.GetMaxTokenValue(TokenTypes.Param) + 1; } Debug.Assert(offset < methods.Length, @"Invalid method index."); methods[offset++] = new CilRuntimeMethod(this, offset, methodDef, maxParam, declaringType); //Debug.Write("-> " + ((uint)token).ToString("X") + ": "); //Debug.Write(methodDef.NameStringIdx.ToString("X") + ": "); //Debug.Write(metadata.ReadString(methodDef.NameStringIdx)); //Debug.WriteLine(" - " + methodDef.SignatureBlobIdx.ToString()); methodDef = nextMethodDef; } }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> public override bool Equals(RuntimeMethod other) { CilRuntimeMethod crm = other as CilRuntimeMethod; return(crm != null && this.nameIdx == crm.nameIdx && this.signatureBlobIdx == crm.signatureBlobIdx && base.Equals(other) == true); }