2 overrides of GetAccessibility
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
1398
public override Accessibility
GetAccessibility
(SyntaxNode declaration)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
2508
Public Overrides Function
GetAccessibility
(declaration As SyntaxNode) As Accessibility
99 references to GetAccessibility
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
35
return generator.
GetAccessibility
(declaration) == Accessibility.NotApplicable
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (47)
CodeGeneration\SyntaxGeneratorTests.cs (47)
2943
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal)));
2944
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.StructDeclaration("s", accessibility: Accessibility.Internal)));
2945
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal)));
2946
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal)));
2947
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal)));
2948
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal)));
2949
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal)));
2950
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.ParameterDeclaration("p")));
2951
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal)));
2953
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal)));
2954
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.EnumMember("v")));
2955
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal)));
2956
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal)));
2957
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.NamespaceDeclaration("n")));
2958
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.NamespaceImportDeclaration("u")));
2959
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc")));
2960
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.Attribute("a")));
2961
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(TypeParameter("tp")));
2967
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal), Accessibility.Private)));
2968
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal), Accessibility.Private)));
2969
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal), Accessibility.Private)));
2970
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal), Accessibility.Private)));
2971
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal), Accessibility.Private)));
2972
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal), Accessibility.Private)));
2973
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal), Accessibility.Private)));
2974
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.ParameterDeclaration("p"), Accessibility.Private)));
2975
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private)));
2977
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private)));
2978
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EnumMember("v"), Accessibility.Private)));
2979
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private)));
2980
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private)));
2981
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.NamespaceDeclaration("n"), Accessibility.Private)));
2982
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private)));
2983
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Accessibility.Private)));
2984
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.Attribute("a"), Accessibility.Private)));
2985
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(TypeParameter("tp"), Accessibility.Private)));
2986
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(AccessorDeclaration(SyntaxKind.InitAccessorDeclaration), Accessibility.Private)));
3362
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(getAccessor));
3367
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(setAccessor));
3374
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(Generator.WithAccessibility(getAccessor, Accessibility.Public)));
3375
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(setAccessor, Accessibility.Private)));
3393
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(Generator.GetAccessor(newProp, DeclarationKind.GetAccessor)));
3396
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(Generator.GetAccessor(newProp, DeclarationKind.SetAccessor)));
3799
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(declX));
3805
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(declY));
3811
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(declZ));
3832
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(xPrivate));
Microsoft.CodeAnalysis.Features (1)
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
35
return generator.
GetAccessibility
(declaration) == Accessibility.NotApplicable
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (50)
CodeGeneration\SyntaxGeneratorTests.vb (50)
2641
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.ClassDeclaration("c", accessibility:=Accessibility.Internal)))
2642
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.StructDeclaration("s", accessibility:=Accessibility.Internal)))
2643
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.InterfaceDeclaration("i", accessibility:=Accessibility.Internal)))
2644
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.EnumDeclaration("e", accessibility:=Accessibility.Internal)))
2645
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.DelegateDeclaration("d", accessibility:=Accessibility.Internal)))
2646
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.MethodDeclaration("m", accessibility:=Accessibility.Internal)))
2647
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.ConstructorDeclaration(accessibility:=Accessibility.Internal)))
2648
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.ParameterDeclaration("p")))
2649
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal)))
2650
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.IndexerDeclaration({Generator.ParameterDeclaration("i")}, Generator.IdentifierName("t"), accessibility:=Accessibility.Internal)))
2651
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal)))
2652
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.EnumMember("v")))
2653
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal)))
2654
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal)))
2655
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.NamespaceDeclaration("n")))
2656
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.NamespaceImportDeclaration("u")))
2657
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc")))
2658
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.Attribute("a")))
2659
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(SyntaxFactory.TypeParameter("tp")))
2664
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(m))
2669
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.ClassDeclaration("c", accessibility:=Accessibility.Internal), Accessibility.Private)))
2670
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.StructDeclaration("s", accessibility:=Accessibility.Internal), Accessibility.Private)))
2671
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EnumDeclaration("i", accessibility:=Accessibility.Internal), Accessibility.Private)))
2672
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EnumDeclaration("e", accessibility:=Accessibility.Internal), Accessibility.Private)))
2673
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.DelegateDeclaration("d", accessibility:=Accessibility.Internal), Accessibility.Private)))
2674
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.MethodDeclaration("m", accessibility:=Accessibility.Internal), Accessibility.Private)))
2675
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.ConstructorDeclaration(accessibility:=Accessibility.Internal), Accessibility.Private)))
2676
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.ParameterDeclaration("p"), Accessibility.Private)))
2677
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal), Accessibility.Private)))
2678
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.IndexerDeclaration({Generator.ParameterDeclaration("i")}, Generator.IdentifierName("t"), accessibility:=Accessibility.Internal), Accessibility.Private)))
2679
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal), Accessibility.Private)))
2680
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EnumMember("v"), Accessibility.Private)))
2681
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal), Accessibility.Private)))
2682
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal), Accessibility.Private)))
2683
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.NamespaceDeclaration("n"), Accessibility.Private)))
2684
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private)))
2685
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Accessibility.Private)))
2686
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(Generator.Attribute("a"), Accessibility.Private)))
2687
Assert.Equal(Accessibility.NotApplicable, Generator.
GetAccessibility
(Generator.WithAccessibility(SyntaxFactory.TypeParameter("tp"), Accessibility.Private)))
2692
Assert.Equal(Accessibility.Internal, Generator.
GetAccessibility
(Generator.WithAccessibility(m, Accessibility.Internal)))
3066
Assert.Equal(Accessibility.NotApplicable, _g.
GetAccessibility
(getAccessor))
3071
Assert.Equal(Accessibility.NotApplicable, _g.
GetAccessibility
(setAccessor))
3078
Assert.Equal(Accessibility.Public, _g.
GetAccessibility
(_g.WithAccessibility(getAccessor, Accessibility.Public)))
3079
Assert.Equal(Accessibility.Private, _g.
GetAccessibility
(_g.WithAccessibility(setAccessor, Accessibility.Private)))
3092
Assert.Equal(Accessibility.Public, _g.
GetAccessibility
(_g.GetAccessor(newProp, DeclarationKind.GetAccessor)))
3095
Assert.Equal(Accessibility.Public, _g.
GetAccessibility
(_g.GetAccessor(newProp, DeclarationKind.SetAccessor)))
3490
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(declX))
3496
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(declY))
3502
Assert.Equal(Accessibility.Public, Generator.
GetAccessibility
(declZ))
3523
Assert.Equal(Accessibility.Private, Generator.
GetAccessibility
(xPrivate))