private static INamespaceOrTypeSymbol CreateCodeGenerationSymbol( Document document, ISymbol symbol ) { symbol = symbol.GetOriginalUnreducedDefinition(); var topLevelNamespaceSymbol = symbol.ContainingNamespace; var topLevelNamedType = MetadataAsSourceHelpers.GetTopLevelContainingNamedType(symbol); var canImplementImplicitly = document.GetLanguageService <ISemanticFactsService>().SupportsImplicitInterfaceImplementation; var docCommentFormattingService = document.GetLanguageService <IDocumentationCommentFormattingService>(); INamespaceOrTypeSymbol wrappedType = new WrappedNamedTypeSymbol( topLevelNamedType, canImplementImplicitly, docCommentFormattingService ); return(topLevelNamespaceSymbol.IsGlobalNamespace ? wrappedType : CodeGenerationSymbolFactory.CreateNamespaceSymbol( topLevelNamespaceSymbol.ToDisplayString(SymbolDisplayFormats.NameFormat), null, new[] { wrappedType } )); }
private static INamespaceOrTypeSymbol CreateCodeGenerationSymbol(Document document, ISymbol symbol) { symbol = symbol.GetOriginalUnreducedDefinition(); var topLevelNamespaceSymbol = symbol.ContainingNamespace; var topLevelNamedType = MetadataAsSourceHelpers.GetTopLevelContainingNamedType(symbol); var canImplementImplicitly = document.GetLanguageService<ISemanticFactsService>().SupportsImplicitInterfaceImplementation; var docCommentFormattingService = document.GetLanguageService<IDocumentationCommentFormattingService>(); INamespaceOrTypeSymbol wrappedType = new WrappedNamedTypeSymbol(topLevelNamedType, canImplementImplicitly, docCommentFormattingService); return topLevelNamespaceSymbol.IsGlobalNamespace ? wrappedType : CodeGenerationSymbolFactory.CreateNamespaceSymbol( topLevelNamespaceSymbol.ToDisplayString(SymbolDisplayFormats.NameFormat), null, new[] { wrappedType }); }