public static void AnalyzeXmlCrefAttribute(SyntaxNodeAnalysisContext context)
        {
            var xmlCrefAttribute = (XmlCrefAttributeSyntax)context.Node;

            CrefSyntax cref = xmlCrefAttribute.Cref;

            switch (cref?.Kind())
            {
            case SyntaxKind.NameMemberCref:
            {
                Analyze(context, cref, (NameMemberCrefSyntax)cref);
                break;
            }

            case SyntaxKind.QualifiedCref:
            {
                var qualifiedCref = (QualifiedCrefSyntax)cref;

                MemberCrefSyntax memberCref = qualifiedCref.Member;

                if (memberCref?.IsKind(SyntaxKind.NameMemberCref) != true)
                {
                    break;
                }

                Analyze(context, cref, (NameMemberCrefSyntax)memberCref);
                break;
            }
            }
        }
Esempio n. 2
0
        internal static void AnalyzeXmlCrefAttribute(SyntaxNodeAnalysisContext context)
        {
            var xmlCrefAttribute = (XmlCrefAttributeSyntax)context.Node;

            CrefSyntax cref = xmlCrefAttribute.Cref;

            switch (cref?.Kind())
            {
            case SyntaxKind.NameMemberCref:
            {
                var nameMemberCref = (NameMemberCrefSyntax)cref;

                TypeSyntax name = nameMemberCref.Name;

                if (name?.IsKind(SyntaxKind.PredefinedType) == false &&
                    IsFixable(context, name))
                {
                    ReportDiagnostic(context, cref);
                }

                break;
            }

            case SyntaxKind.QualifiedCref:
            {
                var qualifiedCref = (QualifiedCrefSyntax)cref;

                MemberCrefSyntax memberCref = qualifiedCref.Member;

                if (memberCref?.IsKind(SyntaxKind.NameMemberCref) == true)
                {
                    var nameMemberCref = (NameMemberCrefSyntax)memberCref;

                    TypeSyntax name = nameMemberCref.Name;

                    if (name != null &&
                        IsFixable(context, name))
                    {
                        ReportDiagnostic(context, cref);
                    }
                }

                break;
            }
            }
        }