493 references to ClassDeclarationSyntax
IdeCoreBenchmarks (1)
IncrementalSourceGeneratorBenchmarks.cs (1)
130(n, _) => n is ClassDeclarationSyntax,
ILLink.CodeFixProvider (1)
BaseAttributeCodeFixProvider.cs (1)
116 case ClassDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.Class):
Microsoft.Analyzers.Extra (8)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (8)
134ClassDeclarationSyntax targetClass, 263private static async Task<(Solution solution, ClassDeclarationSyntax declarationSyntax, Document document)> 270var allClasses = allNodes.Where(d => d.IsKind(SyntaxKind.ClassDeclaration)).OfType<ClassDeclarationSyntax>(); 271foreach (var cl in allClasses) 329private static string GetNamespace(ClassDeclarationSyntax cl) 537ClassDeclarationSyntax targetClass; 571ClassDeclarationSyntax targetClass, 618private int CalcEventId(Compilation comp, ClassDeclarationSyntax targetClass, CancellationToken cancellationToken)
Microsoft.Analyzers.Extra.Tests (2)
CallAnalysis\LegacyLoggingTests.cs (2)
823var targetClass = targetRoot!.FindNode(RoslynTestUtils.MakeTextSpan(TargetSourceCode, 0)) as ClassDeclarationSyntax;
Microsoft.AspNetCore.App.Analyzers (2)
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (1)
136else if (attributeParent is ClassDeclarationSyntax classDeclarationSyntax)
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (1)
36return syntaxNode is ClassDeclarationSyntax { Modifiers: { } modifiers } classDeclaration
Microsoft.AspNetCore.App.CodeFixes (2)
PublicPartialProgramClassFixer.cs (2)
38var classDeclaration = root.FindNode(diagnostic.Location.SourceSpan) 39.FirstAncestorOrSelf<ClassDeclarationSyntax>();
Microsoft.AspNetCore.App.SourceGenerators (1)
PublicTopLevelProgramGenerator.cs (1)
34.Select(static (declaringSyntaxReference, cancellationToken) => declaringSyntaxReference?.GetSyntax(cancellationToken) is ClassDeclarationSyntax ? null : declaringSyntaxReference);
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (6)
HubClientProxyGenerator.Parser.cs (3)
31Parent: ClassDeclarationSyntax 118private static bool IsExtensionClassSignatureValid(ClassDeclarationSyntax syntax) 217if (!IsExtensionClassSignatureValid((ClassDeclarationSyntax)methodDeclarationSyntax.Parent))
HubServerProxyGenerator.Parser.cs (3)
31Parent: ClassDeclarationSyntax 108private static bool IsExtensionClassSignatureValid(ClassDeclarationSyntax syntax) 206if (!IsExtensionClassSignatureValid((ClassDeclarationSyntax)methodDeclarationSyntax.Parent))
Microsoft.CodeAnalysis.CSharp (11)
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
804public override Binder VisitClassDeclaration(ClassDeclarationSyntax node)
Binder\LocalBinderFactory.cs (1)
164public override void VisitClassDeclaration(ClassDeclarationSyntax node)
Declarations\DeclarationTreeBuilder.cs (2)
656public override SingleNamespaceOrTypeDeclaration VisitClassDeclaration(ClassDeclarationSyntax node) 700var hasPrimaryCtor = node.ParameterList != null && node is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax;
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
64case ClassDeclarationSyntax classDecl:
Syntax\ClassDeclarationSyntax.cs (1)
9public ClassDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
Syntax\SyntaxFactory.cs (5)
2857public static ClassDeclarationSyntax ClassDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) 2866public static ClassDeclarationSyntax ClassDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxList<MemberDeclarationSyntax> members) 2872public static ClassDeclarationSyntax ClassDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxList<MemberDeclarationSyntax> members) 2876public static ClassDeclarationSyntax ClassDeclaration(SyntaxToken identifier) 2880public static ClassDeclarationSyntax ClassDeclaration(string identifier)
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
53c => c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1090case ClassDeclarationSyntax @class:
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
247public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (18)
CodeGen\CodeGenTupleTest.cs (18)
20359var c1 = nodes.OfType<ClassDeclarationSyntax>().First(); 20364var c2 = nodes.OfType<ClassDeclarationSyntax>().Skip(1).First(); 20368var c3 = nodes.OfType<ClassDeclarationSyntax>().Skip(2).First(); 24259var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24322var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24386var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24459var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24532var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24606var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (12)
Semantics\PrimaryConstructorTests.cs (12)
1422var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1483var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1551var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1640var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 3882var @class = (ClassDeclarationSyntax)context.Node; 4829case ClassDeclarationSyntax { Identifier: { ValueText: "A" } }: 4840case ClassDeclarationSyntax { Identifier: { ValueText: "B" } }: 4974case ClassDeclarationSyntax { Identifier: { ValueText: "A" } }: 4985case ClassDeclarationSyntax { Identifier: { ValueText: "B" } }: 5042case ClassDeclarationSyntax { Identifier: { ValueText: "A" } }: 5053case ClassDeclarationSyntax { Identifier: { ValueText: "B" } }:
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (3)
EndToEndTests.cs (3)
820(node, _) => node is ClassDeclarationSyntax, 821(context, _) => (ClassDeclarationSyntax)context.TargetNode); 834step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C1" }));
Microsoft.CodeAnalysis.CSharp.Features (17)
CodeLens\CSharpCodeLensMemberFinder.cs (1)
43public override void VisitClassDeclaration(ClassDeclarationSyntax node)
CodeRefactorings\ExtractClass\CSharpExtractClassCodeRefactoringProvider.cs (1)
41var relaventNodes = await context.GetRelevantNodesAsync<ClassDeclarationSyntax>().ConfigureAwait(false);
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (6)
39var oldClassDeclaration = root.Members.OfType<ClassDeclarationSyntax>().FirstOrDefault(IsProgramClass); 63private static bool IsProgramClass(ClassDeclarationSyntax declaration) 69private static async Task<ClassDeclarationSyntax> GenerateProgramClassAsync( 71ClassDeclarationSyntax? oldClassDeclaration, 102return FixupComments((ClassDeclarationSyntax)generator.ClassDeclaration(
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
376public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
Organizing\Organizers\ClassDeclarationOrganizer.cs (3)
17internal class ClassDeclarationOrganizer : AbstractSyntaxNodeOrganizer<ClassDeclarationSyntax> 25protected override ClassDeclarationSyntax Organize( 26ClassDeclarationSyntax syntax,
Snippets\CSharpClassSnippetProvider.cs (3)
23internal sealed class CSharpClassSnippetProvider() : AbstractCSharpTypeSnippetProvider<ClassDeclarationSyntax> 45protected override async Task<ClassDeclarationSyntax> GenerateTypeDeclarationAsync(Document document, int position, CancellationToken cancellationToken) 51return (ClassDeclarationSyntax)generator.ClassDeclaration(name);
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>();
Structure\CSharpBlockStructureProvider.cs (1)
24builder.Add<ClassDeclarationSyntax, TypeDeclarationStructureProvider>();
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (19)
Diagnostics\Suppression\RemoveSuppressionTests.cs (2)
48var classDecl = (ClassDeclarationSyntax)context.Node;
Diagnostics\Suppression\SuppressionTest_FixMultipleTests.cs (2)
50var classDecl = (ClassDeclarationSyntax)context.Node;
Diagnostics\Suppression\SuppressionTests.cs (12)
708var classDecl = (ClassDeclarationSyntax)context.Node; 818var classDecl = (ClassDeclarationSyntax)context.Node; 881var classDecl = (ClassDeclarationSyntax)context.Node; 931var classDecl = (ClassDeclarationSyntax)context.Node; 1075var classDecl = (ClassDeclarationSyntax)context.Node; 2069var classDecl = (ClassDeclarationSyntax)context.Node;
EditAndContinue\Helpers\EditingTestBase.cs (3)
207var declaration = (BaseMethodDeclarationSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)root).Members[0]).Members[0]; 242var oldDeclaration = (MethodDeclarationSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)edits.Match.OldRoot).Members[0]).Members[0]; 246var newDeclaration = (MethodDeclarationSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)edits.Match.NewRoot).Members[0]).Members[0];
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (2)
IOperation\IOperationTests_IFieldReferenceExpression.cs (2)
707var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (177)
Semantics\ArglistTests.cs (2)
960var clss = root.Members[0] as ClassDeclarationSyntax;
Semantics\NativeIntegerTests.cs (1)
3636var underlyingType = model.GetDeclaredSymbol(nodes.OfType<ClassDeclarationSyntax>().Single());
Semantics\NullableContextTests.cs (4)
67var classDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 102var classDecl1 = syntaxTree1.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 103var classDecl2 = syntaxTree2.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 580verifyContextState(tree, syntaxNodes.OfType<ClassDeclarationSyntax>().Single(), classDirectives.ExpectedWarningsState, classDirectives.ExpectedAnnotationsState);
Semantics\SyntaxTreeRootTests.cs (1)
108Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SyntaxTree);
SourceGeneration\GeneratorDriverTests.cs (21)
1501var name = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("Attr") 2393var input = ctx.SyntaxProvider.CreateSyntaxProvider(static (n, _) => n is ClassDeclarationSyntax, (gsc, _) => (ClassDeclarationSyntax)gsc.Node) 2406Assert.Equal("C", ((ClassDeclarationSyntax)step.Outputs[0].Value).Identifier.ValueText); 2411Assert.Equal("D", ((ClassDeclarationSyntax)step.Outputs[0].Value).Identifier.ValueText); 2422Assert.Equal("C", ((ClassDeclarationSyntax)step.Outputs[0].Value).Identifier.ValueText); 2427Assert.Equal("D", ((ClassDeclarationSyntax)step.Outputs[0].Value).Identifier.ValueText); 2439Assert.Equal("E", ((ClassDeclarationSyntax)step.Outputs[0].Value).Identifier.ValueText); 2444Assert.Equal("D", ((ClassDeclarationSyntax)step.Outputs[0].Value).Identifier.ValueText); 2554IncrementalValuesProvider<ClassDeclarationSyntax> classDeclarations = ctx.SyntaxProvider 2558IncrementalValueProvider<(Compilation, ImmutableArray<ClassDeclarationSyntax>)> compilationAndClasses = 2584static void validate(Compilation compilation, ImmutableArray<ClassDeclarationSyntax> nodes) 2586foreach (var node in nodes) 2593=> node is ClassDeclarationSyntax { AttributeLists: { Count: > 0 } }; 2595static ClassDeclarationSyntax? getSemanticTargetForGeneration(GeneratorSyntaxContext context, CancellationToken cancellationToken) 2597var classDeclarationSyntax = (ClassDeclarationSyntax)context.Node; 3151ctx.RegisterSourceOutput(ctx.SyntaxProvider.CreateSyntaxProvider((node, ct) => node is ClassDeclarationSyntax c, (context, ct) => context.Node).WithTrackingName("Syntax"), (context, ct) => { }); 3285ctx.RegisterSourceOutput(ctx.SyntaxProvider.CreateSyntaxProvider((node, ct) => node is ClassDeclarationSyntax c, (context, ct) => context.Node).WithTrackingName("Syntax"), (context, ct) => { }); 4054static (node, _) => node is ClassDeclarationSyntax c, 4056.Select(static (node, _) => (ClassDeclarationSyntax)node)
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (55)
74var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("N1.XAttribute"); 83step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C1" })); 116var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>(name); 153var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("N2.XAttribute"); 162step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C2" })); 815var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("Outer1+InnerAttribute"); 824step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C1" })); 852var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("Outer2+InnerAttribute"); 861step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C2" })); 889var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("Outer1+InnerAttribute`1"); 898step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C1" })); 926var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("Outer2+InnerAttribute`2"); 935step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C2" })); 963var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("Outer1+InnerAttribute`2"); 999var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("Outer2+InnerAttribute`1"); 1027var input = ctx.SyntaxProvider.ForAttributeWithMetadataName<ClassDeclarationSyntax>( 1033return (ClassDeclarationSyntax)ctx.TargetNode; 1043step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1064var input = ctx.SyntaxProvider.ForAttributeWithMetadataName<ClassDeclarationSyntax>( 1070return (ClassDeclarationSyntax)ctx.TargetNode; 1080step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1102var input = ctx.SyntaxProvider.ForAttributeWithMetadataName<ClassDeclarationSyntax>( 1108return (ClassDeclarationSyntax)ctx.TargetNode; 1118step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1140var input = ctx.SyntaxProvider.ForAttributeWithMetadataName<ClassDeclarationSyntax>( 1146return (ClassDeclarationSyntax)ctx.TargetNode; 1156step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1178var input = ctx.SyntaxProvider.ForAttributeWithMetadataName<ClassDeclarationSyntax>( 1184return (ClassDeclarationSyntax)ctx.TargetNode; 1194step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1216var input = ctx.SyntaxProvider.ForAttributeWithMetadataName<ClassDeclarationSyntax>( 1222return (ClassDeclarationSyntax)ctx.TargetNode; 1232step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1244var provider = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("GenerateAttribute"); 1420var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1429step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1436step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1467var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1476step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1483step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1514var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1523step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1529step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1557var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1575step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1605var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1624t => Assert.True(t.Value is ClassDeclarationSyntax { Identifier.ValueText: "C1" }), 1625t => Assert.True(t.Value is ClassDeclarationSyntax { Identifier.ValueText: "C2" }))); 1658var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1676step => Assert.Collection(step.Outputs, t => Assert.True(t.Value is ClassDeclarationSyntax { Identifier.ValueText: "C1" })), 1677step => Assert.Collection(step.Outputs, t => Assert.True(t.Value is ClassDeclarationSyntax { Identifier.ValueText: "C2" }))); 1717var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1740step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1769var input = ctx.ForAttributeWithMetadataName<ClassDeclarationSyntax>("XAttribute"); 1788step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" }));
SourceGeneration\GeneratorDriverTests_Attributes_SimpleName.cs (88)
45var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 54step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 77var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 86step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 162step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 181var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 192Assert.True(step.Outputs.First().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" }); 193Assert.True(step.Outputs.Last().Value is ClassDeclarationSyntax { Identifier.ValueText: "D" }); 213var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 224Assert.True(step.Outputs.First().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" }); 225Assert.False(step.Outputs.Any(o => o.Value is ClassDeclarationSyntax { Identifier.ValueText: "D" })); 245var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 256Assert.False(step.Outputs.Any(o => o.Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 257Assert.True(step.Outputs.Last().Value is ClassDeclarationSyntax { Identifier.ValueText: "D" }); 279var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 290Assert.True(step.Outputs.First().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" }); 291Assert.True(step.Outputs.Last().Value is ClassDeclarationSyntax { Identifier.ValueText: "D" }); 312var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 321step => Assert.True(step.Outputs.First().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 338var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 347step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 364var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("X"); 373step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 390var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 399step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 423var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 432step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 451var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 460step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 479var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 506var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 537var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 546step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 570var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 579step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 602var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 611step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 634var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 662var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 690var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 718var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 745var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 772var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 801var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 810step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 832var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 841step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 862var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 871step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 891var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 919var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 947var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 956step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 976var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 985step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1008var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1017step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1024step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1048var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1057step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1064step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1094var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1103step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1147var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1156step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1198var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1230step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1253var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1262step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1306var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1315step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1324Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" }); 1364var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1373step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1380step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1412var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1442step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1457var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1485step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1508var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1517step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1559var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1568step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1596step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" }), 1597step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "D" })); 1620var input = ctx.ForAttributeWithSimpleName<ClassDeclarationSyntax>("XAttribute"); 1629step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "C" })); 1653step => Assert.True(step.Outputs.Single().Value is ClassDeclarationSyntax { Identifier.ValueText: "D" }));
SourceGeneration\SyntaxAwareGeneratorTests.cs (5)
696var classDeclarations = testReceiver.VisitedNodes.OfType<ClassDeclarationSyntax>().Select(c => c.Identifier.Text); 753var classDeclarations = testReceiver.VisitedNodes.OfType<ClassDeclarationSyntax>().Select(c => c.Identifier.Text); 786if (ctx.Node is ClassDeclarationSyntax cds 903var source2 = context.SyntaxProvider.CreateSyntaxProvider((c, _) => c is ClassDeclarationSyntax fds, (c, _) => ((ClassDeclarationSyntax)c.Node).Identifier.ValueText);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (25)
Compilation\SemanticModelAPITests.cs (4)
871var pType01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 872var pType02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Last();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (13)
1005var typeDecl = (ClassDeclarationSyntax)root.Members[1]; 1054var classDecl = (ClassDeclarationSyntax)namespaceDecl.Members[0]; 1487var classDecl = (ClassDeclarationSyntax)cu.Members[1]; 3966var attr = (AttributeSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)tree2.GetCompilationUnitRoot()).Members[0]).AttributeLists[0].Attributes[0]; 4691var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4706var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4721var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration));
Symbols\Source\MethodTests.cs (2)
2571var type = syntax.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Symbols\SymbolEqualityTests.cs (6)
776var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 827var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 888var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (32)
Generated\Syntax.Test.xml.Generated.cs (5)
10718private static ClassDeclarationSyntax GenerateClassDeclaration() 12979var node = GenerateClassDeclaration(); 12993var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithKeyword(node.Keyword).WithIdentifier(node.Identifier).WithTypeParameterList(node.TypeParameterList).WithParameterList(node.ParameterList).WithBaseList(node.BaseList).WithConstraintClauses(node.ConstraintClauses).WithOpenBraceToken(node.OpenBraceToken).WithMembers(node.Members).WithCloseBraceToken(node.CloseBraceToken).WithSemicolonToken(node.SemicolonToken); 18337var oldNode = GenerateClassDeclaration(); 18353var oldNode = GenerateClassDeclaration();
LexicalAndXml\PreprocessorTests.cs (2)
2382var classDeclaration = node.ChildNodes().Single(n => n is ClassDeclarationSyntax); 4569token = nodes.OfType<ClassDeclarationSyntax>().Single().Identifier;
LexicalAndXml\XmlDocCommentTests.cs (1)
2009Assert.Equal(typeof(ClassDeclarationSyntax), tree.GetCompilationUnitRoot().Members[0].GetType());
Parsing\DeclarationParsingTests.cs (4)
4405var cs = (ClassDeclarationSyntax)file.Members[0]; 4460var cs = (ClassDeclarationSyntax)file.Members[0];
Parsing\LocalFunctionParsingTests.cs (4)
1294var c = Assert.IsType<ClassDeclarationSyntax>(file.Members.Single()); 1346var c = Assert.IsType<ClassDeclarationSyntax>(file.Members.Single());
Parsing\ParsingErrorRecoveryTests.cs (6)
7937var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 7958var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 8026var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Syntax\SyntaxFactoryTests.cs (1)
81var c = SyntaxFactory.ClassDeclaration(identifier: SyntaxFactory.Identifier("goo"));
Syntax\SyntaxNodeTests.cs (7)
64var cls = SyntaxFactory.ParseCompilationUnit("class C { }").Members[0] as ClassDeclarationSyntax; 65var cls2 = cls.AddBaseListTypes(SyntaxFactory.SimpleBaseType(SyntaxFactory.ParseTypeName("B"))); 2273var privateToken = ((ClassDeclarationSyntax)cu.Members[0]).Modifiers[0]; 2307var publicToken = ((ClassDeclarationSyntax)cu.Members[0]).Modifiers[0]; 3502var @class = (ClassDeclarationSyntax)compilationUnit.Members.Single();
Syntax\SyntaxRewriterTests.cs (2)
314var node = SyntaxFactory.ClassDeclaration("Class1"); 791public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
53c => c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1090case ClassDeclarationSyntax @class:
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
247public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (67)
CodeGeneration\SyntaxGeneratorTests.cs (67)
1533VerifySyntax<ClassDeclarationSyntax>( 1537VerifySyntax<ClassDeclarationSyntax>( 1541VerifySyntax<ClassDeclarationSyntax>( 1545VerifySyntax<ClassDeclarationSyntax>( 1549VerifySyntax<ClassDeclarationSyntax>( 1553VerifySyntax<ClassDeclarationSyntax>( 1557VerifySyntax<ClassDeclarationSyntax>( 1561VerifySyntax<ClassDeclarationSyntax>( 1565VerifySyntax<ClassDeclarationSyntax>( 1892VerifySyntax<ClassDeclarationSyntax>( 1987VerifySyntax<ClassDeclarationSyntax>(added, "// comment\r\n[a]\r\npublic class C\r\n{\r\n} // end\r\n"); 1990VerifySyntax<ClassDeclarationSyntax>(removed, "// comment\r\npublic class C\r\n{\r\n} // end\r\n"); 2022VerifySyntax<ClassDeclarationSyntax>( 2119VerifySyntax<ClassDeclarationSyntax>( 3128var fileClass = (ClassDeclarationSyntax)ParseMemberDeclaration("file class C { }"); 3130VerifySyntax<ClassDeclarationSyntax>(fileAbstractClass, @"file abstract class C 3138var fileClass = (ClassDeclarationSyntax)ParseMemberDeclaration("file class C { }"); 3140VerifySyntax<ClassDeclarationSyntax>(filePublicClass, @"public class C 3148var abstractClass = (ClassDeclarationSyntax)ParseMemberDeclaration("abstract class C { }"); 3150VerifySyntax<ClassDeclarationSyntax>(fileAbstractClass, @"file abstract class C 3158var publicClass = (ClassDeclarationSyntax)ParseMemberDeclaration("public class C { }"); 3160VerifySyntax<ClassDeclarationSyntax>(filePublicClass, @"file class C 3679VerifySyntax<ClassDeclarationSyntax>( 3685VerifySyntax<ClassDeclarationSyntax>( 3691VerifySyntax<ClassDeclarationSyntax>( 3716VerifySyntax<ClassDeclarationSyntax>( 3722VerifySyntax<ClassDeclarationSyntax>( 3729VerifySyntax<ClassDeclarationSyntax>( 3754VerifySyntax<ClassDeclarationSyntax>( 3760VerifySyntax<ClassDeclarationSyntax>( 3766VerifySyntax<ClassDeclarationSyntax>( 3851VerifySyntax<ClassDeclarationSyntax>( 3859VerifySyntax<ClassDeclarationSyntax>( 3868VerifySyntax<ClassDeclarationSyntax>( 3877VerifySyntax<ClassDeclarationSyntax>( 3885VerifySyntax<ClassDeclarationSyntax>( 3893VerifySyntax<ClassDeclarationSyntax>( 3901VerifySyntax<ClassDeclarationSyntax>( 3910VerifySyntax<ClassDeclarationSyntax>( 3918VerifySyntax<ClassDeclarationSyntax>( 3926VerifySyntax<ClassDeclarationSyntax>( 3933VerifySyntax<ClassDeclarationSyntax>( 3939VerifySyntax<ClassDeclarationSyntax>( 3946VerifySyntax<ClassDeclarationSyntax>( 3984VerifySyntax<ClassDeclarationSyntax>( 4153VerifySyntax<ClassDeclarationSyntax>( 4161VerifySyntax<ClassDeclarationSyntax>( 4170VerifySyntax<ClassDeclarationSyntax>( 4179VerifySyntax<ClassDeclarationSyntax>( 4188VerifySyntax<ClassDeclarationSyntax>( 4195VerifySyntax<ClassDeclarationSyntax>( 4202VerifySyntax<ClassDeclarationSyntax>( 4209VerifySyntax<ClassDeclarationSyntax>( 4216VerifySyntax<ClassDeclarationSyntax>( 4223VerifySyntax<ClassDeclarationSyntax>( 4230VerifySyntax<ClassDeclarationSyntax>( 4237VerifySyntax<ClassDeclarationSyntax>( 4244VerifySyntax<ClassDeclarationSyntax>( 4251VerifySyntax<ClassDeclarationSyntax>( 4258VerifySyntax<ClassDeclarationSyntax>( 4581var decl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 4673VerifySyntax<ClassDeclarationSyntax>(
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (4)
CodeGeneration\CodeGenerationTests.CSharp.cs (4)
1408await TestUpdateDeclarationAsync<ClassDeclarationSyntax>(input, expected, modifiers: newModifiers); 1424await TestUpdateDeclarationAsync<ClassDeclarationSyntax>(input, expected, accessibility: Accessibility.Internal); 1466await TestUpdateDeclarationAsync<ClassDeclarationSyntax>( 1492await TestUpdateDeclarationAsync<ClassDeclarationSyntax>(input, expected, getNewMembers: getMembers, declareNewMembersAtTop: true);
Microsoft.CodeAnalysis.UnitTests (2)
Diagnostics\OperationTests.cs (2)
323var classDecl = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
340var decl = root.DescendantNodes().OfType<CS.Syntax.ClassDeclarationSyntax>().First(); 341var newDecl = decl.WithIdentifier(CS.SyntaxFactory.Identifier("Pogrom").WithLeadingTrivia(decl.Identifier.LeadingTrivia).WithTrailingTrivia(decl.Identifier.TrailingTrivia));
Microsoft.CodeAnalysis.Workspaces.UnitTests (8)
SolutionTests\SolutionTests.cs (2)
3235var classNode = syntaxRoot.DescendantNodes().OfType<CS.Syntax.ClassDeclarationSyntax>().Single();
SyntaxNodeTests.cs (6)
53var nodes = root.DescendantNodes().Where(n => n is VariableDeclaratorSyntax or ClassDeclarationSyntax).ToList(); 58if (n is ClassDeclarationSyntax classDecl) 95var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 105var currentClassDecl = trackedRoot.GetCurrentNodes(classDecl).First(); 123var finalClassDecl = root2.GetCurrentNodes(classDecl).First();
Microsoft.DotNet.GenFacades (1)
NotSupportedAssemblyGenerator.cs (1)
149public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
Microsoft.Extensions.Logging.Generators (9)
LoggerMessageGenerator.Parser.cs (4)
37public IReadOnlyList<LoggerClass> GetLogClasses(IEnumerable<ClassDeclarationSyntax> classes) 75foreach (IGrouping<SyntaxTree, ClassDeclarationSyntax> group in classes.GroupBy(x => x.SyntaxTree)) 80foreach (ClassDeclarationSyntax classDec in group) 688.Any(ds => ds.GetSyntax() is ClassDeclarationSyntax));
LoggerMessageGenerator.Roslyn4.0.cs (5)
24IncrementalValuesProvider<ClassDeclarationSyntax> classDeclarations = context.SyntaxProvider 31(context, _) => context.TargetNode.Parent as ClassDeclarationSyntax) 34IncrementalValueProvider<(Compilation, ImmutableArray<ClassDeclarationSyntax>)> compilationAndClasses = 40private static void Execute(Compilation compilation, ImmutableArray<ClassDeclarationSyntax> classes, SourceProductionContext context) 48ImmutableHashSet<ClassDeclarationSyntax> distinctClasses = classes.ToImmutableHashSet();
Microsoft.Extensions.Options.SourceGeneration (1)
TypeDeclarationSyntaxReceiver.cs (1)
25if (syntaxNode is ClassDeclarationSyntax classSyntax)
Microsoft.Gen.ComplianceReports (1)
src\Generators\Shared\TypeDeclarationSyntaxReceiver.cs (1)
30if (syntaxNode is ClassDeclarationSyntax classSyntax)
Microsoft.Gen.Logging (5)
Parsing\Parser.cs (1)
710.Any(ds => ds.GetSyntax() is ClassDeclarationSyntax));
src\Generators\Shared\ClassDeclarationSyntaxReceiver.cs (3)
25public ICollection<ClassDeclarationSyntax> ClassDeclarations { get; } = new List<ClassDeclarationSyntax>(); 30if (syntaxNode is ClassDeclarationSyntax classSyntax)
src\Generators\Shared\TypeDeclarationSyntaxReceiver.cs (1)
30if (syntaxNode is ClassDeclarationSyntax classSyntax)
Microsoft.Gen.Metrics (4)
src\Generators\Shared\ClassDeclarationSyntaxReceiver.cs (3)
25public ICollection<ClassDeclarationSyntax> ClassDeclarations { get; } = new List<ClassDeclarationSyntax>(); 30if (syntaxNode is ClassDeclarationSyntax classSyntax)
src\Generators\Shared\TypeDeclarationSyntaxReceiver.cs (1)
30if (syntaxNode is ClassDeclarationSyntax classSyntax)
Microsoft.Gen.MetricsReports (3)
src\Generators\Shared\ClassDeclarationSyntaxReceiver.cs (3)
25public ICollection<ClassDeclarationSyntax> ClassDeclarations { get; } = new List<ClassDeclarationSyntax>(); 30if (syntaxNode is ClassDeclarationSyntax classSyntax)
Microsoft.Interop.ComInterfaceGenerator (9)
ComClassGenerator.cs (5)
26static (node, ct) => node is ClassDeclarationSyntax, 34var syntax = (ClassDeclarationSyntax)context.TargetNode; 75private static ClassDeclarationSyntax GenerateClassInfoType(ImmutableArray<string> implementedInterfaces) 81var typeDeclaration = ClassDeclaration(ClassInfoTypeName)
ComClassInfo.cs (1)
26public static DiagnosticOr<ComClassInfo> From(INamedTypeSymbol type, ClassDeclarationSyntax syntax, bool unsafeCodeIsEnabled)
ComInterfaceGenerator.cs (3)
629private static readonly ClassDeclarationSyntax InterfaceInformationTypeTemplate = 634private static ClassDeclarationSyntax GenerateInterfaceInformation(ComInterfaceInfo context, CancellationToken _) 636ClassDeclarationSyntax interfaceInformationType = InterfaceInformationTypeTemplate
Microsoft.ML.InternalCodeAnalyzer (1)
NameAnalyzer.cs (1)
92=> CheckPascal(((ClassDeclarationSyntax)context.Node).Identifier, context);
Microsoft.VisualStudio.LanguageServices.CSharp (15)
CodeModel\CSharpCodeModelService.cs (15)
950return ((ClassDeclarationSyntax)typeNode).WithIdentifier(newIdentifier); 2061Debug.Assert(typeNode is ClassDeclarationSyntax); 2063var type = (ClassDeclarationSyntax)typeNode; 2073Debug.Assert(typeNode is ClassDeclarationSyntax); 2075var type = (ClassDeclarationSyntax)typeNode; 2220Debug.Assert(typeNode is ClassDeclarationSyntax); 2222var type = (ClassDeclarationSyntax)typeNode; 2286if (member.Parent is ClassDeclarationSyntax) 2288var parentFlags = ((ClassDeclarationSyntax)member.Parent).GetModifierFlags(); 2383Debug.Assert(typeNode is ClassDeclarationSyntax); 3369else if (container is ClassDeclarationSyntax classDeclaration) 3580if (methodDeclaration?.Parent is not ClassDeclarationSyntax classDecl ||
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
Venus\DocumentService_IntegrationTests.vb (1)
147Dim node = root.FindNode(originalDocument.AnnotatedSpans("Original").First()).AncestorsAndSelf().OfType(Of ClassDeclarationSyntax).First()
System.Private.CoreLib.Generators (3)
EventSourceGenerator.cs (1)
43(node, _) => node is ClassDeclarationSyntax,
EventSourceGenerator.Parser.cs (2)
21var classDef = (ClassDeclarationSyntax)context.TargetNode;
System.Text.Json.SourceGeneration (9)
JsonSourceGenerator.Parser.cs (2)
78public ContextGenerationSpec? ParseContextGenerationSpec(ClassDeclarationSyntax contextClassDeclaration, SemanticModel semanticModel, CancellationToken cancellationToken) 169private static bool TryGetNestedTypeDeclarations(ClassDeclarationSyntax contextClassSyntax, SemanticModel semanticModel, CancellationToken cancellationToken, [NotNullWhen(true)] out List<string>? typeDeclarations)
JsonSourceGenerator.Roslyn3.11.cs (7)
57foreach ((ClassDeclarationSyntax? contextClassDeclaration, SemanticModel semanticModel) in receiver.ContextClassDeclarations) 97public List<(ClassDeclarationSyntax, SemanticModel)>? ContextClassDeclarations { get; private set; } 103ClassDeclarationSyntax? classSyntax = GetSemanticTargetForGeneration(context, _cancellationToken); 111private static bool IsSyntaxTargetForGeneration(SyntaxNode node) => node is ClassDeclarationSyntax { AttributeLists.Count: > 0, BaseList.Types.Count: > 0 }; 113private static ClassDeclarationSyntax? GetSemanticTargetForGeneration(GeneratorSyntaxContext context, CancellationToken cancellationToken) 115var classDeclarationSyntax = (ClassDeclarationSyntax)context.Node;
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
237((CompilationUnitSyntax)newTypeDeclarationOrCompilationUnit).AddMembers((ClassDeclarationSyntax)generator.ClassDeclaration("Program", modifiers: DeclarationModifiers.Partial, members: new[] { newMethod }));