public static IEnumerable <MethodRef> FindMethodsInvokedIn(MethodRef ep) { var eps = new HashSet <MethodRef>(); var declarationHasBody = !ep.Declaration.IsAbstract; var isInvalid = !ep.Declaration.IsAbstract && ep.Declaration.Body == null; if (declarationHasBody && !isInvalid) { ep.Declaration.Body.Accept(new InvocationCollector(), eps); } return(eps); }
// TODO Quality: Move hierarchy juggling to ReSharperUtils public static IMethodName GetFirstDeclaration(this MethodRef self) { if (self.Method != null) { var hierarchy = self.Method.CollectDeclarationInfo <IMethodName, MethodHierarchy>(self.Name); if (hierarchy.First == null && hierarchy.Super != null) { return(hierarchy.Super); } if (hierarchy.First != null) { return(hierarchy.First); } } return(self.Name); }
private void ReallyAnalyzeTransitiveCallsIn(MethodRef ep) { _analyzed.Add(ep); foreach (var method in ReSharperUtils.FindMethodsInvokedIn(ep)) { if (IsNotAnalyzed(method) && !method.IsAssemblyReference) { AnalyzeTransitiveCallsIn(method); } else { var isSimpleRecursion = method.Equals(ep); if (IsEntryPoint(method) && !IsDefiniteEntryPoint(method.Name) && !isSimpleRecursion) { _entryPoints.Remove(method); } } } }
private static MethodRef CreateRef(IConstructorDeclaration cd) { return(MethodRef.CreateConstructorReference(cd.GetName(), cd.DeclaredElement, cd)); }
private static MethodRef CreateRef(IMethodDeclaration md) { return(MethodRef.CreateLocalReference(md.GetName(), md.DeclaredElement, md)); }
private bool IsNotAnalyzed(MethodRef ep2) { return(!_analyzed.Contains(ep2)); }
private bool IsEntryPoint(MethodRef ep) { return(_entryPoints.Contains(ep)); }
private bool Equals(MethodRef other) { return(Equals(Name, other.Name) && Equals(Declaration, other.Declaration) && Equals(Method, other.Method) && (IsAssemblyReference == other.IsAssemblyReference)); }