Exemplo n.º 1
0
        public override void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
        {
            node.Cref?.Accept(this);
            node.Name?.Accept(this);

            base.VisitXmlCrefAttribute(node);
        }
Exemplo n.º 2
0
        public override Evaluation VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
        {
            node.Cref?.Accept <Evaluation>(this);
            node.Name?.Accept <Evaluation>(this);

            return(base.VisitXmlCrefAttribute(node));
        }
        private bool SeeTagIsCorrect(XmlEmptyElementSyntax classReferencePart, BaseMethodDeclarationSyntax constructorDeclarationSyntax)
        {
            if (classReferencePart.Name.ToString() == XmlCommentHelper.SeeXmlTag)
            {
                XmlCrefAttributeSyntax crefAttribute = classReferencePart.Attributes.OfType <XmlCrefAttributeSyntax>().FirstOrDefault();

                if (crefAttribute != null)
                {
                    NameMemberCrefSyntax nameMember = crefAttribute.Cref as NameMemberCrefSyntax;

                    if (nameMember != null && nameMember.Parameters == null)
                    {
                        ClassDeclarationSyntax classDeclarationSyntax = constructorDeclarationSyntax.FirstAncestorOrSelf <ClassDeclarationSyntax>();

                        if (classDeclarationSyntax != null &&
                            classDeclarationSyntax.Identifier.ToString() == this.GetName(nameMember.Name))
                        {
                            // Check if type parameters are called the same
                            if (TypeParameterNamesMatch(classDeclarationSyntax, nameMember.Name))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
Exemplo n.º 4
0
            public override SyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
            {
                string existingName = node.Cref.ToString();

                return(existingName == _oldTypeName
                    ? node.WithCref(SyntaxFactory.NameMemberCref(SyntaxFactory.ParseName(_newTypeName)))
                    : node);
            }
Exemplo n.º 5
0
        private void FormatTagCrefAttribute(XmlCrefAttributeSyntax node)
        {
            EnqueueTrailingTriviaChange(node.StartQuoteToken, string.Empty);

            EnqueueLeadingTriviaChange(node.Cref, string.Empty);

            AddWord(node.Cref.Span);

            EnqueueTrailingTriviaChange(node.Cref, string.Empty);

            EnqueueLeadingTriviaChange(node.EndQuoteToken, string.Empty);
        }
Exemplo n.º 6
0
        public override void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
        {
            if (!PreVisit(node))
            {
                return;
            }

            node.Cref?.Accept(this);
            node.Name?.Accept(this);

            base.VisitXmlCrefAttribute(node);

            PostVisit(node);
        }
        private static bool SeeTagIsCorrect(SyntaxNodeAnalysisContext context, XmlEmptyElementSyntax classReferencePart, BaseMethodDeclarationSyntax constructorDeclarationSyntax)
        {
            XmlCrefAttributeSyntax crefAttribute = XmlCommentHelper.GetFirstAttributeOrDefault <XmlCrefAttributeSyntax>(classReferencePart);
            CrefSyntax             crefSyntax    = crefAttribute?.Cref;

            if (crefAttribute == null)
            {
                return(false);
            }

            SemanticModel semanticModel = context.SemanticModel;

            if (!(semanticModel.GetSymbolInfo(crefSyntax, context.CancellationToken).Symbol is INamedTypeSymbol actualSymbol))
            {
                return(false);
            }

            INamedTypeSymbol expectedSymbol = semanticModel.GetDeclaredSymbol(constructorDeclarationSyntax.Parent, context.CancellationToken) as INamedTypeSymbol;

            return(Equals(actualSymbol.OriginalDefinition, expectedSymbol));
        }
            public override void DefaultVisit(SyntaxNode node)
            {
                SyntaxKind nodeKind = node.Kind();
                bool       diagnose = node.SyntaxTree.ReportDocumentationCommentDiagnostics();

                if (nodeKind == SyntaxKind.XmlCrefAttribute)
                {
                    XmlCrefAttributeSyntax crefAttr = (XmlCrefAttributeSyntax)node;
                    CrefSyntax             cref     = crefAttr.Cref;

                    BinderFactory factory = _compilation.GetBinderFactory(cref.SyntaxTree);
                    Binder        binder  = factory.GetBinder(cref);

                    // Do this for the diagnostics, even if it won't be written.
                    DiagnosticBag crefDiagnostics = DiagnosticBag.GetInstance();
                    string        docCommentId    = GetDocumentationCommentId(cref, binder, crefDiagnostics);
                    if (diagnose)
                    {
                        _diagnostics.AddRange(crefDiagnostics);
                    }
                    crefDiagnostics.Free();

                    if (_writer != null)
                    {
                        Visit(crefAttr.Name);
                        VisitToken(crefAttr.EqualsToken);

                        // Not going to visit normally, because we want to skip trivia within
                        // the attribute value.
                        crefAttr.StartQuoteToken.WriteTo(_writer, leading: true, trailing: false);

                        // We're not going to visit the cref because we want to bind it
                        // and write a doc comment ID in its place.
                        _writer.Write(docCommentId);

                        // Not going to visit normally, because we want to skip trivia within
                        // the attribute value.
                        crefAttr.EndQuoteToken.WriteTo(_writer, leading: false, trailing: true);
                    }

                    // Don't descend - we've already written out everything necessary.
                    return;
                }
                else if (diagnose && nodeKind == SyntaxKind.XmlNameAttribute)
                {
                    XmlNameAttributeSyntax nameAttr = (XmlNameAttributeSyntax)node;

                    BinderFactory factory = _compilation.GetBinderFactory(nameAttr.SyntaxTree);
                    Binder        binder  = factory.GetBinder(nameAttr, nameAttr.Identifier.SpanStart);

                    // Do this for diagnostics, even if we aren't writing.
                    BindName(nameAttr, binder, _memberSymbol, ref _documentedParameters, ref _documentedTypeParameters, _diagnostics);

                    // Do descend - we still need to write out the tokens of the attribute.
                }

                // NOTE: if we're recording any include element nodes (i.e. if includeElementsNodes is non-null),
                // then we want to record all of them, because we won't be able to distinguish in the XML DOM.
                if (_includeElementNodes != null)
                {
                    XmlNameSyntax nameSyntax = null;
                    if (nodeKind == SyntaxKind.XmlEmptyElement)
                    {
                        nameSyntax = ((XmlEmptyElementSyntax)node).Name;
                    }
                    else if (nodeKind == SyntaxKind.XmlElementStartTag)
                    {
                        nameSyntax = ((XmlElementStartTagSyntax)node).Name;
                    }

                    if (nameSyntax != null && nameSyntax.Prefix == null &&
                        DocumentationCommentXmlNames.ElementEquals(nameSyntax.LocalName.ValueText, DocumentationCommentXmlNames.IncludeElementName))
                    {
                        _includeElementNodes.Add((CSharpSyntaxNode)node);
                    }
                }

                base.DefaultVisit(node);
            }
Exemplo n.º 9
0
 public override void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 public override void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
 }
 public override void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
     return;  //To prevent coloring in XML comments don't call base method
 }
 //
 // Summary:
 //     Called when the visitor visits a XmlCrefAttributeSyntax node.
 public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node);
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
     this.OnNodeVisited(node, this.type.IsInstanceOfType(node));
     base.VisitXmlCrefAttribute(node);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
     this.OnNodeVisited(node);
     if (!this.traverseRootOnly) base.VisitXmlCrefAttribute(node);
 }
 public override SyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
     node = (XmlCrefAttributeSyntax)base.VisitXmlCrefAttribute(node);
     Classes.Add(node);
     return(node);
 }
Exemplo n.º 16
0
 public override void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
 {
     Debug.Fail(node.ToString());
     base.VisitXmlCrefAttribute(node);
 }
 public TameXmlCrefAttributeSyntax(XmlCrefAttributeSyntax node)
 {
     Node = node;
     AddChildren();
 }