public FunctionPointerType() : base(null) { this.function = new MethodReference (); this.function.Name = "method"; this.etype = MD.ElementType.FnPtr; }
internal MethodSpecification(MethodReference method) { if (method == null) throw new ArgumentNullException ("method"); this.method = method; this.token = new MetadataToken (TokenType.MethodSpec); }
public static MethodReference MakeGeneric(this MethodReference self, params TypeReference [] arguments) { var reference = new MethodReference { Name = self.Name, DeclaringType = self.DeclaringType.MakeGenericType (arguments), HasThis = self.HasThis, ExplicitThis = self.ExplicitThis, ReturnType = self.ReturnType, CallingConvention = self.CallingConvention, }; foreach (var parameter in self.Parameters) reference.Parameters.Add (new ParameterDefinition (parameter.ParameterType)); foreach (var generic_parameter in self.GenericParameters) reference.GenericParameters.Add (new GenericParameter (generic_parameter.Name, reference)); return reference; }
public GenericInstanceMethod(MethodReference method) : base(method) { }
internal CustomAttribute(uint signature, MethodReference constructor) { this.signature = signature; this.constructor = constructor; this.resolved = false; }
public CustomAttribute(MethodReference constructor, byte [] blob) { this.constructor = constructor; this.resolved = false; this.blob = blob; }
public CustomAttribute(MethodReference constructor) { this.constructor = constructor; this.resolved = true; }
private static bool IsVarArgCallTo (MethodDefinition method, MethodReference reference) { if (method.Parameters.Count >= reference.Parameters.Count) return false; if (reference.GetSentinelPosition () != method.Parameters.Count) return false; for (int i = 0; i < method.Parameters.Count; i++) if (!AreSame (method.Parameters [i].ParameterType, reference.Parameters [i].ParameterType)) return false; return true; }
public static MethodDefinition GetMethod (Collection<MethodDefinition> methods, MethodReference reference) { for (int i = 0; i < methods.Count; i++) { var method = methods [i]; if (method.Name != reference.Name) continue; if (method.HasGenericParameters != reference.HasGenericParameters) continue; if (method.HasGenericParameters && method.GenericParameters.Count != reference.GenericParameters.Count) continue; if (!AreSame (method.ReturnType, reference.ReturnType)) continue; if (method.IsVarArg () != reference.IsVarArg ()) continue; if (method.IsVarArg () && IsVarArgCallTo (method, reference)) return method; if (method.HasParameters != reference.HasParameters) continue; if (!method.HasParameters && !reference.HasParameters) return method; if (!AreSame (method.Parameters, reference.Parameters)) continue; return method; } return null; }
MethodDefinition GetMethod (TypeDefinition type, MethodReference reference) { while (type != null) { var method = GetMethod (type.Methods, reference); if (method != null) return method; if (type.BaseType == null) return null; type = Resolve (type.BaseType); } return null; }
public virtual MethodDefinition Resolve (MethodReference method) { if (method == null) throw new ArgumentNullException ("method"); var type = Resolve (method.DeclaringType); if (type == null) return null; method = method.GetElementMethod (); if (!type.HasMethods) return null; return GetMethod (type, method); }
internal CallSite() { this.signature = new MethodReference (); this.signature.token = new MetadataToken (TokenType.Signature, 0); }