135 references to IsParentKind
Microsoft.CodeAnalysis.CSharp.CodeStyle (66)
CastSimplifier.cs (1)
470
if (castNode.
IsParentKind
(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object)
CSharpAddBracesDiagnosticAnalyzer.cs (1)
276
while (result.
IsParentKind
(SyntaxKind.ElseClause))
CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
312
return current.
IsParentKind
(SyntaxKind.Block)
CSharpSmartTokenFormatter.cs (2)
75
(endToken.Parent.
IsParentKind
(SyntaxKind.TryStatement) || endToken.Parent.
IsParentKind
(SyntaxKind.DoStatement));
CSharpSyntaxFacts.cs (10)
634
node.
IsParentKind
(SyntaxKind.NameColon) &&
635
node.Parent.
IsParentKind
(SyntaxKind.Subpattern);
647
if (identifier.Parent.
IsParentKind
(SyntaxKind.WithInitializerExpression))
653
else if (identifier.Parent.
IsParentKind
(SyntaxKind.ObjectInitializerExpression))
1173
=> node.
IsParentKind
(SyntaxKind.PostIncrementExpression) ||
1174
node.
IsParentKind
(SyntaxKind.PreIncrementExpression);
1177
=> node.
IsParentKind
(SyntaxKind.PostDecrementExpression) ||
1178
node.
IsParentKind
(SyntaxKind.PreDecrementExpression);
1264
return node.Parent.
IsParentKind
(SyntaxKind.FieldDeclaration) ||
1265
node.Parent.
IsParentKind
(SyntaxKind.EventFieldDeclaration);
CSharpUseLocalFunctionDiagnosticAnalyzer.cs (3)
186
if (anonymousFunction.
IsParentKind
(SyntaxKind.EqualsValueClause) &&
187
anonymousFunction.Parent.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
188
anonymousFunction.Parent.Parent.
IsParentKind
(SyntaxKind.VariableDeclaration) &&
DefaultExpressionSyntaxExtensions.cs (1)
69
if (equalsValueClause.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
ElasticTriviaFormattingRule.cs (1)
131
currentToken.Parent.
IsParentKind
(SyntaxKind.IfStatement))
ExpressionSyntaxExtensions.cs (10)
36
=> expression.
IsParentKind
(SyntaxKind.NameMemberCref) && expression.Parent.
IsParentKind
(SyntaxKind.QualifiedCref);
100
=> name.
IsParentKind
(SyntaxKind.ExplicitInterfaceSpecifier);
181
if (expression.
IsParentKind
(SyntaxKind.ConstantPattern))
275
if (!expr.
IsParentKind
(SyntaxKind.Argument))
386
return nameEquals.
IsParentKind
(SyntaxKind.AttributeArgument);
470
if (expression is LiteralExpressionSyntax && !expression.
IsParentKind
(SyntaxKind.UnaryMinusExpression))
583
if (!(expression is LiteralExpressionSyntax && expression.
IsParentKind
(SyntaxKind.UnaryMinusExpression)))
624
if ((expression.
IsParentKind
(SyntaxKind.NameEquals) && expression.Parent.
IsParentKind
(SyntaxKind.AttributeArgument)) ||
FormattingHelpers.cs (5)
77
=> token.IsOpenParenInParameterList() && token.Parent.
IsParentKind
(SyntaxKind.ConversionOperatorDeclaration);
80
=> token.IsOpenParenInParameterList() && token.Parent.
IsParentKind
(SyntaxKind.OperatorDeclaration);
134
return node.
IsParentKind
(SyntaxKind.SimpleLambdaExpression) || node.
IsParentKind
(SyntaxKind.ParenthesizedLambdaExpression);
144
return node.
IsParentKind
(SyntaxKind.AnonymousMethodExpression);
NullableImpactingSpanWalker.cs (4)
82
if (node.
IsParentKind
(SyntaxKind.UsingDirective))
88
if (node.
IsParentKind
(SyntaxKind.SimpleBaseType))
100
if (node.
IsParentKind
(SyntaxKind.NameEquals) && node.Parent.
IsParentKind
(SyntaxKind.UsingDirective))
ParenthesizedExpressionSyntaxExtensions.cs (2)
251
nodeParent.
IsParentKind
(SyntaxKind.CasePatternSwitchLabel))
556
(binaryExpression.
IsParentKind
(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax))
SemanticModelExtensions.cs (20)
226
variableDeclaration.
IsParentKind
(SyntaxKind.FieldDeclaration))
233
if (type.
IsParentKind
(SyntaxKind.ObjectCreationExpression) &&
234
type.Parent.
IsParentKind
(SyntaxKind.EqualsValueClause) &&
235
type.Parent.Parent.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
237
variableDeclaration.
IsParentKind
(SyntaxKind.FieldDeclaration))
252
if (type.
IsParentKind
(SyntaxKind.DelegateDeclaration) ||
253
type.
IsParentKind
(SyntaxKind.MethodDeclaration) ||
254
type.
IsParentKind
(SyntaxKind.PropertyDeclaration) ||
255
type.
IsParentKind
(SyntaxKind.EventDeclaration) ||
256
type.
IsParentKind
(SyntaxKind.IndexerDeclaration) ||
257
type.
IsParentKind
(SyntaxKind.OperatorDeclaration))
273
if (type.
IsParentKind
(SyntaxKind.Parameter) && type.Parent.
IsParentKind
(SyntaxKind.ParameterList))
275
if (type.Parent.Parent.
IsParentKind
(SyntaxKind.DelegateDeclaration) ||
276
type.Parent.Parent.
IsParentKind
(SyntaxKind.MethodDeclaration) ||
277
type.Parent.Parent.
IsParentKind
(SyntaxKind.IndexerDeclaration) ||
278
type.Parent.Parent.
IsParentKind
(SyntaxKind.OperatorDeclaration))
284
if (type.Parent.Parent.
IsParentKind
(SyntaxKind.ConstructorDeclaration))
296
variableDeclaration.
IsParentKind
(SyntaxKind.EventFieldDeclaration))
306
if (type.
IsParentKind
(SyntaxKind.TypeConstraint))
SimpleNameSyntaxExtensions.cs (1)
16
Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.
IsParentKind
(SyntaxKind.NameMemberCref));
SyntaxNodeExtensions.cs (2)
49
if (node.
IsParentKind
(kind))
758
equalsValue.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
TokenBasedFormattingRule.cs (2)
287
previousToken.Parent.
IsParentKind
(SyntaxKind.Parameter))
465
previousToken.Parent?.
IsParentKind
(SyntaxKind.ArrayType) == true)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (69)
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
115
editor.RemoveNode(nextStatement.
IsParentKind
(SyntaxKind.GlobalStatement) ? nextStatement.GetRequiredParent() : nextStatement);
CSharpCodeGenerationService.cs (1)
515
else if (destinationMember is StatementSyntax statement && statement.
IsParentKind
(SyntaxKind.GlobalStatement))
CSharpDeclareAsNullableCodeFixProvider.cs (3)
71
if (node.
IsParentKind
(SyntaxKind.Argument))
157
var onYield = node.
IsParentKind
(SyntaxKind.YieldReturnStatement);
279
if (node.
IsParentKind
(SyntaxKind.ArrowExpressionClause) &&
CSharpIsAndCastCheckCodeFixProvider.cs (1)
99
newIf = originalIf.
IsParentKind
(SyntaxKind.ElseClause)
CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
64
(i == 0 && currentUsing.
IsParentKind
(SyntaxKind.FileScopedNamespaceDeclaration)))
CSharpRemoveUnreachableCodeCodeFixProvider.cs (3)
84
if (!statement.
IsParentKind
(SyntaxKind.Block)
85
&& !statement.
IsParentKind
(SyntaxKind.SwitchSection)
86
&& !statement.
IsParentKind
(SyntaxKind.GlobalStatement))
CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
85
return node.
IsParentKind
(SyntaxKind.Subpattern)
CSharpTypeInferenceService.TypeInferrer.cs (8)
323
if (argument.Parent.
IsParentKind
(SyntaxKind.ImplicitElementAccess) &&
324
argument.Parent.Parent.
IsParentKind
(SyntaxKind.SimpleAssignmentExpression) &&
325
argument.Parent.Parent.Parent.
IsParentKind
(SyntaxKind.ObjectInitializerExpression) &&
1234
if (equalsValue.
IsParentKind
(SyntaxKind.Parameter) &&
1440
else if (initializerExpression.
IsParentKind
(SyntaxKind.SimpleAssignmentExpression))
1766
memberAccessExpression.Parent.
IsParentKind
(SyntaxKind.AwaitExpression))
2245
if (variableDeclaration.
IsParentKind
(SyntaxKind.UsingStatement))
2249
if (variableDeclaration.
IsParentKind
(SyntaxKind.ForStatement))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (6)
18
if (node.
IsParentKind
(SyntaxKind.MethodDeclaration) ||
19
node.
IsParentKind
(SyntaxKind.LocalFunctionStatement) ||
20
node.
IsParentKind
(SyntaxKind.ConstructorDeclaration) ||
21
node.
IsParentKind
(SyntaxKind.DelegateDeclaration))
29
node.
IsParentKind
(SyntaxKind.OperatorDeclaration) ||
30
node.
IsParentKind
(SyntaxKind.ConversionOperatorDeclaration);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (13)
117
return statement != null && !statement.
IsParentKind
(SyntaxKind.GlobalStatement) &&
132
if (!token.Parent.
IsParentKind
(SyntaxKind.TryStatement) &&
133
!token.Parent.
IsParentKind
(SyntaxKind.DoStatement))
139
token.Parent.
IsParentKind
(SyntaxKind.ElseClause) ||
140
token.Parent.
IsParentKind
(SyntaxKind.FinallyClause) ||
141
token.Parent.
IsParentKind
(SyntaxKind.CatchClause) ||
142
token.Parent.
IsParentKind
(SyntaxKind.SwitchSection))
210
memberDeclaration.
IsParentKind
(SyntaxKind.CompilationUnit))
229
memberDeclaration.
IsParentKind
(SyntaxKind.CompilationUnit))
468
if (targetToken.Parent.
IsParentKind
(SyntaxKind.ObjectCreationExpression) ||
469
targetToken.Parent.
IsParentKind
(SyntaxKind.BaseConstructorInitializer) ||
470
targetToken.Parent.
IsParentKind
(SyntaxKind.ThisConstructorInitializer))
478
if (targetToken.Parent.
IsParentKind
(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression())
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (27)
60
token.Parent.
IsParentKind
(SyntaxKind.Attribute))
68
token.Parent.
IsParentKind
(SyntaxKind.Attribute))
115
(parent is MemberDeclarationSyntax && parent.
IsParentKind
(SyntaxKind.CompilationUnit)))
510
if (token.Parent.
IsParentKind
(SyntaxKind.CompilationUnit))
832
token.Parent.
IsParentKind
(SyntaxKind.SimpleBaseType) &&
833
token.Parent.Parent.
IsParentKind
(SyntaxKind.BaseList))
1007
if (name.
IsParentKind
(SyntaxKind.LessThanExpression) &&
1009
conditional.
IsParentKind
(SyntaxKind.ExpressionStatement) &&
1010
conditional.Parent.
IsParentKind
(SyntaxKind.GlobalStatement))
1217
token.Parent.
IsParentKind
(SyntaxKind.ParenthesizedLambdaExpression))
1264
return parent.IsKind(SyntaxKind.ParameterList) && parent.
IsParentKind
(SyntaxKind.AnonymousMethodExpression);
1407
leftToken.Parent.
IsParentKind
(SyntaxKind.Subpattern))
1593
leftToken.Parent.
IsParentKind
(SyntaxKind.ParenthesizedVariableDesignation))
1784
if (parent.
IsParentKind
(SyntaxKind.VariableDeclaration) &&
2068
if (equalsValue.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
2069
equalsValue.Parent.
IsParentKind
(SyntaxKind.VariableDeclaration))
2087
if (equalsValue.
IsParentKind
(SyntaxKind.EnumMemberDeclaration))
2093
if (equalsValue.
IsParentKind
(SyntaxKind.Parameter))
2111
token.Parent.
IsParentKind
(SyntaxKind.AttributeArgument))
2119
token.Parent.
IsParentKind
(SyntaxKind.AttributeArgument))
2200
token.Parent.
IsParentKind
(SyntaxKind.UsingDirective))
2340
if (type.
IsParentKind
(SyntaxKind.VariableDeclaration) &&
2459
if (token.Parent.
IsParentKind
(SyntaxKind.ParenthesizedExpression))
2471
token.Parent.
IsParentKind
(SyntaxKind.Argument))
2952
if (block.
IsParentKind
(SyntaxKind.TryStatement) ||
2953
block.
IsParentKind
(SyntaxKind.CatchClause))
3000
token.Parent.
IsParentKind
(SyntaxKind.EnumDeclaration);
NameSyntaxExtensions.cs (4)
54
if (nameSyntax.
IsParentKind
(SyntaxKind.AliasQualifiedName) ||
55
nameSyntax.
IsParentKind
(SyntaxKind.NameColon) ||
56
nameSyntax.
IsParentKind
(SyntaxKind.NameEquals) ||
57
nameSyntax.
IsParentKind
(SyntaxKind.TypeParameterConstraintClause))