public void EMBED0009()
 {
     DiagnosticDescriptors.EMBED0009_UsingStaticDirective(Location.None)
         .GetMessage(formatProvider)
         .Should()
         .Be("Avoid using static directive because there is a risk of name collision");
 }
Exemplo n.º 2
0
 public void EMBED0009()
 {
     DiagnosticDescriptors.EMBED0009_UsingStaticDirective(Location.None)
     .GetMessage(formatProvider)
     .Should()
     .Be("名前衝突の危険があるため using static ディレクティブは非推奨です");
 }
        public override SyntaxNode?VisitUsingDirective(UsingDirectiveSyntax node)
        {
            if (node.Parent.IsKind(SyntaxKind.CompilationUnit))
            {
                Diagnostic diagnostic;
                if (node.StaticKeyword.IsKind(SyntaxKind.StaticKeyword))
                {
                    diagnostic = DiagnosticDescriptors.EMBED0009_UsingStaticDirective(node.GetLocation());
                }
                else if (node.Alias != null)
                {
                    diagnostic = DiagnosticDescriptors.EMBED0010_UsingAliasDirective(node.GetLocation());
                }
                else
                {
                    goto Fin;
                }

                reporter.ReportDiagnostic(diagnostic);
            }
            Fin : return(base.VisitUsingDirective(node));
        }