private static MultiValueDictionary<DocumentId, ClassDeclarationSyntax> GetDocumentIdClassDeclarationMapping( IEnumerable<ClassDeclarationSyntax> classDeclarations, Solution currentSolution) { var mapping = new MultiValueDictionary<DocumentId, ClassDeclarationSyntax>(); foreach (var classDeclaration in classDeclarations) { var documentId = currentSolution.GetDocument(classDeclaration.SyntaxTree).Id; mapping.AddWithKey(documentId, classDeclaration); } return mapping; }
private static void CollectDisposeMethodsCalledFromDispose(InvocationExpressionSyntax invocationExpression, SemanticModel semanticModel, INamedTypeSymbol disposableType, MultiValueDictionary <INamedTypeSymbol, IMethodSymbol> disposeMethodsCalledFromDispose) { var invokedMethod = semanticModel.GetSymbolInfo(invocationExpression).Symbol as IMethodSymbol; if (invokedMethod == null || invokedMethod.Name != DisposeMethodName || !disposableType.Equals(invokedMethod.ContainingType)) { return; } disposeMethodsCalledFromDispose.AddWithKey(disposableType, invokedMethod); }
private static void CollectDisposeMethodsCalledFromDispose(InvocationExpressionSyntax invocationExpression, SemanticModel semanticModel, INamedTypeSymbol disposableType, MultiValueDictionary<INamedTypeSymbol, IMethodSymbol> disposeMethodsCalledFromDispose) { var invokedMethod = semanticModel.GetSymbolInfo(invocationExpression).Symbol as IMethodSymbol; if (invokedMethod == null || invokedMethod.Name != DisposeMethodName || !disposableType.Equals(invokedMethod.ContainingType)) { return; } disposeMethodsCalledFromDispose.AddWithKey(disposableType, invokedMethod); }
private static MultiValueDictionary<DocumentId, ClassDeclarationSyntax> GetDocumentIdClassDeclarationMapping( List<ClassDeclarationSyntax> classDeclarations, Solution currentSolution) { var mapping = new MultiValueDictionary<DocumentId, ClassDeclarationSyntax>(); foreach (var classDeclaration in classDeclarations) { var documentId = currentSolution.GetDocument(classDeclaration.SyntaxTree).Id; mapping.AddWithKey(documentId, classDeclaration); } return mapping; }