321 references to Node
Microsoft.CodeAnalysis (1)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (1)
1514
/// Indicates if the <see cref="
Node
"/> is generated code.
Microsoft.CodeAnalysis.CodeStyle (24)
AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs (1)
90
var binaryLike = (TBinaryLikeExpressionSyntax)context.
Node
;
AbstractForEachCastDiagnosticAnalyzer.cs (1)
63
if (context.
Node
is not TForEachStatementSyntax node)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
72
writesToThis = writesToThis || IsWrittenTo(context.SemanticModel, (TThisExpression)context.
Node
, context.CancellationToken);
AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
70
var namespaceDecl = (TNamespaceSyntax)context.
Node
;
AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
44
(TCastExpression)context.
Node
,
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
50
var parenthesizedExpression = (TParenthesizedExpressionSyntax)context.
Node
;
AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
75
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseAutoPropertyAnalyzer.cs (1)
154
var propertyDeclaration = (TPropertyDeclaration)context.
Node
;
AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
61
var ifStatement = (TIfStatementSyntax)context.
Node
;
AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
53
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
50
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (2)
89
var objectCreationExpression = (TObjectCreationExpressionSyntax)context.
Node
;
138
var syntaxTree = context.
Node
.SyntaxTree;
AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
72
var assignment = (TAssignmentSyntax)context.
Node
;
AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
68
var invocation = context.
Node
;
AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
108
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
38
var ifStatement = (TIfStatementSyntax)context.
Node
;
AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
81
var objectCreationExpression = (TObjectCreationExpressionSyntax)context.
Node
;
125
var syntaxTree = context.
Node
.SyntaxTree;
AbstractValidateFormatStringDiagnosticAnalyzer.cs (3)
92
var expression = syntaxFacts.GetExpressionOfInvocationExpression(context.
Node
);
104
var arguments = syntaxFacts.GetArgumentsOfInvocationExpression(context.
Node
);
353
context.
Node
.SyntaxTree,
AnalyzerOptionsProvider.cs (1)
136
=> GetAnalyzerOptions(context.Options, context.
Node
.SyntaxTree);
NamingStyleDiagnosticAnalyzerBase.cs (1)
80
var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(syntaxContext.
Node
, syntaxContext.CancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (47)
ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
50
var switchStatement = context.
Node
;
ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
34
var namespaceDeclaration = (FileScopedNamespaceDeclarationSyntax)context.
Node
;
ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
34
var namespaceDeclaration = (NamespaceDeclarationSyntax)context.
Node
;
ConvertToProgramMainDiagnosticAnalyzer.cs (1)
44
var root = (CompilationUnitSyntax)context.
Node
;
ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
62
var root = (CompilationUnitSyntax)context.
Node
;
CSharpAddBracesDiagnosticAnalyzer.cs (1)
49
var statement = context.
Node
;
CSharpAnalyzerOptionsProvider.cs (1)
138
=> GetCSharpAnalyzerOptions(context.Options, context.
Node
.SyntaxTree);
CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
65
var asExpression = (BinaryExpressionSyntax)context.
Node
;
CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
54
var node = syntaxContext.
Node
;
CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
62
var syntaxTree = context.
Node
.SyntaxTree;
77
var argumentNode = (ArgumentSyntax)context.
Node
;
CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
68
var isExpression = (BinaryExpressionSyntax)syntaxContext.
Node
;
CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
50
var thisExpression = (ThisExpressionSyntax)context.
Node
;
CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (1)
32
var node = context.
Node
;
CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (1)
18
var attributeList = (AttributeListSyntax)context.
Node
;
CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
50
var discard = (DiscardDesignationSyntax)context.
Node
;
CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
73
var anonymousFunction = (AnonymousFunctionExpressionSyntax)context.
Node
;
CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
60
var subpattern = (SubpatternSyntax)syntaxContext.
Node
;
CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
52
var declarationStatement = context.
Node
;
CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
59
var coalesceExpression = (BinaryExpressionSyntax)context.
Node
;
124
var ifStatement = (IfStatementSyntax)context.
Node
;
CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
48
switch (context.
Node
)
CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
37
var syntaxTree = context.
Node
.SyntaxTree;
41
var defaultExpression = (DefaultExpressionSyntax)context.
Node
;
CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (2)
39
var syntaxTree = context.
Node
.SyntaxTree;
61
var objectCreation = (ObjectCreationExpressionSyntax)context.
Node
;
CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (5)
26
switch (context.
Node
.Kind())
29
ReportDiagnosticsIfNeeded((NameColonSyntax)context.
Node
, context);
32
ReportDiagnosticsIfNeeded((NameEqualsSyntax)context.
Node
, context);
44
var syntaxTree = context.
Node
.SyntaxTree;
86
additionalUnnecessaryLocations: ImmutableArray.Create(context.
Node
.SyntaxTree.GetLocation(fadeSpan))));
CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
52
var binaryExpression = (BinaryExpressionSyntax)context.
Node
;
CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
80
var anonymousFunction = (AnonymousFunctionExpressionSyntax)syntaxContext.
Node
;
CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
55
var attribute = (AttributeSyntax)context.
Node
;
CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
61
var node = syntaxContext.
Node
;
CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
54
var expression = (ExpressionSyntax)context.
Node
;
CSharpUseTupleSwapDiagnosticAnalyzer.cs (1)
72
var localDeclarationStatement = (LocalDeclarationStatementSyntax)syntaxContext.
Node
;
InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
49
var ifStatement = (IfStatementSyntax)syntaxContext.
Node
;
174
var tree = syntaxContext.
Node
.SyntaxTree;
MakeLocalFunctionStaticDiagnosticAnalyzer.cs (1)
38
var localFunction = (LocalFunctionStatementSyntax)context.
Node
;
MisplacedUsingDirectivesDiagnosticAnalyzer.cs (2)
62
var namespaceDeclaration = (BaseNamespaceDeclarationSyntax)context.
Node
;
69
var compilationUnit = (CompilationUnitSyntax)context.
Node
;
UseExpressionBodyDiagnosticAnalyzer.cs (3)
53
var nodeKind = context.
Node
.Kind();
58
var grandparent = context.
Node
.GetRequiredParent().GetRequiredParent();
77
var diagnostic = AnalyzeSyntax(options, context.
Node
, helper);
UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
59
var declaration = (LambdaExpressionSyntax)context.
Node
;
UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
79
var outermostUsing = (UsingStatementSyntax)context.
Node
;
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (5)
CommandLineTests.cs (5)
14615
context.ReportDiagnostic(Diagnostic.Create(Hidden01, context.
Node
.GetLocation()));
14639
if ((context.
Node
as PragmaWarningDirectiveTriviaSyntax).DisableOrRestoreKeyword.IsKind(SyntaxKind.RestoreKeyword))
14641
context.ReportDiagnostic(Diagnostic.Create(Info01, context.
Node
.GetLocation()));
14694
if ((nodeContext.
Node
as PragmaWarningDirectiveTriviaSyntax).DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword))
14696
nodeContext.ReportDiagnostic(Diagnostic.Create(Error01, nodeContext.
Node
.GetLocation()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (24)
Diagnostics\Configuration\ConfigureSeverity\AllAnalyzersSeverityConfigurationTests.cs (1)
39
c => c.ReportDiagnostic(Diagnostic.Create(Rule, c.
Node
.GetLocation())),
Diagnostics\Configuration\ConfigureSeverity\CategoryBasedSeverityConfigurationTests.cs (1)
39
c => c.ReportDiagnostic(Diagnostic.Create(Rule, c.
Node
.GetLocation())),
Diagnostics\Configuration\ConfigureSeverity\DotNetDiagnosticSeverityBasedSeverityConfigurationTests.cs (1)
39
c => c.ReportDiagnostic(Diagnostic.Create(Rule, c.
Node
.GetLocation())),
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (2)
326
Assert.NotEqual(SyntaxKind.MethodDeclaration, context.
Node
.Kind());
327
context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.
Node
.GetLocation()));
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
49
if (context.
Node
is SimpleNameSyntax node)
Diagnostics\Suppression\RemoveSuppressionTests.cs (1)
48
var classDecl = (ClassDeclarationSyntax)context.
Node
;
Diagnostics\Suppression\SuppressionTest_FixMultipleTests.cs (1)
50
var classDecl = (ClassDeclarationSyntax)context.
Node
;
Diagnostics\Suppression\SuppressionTests.cs (16)
711
var classDecl = (ClassDeclarationSyntax)context.
Node
;
821
var classDecl = (ClassDeclarationSyntax)context.
Node
;
884
var classDecl = (ClassDeclarationSyntax)context.
Node
;
934
var classDecl = (ClassDeclarationSyntax)context.
Node
;
1075
switch (context.
Node
.Kind())
1078
var classDecl = (ClassDeclarationSyntax)context.
Node
;
1083
var ns = (NamespaceDeclarationSyntax)context.
Node
;
1088
var method = (MethodDeclarationSyntax)context.
Node
;
1093
var property = (PropertyDeclarationSyntax)context.
Node
;
1098
var field = (FieldDeclarationSyntax)context.
Node
;
1103
var e = (EventDeclarationSyntax)context.
Node
;
1109
foreach (var trivia in context.
Node
.DescendantTrivia().Where(t => t.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia))
2069
switch (context.
Node
.Kind())
2072
var classDecl = (ClassDeclarationSyntax)context.
Node
;
2077
var ns = (NamespaceDeclarationSyntax)context.
Node
;
2082
var method = (MethodDeclarationSyntax)context.
Node
;
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (16)
Diagnostics\DiagnosticAnalyzerTests.cs (13)
54
var id = (IdentifierNameSyntax)context.
Node
;
250
switch (context.
Node
.Kind())
253
var diag1 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.
Node
.GetLocation(), "Attribute");
258
var diag2 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.
Node
.GetLocation(), "ClassDeclaration");
263
var diag3 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.
Node
.GetLocation(), "UsingDirective");
666
var fieldDeclaration = (FieldDeclarationSyntax)context.
Node
;
807
switch (CSharpExtensions.Kind(context.
Node
.Parent))
1654
nodeContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(ExpressionDescriptor, nodeContext.
Node
.GetLocation()));
2322
sortedCallbackEntityNames.Add($"Node: {syntaxContext.
Node
.ToString()}");
2323
ReportNodeDiagnostics(syntaxContext.
Node
, syntaxContext.ReportDiagnostic);
3758
context => context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Rule, context.
Node
.GetLocation())),
3764
context => context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Rule, context.
Node
.GetLocation())),
3994
var recordDeclaration = (RecordDeclarationSyntax)context.
Node
;
Diagnostics\GetDiagnosticsTests.cs (3)
905
context => analyzeNode(context.
Node
, context.ContainingSymbol, context.ReportDiagnostic),
945
if (!uniqueCallbacks.Add(context.
Node
))
946
throw new Exception($"Multiple callbacks for {context.
Node
}");
Microsoft.CodeAnalysis.CSharp.Features (48)
ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
50
var switchStatement = context.
Node
;
ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
34
var namespaceDeclaration = (FileScopedNamespaceDeclarationSyntax)context.
Node
;
ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
34
var namespaceDeclaration = (NamespaceDeclarationSyntax)context.
Node
;
ConvertToProgramMainDiagnosticAnalyzer.cs (1)
44
var root = (CompilationUnitSyntax)context.
Node
;
ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
62
var root = (CompilationUnitSyntax)context.
Node
;
CSharpAddBracesDiagnosticAnalyzer.cs (1)
49
var statement = context.
Node
;
CSharpAnalyzerOptionsProvider.cs (1)
138
=> GetCSharpAnalyzerOptions(context.Options, context.
Node
.SyntaxTree);
CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
65
var asExpression = (BinaryExpressionSyntax)context.
Node
;
CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
54
var node = syntaxContext.
Node
;
CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
62
var syntaxTree = context.
Node
.SyntaxTree;
77
var argumentNode = (ArgumentSyntax)context.
Node
;
CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
68
var isExpression = (BinaryExpressionSyntax)syntaxContext.
Node
;
CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
50
var thisExpression = (ThisExpressionSyntax)context.
Node
;
CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (1)
32
var node = context.
Node
;
CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (1)
18
var attributeList = (AttributeListSyntax)context.
Node
;
CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
50
var discard = (DiscardDesignationSyntax)context.
Node
;
CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
73
var anonymousFunction = (AnonymousFunctionExpressionSyntax)context.
Node
;
CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
60
var subpattern = (SubpatternSyntax)syntaxContext.
Node
;
CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
52
var declarationStatement = context.
Node
;
CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
59
var coalesceExpression = (BinaryExpressionSyntax)context.
Node
;
124
var ifStatement = (IfStatementSyntax)context.
Node
;
CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
48
switch (context.
Node
)
CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
37
var syntaxTree = context.
Node
.SyntaxTree;
41
var defaultExpression = (DefaultExpressionSyntax)context.
Node
;
CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (2)
39
var syntaxTree = context.
Node
.SyntaxTree;
61
var objectCreation = (ObjectCreationExpressionSyntax)context.
Node
;
CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (5)
26
switch (context.
Node
.Kind())
29
ReportDiagnosticsIfNeeded((NameColonSyntax)context.
Node
, context);
32
ReportDiagnosticsIfNeeded((NameEqualsSyntax)context.
Node
, context);
44
var syntaxTree = context.
Node
.SyntaxTree;
86
additionalUnnecessaryLocations: ImmutableArray.Create(context.
Node
.SyntaxTree.GetLocation(fadeSpan))));
CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
52
var binaryExpression = (BinaryExpressionSyntax)context.
Node
;
CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
80
var anonymousFunction = (AnonymousFunctionExpressionSyntax)syntaxContext.
Node
;
CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
55
var attribute = (AttributeSyntax)context.
Node
;
CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
61
var node = syntaxContext.
Node
;
CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
54
var expression = (ExpressionSyntax)context.
Node
;
CSharpUseTupleSwapDiagnosticAnalyzer.cs (1)
72
var localDeclarationStatement = (LocalDeclarationStatementSyntax)syntaxContext.
Node
;
InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
49
var ifStatement = (IfStatementSyntax)syntaxContext.
Node
;
174
var tree = syntaxContext.
Node
.SyntaxTree;
MakeLocalFunctionStaticDiagnosticAnalyzer.cs (1)
38
var localFunction = (LocalFunctionStatementSyntax)context.
Node
;
MisplacedUsingDirectivesDiagnosticAnalyzer.cs (2)
62
var namespaceDeclaration = (BaseNamespaceDeclarationSyntax)context.
Node
;
69
var compilationUnit = (CompilationUnitSyntax)context.
Node
;
UseExpressionBodyDiagnosticAnalyzer.cs (3)
53
var nodeKind = context.
Node
.Kind();
58
var grandparent = context.
Node
.GetRequiredParent().GetRequiredParent();
77
var diagnostic = AnalyzeSyntax(options, context.
Node
, helper);
UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
59
var declaration = (LambdaExpressionSyntax)context.
Node
;
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
86
var isExpression = (BinaryExpressionSyntax)context.
Node
;
UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
79
var outermostUsing = (UsingStatementSyntax)context.
Node
;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (42)
Semantics\ColorColorTests.cs (1)
1784
var memberAccessExpression = context.
Node
as MemberAccessExpressionSyntax;
Semantics\OutVarTests.cs (2)
18812
var tree = context.
Node
.SyntaxTree;
18814
var constructorDeclaration = (ConstructorDeclarationSyntax)context.
Node
.Parent;
Semantics\PrimaryConstructorTests.cs (17)
3183
var literal = (LiteralExpressionSyntax)context.
Node
;
3222
var equalsValue = (EqualsValueClauseSyntax)context.
Node
;
3248
var initializer = (ConstructorInitializerSyntax)context.
Node
;
3272
var baseType = (PrimaryConstructorBaseTypeSyntax)context.
Node
;
3300
var @class = (ClassDeclarationSyntax)context.
Node
;
3327
var identifier = (IdentifierNameSyntax)context.
Node
;
3365
var baseType = (SimpleBaseTypeSyntax)context.
Node
;
3409
var parameterList = (ParameterListSyntax)context.
Node
;
3435
var argumentList = (ArgumentListSyntax)context.
Node
;
4689
var literal = (LiteralExpressionSyntax)context.
Node
;
4715
var equalsValue = (EqualsValueClauseSyntax)context.
Node
;
4733
var initializer = (ConstructorInitializerSyntax)context.
Node
;
4762
var record = (StructDeclarationSyntax)context.
Node
;
4780
var identifier = (IdentifierNameSyntax)context.
Node
;
4793
var baseType = (SimpleBaseTypeSyntax)context.
Node
;
4820
var parameterList = (ParameterListSyntax)context.
Node
;
4842
var argumentList = (ArgumentListSyntax)context.
Node
;
Semantics\RecordStructTests.cs (8)
5939
var literal = (LiteralExpressionSyntax)context.
Node
;
5965
var equalsValue = (EqualsValueClauseSyntax)context.
Node
;
5983
var initializer = (ConstructorInitializerSyntax)context.
Node
;
6012
var record = (RecordDeclarationSyntax)context.
Node
;
6030
var identifier = (IdentifierNameSyntax)context.
Node
;
6043
var baseType = (SimpleBaseTypeSyntax)context.
Node
;
6070
var parameterList = (ParameterListSyntax)context.
Node
;
6092
var argumentList = (ArgumentListSyntax)context.
Node
;
Semantics\RecordTests.cs (9)
26221
var literal = (LiteralExpressionSyntax)context.
Node
;
26260
var equalsValue = (EqualsValueClauseSyntax)context.
Node
;
26286
var initializer = (ConstructorInitializerSyntax)context.
Node
;
26310
var baseType = (PrimaryConstructorBaseTypeSyntax)context.
Node
;
26338
var record = (RecordDeclarationSyntax)context.
Node
;
26361
var identifier = (IdentifierNameSyntax)context.
Node
;
26399
var baseType = (SimpleBaseTypeSyntax)context.
Node
;
26443
var parameterList = (ParameterListSyntax)context.
Node
;
26469
var argumentList = (ArgumentListSyntax)context.
Node
;
Semantics\TopLevelStatementsTests.cs (5)
6426
var globalStatement = (GlobalStatementSyntax)context.
Node
;
6456
var unit = (CompilationUnitSyntax)context.
Node
;
7054
var node = (CSharpSyntaxNode)context.
Node
;
7088
var node = (CSharpSyntaxNode)context.
Node
;
7169
var node = (CSharpSyntaxNode)context.
Node
;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (8)
Symbols\Source\NullablePublicAPITests.cs (8)
1165
if (syntaxContext.
Node
.ToString() != "o") return;
1166
var info = syntaxContext.SemanticModel.GetTypeInfoAndVerifyIOperation(syntaxContext.
Node
);
1167
Assert.True(syntaxContext.SemanticModel.TryGetSpeculativeSemanticModel(syntaxContext.
Node
.SpanStart, newSource, out var specModel));
1169
syntaxContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_descriptor1, syntaxContext.
Node
.GetLocation(), syntaxContext.
Node
, info.Nullability.FlowState, info.Nullability.Annotation, specInfo.Nullability.FlowState));
1174
var declarator = (VariableDeclaratorSyntax)context.
Node
;
1792
var node = (MemberAccessExpressionSyntax)context.
Node
;
4848
var node = (MemberAccessExpressionSyntax)context.
Node
;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (5)
Diagnostics\DiagnosticServiceTests.vb (5)
1412
Dim fieldDecl = DirectCast(context.
Node
, CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax)
1871
context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor2, context.
Node
.GetLocation()))
1875
context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor3, context.
Node
.GetLocation()))
1880
Select Case CodeAnalysis.CSharp.CSharpExtensions.Kind(context.
Node
.Parent)
1894
context.ReportDiagnostic(Diagnostic.Create(descriptor, context.
Node
.GetLocation))
Microsoft.CodeAnalysis.Features (28)
AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs (1)
90
var binaryLike = (TBinaryLikeExpressionSyntax)context.
Node
;
AbstractForEachCastDiagnosticAnalyzer.cs (1)
63
if (context.
Node
is not TForEachStatementSyntax node)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
72
writesToThis = writesToThis || IsWrittenTo(context.SemanticModel, (TThisExpression)context.
Node
, context.CancellationToken);
AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
70
var namespaceDecl = (TNamespaceSyntax)context.
Node
;
AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
44
(TCastExpression)context.
Node
,
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
50
var parenthesizedExpression = (TParenthesizedExpressionSyntax)context.
Node
;
AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
75
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseAutoPropertyAnalyzer.cs (1)
154
var propertyDeclaration = (TPropertyDeclaration)context.
Node
;
AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
61
var ifStatement = (TIfStatementSyntax)context.
Node
;
AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
53
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
50
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (2)
89
var objectCreationExpression = (TObjectCreationExpressionSyntax)context.
Node
;
138
var syntaxTree = context.
Node
.SyntaxTree;
AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
72
var assignment = (TAssignmentSyntax)context.
Node
;
AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
68
var invocation = context.
Node
;
AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
108
var conditionalExpression = (TConditionalExpressionSyntax)context.
Node
;
AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
38
var ifStatement = (TIfStatementSyntax)context.
Node
;
AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
81
var objectCreationExpression = (TObjectCreationExpressionSyntax)context.
Node
;
125
var syntaxTree = context.
Node
.SyntaxTree;
AbstractValidateFormatStringDiagnosticAnalyzer.cs (3)
92
var expression = syntaxFacts.GetExpressionOfInvocationExpression(context.
Node
);
104
var arguments = syntaxFacts.GetArgumentsOfInvocationExpression(context.
Node
);
353
context.
Node
.SyntaxTree,
AnalyzerOptionsProvider.cs (1)
136
=> GetAnalyzerOptions(context.Options, context.
Node
.SyntaxTree);
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (2)
66
if (context.
Node
is TIncompleteMemberSyntax)
68
ReportUnboundIdentifierNames(context, context.
Node
);
NamingStyleDiagnosticAnalyzerBase.cs (1)
80
var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(syntaxContext.
Node
, syntaxContext.CancellationToken);
PreferFrameworkType\PreferFrameworkTypeDiagnosticAnalyzerBase.cs (1)
71
var typeNode = (TTypeSyntax)context.
Node
;
SimplifyThisOrMe\AbstractSimplifyThisOrMeDiagnosticAnalyzer.cs (1)
54
var node = context.
Node
;
Microsoft.CodeAnalysis.Test.Utilities (15)
Diagnostics\CommonDiagnosticAnalyzers.cs (7)
572
syntaxNodeContext.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptor, syntaxNodeContext.
Node
.GetLocation()));
602
context.ReportDiagnostic(Diagnostic.Create(Rule, context.
Node
.GetLocation()));
642
context.ReportDiagnostic(Diagnostic.Create(Rule, context.
Node
.GetLocation()));
2556
context => context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.
Node
.GetLocation())),
2611
context.RegisterSyntaxNodeAction(context => HandleCallback(context.
Node
.GetLocation(), context.Compilation, context.ReportDiagnostic, context.CancellationToken), CodeAnalysis.CSharp.SyntaxKind.ClassDeclaration);
2692
context.RegisterSyntaxNodeAction(syntaxNodeContext => AnalyzedSyntaxNodes.Add(syntaxNodeContext.
Node
), SyntaxKind.LocalDeclarationStatement);
2726
codeBlockStartContext.RegisterSyntaxNodeAction(syntaxNodeContext => AnalyzedSyntaxNodesInsideCodeBlock.Add(syntaxNodeContext.
Node
), SyntaxKind.LocalDeclarationStatement);
Diagnostics\OperationTestAnalyzer.cs (3)
2023
syntaxContext.ReportDiagnostic(Diagnostic.Create(AssignmentSyntaxDescriptor, syntaxContext.
Node
.GetLocation()));
2139
var node = syntaxContext.
Node
;
2151
var node = syntaxContext.
Node
;
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (4)
160
context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.
Node
.GetLocation(), messageArgs: context.
Node
.ToFullString()));
179
context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.
Node
.GetLocation(), messageArgs: context.
Node
.ToFullString()));
Diagnostics\TestDiagnosticAnalyzer.cs (1)
100
OnAbstractMember("SyntaxNode", context.
Node
);
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\AnalysisContextInfoTests.cs (1)
80
c.RegisterSyntaxNodeAction(b => ThrowIfMatch(nameof(c.RegisterSyntaxNodeAction), new AnalysisContextInfo(b.SemanticModel.Compilation, b.
Node
)), SyntaxKind.ReturnStatement);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (11)
VisualBasicAnalyzerOptionsProvider.vb (1)
107
Return GetVisualBasicAnalyzerOptions(context.Options, context.
Node
.SyntaxTree)
VisualBasicRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.vb (1)
18
Dim attribute = DirectCast(syntaxContext.
Node
, AttributeSyntax)
VisualBasicRemoveUnnecessaryByValDiagnosticAnalyzer.vb (1)
26
Dim parameterSyntax = DirectCast(syntaxContext.
Node
, ParameterSyntax)
VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
39
For Each node In context.
Node
.DescendantNodes()
VisualBasicSimplifyObjectCreationDiagnosticAnalyzer.vb (1)
42
Dim node = context.
Node
VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (5)
28
Select Case context.
Node
.Kind()
30
ReportDiagnosticsIfNeeded(DirectCast(context.
Node
, NameColonEqualsSyntax), context)
33
ReportDiagnosticsIfNeeded(DirectCast(context.
Node
, NamedFieldInitializerSyntax), context)
44
Dim syntaxTree = context.
Node
.SyntaxTree
75
Dim syntaxTree = context.
Node
.SyntaxTree
VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
43
Dim node = syntaxContext.
Node
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
10628
context.ReportDiagnostic(Diagnostic.Create(Hidden01, context.
Node
.GetLocation()))
10653
context.ReportDiagnostic(Diagnostic.Create(Info01, context.
Node
.GetLocation()))
10704
context.ReportDiagnostic(Diagnostic.Create(Error01, context.
Node
.GetLocation()))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (19)
Diagnostics\Configuration\ConfigureSeverity\DotNetDiagnosticSeverityBasedSeverityConfigurationTests.vb (1)
35
Sub(c) c.ReportDiagnostic(Diagnostic.Create(Rule, c.
Node
.GetLocation())),
Diagnostics\Suppression\SuppressionTests.vb (18)
710
Dim classDecl = DirectCast(context.
Node
, ClassStatementSyntax)
783
Dim classDecl = DirectCast(context.
Node
, ClassStatementSyntax)
827
Dim classDecl = DirectCast(context.
Node
, ClassStatementSyntax)
891
Dim classDecl = DirectCast(context.
Node
, ClassStatementSyntax)
1009
Select Case context.
Node
.Kind()
1011
Dim classDecl = DirectCast(context.
Node
, ClassStatementSyntax)
1016
Dim ns = DirectCast(context.
Node
, NamespaceStatementSyntax)
1021
Dim method = DirectCast(context.
Node
, MethodStatementSyntax)
1026
Dim p = DirectCast(context.
Node
, PropertyStatementSyntax)
1031
Dim f = DirectCast(context.
Node
, FieldDeclarationSyntax)
1036
Dim e = DirectCast(context.
Node
, EventStatementSyntax)
1725
Select Case context.
Node
.Kind()
1727
Dim classDecl = DirectCast(context.
Node
, ClassStatementSyntax)
1732
Dim ns = DirectCast(context.
Node
, NamespaceStatementSyntax)
1737
Dim method = DirectCast(context.
Node
, MethodStatementSyntax)
1742
Dim p = DirectCast(context.
Node
, PropertyStatementSyntax)
1747
Dim f = DirectCast(context.
Node
, FieldDeclarationSyntax)
1752
Dim e = DirectCast(context.
Node
, EventStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features (11)
VisualBasicAnalyzerOptionsProvider.vb (1)
107
Return GetVisualBasicAnalyzerOptions(context.Options, context.
Node
.SyntaxTree)
VisualBasicRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.vb (1)
18
Dim attribute = DirectCast(syntaxContext.
Node
, AttributeSyntax)
VisualBasicRemoveUnnecessaryByValDiagnosticAnalyzer.vb (1)
26
Dim parameterSyntax = DirectCast(syntaxContext.
Node
, ParameterSyntax)
VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
39
For Each node In context.
Node
.DescendantNodes()
VisualBasicSimplifyObjectCreationDiagnosticAnalyzer.vb (1)
42
Dim node = context.
Node
VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (5)
28
Select Case context.
Node
.Kind()
30
ReportDiagnosticsIfNeeded(DirectCast(context.
Node
, NameColonEqualsSyntax), context)
33
ReportDiagnosticsIfNeeded(DirectCast(context.
Node
, NamedFieldInitializerSyntax), context)
44
Dim syntaxTree = context.
Node
.SyntaxTree
75
Dim syntaxTree = context.
Node
.SyntaxTree
VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
43
Dim node = syntaxContext.
Node
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (11)
Diagnostics\DiagnosticAnalyzerTests.vb (8)
40
Dim id = CType(context.
Node
, IdentifierNameSyntax)
278
Dim moduleStatement = DirectCast(context.
Node
, ModuleStatementSyntax)
279
context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(desc1, context.
Node
.GetLocation))
362
Select Case context.
Node
.Kind
364
location = DirectCast(context.
Node
, NamespaceBlockSyntax).NamespaceStatement.Name.GetLocation
366
location = DirectCast(context.
Node
, ClassBlockSyntax).BlockStatement.Identifier.GetLocation
575
Dim sourceLoc = DirectCast(context.
Node
, FieldDeclarationSyntax).GetLocation
962
nodeContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(ExpressionDescriptor, nodeContext.
Node
.GetLocation()))
Diagnostics\GetDiagnosticsTests.vb (3)
620
If Not uniqueCallbacks.Add(nodeContext.
Node
) Then
621
Throw New Exception($"Multiple callbacks for {nodeContext.
Node
}")
628
AnalyzeNode(context.
Node
, context.ContainingSymbol, AddressOf context.ReportDiagnostic)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (1)
Parser\ParseDirectives.vb (1)
3174
context.ReportDiagnostic(_reporter(context.
Node
, _descriptor))
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
BatchFixAllProviderTests.cs (1)
71
var node = (LiteralExpressionSyntax)context.
Node
;