75 references to IsParentKind
Roslyn.Diagnostics.CSharp.Analyzers (75)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (1)
69
if (equalsValueClause.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (10)
45
=> expression.
IsParentKind
(SyntaxKind.NameMemberCref) && expression.Parent.
IsParentKind
(SyntaxKind.QualifiedCref);
109
=> name.
IsParentKind
(SyntaxKind.ExplicitInterfaceSpecifier);
187
if (expression.
IsParentKind
(SyntaxKind.ConstantPattern))
275
if (!expr.
IsParentKind
(SyntaxKind.Argument))
400
return nameEquals.
IsParentKind
(SyntaxKind.AttributeArgument);
485
if (expression is LiteralExpressionSyntax && !expression.
IsParentKind
(SyntaxKind.UnaryMinusExpression))
598
if (!(expression is LiteralExpressionSyntax && expression.
IsParentKind
(SyntaxKind.UnaryMinusExpression)))
639
if ((expression.
IsParentKind
(SyntaxKind.NameEquals) && expression.Parent.
IsParentKind
(SyntaxKind.AttributeArgument)) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (2)
275
nodeParent.
IsParentKind
(SyntaxKind.CasePatternSwitchLabel))
586
(binaryExpression.
IsParentKind
(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (10)
225
variableDeclaration.
IsParentKind
(SyntaxKind.FieldDeclaration))
232
if (type.
IsParentKind
(SyntaxKind.ObjectCreationExpression) &&
233
type.Parent.
IsParentKind
(SyntaxKind.EqualsValueClause) &&
234
type.Parent.Parent.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
236
variableDeclaration.
IsParentKind
(SyntaxKind.FieldDeclaration))
273
if (type.
IsParentKind
(SyntaxKind.Parameter) && type.Parent.
IsParentKind
(SyntaxKind.ParameterList))
285
if (type.Parent.Parent.
IsParentKind
(SyntaxKind.ConstructorDeclaration))
297
variableDeclaration.
IsParentKind
(SyntaxKind.EventFieldDeclaration))
307
if (type.
IsParentKind
(SyntaxKind.TypeConstraint))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16
Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.
IsParentKind
(SyntaxKind.NameMemberCref));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
50
if (node.
IsParentKind
(kind))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (3)
77
=> token.IsOpenParenInParameterList() && token.Parent.
IsParentKind
(SyntaxKind.ConversionOperatorDeclaration);
80
=> token.IsOpenParenInParameterList() && token.Parent.
IsParentKind
(SyntaxKind.OperatorDeclaration);
144
return node.
IsParentKind
(SyntaxKind.AnonymousMethodExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
143
currentToken.Parent.
IsParentKind
(SyntaxKind.IfStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (2)
298
previousToken.Parent.
IsParentKind
(SyntaxKind.Parameter))
480
previousToken.Parent?.
IsParentKind
(SyntaxKind.ArrayType) == true)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
632
node.
IsParentKind
(SyntaxKind.NameColon) &&
633
node.Parent.
IsParentKind
(SyntaxKind.Subpattern);
645
if (identifier.Parent.
IsParentKind
(SyntaxKind.WithInitializerExpression))
651
else if (identifier.Parent.
IsParentKind
(SyntaxKind.ObjectInitializerExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
553
if (castNode.
IsParentKind
(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
515
else if (destinationMember is StatementSyntax statement && statement.
IsParentKind
(SyntaxKind.GlobalStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (4)
120
return statement != null && !statement.
IsParentKind
(SyntaxKind.GlobalStatement) &&
211
memberDeclaration.
IsParentKind
(SyntaxKind.CompilationUnit))
230
memberDeclaration.
IsParentKind
(SyntaxKind.CompilationUnit))
480
if (targetToken.Parent.
IsParentKind
(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (25)
61
token.Parent.
IsParentKind
(SyntaxKind.Attribute))
69
token.Parent.
IsParentKind
(SyntaxKind.Attribute))
116
(parent is MemberDeclarationSyntax && parent.
IsParentKind
(SyntaxKind.CompilationUnit)))
511
if (token.Parent.
IsParentKind
(SyntaxKind.CompilationUnit))
833
token.Parent.
IsParentKind
(SyntaxKind.SimpleBaseType) &&
834
token.Parent.Parent.
IsParentKind
(SyntaxKind.BaseList))
1008
if (name.
IsParentKind
(SyntaxKind.LessThanExpression) &&
1010
conditional.
IsParentKind
(SyntaxKind.ExpressionStatement) &&
1011
conditional.Parent.
IsParentKind
(SyntaxKind.GlobalStatement))
1232
token.Parent.
IsParentKind
(SyntaxKind.ParenthesizedLambdaExpression))
1279
return parent.IsKind(SyntaxKind.ParameterList) && parent.
IsParentKind
(SyntaxKind.AnonymousMethodExpression);
1422
leftToken.Parent.
IsParentKind
(SyntaxKind.Subpattern))
1610
leftToken.Parent.
IsParentKind
(SyntaxKind.ParenthesizedVariableDesignation))
1801
if (parent.
IsParentKind
(SyntaxKind.VariableDeclaration) &&
2078
if (equalsValue.
IsParentKind
(SyntaxKind.VariableDeclarator) &&
2079
equalsValue.Parent.
IsParentKind
(SyntaxKind.VariableDeclaration))
2097
if (equalsValue.
IsParentKind
(SyntaxKind.EnumMemberDeclaration))
2103
if (equalsValue.
IsParentKind
(SyntaxKind.Parameter))
2120
token.Parent.
IsParentKind
(SyntaxKind.AttributeArgument))
2128
token.Parent.
IsParentKind
(SyntaxKind.AttributeArgument))
2210
token.Parent.
IsParentKind
(SyntaxKind.UsingDirective))
2348
if (type.
IsParentKind
(SyntaxKind.VariableDeclaration) &&
2456
if (token.Parent.
IsParentKind
(SyntaxKind.ParenthesizedExpression))
2468
token.Parent.
IsParentKind
(SyntaxKind.Argument))
3013
targetToken.Parent.
IsParentKind
(SyntaxKind.EnumDeclaration);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63
(i == 0 && currentUsing.
IsParentKind
(SyntaxKind.FileScopedNamespaceDeclaration)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\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) &&
1220
if (equalsValue.
IsParentKind
(SyntaxKind.Parameter) &&
1414
else if (initializerExpression.
IsParentKind
(SyntaxKind.SimpleAssignmentExpression))
1729
memberAccessExpression.Parent.
IsParentKind
(SyntaxKind.AwaitExpression))
2192
if (variableDeclaration.
IsParentKind
(SyntaxKind.UsingStatement))
2196
if (variableDeclaration.
IsParentKind
(SyntaxKind.ForStatement))