Ejemplo n.º 1
0
        public override MetadataItem DefaultVisit(ISymbol symbol)
        {
            if (!VisitorHelper.CanVisit(symbol))
            {
                return(null);
            }
            var item = new MetadataItem
            {
                Name       = VisitorHelper.GetId(symbol),
                RawComment = symbol.GetDocumentationCommentXml(),
                Language   = Language,
            };

            item.DisplayNames          = new SortedList <SyntaxLanguage, string>();
            item.DisplayQualifiedNames = new SortedList <SyntaxLanguage, string>();
            item.Source = VisitorHelper.GetSourceDetail(symbol);
            var assemblyName = symbol.ContainingAssembly?.Name;

            item.AssemblyNameList = string.IsNullOrEmpty(assemblyName) ? null : new List <string> {
                assemblyName
            };
            if (!(symbol is INamespaceSymbol))
            {
                var namespaceName = VisitorHelper.GetId(symbol.ContainingNamespace);
                item.NamespaceName = string.IsNullOrEmpty(namespaceName) ? null : namespaceName;
            }

            VisitorHelper.FeedComments(item, GetTripleSlashCommentParserContext(item, _preserveRawInlineComments));
            if (item.Exceptions != null)
            {
                foreach (var exceptions in item.Exceptions)
                {
                    AddReference(exceptions.Type);
                }
            }

            if (item.Sees != null)
            {
                foreach (var i in item.Sees)
                {
                    AddReference(i.Type);
                }
            }

            if (item.SeeAlsos != null)
            {
                foreach (var i in item.SeeAlsos)
                {
                    AddReference(i.Type);
                }
            }

            _generator.DefaultVisit(symbol, item, this);
            return(item);
        }