private void AnalyzeMethodBody(OperationAnalysisContext context) { var method = (IMethodSymbol)context.ContainingSymbol; var methodBody = (IMethodBodyOperation)context.Operation; MethodBodyAnalyzer.Run(context.ReportDiagnostic, context.Compilation, _asyncUtilities, method, methodBody.BlockBody ?? methodBody.ExpressionBody); }
private void AnalyzeAnonymousFunction(OperationAnalysisContext context) { var operation = (IAnonymousFunctionOperation)context.Operation; var method = operation.Symbol; if (method.ContainingSymbol.Kind != SymbolKind.Method) { MethodBodyAnalyzer.Run(context.ReportDiagnostic, context.Compilation, _asyncUtilities, method, operation.Body); } }
private void AnalyzeArrowExpressionClause(SyntaxNodeAnalysisContext context) { if (!(context.ContainingSymbol is IMethodSymbol method) || method.MethodKind != MethodKind.PropertyGet) { return; } var operation = context.SemanticModel.GetOperation(context.Node, context.CancellationToken); if (operation is IBlockOperation block && block.Parent == null) { MethodBodyAnalyzer.Run(context.ReportDiagnostic, context.Compilation, _asyncUtilities, method, block); } }