Exemplo n.º 1
0
        public override void VisitGenericName(GenericNameSyntax node)
        {
            if (node.IsKind(SyntaxKind.GenericName) && TrySimplify(node))
            {
                // found a match. report it and stop processing.
                return;
            }

            // descend further.
            DefaultVisit(node);
        }
        private void Handle(string identifier, Location location, GenericNameSyntax genericName, SyntaxNodeAnalysisContext context)
        {
            // Leave if type is in nullable form
            if (genericName.IsKind(SyntaxKind.NullableType))
            {
                return;
            }

            var genericType = context.SemanticModel.GetTypeInfo(genericName);

            if (genericType.Type?.MetadataName == "Nullable`1")
            {
                context.ReportDiagnostic(Diagnostic.Create(Rule, location, identifier));
            }
        }
        public override void VisitGenericName(GenericNameSyntax node)
        {
            if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false)
            {
                return;
            }

            if (node.IsKind(SyntaxKind.GenericName) && TrySimplify(node))
            {
                // found a match. report it and stop processing.
                return;
            }

            // descend further.
            DefaultVisit(node);
        }