1034 references to IsKind
Microsoft.Analyzers.Extra (4)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
169foreach (var method in targetClass.Members.Where(m => m.IsKind(SyntaxKind.MethodDeclaration)).OfType<MethodDeclarationSyntax>()) 270var allClasses = allNodes.Where(d => d.IsKind(SyntaxKind.ClassDeclaration)).OfType<ClassDeclarationSyntax>(); 522if (invocationExpression.Parent!.IsKind(SyntaxKind.ConditionalAccessExpression))
Utilities\SyntaxNodeExtensions.cs (1)
27while (n != null && !n.IsKind(kind))
Microsoft.Analyzers.Local (2)
CallAnalysis\Throws.cs (2)
35if (op.Syntax.IsKind(SyntaxKind.ThrowStatement)) 44else if (op.Syntax.IsKind(SyntaxKind.ThrowExpression))
Microsoft.AspNetCore.App.Analyzers (14)
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
43if (!argument.Value.Syntax.IsKind(SyntaxKind.NumericLiteralExpression))
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (6)
149if (container.Parent.IsKind(SyntaxKind.Argument)) 187else if (container.IsKind(SyntaxKind.Parameter)) 326if (current.IsKind(SyntaxKind.Parameter)) 342if (current.Parent?.IsKind(SyntaxKind.Argument) ?? false) 344if (current.Parent?.Parent?.IsKind(SyntaxKind.ArgumentList) ?? false) 388if (token.Parent.IsKind(SyntaxKind.PredefinedType))
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (4)
83if (container.Parent.IsKind(SyntaxKind.Argument)) 90else if (container.Parent.IsKind(SyntaxKind.AttributeArgument)) 111if (container.Parent?.IsKind(SyntaxKind.EqualsValueClause) ?? false) 113if (container.Parent.Parent?.IsKind(SyntaxKind.VariableDeclarator) ?? false)
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (2)
82if (container.Parent.IsKind(SyntaxKind.Argument)) 109else if (container.Parent.IsKind(SyntaxKind.AttributeArgument))
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (1)
71exprStatement.Expression.IsKind(SyntaxKind.SimpleAssignmentExpression);
Microsoft.AspNetCore.App.CodeFixes (1)
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
90if (current?.IsKind(SyntaxKind.SimpleMemberAccessExpression) ?? false)
Microsoft.AspNetCore.Components.Analyzers (3)
ComponentParameterAnalyzer.cs (3)
157if (getterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration)) 163if (!getterAccessor.IsKind(SyntaxKind.GetAccessorDeclaration) || !setterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration))
Microsoft.CodeAnalysis.CSharp (116)
Binder\Binder_Crefs.cs (1)
1028return parentSyntax == null || parentSyntax.IsKind(SyntaxKind.XmlCrefAttribute)
Binder\Binder_Expressions.cs (8)
4576if (!equalsValueClause.IsKind(SyntaxKind.EqualsValueClause)) 4583if (!variableDeclarator.IsKind(SyntaxKind.VariableDeclarator)) 4589if (!variableDeclaration.IsKind(SyntaxKind.VariableDeclaration)) 4595variableDeclaration.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) || 4596variableDeclaration.Parent.IsKind(SyntaxKind.ForStatement); 4611Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 4648bool isInferred = node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression);
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
1091if (node.IsKind(SyntaxKind.UsingDirective) && node.Parent == containingNode)
Binder\DecisionDagBuilder.cs (1)
2218if (e.Syntax.IsKind(SyntaxKind.ListPattern))
Binder\WithUsingNamespacesAndTypesBinder.cs (2)
306Debug.Assert(declarationSyntax.IsKind(SyntaxKind.CompilationUnit) || declarationSyntax.IsKind(SyntaxKind.NamespaceDeclaration));
CodeGen\EmitStatement.cs (2)
847return _ilEmitStyle == ILEmitStyle.Debug && _method.GenerateDebugInfo && _methodBodySyntaxOpt?.IsKind(SyntaxKind.Block) == true || 858(boundReturnStatement.Syntax.IsKind(SyntaxKind.Block) || _method?.IsImplicitConstructor == true) &&
Compilation\CSharpCompilation.cs (1)
782if (root.DescendantNodes(n => n is GlobalStatementSyntax || n is StatementSyntax || n is CompilationUnitSyntax).Any(n => n.IsKind(SyntaxKind.ReturnStatement)))
Compilation\CSharpSemanticModel.cs (1)
1847if (curr.IsKind(SyntaxKind.TypeOfExpression))
Compilation\InitializerSemanticModel.cs (3)
42Debug.Assert(syntax.IsKind(SyntaxKind.VariableDeclarator) || syntax.IsKind(SyntaxKind.EnumMemberDeclaration)); 52Debug.Assert(syntax.IsKind(SyntaxKind.PropertyDeclaration));
FlowAnalysis\FlowAnalysisPass.cs (4)
195syntax.IsKind(SyntaxKind.Block) || 196syntax.IsKind(SyntaxKind.ArrowExpressionClause) || 197syntax.IsKind(SyntaxKind.ConstructorDeclaration) || 198syntax.IsKind(SyntaxKind.CompilationUnit));
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (2)
548Debug.Assert(node.Syntax.IsKind(SyntaxKind.CatchClause)); 1067Debug.Assert(pendingCatch.SyntaxOpt.IsKind(SyntaxKind.TryStatement));
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
362Debug.Assert(node.Syntax.IsKind(SyntaxKind.AwaitExpression) || node.WasCompilerGenerated);
Lowering\Instrumentation\DebugInfoInjector.cs (1)
134if (syntax.IsKind(SyntaxKind.Parameter))
Lowering\LocalRewriter\LocalRewriter.cs (1)
865if (syntax.IsKind(SyntaxKind.Parameter))
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (2)
519SynthesizedLocalKind.Spill => awaitSyntaxOpt.IsKind(SyntaxKind.AwaitExpression) || awaitSyntaxOpt.IsKind(SyntaxKind.SwitchExpression),
Operations\CSharpOperationFactory.cs (1)
2156SyntaxNode declarationSyntax = declarationGroupSyntax.IsKind(SyntaxKind.LocalDeclarationStatement) ?
Symbols\FieldOrPropertyInitializer.cs (2)
31Debug.Assert(((syntax.IsKind(SyntaxKind.EqualsValueClause) || syntax.IsKind(SyntaxKind.Parameter)) && fieldOpt != null) || syntax is StatementSyntax);
Symbols\Source\SourceComplexParameterSymbol.cs (1)
53Debug.Assert((syntaxRef == null) || (syntaxRef.GetSyntax().IsKind(SyntaxKind.Parameter)));
Symbols\Source\TypeParameterBuilder.cs (1)
29Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter));
Syntax\CSharpSyntaxRewriter.cs (1)
152if (!alternate.IsNull && visited != null && !visited.IsKind(SyntaxKind.None))
Syntax\LambdaUtilities.cs (7)
40return !node.Parent.IsKind(SyntaxKind.QueryExpression); 55if (lambda.IsKind(SyntaxKind.ArrowExpressionClause)) 61Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 298if (node.Parent.IsKind(SyntaxKind.QueryExpression)) 376return syntax.IsKind(SyntaxKind.GroupClause) || 377syntax.IsKind(SyntaxKind.JoinClause) || 378syntax.IsKind(SyntaxKind.FromClause);
Syntax\SyntaxBindingUtilities.cs (2)
14=> node.IsKind(SyntaxKind.YieldReturnStatement) || 15node.IsKind(SyntaxKind.AwaitExpression) ||
Syntax\SyntaxFactory.cs (3)
2229if (parent.Parent.IsKind(SyntaxKind.Subpattern)) 2360if (lastNode.IsKind(SyntaxKind.IncompleteMember)) 2367if (!lastNode.IsKind(SyntaxKind.GlobalStatement))
Syntax\SyntaxFacts.cs (13)
278if (!node.IsKind(IdentifierName)) 284if (parent1 == null || !parent1.IsKind(NameColon)) 290if (parent2.IsKind(SyntaxKind.Subpattern)) 295if (parent2 == null || !(parent2.IsKind(Argument) || parent2.IsKind(AttributeArgument))) 306if (parent3.IsKind(SyntaxKind.TupleExpression)) 311if (!(parent3 is BaseArgumentListSyntax || parent3.IsKind(AttributeArgumentList))) 348while (current != null && (current.IsKind(ParenthesizedExpression) || current.IsKind(CastExpression))) current = current.Parent; 349if (current == null || !current.IsKind(EqualsValueClause)) return false; 351if (current == null || !current.IsKind(VariableDeclarator)) return false; 353if (current == null || !current.IsKind(VariableDeclaration)) return false; 355return current != null && current.IsKind(FixedStatement);
Syntax\SyntaxNodeExtensions.cs (5)
150if (node.Parent.IsKind(SyntaxKind.CastExpression)) 155while (node.Parent.IsKind(SyntaxKind.ConditionalExpression)) 174return variableDeclarator.IsKind(SyntaxKind.VariableDeclarator) && 175variableDeclarator.Parent.IsKind(SyntaxKind.VariableDeclaration); 180return parentNode.Parent.IsKind(SyntaxKind.ExpressionStatement);
Syntax\SyntaxNormalizer.cs (49)
279if ((nextToken.IsKind(SyntaxKind.FromKeyword) && nextToken.Parent.IsKind(SyntaxKind.FromClause)) || 280(nextToken.IsKind(SyntaxKind.LetKeyword) && nextToken.Parent.IsKind(SyntaxKind.LetClause)) || 281(nextToken.IsKind(SyntaxKind.WhereKeyword) && nextToken.Parent.IsKind(SyntaxKind.WhereClause)) || 282(nextToken.IsKind(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinClause)) || 283(nextToken.IsKind(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 284(nextToken.IsKind(SyntaxKind.OrderByKeyword) && nextToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 285(nextToken.IsKind(SyntaxKind.SelectKeyword) && nextToken.Parent.IsKind(SyntaxKind.SelectClause)) || 286(nextToken.IsKind(SyntaxKind.GroupKeyword) && nextToken.Parent.IsKind(SyntaxKind.GroupClause))) 320if (parent.IsKind(SyntaxKind.Interpolation) || 337if (parent.IsKind(SyntaxKind.Interpolation) || 353parent.IsKind(SyntaxKind.Interpolation) || 369currentTokenParent.IsKind(SyntaxKind.Interpolation) || 400nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 417if (currentToken.Parent.IsKind(SyntaxKind.ForStatement)) 425else if (currentToken.Parent.IsKind(SyntaxKind.UsingDirective)) 427return nextToken.Parent.IsKind(SyntaxKind.UsingDirective) ? 1 : 2; 429else if (currentToken.Parent.IsKind(SyntaxKind.ExternAliasDirective)) 431return nextToken.Parent.IsKind(SyntaxKind.ExternAliasDirective) ? 1 : 2; 470if (token.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 474else if (next.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 530if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 534else if (next.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 649if (token.IsKind(SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeArgumentList)) 658token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && 666!token.Parent.IsKind(SyntaxKind.EnumDeclaration)) 684if (token.Parent.IsKind(SyntaxKind.ConditionalExpression) || token.Parent is TypeSyntax) 695return !token.Parent.IsKind(SyntaxKind.InterpolationFormatClause) && 696!token.Parent.IsKind(SyntaxKind.XmlPrefix); 701if (next.Parent.IsKind(SyntaxKind.BaseList) || 702next.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) || 715if (token.IsKind(SyntaxKind.CloseParenToken) && IsWord(next.Kind()) && token.Parent.IsKind(SyntaxKind.TupleType) == true) 721&& (next.Parent.IsKind(SyntaxKind.ConditionalExpression))) 728return !token.Parent.IsKind(SyntaxKind.XmlTextAttribute); 733return !next.Parent.IsKind(SyntaxKind.XmlTextAttribute); 738if (token.Parent.IsKind(SyntaxKind.FunctionPointerType)) 747if (token.IsKind(SyntaxKind.AsteriskToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention)) 759if (next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && next.IsKind(SyntaxKind.LessThanToken)) 771case SyntaxKind.CloseBracketToken when token.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList): 778if (token.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention) && next.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList) && 785if (next.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList) && token.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList)) 818if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 825if (next.IsKind(SyntaxKind.GreaterThanToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 849(next.IsKind(SyntaxKind.IdentifierToken) || next.Parent.IsKind(SyntaxKind.IndexerDeclaration))) 896(!next.IsKind(SyntaxKind.OpenParenToken) || KeywordNeedsSeparatorBeforeOpenParen(token.Kind()) || next.Parent.IsKind(SyntaxKind.TupleType)) && 1321if (node.Parent.IsKind(SyntaxKind.CompilationUnit)) 1333if (node.IsKind(SyntaxKind.IfStatement) && node.Parent.IsKind(SyntaxKind.ElseClause))
Microsoft.CodeAnalysis.CSharp.CodeStyle (181)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (4)
268if (ifStatementOrElseClause.IsKind(SyntaxKind.ElseClause)) 274Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement)); 293if (statement.Statement.IsKind(SyntaxKind.Block)) 297if (elseStatement.IsKind(SyntaxKind.Block))
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (3)
84if (!_assignmentTargetOpt.IsKind(SyntaxKind.IdentifierName)) 224case 2 when section.Statements[1].IsKind(SyntaxKind.BreakStatement) || section.Statements[0].IsKind(SyntaxKind.SwitchStatement):
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionHelpers.cs (2)
15if (node.IsKind(SyntaxKind.DefaultSwitchLabel)) 23if (@case.Pattern.IsKind(SyntaxKind.DiscardPattern))
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (7)
58if (!ifStatement.Condition.IsKind(SyntaxKind.NotEqualsExpression)) 121if (condition.Left.IsKind(SyntaxKind.NullLiteralExpression) || 122condition.Right.IsKind(SyntaxKind.NullLiteralExpression)) 124var expr = condition.Left.IsKind(SyntaxKind.NullLiteralExpression) 227if (!ifStatement.Parent.IsKind(SyntaxKind.Block)) 333=> left.IsKind(SyntaxKind.IdentifierName) && right.IsKind(SyntaxKind.NullLiteralExpression);
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (3)
91var parentIsElseClause = parent.IsKind(SyntaxKind.ElseClause); 97if (statement.IsKind(SyntaxKind.IfStatement) && parentIsElseClause) 109if (parent.IsKind(SyntaxKind.Block))
src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (4)
24=> node.IsKind(SyntaxKind.ThisExpression); 38if (node.IsKind(SyntaxKind.BaseExpression)) 62=> declarationSyntax.IsKind(SyntaxKind.PropertyDeclaration) && declarationSyntax.Contains(node); 65=> declarationSyntax.GetAncestorsOrThis(n => n.IsKind(SyntaxKind.FieldDeclaration) && n.Contains(node)).Any();
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (2)
66if (currentStatement.IsKind(SyntaxKind.LabeledStatement)) 76if (currentStatement.IsKind(SyntaxKind.LocalFunctionStatement))
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
79!blockOperation.Syntax.IsKind(SyntaxKind.Block);
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (2)
58if (node.IsKind(SyntaxKind.FieldExpression)) 181else if (expression.IsKind(SyntaxKind.IdentifierName))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
1037if (objectCreation.Initializer.IsKind(SyntaxKind.ObjectCreationExpression) && objectCreation.Initializer.Expressions.Count > 0)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (1)
35=> expression.IsKind(SyntaxKind.ComplexElementInitializerExpression);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (1)
57=> declaration.IsKind(SyntaxKind.GetAccessorDeclaration);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
194if (expressionBody!.Expression.IsKind(SyntaxKind.ThrowExpression))
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
56if (expressionBodyOpt.IsKind(SyntaxKind.ThrowExpression) &&
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
101else if (objectCreation.Parent.IsKind(SyntaxKind.ArrowExpressionClause))
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
73right.IsKind(SyntaxKind.NullLiteralExpression))
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
357if (assignment.Left.IsKind(SyntaxKind.IdentifierName))
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
39Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement));
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (3)
338if (left.IsKind(SyntaxKind.NullLiteralExpression)) 345if (right.IsKind(SyntaxKind.NullLiteralExpression)) 361&& constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
96var ifStatementScope = ifStatement.Parent.IsKind(SyntaxKind.Block)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (2)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (29)
40var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 59if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 60parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 89var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 95if (expression.IsKind(SyntaxKind.ThrowExpression)) 99if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 103if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 111if (expression.IsKind(SyntaxKind.TupleExpression)) 163if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 173if (nodeParent.IsKind(SyntaxKind.Interpolation)) 178if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 234if (expression.IsKind(SyntaxKind.ThisExpression)) 238if (expression.IsKind(SyntaxKind.ThrowExpression) && 246if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 250if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 257if (nodeParent.IsKind(SyntaxKind.WhenClause)) 271if (parentExpression.IsKind(SyntaxKind.CastExpression) && 279if (expression.IsKind(SyntaxKind.ConditionalExpression) && 290if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 425if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 518if (name.IsKind(SyntaxKind.AliasQualifiedName)) 547if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 560else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 575else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 582else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 624|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 755if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 758if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
32if (node.IsKind(kind)) 43=> CodeAnalysis.CSharpExtensions.IsKind(node?.Parent, kind); 358return !current.Parent.IsKind(SyntaxKind.CompilationUnit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (20)
83=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 86=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 109if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 119=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 125=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 178return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 210token.Parent.IsKind(SyntaxKind.EnumDeclaration); 278token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 279token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 305=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 340=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 433parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 452parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 521=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 539currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 543=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (1)
25if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (1)
184else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (11)
116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 373if ((currentToken.Kind() == SyntaxKind.FromKeyword && currentToken.Parent.IsKind(SyntaxKind.FromClause)) || 374(currentToken.Kind() == SyntaxKind.LetKeyword && currentToken.Parent.IsKind(SyntaxKind.LetClause)) || 375(currentToken.Kind() == SyntaxKind.WhereKeyword && currentToken.Parent.IsKind(SyntaxKind.WhereClause)) || 376(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinClause)) || 377(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 378(currentToken.Kind() == SyntaxKind.OrderByKeyword && currentToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 379(currentToken.Kind() == SyntaxKind.SelectKeyword && currentToken.Parent.IsKind(SyntaxKind.SelectClause)) || 380(currentToken.Kind() == SyntaxKind.GroupKeyword && currentToken.Parent.IsKind(SyntaxKind.GroupClause))) 438nextToken.Parent.IsKind(SyntaxKind.DoStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
233if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (13)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 189if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 198if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 217if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 246if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 260if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 327if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 399if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 412if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 439if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 468&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (4)
92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 458if (previousToken.Parent.IsKind(SyntaxKind.NotPattern))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (5)
175if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 288previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 453if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 474currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 521&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
74if (embeddedStatement.IsKind(SyntaxKind.Block))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (1)
74endToken.Parent.IsKind(SyntaxKind.Block) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (3)
323=> node?.Parent.IsKind(SyntaxKind.FieldDeclaration) ?? false; 326=> node?.Parent.IsKind(SyntaxKind.EventFieldDeclaration) ?? false; 329=> node?.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) ?? false;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
23=> node.IsKind(SyntaxKind.Block);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (10)
521if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 527&& token.Parent.IsKind(SyntaxKind.CollectionExpression)) 555=> simpleName.IsKind(SyntaxKind.GenericName) || 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 635=> node.IsKind(SyntaxKind.IdentifierName) && 690=> node.IsKind(SyntaxKind.ElementAccessExpression); 1241=> node.IsKind(SyntaxKind.Attribute) && 1299exprStatement.Expression.IsKind(SyntaxKind.SimpleAssignmentExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
16if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
179var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 326var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 814if (originalConditionalExpression.WhenTrue.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression) || 815originalConditionalExpression.WhenFalse.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
349(previousToken.Parent.IsKind(SyntaxKind.Block) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (10)
303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 773if (newExpression.IsKind(SyntaxKind.ConditionalExpression) && 783if (newExpression.IsKind(SyntaxKind.SwitchExpression) && 793if (newExpression.IsKind(SyntaxKind.CollectionExpression) && 802if (newExpression.IsKind(SyntaxKind.TupleExpression) && 818if (originalExpression.IsKind(SyntaxKind.ConditionalExpression) && 819newExpression.IsKind(SyntaxKind.ConditionalExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (1)
73declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (4)
133if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType)) 137.Any(node => node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 281if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 287if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (87)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (4)
55if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent?.Parent?.IsKind(SyntaxKind.EventFieldDeclaration) == false) 86if (node.IsKind(SyntaxKind.VariableDeclarator) && !(node = node.Parent?.Parent).IsKind(SyntaxKind.EventFieldDeclaration))
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
60if (constructorInitializer.IsKind(SyntaxKind.BaseConstructorInitializer))
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement));
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression));
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
700if (docComment.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia))
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (2)
60typeToGenerateIn = constructorInitializer.IsKind(SyntaxKind.ThisConstructorInitializer) 191constructorDeclarationSyntax.Initializer.IsKind(SyntaxKind.ThisConstructorInitializer))
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
126else if (simpleName.IsKind(SyntaxKind.IdentifierName))
src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (2)
45if (node.IsKind(SyntaxKind.MemberBindingExpression)) 47var nameNode = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.IdentifierName));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
102if (ifStatement.Parent.IsKind(SyntaxKind.ElseClause) &&
src\Analyzers\CSharp\CodeFixes\MakeMemberStatic\CSharpMakeMemberStaticCodeFixProvider.cs (1)
31if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax })
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
67if (node.IsKind(SyntaxKind.ConditionalAccessExpression))
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (3)
94if (newNameNode.IsKind(SyntaxKind.DiscardDesignation)) 213if (originalCompoundAssignment.Parent.IsKind(SyntaxKind.ExpressionStatement)) 215if (!originalCompoundAssignment.IsKind(SyntaxKind.CoalesceAssignmentExpression))
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
75if (binary.IsKind(SyntaxKind.EqualsExpression)) 95=> binary.Right.IsKind(SyntaxKind.NullLiteralExpression)
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (2)
117if (expr.IsKind(SyntaxKind.DefaultLiteralExpression)) 121if (expr.IsKind(SyntaxKind.NullLiteralExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
509var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
166if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (20)
115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 124if (token.Parent.IsKind(SyntaxKind.Block)) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 174return token.Parent.IsKind(SyntaxKind.ElseClause); 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 468if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 582targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 590targetToken.Parent.IsKind(SyntaxKind.Block) && 605targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 616if (node.IsKind(SyntaxKind.TypeParameterList)) 650targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 651targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (32)
207token.Parent.IsKind(SyntaxKind.Block) && 220token.Parent.IsKind(SyntaxKind.AttributeList)) 482else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 491token.Parent.IsKind(SyntaxKind.Block) && 507token.Parent.IsKind(SyntaxKind.AttributeList)) 601return incompleteMember.Type.IsKind(SyntaxKind.RefType); 941return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 1158return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1171token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1230if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1265else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1269else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1278return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1349leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1376if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1391if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1398if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1405if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1412if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1438if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1448leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1583if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1673if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1679if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1692leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 2049token.Parent.IsKind(SyntaxKind.CastExpression)) 2865token.Parent.IsKind(SyntaxKind.IdentifierName) && 2873token.Parent.IsKind(SyntaxKind.IdentifierName)) 2980token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 2996targetToken.Parent.IsKind(SyntaxKind.BaseList) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (2)
30if (expression.IsKind(SyntaxKind.RefExpression)) 44if (expression.IsKind(SyntaxKind.ThrowExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (2)
126node.IsKind(SyntaxKind.Interpolation)) 133!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (4)
179(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 251if (token.Parent.IsKind(SyntaxKind.AccessorList) && 252token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 307if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1287if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1307else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (4)
CompleteStatement\CompleteStatementCommandHandler.cs (3)
233else if (currentNode.IsKind(SyntaxKind.DoStatement)) 263if (currentNode.IsKind(SyntaxKind.EqualsValueClause) && currentNode.IsParentKind(SyntaxKind.PropertyDeclaration)) 491else if (currentNode.IsKind(SyntaxKind.Utf8StringLiteralExpression))
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
115|| node.IsKind(SyntaxKind.UsingDirective);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenFunctionPointersTests.cs (2)
3339var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Initializer!.Value.IsKind(SyntaxKind.AddressOfExpression)).ToArray(); 4921.Where(l => l.IsKind(SyntaxKind.DefaultLiteralExpression))
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\EditAndContinue\EditAndContinueTestBase.cs (1)
74if (newNode.IsKind(kind))
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
Diagnostics\GetDiagnosticsTests.cs (2)
1636AssertEx.All(analyzer.AnalyzedSyntaxNodes, node => node.IsKind(SyntaxKind.LocalDeclarationStatement)); 1640AssertEx.All(analyzer.AnalyzedSyntaxNodesInsideCodeBlock, node => node.IsKind(SyntaxKind.LocalDeclarationStatement));
Semantics\PatternMatchingTests_ListPatterns.cs (1)
3677.Where(p => p.IsKind(SyntaxKind.PropertyPatternClause));
Microsoft.CodeAnalysis.CSharp.Features (174)
AddImport\CSharpAddImportFeatureService.cs (3)
68else if (node.Parent.IsKind(SyntaxKind.CollectionInitializerExpression)) 608if (expression.IsKind(SyntaxKind.CollectionInitializerExpression)) 626if (node.Parent.IsKind(SyntaxKind.CollectionInitializerExpression))
BraceCompletion\BracketBraceCompletionService.cs (1)
49if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && currentToken.Parent.IsKind(SyntaxKind.ListPattern))
BraceCompletion\CurlyBraceCompletionService.cs (4)
48=> token.IsKind(SyntaxKind.OpenBraceToken) && !token.Parent.IsKind(SyntaxKind.Interpolation); 159if (currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 165if (currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 201if (node.IsKind(SyntaxKind.SwitchStatement))
BraceCompletion\InterpolationBraceCompletionService.cs (1)
42=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation);
CodeLens\CSharpCodeLensDisplayInfoService.cs (2)
96if (node.Parent.IsKind(SyntaxKind.AccessorList) && 97node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration))
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (3)
27directive => directive.IsKind(SyntaxKind.NullableDirectiveTrivia); 225if (firstToken.IsKind(SyntaxKind.HashToken) && firstToken.Parent.IsKind(SyntaxKind.RegionDirectiveTrivia)) 230if (nextToken.IsKind(SyntaxKind.HashToken) && nextToken.Parent.IsKind(SyntaxKind.EndRegionDirectiveTrivia))
CodeRefactorings\InlineMethod\CSharpInlineMethodRefactoringProvider.cs (4)
66=> node.IsKind(SyntaxKind.FieldDeclaration); 88return expressionNode.IsKind(SyntaxKind.InvocationExpression) 117var parent => parent.IsKind(SyntaxKind.ArrowExpressionClause), 134(whenNotNull.IsKind(SyntaxKind.InvocationExpression) || IsNullConditionalInvocationExpression(whenNotNull));
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (4)
276while (scope.IsKind(SyntaxKind.LabeledStatement)) 282if (scope.IsKind(SyntaxKind.GlobalStatement)) 440while (parent.IsKind(SyntaxKind.Argument)) 443if (!parent.IsKind(SyntaxKind.TupleExpression))
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
558when canConvertToSubpattern(name, arg) && !memberAccess.Expression.IsKind(SyntaxKind.BaseExpression):
Completion\CompletionProviders\CrefCompletionProvider.cs (4)
122token.Parent.IsKind(SyntaxKind.XmlCrefAttribute); 141token.Parent.IsKind(SyntaxKind.CrefParameterList)) 147token.Parent.IsKind(SyntaxKind.CrefBracketedParameterList)) 161&& token.Parent.IsKind(SyntaxKind.QualifiedCref);
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (2)
113if (token.IsKind(SyntaxKind.NewKeyword) && token.Parent.IsKind(SyntaxKind.ObjectCreationExpression)) 174if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.ArgumentList)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (3)
139token.Parent.IsKind(SyntaxKind.IdentifierName)) 419token.Parent.IsKind(SyntaxKind.TypeParameterList)) 505token.Parent.IsKind(SyntaxKind.PredefinedType);
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (1)
157if (parent.IsKind(SyntaxKind.SimpleAssignmentExpression))
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (1)
200while (memberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression))
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (2)
231if (token.IsKind(SyntaxKind.IdentifierToken) && token.Parent.IsKind(SyntaxKind.XmlName)) 293if (token.Parent.IsKind(SyntaxKind.IdentifierName) &&
Completion\KeywordRecommenders\ExternKeywordRecommender.cs (3)
91token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 99token.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)) 107token.Parent.IsKind(SyntaxKind.ExternAliasDirective))
Completion\KeywordRecommenders\NamespaceKeywordRecommender.cs (5)
105token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 118!token.Parent.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)) 133else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 144if (token.Parent.IsKind(SyntaxKind.DelegateDeclaration) && 155token.Parent.IsKind(SyntaxKind.AttributeList) &&
Completion\KeywordRecommenders\ParamKeywordRecommender.cs (1)
29token.Parent.IsKind(SyntaxKind.AttributeList))
Completion\KeywordRecommenders\TypeVarKeywordRecommender.cs (1)
24token.Parent.IsKind(SyntaxKind.AttributeList))
Completion\KeywordRecommenders\UsingKeywordRecommender.cs (2)
103if ((token.Kind() == SyntaxKind.OpenBraceToken && token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 104|| (token.Kind() == SyntaxKind.SemicolonToken && token.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)))
Completion\KeywordRecommenders\VoidKeywordRecommender.cs (1)
76token.Parent.IsKind(SyntaxKind.ParenthesizedExpression))
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (2)
58token.Parent.IsKind(SyntaxKind.ParameterList) && 71token.Parent.IsKind(SyntaxKind.ParameterList))
Completion\KeywordRecommenders\WhileKeywordRecommender.cs (1)
41token.Parent.IsKind(SyntaxKind.Block) &&
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
75=> (accessorListSyntax.Accessors.FirstOrDefault(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)),
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (1)
59if (expression.IsKind(SyntaxKind.NullLiteralExpression) && nullableContext.HasFlag(NullableContext.AnnotationsEnabled) && isReferenceType)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
32=> !operation.SemanticModel.AnalyzeControlFlow(operation.Syntax).ExitPoints.Any(static n => n.IsKind(SyntaxKind.BreakStatement));
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
220var statementAncestor = _parentStatement.Ancestors().OfType<StatementSyntax>().FirstOrDefault(node => !node.IsKind(SyntaxKind.Block));
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (1)
90if (node is MemberAccessExpressionSyntax memberAccess && memberAccess.Expression.IsKind(SyntaxKind.ThisExpression))
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (4)
149if (node.IsKind(SyntaxKind.QualifiedName) && TrySimplify(node)) 166if (node.IsKind(SyntaxKind.AliasQualifiedName) && TrySimplify(node)) 238if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression) && TrySimplify(node)) 260if (node.IsKind(SyntaxKind.QualifiedCref) && TrySimplify(node))
EditAndContinue\BreakpointSpans.cs (1)
201var baseInitializer = (PrimaryConstructorBaseTypeSyntax?)typeDeclaration.BaseList?.Types.FirstOrDefault(t => t.IsKind(SyntaxKind.PrimaryConstructorBaseType));
EditAndContinue\SyntaxComparer.cs (4)
245if (node != null && node.Parent.IsKind(SyntaxKind.ForStatement) && node is ExpressionSyntax) 467if (node == null || node.Parent.IsKind(SyntaxKind.QueryExpression)) 1040leftBlock.Parent.IsKind(SyntaxKind.ConstructorDeclaration) || 1041rightBlock.Parent.IsKind(SyntaxKind.ConstructorDeclaration))
EditAndContinue\SyntaxUtilities.cs (2)
161var firstGetter = accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault(); 215if (declaration.IsKind(SyntaxKind.ArrowExpressionClause))
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
106if ((!node.IsKind(SyntaxKind.ObjectCreationExpression) && semanticModel.GetMemberGroup(expression).Length > 0) ||
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (2)
136if (identifierName.IsKind(SyntaxKind.GenericName)) 158return parsedType.IsKind(SyntaxKind.GenericName) && !parsedType.ContainsDiagnostics;
GenerateType\CSharpGenerateTypeService.cs (3)
220if (nameOrMemberAccessExpression == null || !nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression) || !simpleName.IsRightSideOfDot()) 338if ((nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression) || (nameOrMemberAccessExpression.Parent != null && nameOrMemberAccessExpression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression))) 343if (nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression))
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
48expressionStatement.Expression.IsKind(SyntaxKind.IdentifierName))
IntroduceVariable\CSharpIntroduceVariableService.cs (4)
69if (node.IsKind(SyntaxKind.Block)) 73else if (node.IsKind(SyntaxKind.ArrowExpressionClause)) 120if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 126if (expression.IsKind(SyntaxKind.ThrowExpression))
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
386var localFunctions = innermostCommonBlock.DescendantNodes().Where(node => node.IsKind(SyntaxKind.LocalFunctionStatement) && matches.Any(match => match.Span.OverlapsWith(node.Span))); 398!invocationExpression.Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression) &&
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (1)
199if (syntax.IsKind(SyntaxKind.LocalFunctionStatement) || syntax is AnonymousFunctionExpressionSyntax)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (3)
45else if (token.IsKind(SyntaxKind.DelegateKeyword) && token.Parent.IsKind(SyntaxKind.AnonymousMethodExpression)) 59token.Parent?.Parent.IsKind(SyntaxKind.ElementAccessExpression) == true) 83=> !token.Parent.IsKind(SyntaxKind.XmlCrefAttribute);
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
97=> node.IsKind(SyntaxKind.Block)
Rename\CSharpRenameIssuesService.cs (1)
59if (parent.IsKind(SyntaxKind.IdentifierName))
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (1)
67expression.IsKind(SyntaxKind.NullableType) &&
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
65(throughExpression.IsKind(SyntaxKind.IdentifierName) &&
SplitOrMergeIfStatements\CSharpIfLikeStatementGenerator.cs (1)
171if (statement.IsKind(SyntaxKind.IfStatement))
SplitStringLiteral\StringSplitter.cs (1)
73token.Parent.IsKind(SyntaxKind.Interpolation) &&
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (4)
268if (ifStatementOrElseClause.IsKind(SyntaxKind.ElseClause)) 274Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement)); 293if (statement.Statement.IsKind(SyntaxKind.Block)) 297if (elseStatement.IsKind(SyntaxKind.Block))
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (3)
84if (!_assignmentTargetOpt.IsKind(SyntaxKind.IdentifierName)) 224case 2 when section.Statements[1].IsKind(SyntaxKind.BreakStatement) || section.Statements[0].IsKind(SyntaxKind.SwitchStatement):
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionHelpers.cs (2)
15if (node.IsKind(SyntaxKind.DefaultSwitchLabel)) 23if (@case.Pattern.IsKind(SyntaxKind.DiscardPattern))
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (7)
58if (!ifStatement.Condition.IsKind(SyntaxKind.NotEqualsExpression)) 121if (condition.Left.IsKind(SyntaxKind.NullLiteralExpression) || 122condition.Right.IsKind(SyntaxKind.NullLiteralExpression)) 124var expr = condition.Left.IsKind(SyntaxKind.NullLiteralExpression) 227if (!ifStatement.Parent.IsKind(SyntaxKind.Block)) 333=> left.IsKind(SyntaxKind.IdentifierName) && right.IsKind(SyntaxKind.NullLiteralExpression);
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (3)
91var parentIsElseClause = parent.IsKind(SyntaxKind.ElseClause); 97if (statement.IsKind(SyntaxKind.IfStatement) && parentIsElseClause) 109if (parent.IsKind(SyntaxKind.Block))
src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (3)
24=> node.IsKind(SyntaxKind.ThisExpression); 38if (node.IsKind(SyntaxKind.BaseExpression)) 62=> declarationSyntax.IsKind(SyntaxKind.PropertyDeclaration) && declarationSyntax.Contains(node);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (2)
66if (currentStatement.IsKind(SyntaxKind.LabeledStatement)) 76if (currentStatement.IsKind(SyntaxKind.LocalFunctionStatement))
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
79!blockOperation.Syntax.IsKind(SyntaxKind.Block);
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (2)
58if (node.IsKind(SyntaxKind.FieldExpression)) 181else if (expression.IsKind(SyntaxKind.IdentifierName))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
1037if (objectCreation.Initializer.IsKind(SyntaxKind.ObjectCreationExpression) && objectCreation.Initializer.Expressions.Count > 0)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (1)
35=> expression.IsKind(SyntaxKind.ComplexElementInitializerExpression);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (1)
57=> declaration.IsKind(SyntaxKind.GetAccessorDeclaration);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
194if (expressionBody!.Expression.IsKind(SyntaxKind.ThrowExpression))
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
56if (expressionBodyOpt.IsKind(SyntaxKind.ThrowExpression) &&
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
101else if (objectCreation.Parent.IsKind(SyntaxKind.ArrowExpressionClause))
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
73right.IsKind(SyntaxKind.NullLiteralExpression))
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
357if (assignment.Left.IsKind(SyntaxKind.IdentifierName))
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
39Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement));
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (3)
338if (left.IsKind(SyntaxKind.NullLiteralExpression)) 345if (right.IsKind(SyntaxKind.NullLiteralExpression)) 361&& constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
96var ifStatementScope = ifStatement.Parent.IsKind(SyntaxKind.Block)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (4)
55if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent?.Parent?.IsKind(SyntaxKind.EventFieldDeclaration) == false) 86if (node.IsKind(SyntaxKind.VariableDeclarator) && !(node = node.Parent?.Parent).IsKind(SyntaxKind.EventFieldDeclaration))
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
60if (constructorInitializer.IsKind(SyntaxKind.BaseConstructorInitializer))
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement));
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression));
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
700if (docComment.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia))
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (2)
60typeToGenerateIn = constructorInitializer.IsKind(SyntaxKind.ThisConstructorInitializer) 191constructorDeclarationSyntax.Initializer.IsKind(SyntaxKind.ThisConstructorInitializer))
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
126else if (simpleName.IsKind(SyntaxKind.IdentifierName))
src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (2)
45if (node.IsKind(SyntaxKind.MemberBindingExpression)) 47var nameNode = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.IdentifierName));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
102if (ifStatement.Parent.IsKind(SyntaxKind.ElseClause) &&
src\Analyzers\CSharp\CodeFixes\MakeMemberStatic\CSharpMakeMemberStaticCodeFixProvider.cs (1)
31if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax })
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
67if (node.IsKind(SyntaxKind.ConditionalAccessExpression))
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (3)
94if (newNameNode.IsKind(SyntaxKind.DiscardDesignation)) 213if (originalCompoundAssignment.Parent.IsKind(SyntaxKind.ExpressionStatement)) 215if (!originalCompoundAssignment.IsKind(SyntaxKind.CoalesceAssignmentExpression))
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
75if (binary.IsKind(SyntaxKind.EqualsExpression)) 95=> binary.Right.IsKind(SyntaxKind.NullLiteralExpression)
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (2)
117if (expr.IsKind(SyntaxKind.DefaultLiteralExpression)) 121if (expr.IsKind(SyntaxKind.NullLiteralExpression))
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (12)
40return !node.Parent.IsKind(SyntaxKind.QueryExpression); 55if (lambda.IsKind(SyntaxKind.ArrowExpressionClause)) 61Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 218if (!selectOrGroupExpression.IsKind(SyntaxKind.IdentifierName)) 230if (containingQueryOrContinuation.IsKind(SyntaxKind.QueryExpression)) 248if (selectOrGroupClause.IsKind(SyntaxKind.SelectClause) && containingBody.Clauses.Count == 0) 255if (!clause.IsKind(SyntaxKind.WhereClause) && !clause.IsKind(SyntaxKind.OrderByClause)) 298if (node.Parent.IsKind(SyntaxKind.QueryExpression)) 376return syntax.IsKind(SyntaxKind.GroupClause) || 377syntax.IsKind(SyntaxKind.JoinClause) || 378syntax.IsKind(SyntaxKind.FromClause);
src\Compilers\CSharp\Portable\Syntax\SyntaxBindingUtilities.cs (2)
14=> node.IsKind(SyntaxKind.YieldReturnStatement) || 15node.IsKind(SyntaxKind.AwaitExpression) ||
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
176if (node.Parent.IsKind(SyntaxKind.IfStatement))
Structure\Providers\StringLiteralExpressionStructureProvider.cs (1)
21if (node.IsKind(SyntaxKind.StringLiteralExpression) &&
UseAutoProperty\SingleLinePropertyFormattingRule.cs (3)
16if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList)) 19if (previousToken.IsKind(SyntaxKind.OpenBraceToken) && previousToken.Parent.IsKind(SyntaxKind.AccessorList)) 22if (currentToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList))
UseAutoProperty\UseAutoPropertyRewriter.cs (1)
26if (node.Expression.IsKind(SyntaxKind.ThisExpression))
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (59)
Semantics\BindingTests.cs (24)
2365var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single(); 2384var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single(); 2726.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M0")); 2738.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M1")); 2837.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M0")); 2849.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M1")); 2888var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2889var param = node.ChildNodes().Where(n => n.IsKind(SyntaxKind.Parameter)).Single(); 2925var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2927var param = lambda.ChildNodes().Where(n => n.IsKind(SyntaxKind.Parameter)).Single(); 2931var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName)); 2967var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2969var param = lambda.ChildNodes().Where(n => n.IsKind(SyntaxKind.Parameter)).Single(); 2973var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName)); 3037var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3051var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3117var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3131var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3190var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3205var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3275var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3290var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3380var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "MathMin").Single().Parent; 3732var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "E").Single().Parent;
Semantics\ColorColorTests.cs (1)
1817var memberAccess = syntaxRoot.DescendantNodes().Single(node => node.IsKind(SyntaxKind.SimpleMemberAccessExpression)) as MemberAccessExpressionSyntax;
Semantics\ImplicitObjectCreationTests.cs (1)
4532where node.IsKind(SyntaxKind.CollectionInitializerExpression)
Semantics\LambdaTests.cs (7)
1979var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AnonymousMethodExpression)).Single(); 6517.Where(i => i.Ancestors().Any(a => a.IsKind(SyntaxKind.Attribute) || a.IsKind(SyntaxKind.DefaultExpression) || a.IsKind(SyntaxKind.InvocationExpression))) 6827.Where(i => i.Ancestors().Any(a => a.IsKind(SyntaxKind.InvocationExpression))) 6856.Where(i => i.Ancestors().Any(a => a.IsKind(SyntaxKind.InvocationExpression))) 8017.Where(n => n.IsKind(SyntaxKind.ParenthesizedLambdaExpression))
Semantics\LocalFunctionTests.cs (6)
8686.Where(i => i.Ancestors().Any(a => a.IsKind(SyntaxKind.Attribute) || a.IsKind(SyntaxKind.TypeConstraint) || a.IsKind(SyntaxKind.DefaultExpression) || a.IsKind(SyntaxKind.InvocationExpression))) 9554.Where(i => i.Ancestors().Any(a => a.IsKind(SyntaxKind.Attribute))) 10174.Where(i => i.Ancestors().Any(a => a.IsKind(SyntaxKind.Attribute)))
Semantics\NullableReferenceTypesTests.cs (3)
3693var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 3695var param = lambda.ChildNodes().Where(n => n.IsKind(SyntaxKind.Parameter)).Single(); 3699var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName));
Semantics\NullCoalesceAssignmentTests.cs (1)
184var defaultLiteral = syntaxRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().Where(expr => expr.IsKind(SyntaxKind.DefaultLiteralExpression)).Single();
Semantics\ObjectAndCollectionInitializerTests.cs (5)
3466where node.IsKind(SyntaxKind.CollectionInitializerExpression) 3514where node.IsKind(SyntaxKind.CollectionInitializerExpression) 3571where node.IsKind(SyntaxKind.CollectionInitializerExpression) 3607where node.IsKind(SyntaxKind.CollectionInitializerExpression) 3644where node.IsKind(SyntaxKind.CollectionInitializerExpression)
Semantics\QueryTests.cs (6)
2384var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2385var fromClause1 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num1"))).Single() as FromClauseSyntax; 2386var fromClause2 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num2"))).Single() as FromClauseSyntax; 2484var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2548var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2583var orderingClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AscendingOrdering)).Single() as OrderingSyntax;
Semantics\SwitchTests.cs (1)
1154var node = syntaxTree.GetRoot().DescendantNodes().First(x => x.IsKind(SyntaxKind.SimpleMemberAccessExpression));
Semantics\TopLevelStatementsTests.cs (2)
2919var nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2941nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single();
Semantics\UnsafeTests.cs (1)
10224var dereferences = tree.GetCompilationUnitRoot().DescendantNodes().Where(syntax => syntax.IsKind(SyntaxKind.PointerIndirectionExpression)).ToArray();
Semantics\Utf8StringsLiteralsTests.cs (1)
4081foreach (var node in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(b => b.IsKind(SyntaxKind.AddExpression)))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (21)
Compilation\SemanticModelAPITests.cs (2)
404var nsArray = tree.GetCompilationUnitRoot().DescendantNodes().Where(node => node.IsKind(SyntaxKind.NamespaceDeclaration)).ToArray(); 425var nsArray = tree.GetCompilationUnitRoot().DescendantNodes().Where(node => node.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)).ToArray();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (16)
3686var globalStmt = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf('/')).Parent.AncestorsAndSelf().Single(x => x.IsKind(SyntaxKind.GlobalStatement)); 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)); 4797var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4820var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4843var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4866var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4889var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4912var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4935var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4958var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4993var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5039var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5088var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5111var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
Symbols\AnonymousTypesSemanticsTests.cs (1)
2010while (current.Span == identifier.Span && !current.IsKind(SyntaxKind.IdentifierName))
Symbols\IndexerTests.cs (1)
2539node.DescendantNodesAndSelf().Where(s => s.IsKind(SyntaxKind.ElementAccessExpression)).Cast<ElementAccessExpressionSyntax>();
Symbols\Source\NullablePublicAPITests.cs (1)
4730var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Where(p => p.IsKind(SyntaxKind.SuppressNullableWarningExpression)).ToList();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (7)
Syntax\SyntaxRewriterTests.cs (7)
76(node.IsKind(SyntaxKind.IdentifierName) && node.ToString() == "C") ? null : node); 100(node.IsKind(SyntaxKind.IdentifierName) && node.ToString() != "A") ? null : node); 243(node.IsKind(SyntaxKind.ExpressionStatement) && node.ToString().Contains("B")) ? null : node); 257(node.IsKind(SyntaxKind.ExpressionStatement)) ? null : node); 275if (node != null && node.IsKind(SyntaxKind.OmittedArraySizeExpression) && first) 306(node.IsKind(SyntaxKind.IdentifierName) && node.ToString() == "D") ? null : node); 349var typeName = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.GenericName)).Single();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
SemanticModelTestBase.cs (2)
109n.IsKind(SyntaxKind.BaseConstructorInitializer) || n.IsKind(SyntaxKind.ThisConstructorInitializer);
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (1)
CodeGen\WinRTCollectionTests.cs (1)
7424var add = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Add").Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (276)
Classification\ClassificationHelpers.cs (2)
311if (parentNode.IsKind(SyntaxKind.EnumMemberDeclaration)) 318else if (parentNode.IsKind(SyntaxKind.VariableDeclarator))
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
174if ((name.IsUnmanaged || name.IsNotNull) && name.Parent.IsKind(SyntaxKind.TypeConstraint))
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (1)
35if (syntax.IsKind(SyntaxKind.SimpleAssignmentExpression))
CodeGeneration\CSharpSyntaxGenerator.cs (12)
1101if (!declaration.IsKind(SyntaxKind.CompilationUnit)) 1424if (modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration) && accessibility != Accessibility.NotApplicable) 1633(modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration))) 2159currentList ??= declaration.IsKind(SyntaxKind.IndexerDeclaration) 2616return accessorList?.Accessors.FirstOrDefault(a => a.IsKind(kind)); 2626var acc = accessorList.Accessors.FirstOrDefault(a => a.IsKind(kind)); 2754if (fullDecl != declaration && fullDecl.IsKind(newFullDecl.Kind())) 2786if (decl2.IsKind(kind)) 2812if (decl2.IsKind(kind)) 2880if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 2919if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 2990if (node.Parent.IsKind(SyntaxKind.GlobalStatement))
Rename\CSharpRenameRewriterLanguageService.cs (3)
224if (newToken.Parent.IsKind(SyntaxKind.XmlName)) 281token.Parent.IsKind(SyntaxKind.DestructorDeclaration); 712else if (newToken.IsKind(SyntaxKind.IdentifierToken) && newToken.Parent.IsKind(SyntaxKind.XmlName) && newToken.ValueText == _originalText)
Rename\LocalConflictVisitor.cs (1)
186var statements = node.ChildNodes().Where(x => x.IsKind(SyntaxKind.SwitchSection)).SelectMany(x => x.ChildNodes());
Simplification\CSharpSimplificationService.cs (6)
114if (parentOfToken is SimpleNameSyntax && parent.IsKind(SyntaxKind.XmlNameAttribute)) 121if (parent.IsKind(SyntaxKind.AliasQualifiedName) && 205Debug.Assert(tuple.IsKind(SyntaxKind.TupleExpression)); 210if (parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 215if (!parent.IsKind(SyntaxKind.Argument)) 221if (!grandParent.IsKind(SyntaxKind.TupleExpression))
Simplification\CSharpSimplificationService.Expander.cs (1)
374if (result.Expression != null && !result.Expression.IsKind(SyntaxKind.ParenthesizedExpression))
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (4)
37if ((node.Left.IsKind(SyntaxKind.CastExpression) && !reducedNode.Left.IsKind(SyntaxKind.CastExpression)) || 38(node.Right.IsKind(SyntaxKind.CastExpression) && !reducedNode.Right.IsKind(SyntaxKind.CastExpression)))
Simplification\Reducers\CSharpInferredMemberNameReducer.Rewriter.cs (1)
56if (node.Parent.IsKind(SyntaxKind.TupleExpression))
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
142if (!node.Parent.IsKind(SyntaxKind.IfStatement))
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
199if (!memberAccess.Expression.IsKind(SyntaxKind.BaseExpression))
Simplification\Simplifiers\NameSimplifier.cs (2)
241if (!name.Parent.IsKind(SyntaxKind.QualifiedName) && (inDeclarationContext || inMemberAccessContext)) 669if (!reparsedCastExpression.IsKind(SyntaxKind.CastExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (2)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (29)
40var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 59if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 60parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 89var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 95if (expression.IsKind(SyntaxKind.ThrowExpression)) 99if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 103if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 111if (expression.IsKind(SyntaxKind.TupleExpression)) 163if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 173if (nodeParent.IsKind(SyntaxKind.Interpolation)) 178if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 234if (expression.IsKind(SyntaxKind.ThisExpression)) 238if (expression.IsKind(SyntaxKind.ThrowExpression) && 246if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 250if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 257if (nodeParent.IsKind(SyntaxKind.WhenClause)) 271if (parentExpression.IsKind(SyntaxKind.CastExpression) && 279if (expression.IsKind(SyntaxKind.ConditionalExpression) && 290if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 425if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 518if (name.IsKind(SyntaxKind.AliasQualifiedName)) 547if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 560else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 575else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 582else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 624|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 755if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 758if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
32if (node.IsKind(kind)) 43=> CodeAnalysis.CSharpExtensions.IsKind(node?.Parent, kind); 358return !current.Parent.IsKind(SyntaxKind.CompilationUnit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (20)
83=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 86=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 109if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 119=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 125=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 178return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 210token.Parent.IsKind(SyntaxKind.EnumDeclaration); 278token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 279token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 305=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 340=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 433parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 452parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 521=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 539currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 543=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (1)
25if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (1)
184else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (11)
116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 373if ((currentToken.Kind() == SyntaxKind.FromKeyword && currentToken.Parent.IsKind(SyntaxKind.FromClause)) || 374(currentToken.Kind() == SyntaxKind.LetKeyword && currentToken.Parent.IsKind(SyntaxKind.LetClause)) || 375(currentToken.Kind() == SyntaxKind.WhereKeyword && currentToken.Parent.IsKind(SyntaxKind.WhereClause)) || 376(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinClause)) || 377(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 378(currentToken.Kind() == SyntaxKind.OrderByKeyword && currentToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 379(currentToken.Kind() == SyntaxKind.SelectKeyword && currentToken.Parent.IsKind(SyntaxKind.SelectClause)) || 380(currentToken.Kind() == SyntaxKind.GroupKeyword && currentToken.Parent.IsKind(SyntaxKind.GroupClause))) 438nextToken.Parent.IsKind(SyntaxKind.DoStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
233if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (13)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 189if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 198if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 217if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 246if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 260if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 327if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 399if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 412if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 439if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 468&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (4)
92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 458if (previousToken.Parent.IsKind(SyntaxKind.NotPattern))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (5)
175if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 288previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 453if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 474currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 521&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
74if (embeddedStatement.IsKind(SyntaxKind.Block))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (1)
74endToken.Parent.IsKind(SyntaxKind.Block) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (3)
323=> node?.Parent.IsKind(SyntaxKind.FieldDeclaration) ?? false; 326=> node?.Parent.IsKind(SyntaxKind.EventFieldDeclaration) ?? false; 329=> node?.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) ?? false;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
23=> node.IsKind(SyntaxKind.Block);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (10)
521if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 527&& token.Parent.IsKind(SyntaxKind.CollectionExpression)) 555=> simpleName.IsKind(SyntaxKind.GenericName) || 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 635=> node.IsKind(SyntaxKind.IdentifierName) && 690=> node.IsKind(SyntaxKind.ElementAccessExpression); 1241=> node.IsKind(SyntaxKind.Attribute) && 1299exprStatement.Expression.IsKind(SyntaxKind.SimpleAssignmentExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
16if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
179var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 326var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 814if (originalConditionalExpression.WhenTrue.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression) || 815originalConditionalExpression.WhenFalse.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
349(previousToken.Parent.IsKind(SyntaxKind.Block) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (10)
303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 773if (newExpression.IsKind(SyntaxKind.ConditionalExpression) && 783if (newExpression.IsKind(SyntaxKind.SwitchExpression) && 793if (newExpression.IsKind(SyntaxKind.CollectionExpression) && 802if (newExpression.IsKind(SyntaxKind.TupleExpression) && 818if (originalExpression.IsKind(SyntaxKind.ConditionalExpression) && 819newExpression.IsKind(SyntaxKind.ConditionalExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (1)
73declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (4)
133if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType)) 137.Any(node => node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 281if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 287if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
509var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
166if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
230targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (20)
115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 124if (token.Parent.IsKind(SyntaxKind.Block)) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 174return token.Parent.IsKind(SyntaxKind.ElseClause); 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 468if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 582targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 590targetToken.Parent.IsKind(SyntaxKind.Block) && 605targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 616if (node.IsKind(SyntaxKind.TypeParameterList)) 650targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 651targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (67)
114if (parent.IsKind(SyntaxKind.CompilationUnit) || 207token.Parent.IsKind(SyntaxKind.Block) && 220token.Parent.IsKind(SyntaxKind.AttributeList)) 482else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 491token.Parent.IsKind(SyntaxKind.Block) && 507token.Parent.IsKind(SyntaxKind.AttributeList)) 601return incompleteMember.Type.IsKind(SyntaxKind.RefType); 895if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 907if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 920if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 941return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 1071if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1097token.Parent.IsKind(SyntaxKind.AttributeList) && 1158return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1171token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1230if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1265else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1269else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1278return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1349leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1376if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1391if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1398if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1405if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1412if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1438if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1448leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1583if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1673if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1679if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1692leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1786token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1865if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 2049token.Parent.IsKind(SyntaxKind.CastExpression)) 2069token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2110if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2118token.Parent.IsKind(SyntaxKind.NameColon) && 2126token.Parent.IsKind(SyntaxKind.NameEquals) && 2208if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2250if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2367token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2375token.Parent.IsKind(SyntaxKind.RangeExpression) && 2392token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2434if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2447if (token.Parent.IsKind(SyntaxKind.Argument)) 2451else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2466token.Parent.IsKind(SyntaxKind.NameColon) && 2486if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2537token.Parent.IsKind(SyntaxKind.ForStatement)) 2561token.Parent.IsKind(SyntaxKind.JoinClause)) 2568token.Parent.IsKind(SyntaxKind.WhereClause)) 2576token.Parent.IsKind(SyntaxKind.OrderByClause)) 2583token.Parent.IsKind(SyntaxKind.SelectClause)) 2591token.Parent.IsKind(SyntaxKind.GroupClause)) 2624if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2672if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2690token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2699token.Parent.IsKind(SyntaxKind.ListPattern)) 2708token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2717token.Parent.IsKind(SyntaxKind.SpreadElement)) 2865token.Parent.IsKind(SyntaxKind.IdentifierName) && 2873token.Parent.IsKind(SyntaxKind.IdentifierName)) 2980token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 2996targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3012if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (2)
30if (expression.IsKind(SyntaxKind.RefExpression)) 44if (expression.IsKind(SyntaxKind.ThrowExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (2)
126node.IsKind(SyntaxKind.Interpolation)) 133!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (4)
179(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 251if (token.Parent.IsKind(SyntaxKind.AccessorList) && 252token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 307if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1287if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1307else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression))
Microsoft.CodeAnalysis.Test.Utilities (6)
Compilation\ControlFlowGraphVerifier.cs (1)
869conditionalAccess.IsKind(CSharp.SyntaxKind.CoalesceAssignmentExpression) &&
Compilation\TestOperationVisitor.cs (5)
1415if (operation.Syntax.IsKind(CSharp.SyntaxKind.VarPattern) || 1417operation.Syntax.IsKind(CSharp.SyntaxKind.SingleVariableDesignation)) 1432if (designation.IsKind(CSharp.SyntaxKind.SingleVariableDesignation)) 1464if (designation.IsKind(CSharp.SyntaxKind.SingleVariableDesignation)) 1501if (designation.IsKind(CSharp.SyntaxKind.SingleVariableDesignation))
Microsoft.DotNet.CodeAnalysis (3)
Analyzers\AppContextDefaultsAnalyzer.cs (3)
80var containingIfStatement = call.Ancestors().FirstOrDefault(n => n.IsKind(SyntaxKind.IfStatement)) as IfStatementSyntax; 88if (!(containingIfStatement.Parent.IsKind(SyntaxKind.SwitchSection) || 89containingIfStatement.Parent.Parent.IsKind(SyntaxKind.SwitchSection)))
Microsoft.Extensions.Logging.Generators (1)
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithSimpleName.cs (1)
438if (node.IsKind(SyntaxKind.AttributeList))
Microsoft.Gen.ComplianceReports (2)
Parser.cs (1)
39foreach (TypeDeclarationSyntax typeSyntax in typeForSyntaxTree.Where(n => !n.IsKind(SyntaxKind.InterfaceDeclaration)))
src\Generators\Shared\GeneratorUtilities.cs (1)
88if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.ContextualOptions (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
88if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.Logging (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
88if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.Metrics (3)
Parser.cs (2)
81foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 192if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
88if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.MetricsReports (3)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (2)
81foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 192if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
88if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Interop.ComInterfaceGenerator (3)
Analyzers\AddMarshalAsToElementFixer.cs (1)
58if (node.IsKind(SyntaxKind.MethodDeclaration))
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (2)
215if (expression.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 220if (expression.IsKind(SyntaxKind.GenericName))
Microsoft.Interop.LibraryImportGenerator (7)
Analyzers\ConvertToLibraryImportFixer.cs (7)
322else if (invocation.Parent.IsKind(SyntaxKind.ExpressionStatement)) 342else if (invocation.Parent.IsKind(SyntaxKind.EqualsValueClause)) 345if (declaration.IsKind(SyntaxKind.FieldDeclaration) || declaration.IsKind(SyntaxKind.EventFieldDeclaration)) 375else if (invocation.Parent.IsKind(SyntaxKind.SimpleAssignmentExpression) && invocation.Parent.Parent.IsKind(SyntaxKind.ExpressionStatement)) 509if (attrArg.Expression.IsKind(SyntaxKind.StringLiteralExpression))
Microsoft.Interop.SourceGeneration (10)
Marshalling\ElementsMarshalling.cs (2)
79if (numElementsExpression.IsKind(SyntaxKind.CheckedExpression)) 384if (contentsCleanupStatements.IsKind(SyntaxKind.EmptyStatement))
Marshalling\StatefulMarshallingStrategy.cs (2)
333if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 347if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement))
Marshalling\StatelessMarshallingStrategy.cs (2)
574if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 624if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement))
SyntaxExtensions.cs (4)
18if (fixedStatement.Statement.IsKind(SyntaxKind.EmptyStatement)) 24if (fixedStatement.Statement.IsKind(SyntaxKind.Block)) 37if (childStatement.IsKind(SyntaxKind.Block)) 66if (statement.IsKind(SyntaxKind.Block))
Microsoft.ML.InternalCodeAnalyzer (15)
BestFriendAnalyzer.cs (1)
66foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes(n => !n.IsKind(SyntaxKind.UsingDirective)))
ContractsCheckAnalyzer.cs (8)
141if (exp.IsKind(SyntaxKind.AddExpression)) 149if (exp.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 156if (exp.IsKind(SyntaxKind.InvocationExpression)) 159return exp.IsKind(SyntaxKind.StringLiteralExpression) || exp.IsKind(SyntaxKind.IdentifierName); 164while (node != null && !node.IsKind(SyntaxKind.MethodDeclaration) && !node.IsKind(SyntaxKind.ConstructorDeclaration)) 209if (isExcept && invocation.Parent.IsKind(SyntaxKind.ExpressionStatement))
ContractsCheckNameofFixProvider.cs (4)
50Debug.Assert(nameArg.Parent.Parent.IsKind(SyntaxKind.InvocationExpression)); 74.Select(p => p.Parent).Where(n => n.IsKind(SyntaxKind.IdentifierName)); 108while (temp != null && !temp.IsKind(SyntaxKind.MethodDeclaration) && !temp.IsKind(SyntaxKind.ConstructorDeclaration))
InstanceInitializerAnalyzer.cs (1)
72if (!syntax.ChildNodes().Any(s => s.IsKind(SyntaxKind.EqualsValueClause)))
SingleVariableDeclarationAnalyzer.cs (1)
44if (vars.Count <= 1 || node.Parent.IsKind(SyntaxKind.ForStatement))
Microsoft.VisualStudio.LanguageServices.CSharp (21)
CodeModel\CSharpCodeModelService.CodeModelEventCollector.cs (1)
36.Where(n => !n.IsKind(SyntaxKind.IncompleteMember))
CodeModel\CSharpCodeModelService.cs (6)
2321(accessor.Body.Statements.Count == 1 && !accessor.Body.Statements[0].IsKind(SyntaxKind.ReturnStatement))) 2611return property.IsKind(SyntaxKind.IndexerDeclaration); 3709if (node.IsKind(SyntaxKind.ClassDeclaration)) 3713else if (node.IsKind(SyntaxKind.InterfaceDeclaration)) 3734if (typeDeclaration.IsKind(SyntaxKind.ClassDeclaration)) 3773if (!isFirst && node.IsKind(SyntaxKind.ClassDeclaration))
LanguageService\CSharpHelpContextService.cs (14)
218token.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 245if (token.Parent.IsKind(SyntaxKind.EqualsValueClause)) 247if (token.Parent.Parent.IsKind(SyntaxKind.Parameter)) 252else if (token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 257else if (token.Parent.Parent.IsKind(SyntaxKind.EnumMemberDeclaration)) 262else if (token.Parent.Parent.IsKind(SyntaxKind.VariableDeclarator)) 268else if (token.Parent.IsKind(SyntaxKind.NameEquals)) 270if (token.Parent.Parent.IsKind(SyntaxKind.AnonymousObjectMemberDeclarator)) 275else if (token.Parent.Parent.IsKind(SyntaxKind.UsingDirective)) 280else if (token.Parent.Parent.IsKind(SyntaxKind.AttributeArgument)) 286else if (token.Parent.IsKind(SyntaxKind.LetClause)) 309if (token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 443case SyntaxKind.ReturnKeyword when token.Parent.IsKind(SyntaxKind.YieldReturnStatement): 444case SyntaxKind.BreakKeyword when token.Parent.IsKind(SyntaxKind.YieldBreakStatement):