Пример #1
0
        public override MetadataItem VisitAssembly(IAssemblySymbol symbol)
        {
            var item = new MetadataItem
            {
                Name       = VisitorHelper.GetId(symbol),
                RawComment = symbol.GetDocumentationCommentXml(),
                Language   = Language,
            };

            item.DisplayNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.DisplayQualifiedNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.Type   = MemberType.Assembly;
            _references = new Dictionary <string, ReferenceItem>();
            item.Items  = VisitDescendants(
                symbol.GlobalNamespace.GetNamespaceMembers(),
                ns => ns.GetMembers().OfType <INamespaceSymbol>(),
                ns => ns.GetMembers().OfType <INamedTypeSymbol>().Any(t => VisitorHelper.CanVisit(t)));
            item.References = _references;
            return(item);
        }
Пример #2
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);
        }
Пример #3
0
        public override void VisitField(IFieldSymbol symbol)
        {
            var id = VisitorHelper.GetId(symbol.OriginalDefinition);

            ReferenceItem.Parts[SyntaxLanguage.VB].Add(new LinkItem
            {
                DisplayName           = NameVisitorCreator.GetVB(NameOptions.WithGenericParameter).GetName(symbol),
                DisplayQualifiedNames = NameVisitorCreator.GetVB(NameOptions.Qualified | NameOptions.WithGenericParameter).GetName(symbol),
                Name           = id,
                IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
            });
        }
Пример #4
0
        internal string AddReference(ISymbol symbol, Dictionary <string, ReferenceItem> references, SymbolVisitorAdapter adapter)
        {
            var id = VisitorHelper.GetId(symbol);

            ReferenceItem reference = new ReferenceItem();

            reference.Parts        = new SortedList <SyntaxLanguage, List <LinkItem> >();
            reference.IsDefinition = symbol.IsDefinition;
            GenerateReferenceInternal(symbol, reference, adapter);

            if (!references.ContainsKey(id))
            {
                references[id] = reference;
            }
            else
            {
                references[id].Merge(reference);
            }

            return(id);
        }
Пример #5
0
        public override void VisitProperty(IPropertySymbol symbol)
        {
            var id = VisitorHelper.GetId(symbol.OriginalDefinition);

            ReferenceItem.Parts[SyntaxLanguage.VB].Add(new LinkItem
            {
                DisplayName           = NameVisitorCreator.GetVB(NameOptions.WithGenericParameter).GetName(symbol),
                DisplayQualifiedNames = NameVisitorCreator.GetVB(NameOptions.Qualified | NameOptions.WithGenericParameter).GetName(symbol),
                Name           = id,
                IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
            });
            if (symbol.Parameters.Length > 0)
            {
                ReferenceItem.Parts[SyntaxLanguage.VB].Add(new LinkItem
                {
                    DisplayName           = "(",
                    DisplayQualifiedNames = "(",
                });
                for (int i = 0; i < symbol.Parameters.Length; i++)
                {
                    if (i > 0)
                    {
                        ReferenceItem.Parts[SyntaxLanguage.VB].Add(new LinkItem
                        {
                            DisplayName           = ", ",
                            DisplayQualifiedNames = ", ",
                        });
                    }
                    symbol.Parameters[i].Type.Accept(this);
                }
                ReferenceItem.Parts[SyntaxLanguage.VB].Add(new LinkItem
                {
                    DisplayName           = ")",
                    DisplayQualifiedNames = ")",
                });
            }
        }
Пример #6
0
 public override string DefaultVisit(ISymbol symbol)
 {
     return(VisitorHelper.GetId(symbol));
 }