private static void CheckForNoExitMethod(SyntaxNodeAnalysisContext c, CSharpSyntaxNode body, SyntaxToken identifier) { var symbol = c.SemanticModel.GetDeclaredSymbol(c.Node); if (symbol != null && body != null && CSharpControlFlowGraph.TryGet(body, c.SemanticModel, out var cfg)) { var walker = new CfgWalkerForMethod(new RecursionAnalysisContext(cfg, symbol, identifier.GetLocation(), c)); walker.CheckPaths(); CheckInfiniteJumpLoop(body, cfg, "method", c); } }
private static void CheckForNoExitMethod(SyntaxNodeAnalysisContext c) { var method = (MethodDeclarationSyntax)c.Node; var methodSymbol = c.SemanticModel.GetDeclaredSymbol(method); if (methodSymbol == null) { return; } if (CSharpControlFlowGraph.TryGet(method.Body, c.SemanticModel, out var cfg) || CSharpControlFlowGraph.TryGet(method.ExpressionBody?.Expression, c.SemanticModel, out cfg)) { var walker = new CfgWalkerForMethod( new RecursionAnalysisContext(cfg, methodSymbol, method.Identifier.GetLocation(), c)); walker.CheckPaths(); CheckInfiniteJumpLoop(method.Body, cfg, "method", c); } }
private static void CheckForNoExitMethod(SyntaxNodeAnalysisContext c) { var method = (MethodDeclarationSyntax)c.Node; var methodSymbol = c.SemanticModel.GetDeclaredSymbol(method); if (methodSymbol == null) { return; } IControlFlowGraph cfg; if (ControlFlowGraph.TryGet(method.Body, c.SemanticModel, out cfg) || ControlFlowGraph.TryGet(method.ExpressionBody?.Expression, c.SemanticModel, out cfg)) { var walker = new CfgWalkerForMethod( new RecursionAnalysisContext(cfg, methodSymbol, method.Identifier.GetLocation(), c)); walker.CheckPaths(); CheckInfiniteJumpLoop(method.Body, cfg, "method", c); } }