bool CompareMethod(IMethod method, BabelMethodreference babelMethodRef) { var sig = method.MethodSig; if (sig.Params.Count != babelMethodRef.Parameters.Length) { return(false); } if (method.Name != babelMethodRef.Name) { return(false); } if (sig.HasThis != babelMethodRef.HasThis) { return(false); } if (sig.GenParamCount != babelMethodRef.GenericArguments.Length) { return(false); } if (!new SigComparer().Equals(sig.RetType, babelMethodRef.ReturnType)) { return(false); } for (int i = 0; i < babelMethodRef.Parameters.Length; i++) { if (!new SigComparer().Equals(sig.Params[i], babelMethodRef.Parameters[i].Type)) { return(false); } } return(true); }
public MethodReferenceReader(ImageReader imageReader, BinaryReader reader, BabelMethodreference bmr) { this.imageReader = imageReader; this.reader = reader; this.bmr = bmr; }
List<MethodReference> getMethods(TypeDefinition declaringType, BabelMethodreference babelMethodRef) { var methods = new List<MethodReference>(); var git = babelMethodRef.DeclaringType as GenericInstanceType; IGenericInstance gim = babelMethodRef.IsGenericMethod ? babelMethodRef : null; foreach (var method in declaringType.Methods) { if (compareMethod(MethodReferenceInstance.make(method, git, gim), babelMethodRef)) { if (!babelMethodRef.IsGenericMethod) methods.Add(memberReferenceConverter.convert(method)); else { var gim2 = new GenericInstanceMethod(memberReferenceConverter.convert(method)); foreach (var arg in babelMethodRef.GenericArguments) gim2.GenericArguments.Add(arg); methods.Add(gim2); } } } return methods; }
MethodReference getMethodReference(BabelMethodreference babelMethodRef) { var declaringType = resolve(babelMethodRef.DeclaringType); if (declaringType == null) return null; var methods = getMethods(declaringType, babelMethodRef); if (methods.Count != 1) { throw new ApplicationException(string.Format("Couldn't find one method named '{0}' in type {1}", babelMethodRef.Name, Utils.removeNewlines(declaringType))); } return methods[0]; }
bool compareMethod(MethodReference method, BabelMethodreference babelMethodRef) { if (method.Parameters.Count != babelMethodRef.Parameters.Length) return false; if (method.Name != babelMethodRef.Name) return false; if (method.HasThis != babelMethodRef.HasThis) return false; if (method.GenericParameters.Count != babelMethodRef.GenericArguments.Length) return false; if (!MemberReferenceHelper.compareTypes(method.MethodReturnType.ReturnType, babelMethodRef.ReturnType)) return false; for (int i = 0; i < babelMethodRef.Parameters.Length; i++) { if (!MemberReferenceHelper.compareTypes(method.Parameters[i].ParameterType, babelMethodRef.Parameters[i].ParameterType)) return false; } return true; }
bool CompareMethod(IMethod method, BabelMethodreference babelMethodRef) { var sig = method.MethodSig; if (sig.Params.Count != babelMethodRef.Parameters.Length) return false; if (method.Name != babelMethodRef.Name) return false; if (sig.HasThis != babelMethodRef.HasThis) return false; if (sig.GenParamCount != babelMethodRef.GenericArguments.Length) return false; if (!new SigComparer().Equals(sig.RetType, babelMethodRef.ReturnType)) return false; for (int i = 0; i < babelMethodRef.Parameters.Length; i++) { if (!new SigComparer().Equals(sig.Params[i], babelMethodRef.Parameters[i].Type)) return false; } return true; }
List<IMethod> GetMethods(TypeDef declaringType, BabelMethodreference babelMethodRef) { var methods = new List<IMethod>(); var gis = babelMethodRef.DeclaringType as GenericInstSig; var gim = babelMethodRef.GenericArguments; foreach (var method in declaringType.Methods) { if (CompareMethod(GenericArgsSubstitutor.Create(method, gis, gim), babelMethodRef)) { if (!babelMethodRef.IsGenericMethod) methods.Add(memberRefConverter.Convert(method)); else { var gim2 = new GenericInstMethodSig(babelMethodRef.GenericArguments); var ms = module.UpdateRowId(new MethodSpecUser(memberRefConverter.Convert(method), gim2)); methods.Add(ms); } } } return methods; }
public MethodRefReader(ImageReader imageReader, IBinaryReader reader, BabelMethodreference bmr) { this.imageReader = imageReader; this.reader = reader; this.bmr = bmr; }