Exemplo n.º 1
0
        void checksymboliswhitelisted(SyntaxNodeAnalysisContext context, ISymbol symbol)
        {
            if (symbol.IsMemberSymbol())
            {
                if (whitelist.memberiswhitelisted(symbol) == false)
                {
                    var diagnostic2 = Diagnostic.Create(
                        descriptors.whateverError,
                        context.Node.GetLocation(),
                        symbol.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat));

                    context.ReportDiagnostic(diagnostic2);
                    return;
                }
            }

            if (symbol.Kind == SymbolKind.NamedType)
            {
                var namedtypesymbol = symbol as INamedTypeSymbol;

                if (whitelist.typeiswhitelisted(namedtypesymbol) == false)
                {
                    var diagnostic2 = Diagnostic.Create(
                        descriptors.whateverError,
                        context.Node.GetLocation(),
                        symbol.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat));

                    context.ReportDiagnostic(diagnostic2);
                    return;
                }
            }
        }