static bool AllowsHelper(string baseClass, string methodName, IReturnType resolvedType, IProjectContent content) { IClass extensions = content.GetClass("System.Xml.Linq.Extensions", 0); if (extensions == null) { return(false); } IMethod descendents = extensions.Methods.FirstOrDefault(m => m.Name == methodName); if (descendents == null) { return(false); } IParameter param = descendents.Parameters.FirstOrDefault(); if (param == null) { return(false); } IClass resolvedTypeClass = resolvedType.GetUnderlyingClass(); if (resolvedTypeClass == null) { return(false); } return(MemberLookupHelper.IsApplicable(resolvedType, param, descendents) || resolvedTypeClass.IsTypeInInheritanceTree(content.GetClass(baseClass, 0))); }
void CheckApplicability() { LogStep("Step 3 (CheckApplicability)"); foreach (Candidate candidate in candidates) { int c = Math.Min(arguments.Count, candidate.Parameters.Count); for (int i = 0; i < c; i++) { if (MemberLookupHelper.IsApplicable(arguments[i], candidate.Parameters[i], candidate.Method as IMethod)) { candidate.ApplicableArgumentCount++; } } if (candidate.Status == CandidateStatus.Success && candidate.ApplicableArgumentCount < arguments.Count) { candidate.Status = CandidateStatus.NotApplicable; } } }
bool IsApplicable(IReturnType argument, IReturnType expected) { return(MemberLookupHelper.IsApplicable(argument, expected, methodForGenericCalls)); }