28169 references to SyntaxKind
dotnet (14)
Commands\Run\FileBasedAppSourceEditor.cs (14)
143case SyntaxKind.SingleLineCommentTrivia: 144case SyntaxKind.MultiLineCommentTrivia: 145case SyntaxKind.MultiLineDocumentationCommentTrivia: 147if (result.Token.IsKind(SyntaxKind.EndOfFileToken)) 152leadingTrivia[i + 1].IsKind(SyntaxKind.EndOfLineTrivia)) 160Debug.Assert(!trivia.IsKind(SyntaxKind.SingleLineCommentTrivia), 165case SyntaxKind.SingleLineDocumentationCommentTrivia: 167s.ChildNodes().LastOrDefault() is XmlTextSyntax { TextTokens: [.., { RawKind: (int)SyntaxKind.XmlTextLiteralNewLineToken }] }) 174case SyntaxKind.ShebangDirectiveTrivia: 179case SyntaxKind.EndOfLineTrivia: 187case SyntaxKind.WhitespaceTrivia: 220if (!(result.Token.IsKind(SyntaxKind.EndOfFileToken) && !remainingLeadingTrivia.Any() && !result.Token.HasTrailingTrivia) && 221!remainingLeadingTrivia.Any(static t => t.Kind() is SyntaxKind.EndOfLineTrivia or SyntaxKind.IgnoredDirectiveTrivia))
dotnet-format (4)
Utilities\GeneratedCodeUtilities.cs (4)
13(syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) 14|| syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) 15|| syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) 16|| syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia);
EventSourceGenerator (2)
EventSourceGenerator.Parser.cs (2)
48if (modifier.IsKind(SyntaxKind.PartialKeyword)) 77if (ctorModifier.IsKind(SyntaxKind.StaticKeyword))
ILLink.CodeFixProvider (12)
RequiresUnsafeCodeFixProvider.cs (12)
156MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.UnsafeKeyword), 157ConstructorDeclarationSyntax constructor => constructor.Modifiers.Any(SyntaxKind.UnsafeKeyword), 158DestructorDeclarationSyntax destructor => destructor.Modifiers.Any(SyntaxKind.UnsafeKeyword), 159LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.UnsafeKeyword), 160PropertyDeclarationSyntax property => property.Modifiers.Any(SyntaxKind.UnsafeKeyword), 161IndexerDeclarationSyntax indexer => indexer.Modifiers.Any(SyntaxKind.UnsafeKeyword), 162AccessorDeclarationSyntax accessor => accessor.Modifiers.Any(SyntaxKind.UnsafeKeyword), 243SyntaxKind.SimpleAssignmentExpression, 430isVoid = method.ReturnType is PredefinedTypeSyntax pts && pts.Keyword.IsKind(SyntaxKind.VoidKeyword); 434isVoid = localFunc.ReturnType is PredefinedTypeSyntax pts && pts.Keyword.IsKind(SyntaxKind.VoidKeyword); 486var getter = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 505var indexerGetter = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
ILLink.RoslynAnalyzer (2)
RequiresAnalyzerBase.cs (2)
66private protected virtual ImmutableArray<(Action<SyntaxNodeAnalysisContext> Action, SyntaxKind[] SyntaxKind)> ExtraSyntaxNodeActions { get; } = ImmutableArray<(Action<SyntaxNodeAnalysisContext> Action, SyntaxKind[] SyntaxKind)>.Empty;
Microsoft.Analyzers.Extra (6)
AsyncMethodWithoutCancellation.cs (1)
112}, SyntaxKind.MethodDeclaration);
CallAnalysis\Fixers\LegacyLoggingFixer.cs (4)
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>(); 376loggerParam = parameterSyntax.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.ThisKeyword))); 522if (invocationExpression.Parent!.IsKind(SyntaxKind.ConditionalAccessExpression))
Utilities\SyntaxNodeExtensions.cs (1)
24public static SyntaxNode? GetFirstAncestorOfSyntaxKind(this SyntaxNode node, SyntaxKind kind)
Microsoft.Analyzers.Extra.Tests (2)
SyntaxNodeExtensionsTests.cs (2)
101Assert.Null(node.GetFirstAncestorOfSyntaxKind(SyntaxKind.EqualsValueClause)); 188var memberaccess = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, console, writeline);
Microsoft.Analyzers.Local (3)
CallAnalysis\Throws.cs (2)
35if (op.Syntax.IsKind(SyntaxKind.ThrowStatement)) 44else if (op.Syntax.IsKind(SyntaxKind.ThrowExpression))
InternalReferencedInPublicDocAnalyzer.cs (1)
111context.RegisterSyntaxNodeAction(ValidateCref, SyntaxKind.XmlCrefAttribute);
Microsoft.AspNetCore.App.Analyzers (68)
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (8)
70if (token.RawKind == (int)SyntaxKind.StringLiteralToken || 71token.RawKind == (int)SyntaxKind.Utf8StringLiteralToken || 72token.RawKind == (int)SyntaxKind.CharacterLiteralToken) 83if (token.RawKind == (int)SyntaxKind.StringLiteralToken || 84token.RawKind == (int)SyntaxKind.CharacterLiteralToken) 111if (token.RawKind == (int)SyntaxKind.StringLiteralToken || 112token.RawKind == (int)SyntaxKind.CharacterLiteralToken) 116else if (token.RawKind == (int)SyntaxKind.Utf8StringLiteralToken)
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (18)
30if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 34if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 62case SyntaxKind.CharacterLiteralToken: 65case SyntaxKind.StringLiteralToken: 70case SyntaxKind.Utf8StringLiteralToken: 75case SyntaxKind.SingleLineRawStringLiteralToken: 76case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 79case SyntaxKind.MultiLineRawStringLiteralToken: 80case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 85case SyntaxKind.InterpolatedStringTextToken: 98SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 100SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 101SyntaxKind.InterpolatedMultiLineRawStringStartToken 142if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 147if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (1)
24context.RegisterSyntaxNodeAction(KestrelServerOptionsListenInvocation, SyntaxKind.InvocationExpression);
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
43if (!argument.Value.Syntax.IsKind(SyntaxKind.NumericLiteralExpression))
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (18)
107if (token.IsKind(SyntaxKind.QuestionToken) || token.IsKind(SyntaxKind.GreaterThanToken)) 149if (container.Parent.IsKind(SyntaxKind.Argument)) 165if (previous.IsKind(SyntaxKind.CommaToken) || 166previous.IsKind(SyntaxKind.OpenParenToken) || 167previous.IsKind(SyntaxKind.OutKeyword) || 168previous.IsKind(SyntaxKind.InKeyword) || 169previous.IsKind(SyntaxKind.RefKeyword) || 170previous.IsKind(SyntaxKind.ParamsKeyword) || 171(previous.IsKind(SyntaxKind.CloseBracketToken) && previous.GetRequiredParent().FirstAncestorOrSelf<AttributeListSyntax>() != null) || 172(previous.IsKind(SyntaxKind.LessThanToken) && previous.GetRequiredParent().FirstAncestorOrSelf<GenericNameSyntax>() != null)) 187else if (container.IsKind(SyntaxKind.Parameter)) 290return SyntaxFacts.IsPredefinedType(token.Kind()) || token.IsKind(SyntaxKind.IdentifierToken); 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)) 549Debug.Assert(token.IsKind(SyntaxKind.StringLiteralToken));
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (14)
48return rawKind == (int)SyntaxKind.StringLiteralToken || 49rawKind == (int)SyntaxKind.SingleLineRawStringLiteralToken || 50rawKind == (int)SyntaxKind.MultiLineRawStringLiteralToken || 51rawKind == (int)SyntaxKind.Utf8StringLiteralToken || 52rawKind == (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken || 53rawKind == (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 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) 160token.Parent.Parent.RawKind == (int)SyntaxKind.AddExpression) 228=> trivia.IsKind(SyntaxKind.MultiLineCommentTrivia) || trivia.IsKind(SyntaxKind.SingleLineCommentTrivia); 231=> trivia.IsKind(SyntaxKind.ShebangDirectiveTrivia);
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (2)
82if (container.Parent.IsKind(SyntaxKind.Argument)) 109else if (container.Parent.IsKind(SyntaxKind.AttributeArgument))
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (2)
46while (node?.Parent?.RawKind == (int)SyntaxKind.ParenthesizedExpression) 71exprStatement.Expression.IsKind(SyntaxKind.SimpleAssignmentExpression);
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
401Debug.Assert(token.IsKind(SyntaxKind.StringLiteralToken));
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (3)
31}, SyntaxKind.ClassDeclaration); 42&& modifiers.Any(SyntaxKind.PublicKeyword) 43&& modifiers.Any(SyntaxKind.PartialKeyword)
Microsoft.AspNetCore.App.CodeFixes (7)
Authorization\AddAuthorizationBuilderFixer.cs (2)
120.Where(trivia => !trivia.IsKind(SyntaxKind.EndOfLineTrivia)); 128SyntaxKind.SimpleMemberAccessExpression,
Dependencies\ExtensionMethodsCompletionProvider.cs (3)
90if (current?.IsKind(SyntaxKind.SimpleMemberAccessExpression) ?? false) 114var isIdentifierToken = token.IsKind(SyntaxKind.IdentifierName) || token.IsKind(SyntaxKind.IdentifierToken);
Http\HeaderDictionaryAddFixer.cs (1)
125SyntaxKind.SimpleAssignmentExpression,
Http\HeaderDictionaryIndexerFixer.cs (1)
59var newExpression = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expression, SyntaxFactory.IdentifierName(resolvedPropertyName));
Microsoft.AspNetCore.Components.Analyzers (14)
ComponentParameterAnalyzer.cs (3)
157if (getterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration)) 163if (!getterAccessor.IsKind(SyntaxKind.GetAccessorDeclaration) || !setterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration))
ComponentParametersShouldBePublicCodeFixProvider.cs (5)
72if (modifier.IsKind(SyntaxKind.PrivateKeyword) || 73modifier.IsKind(SyntaxKind.ProtectedKeyword) || 74modifier.IsKind(SyntaxKind.InternalKeyword) || 77modifier.IsKind(SyntaxKind.PublicKeyword)) 83var publicModifier = SyntaxFactory.Token(SyntaxKind.PublicKeyword);
PersistentStateAnalyzer.cs (3)
81}, SyntaxKind.PropertyDeclaration); 94LiteralExpressionSyntax literal when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true, 97when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true,
SupplyParameterFromFormAnalyzer.cs (3)
81}, SyntaxKind.PropertyDeclaration); 94LiteralExpressionSyntax literal when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true, 97when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true,
Microsoft.AspNetCore.Components.SdkAnalyzers (5)
ComponentParametersShouldBePublicCodeFixProvider.cs (5)
72if (modifier.IsKind(SyntaxKind.PrivateKeyword) || 73modifier.IsKind(SyntaxKind.ProtectedKeyword) || 74modifier.IsKind(SyntaxKind.InternalKeyword) || 77modifier.IsKind(SyntaxKind.PublicKeyword)) 83var publicModifier = SyntaxFactory.Token(SyntaxKind.PublicKeyword);
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
AddResponseTypeAttributeCodeFixAction.cs (2)
236SyntaxKind.SimpleMemberAccessExpression, 243return SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(statusCode));
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (1)
124if (modifier.IsKind(SyntaxKind.PartialKeyword))
HubServerProxyGenerator.Parser.cs (1)
114if (modifier.IsKind(SyntaxKind.PartialKeyword))
Microsoft.CodeAnalysis.CSharp (12255)
_generated\0\Syntax.xml.Main.Generated.cs (1519)
2280case SyntaxKind.IdentifierToken: 2281case SyntaxKind.GlobalKeyword: break; 2291if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 2298=> SyntaxFactory.QualifiedName(left, SyntaxFactory.Token(SyntaxKind.DotToken), right); 2303if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 2319if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 2320if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 2326=> SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), arguments, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 2332if (colonColonToken.Kind() != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 2339=> SyntaxFactory.AliasQualifiedName(alias, SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); 2343=> SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(alias), SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); 2350case SyntaxKind.BoolKeyword: 2351case SyntaxKind.ByteKeyword: 2352case SyntaxKind.SByteKeyword: 2353case SyntaxKind.IntKeyword: 2354case SyntaxKind.UIntKeyword: 2355case SyntaxKind.ShortKeyword: 2356case SyntaxKind.UShortKeyword: 2357case SyntaxKind.LongKeyword: 2358case SyntaxKind.ULongKeyword: 2359case SyntaxKind.FloatKeyword: 2360case SyntaxKind.DoubleKeyword: 2361case SyntaxKind.DecimalKeyword: 2362case SyntaxKind.StringKeyword: 2363case SyntaxKind.CharKeyword: 2364case SyntaxKind.ObjectKeyword: 2365case SyntaxKind.VoidKeyword: break; 2385if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 2386if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 2392=> SyntaxFactory.ArrayRankSpecifier(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), sizes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 2398if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 2404=> SyntaxFactory.PointerType(elementType, SyntaxFactory.Token(SyntaxKind.AsteriskToken)); 2409if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 2410if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 2417=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), callingConvention, parameterList); 2421=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), default, SyntaxFactory.FunctionPointerParameterList()); 2426if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 2427if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 2433=> SyntaxFactory.FunctionPointerParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 2440case SyntaxKind.ManagedKeyword: 2441case SyntaxKind.UnmanagedKeyword: break; 2454if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 2455if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 2461=> SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), callingConventions, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 2466if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 2474if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 2480=> SyntaxFactory.NullableType(elementType, SyntaxFactory.Token(SyntaxKind.QuestionToken)); 2485if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2486if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2492=> SyntaxFactory.TupleType(SyntaxFactory.Token(SyntaxKind.OpenParenToken), elements, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2500case SyntaxKind.IdentifierToken: 2501case SyntaxKind.None: break; 2514if (omittedTypeArgumentToken.Kind() != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 2520=> SyntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 2525if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 2528case SyntaxKind.ReadOnlyKeyword: 2529case SyntaxKind.None: break; 2538=> SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), default, type); 2543if (scopedKeyword.Kind() != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 2550=> SyntaxFactory.ScopedType(SyntaxFactory.Token(SyntaxKind.ScopedKeyword), type); 2555if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2557if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2563=> SyntaxFactory.ParenthesizedExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2568if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2569if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2575=> SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2578public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 2582case SyntaxKind.UnaryPlusExpression: 2583case SyntaxKind.UnaryMinusExpression: 2584case SyntaxKind.BitwiseNotExpression: 2585case SyntaxKind.LogicalNotExpression: 2586case SyntaxKind.PreIncrementExpression: 2587case SyntaxKind.PreDecrementExpression: 2588case SyntaxKind.AddressOfExpression: 2589case SyntaxKind.PointerIndirectionExpression: 2590case SyntaxKind.IndexExpression: break; 2595case SyntaxKind.PlusToken: 2596case SyntaxKind.MinusToken: 2597case SyntaxKind.TildeToken: 2598case SyntaxKind.ExclamationToken: 2599case SyntaxKind.PlusPlusToken: 2600case SyntaxKind.MinusMinusToken: 2601case SyntaxKind.AmpersandToken: 2602case SyntaxKind.AsteriskToken: 2603case SyntaxKind.CaretToken: break; 2611public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) 2614private static SyntaxKind GetPrefixUnaryExpressionOperatorTokenKind(SyntaxKind kind) 2617SyntaxKind.UnaryPlusExpression => SyntaxKind.PlusToken, 2618SyntaxKind.UnaryMinusExpression => SyntaxKind.MinusToken, 2619SyntaxKind.BitwiseNotExpression => SyntaxKind.TildeToken, 2620SyntaxKind.LogicalNotExpression => SyntaxKind.ExclamationToken, 2621SyntaxKind.PreIncrementExpression => SyntaxKind.PlusPlusToken, 2622SyntaxKind.PreDecrementExpression => SyntaxKind.MinusMinusToken, 2623SyntaxKind.AddressOfExpression => SyntaxKind.AmpersandToken, 2624SyntaxKind.PointerIndirectionExpression => SyntaxKind.AsteriskToken, 2625SyntaxKind.IndexExpression => SyntaxKind.CaretToken, 2632if (awaitKeyword.Kind() != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 2639=> SyntaxFactory.AwaitExpression(SyntaxFactory.Token(SyntaxKind.AwaitKeyword), expression); 2642public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 2646case SyntaxKind.PostIncrementExpression: 2647case SyntaxKind.PostDecrementExpression: 2648case SyntaxKind.SuppressNullableWarningExpression: break; 2654case SyntaxKind.PlusPlusToken: 2655case SyntaxKind.MinusMinusToken: 2656case SyntaxKind.ExclamationToken: break; 2663public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) 2666private static SyntaxKind GetPostfixUnaryExpressionOperatorTokenKind(SyntaxKind kind) 2669SyntaxKind.PostIncrementExpression => SyntaxKind.PlusPlusToken, 2670SyntaxKind.PostDecrementExpression => SyntaxKind.MinusMinusToken, 2671SyntaxKind.SuppressNullableWarningExpression => SyntaxKind.ExclamationToken, 2676public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 2680case SyntaxKind.SimpleMemberAccessExpression: 2681case SyntaxKind.PointerMemberAccessExpression: break; 2687case SyntaxKind.DotToken: 2688case SyntaxKind.MinusGreaterThanToken: break; 2696public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SimpleNameSyntax name) 2699private static SyntaxKind GetMemberAccessExpressionOperatorTokenKind(SyntaxKind kind) 2702SyntaxKind.SimpleMemberAccessExpression => SyntaxKind.DotToken, 2703SyntaxKind.PointerMemberAccessExpression => SyntaxKind.MinusGreaterThanToken, 2711if (operatorToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 2718=> SyntaxFactory.ConditionalAccessExpression(expression, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenNotNull); 2723if (operatorToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 2730=> SyntaxFactory.MemberBindingExpression(SyntaxFactory.Token(SyntaxKind.DotToken), name); 2746if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 2752=> SyntaxFactory.RangeExpression(leftOperand, SyntaxFactory.Token(SyntaxKind.DotDotToken), rightOperand); 2756=> SyntaxFactory.RangeExpression(default, SyntaxFactory.Token(SyntaxKind.DotDotToken), default); 2770public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2774case SyntaxKind.AddExpression: 2775case SyntaxKind.SubtractExpression: 2776case SyntaxKind.MultiplyExpression: 2777case SyntaxKind.DivideExpression: 2778case SyntaxKind.ModuloExpression: 2779case SyntaxKind.LeftShiftExpression: 2780case SyntaxKind.RightShiftExpression: 2781case SyntaxKind.UnsignedRightShiftExpression: 2782case SyntaxKind.LogicalOrExpression: 2783case SyntaxKind.LogicalAndExpression: 2784case SyntaxKind.BitwiseOrExpression: 2785case SyntaxKind.BitwiseAndExpression: 2786case SyntaxKind.ExclusiveOrExpression: 2787case SyntaxKind.EqualsExpression: 2788case SyntaxKind.NotEqualsExpression: 2789case SyntaxKind.LessThanExpression: 2790case SyntaxKind.LessThanOrEqualExpression: 2791case SyntaxKind.GreaterThanExpression: 2792case SyntaxKind.GreaterThanOrEqualExpression: 2793case SyntaxKind.IsExpression: 2794case SyntaxKind.AsExpression: 2795case SyntaxKind.CoalesceExpression: break; 2801case SyntaxKind.PlusToken: 2802case SyntaxKind.MinusToken: 2803case SyntaxKind.AsteriskToken: 2804case SyntaxKind.SlashToken: 2805case SyntaxKind.PercentToken: 2806case SyntaxKind.LessThanLessThanToken: 2807case SyntaxKind.GreaterThanGreaterThanToken: 2808case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 2809case SyntaxKind.BarBarToken: 2810case SyntaxKind.AmpersandAmpersandToken: 2811case SyntaxKind.BarToken: 2812case SyntaxKind.AmpersandToken: 2813case SyntaxKind.CaretToken: 2814case SyntaxKind.EqualsEqualsToken: 2815case SyntaxKind.ExclamationEqualsToken: 2816case SyntaxKind.LessThanToken: 2817case SyntaxKind.LessThanEqualsToken: 2818case SyntaxKind.GreaterThanToken: 2819case SyntaxKind.GreaterThanEqualsToken: 2820case SyntaxKind.IsKeyword: 2821case SyntaxKind.AsKeyword: 2822case SyntaxKind.QuestionQuestionToken: break; 2830public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) 2833private static SyntaxKind GetBinaryExpressionOperatorTokenKind(SyntaxKind kind) 2836SyntaxKind.AddExpression => SyntaxKind.PlusToken, 2837SyntaxKind.SubtractExpression => SyntaxKind.MinusToken, 2838SyntaxKind.MultiplyExpression => SyntaxKind.AsteriskToken, 2839SyntaxKind.DivideExpression => SyntaxKind.SlashToken, 2840SyntaxKind.ModuloExpression => SyntaxKind.PercentToken, 2841SyntaxKind.LeftShiftExpression => SyntaxKind.LessThanLessThanToken, 2842SyntaxKind.RightShiftExpression => SyntaxKind.GreaterThanGreaterThanToken, 2843SyntaxKind.UnsignedRightShiftExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 2844SyntaxKind.LogicalOrExpression => SyntaxKind.BarBarToken, 2845SyntaxKind.LogicalAndExpression => SyntaxKind.AmpersandAmpersandToken, 2846SyntaxKind.BitwiseOrExpression => SyntaxKind.BarToken, 2847SyntaxKind.BitwiseAndExpression => SyntaxKind.AmpersandToken, 2848SyntaxKind.ExclusiveOrExpression => SyntaxKind.CaretToken, 2849SyntaxKind.EqualsExpression => SyntaxKind.EqualsEqualsToken, 2850SyntaxKind.NotEqualsExpression => SyntaxKind.ExclamationEqualsToken, 2851SyntaxKind.LessThanExpression => SyntaxKind.LessThanToken, 2852SyntaxKind.LessThanOrEqualExpression => SyntaxKind.LessThanEqualsToken, 2853SyntaxKind.GreaterThanExpression => SyntaxKind.GreaterThanToken, 2854SyntaxKind.GreaterThanOrEqualExpression => SyntaxKind.GreaterThanEqualsToken, 2855SyntaxKind.IsExpression => SyntaxKind.IsKeyword, 2856SyntaxKind.AsExpression => SyntaxKind.AsKeyword, 2857SyntaxKind.CoalesceExpression => SyntaxKind.QuestionQuestionToken, 2862public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2866case SyntaxKind.SimpleAssignmentExpression: 2867case SyntaxKind.AddAssignmentExpression: 2868case SyntaxKind.SubtractAssignmentExpression: 2869case SyntaxKind.MultiplyAssignmentExpression: 2870case SyntaxKind.DivideAssignmentExpression: 2871case SyntaxKind.ModuloAssignmentExpression: 2872case SyntaxKind.AndAssignmentExpression: 2873case SyntaxKind.ExclusiveOrAssignmentExpression: 2874case SyntaxKind.OrAssignmentExpression: 2875case SyntaxKind.LeftShiftAssignmentExpression: 2876case SyntaxKind.RightShiftAssignmentExpression: 2877case SyntaxKind.UnsignedRightShiftAssignmentExpression: 2878case SyntaxKind.CoalesceAssignmentExpression: break; 2884case SyntaxKind.EqualsToken: 2885case SyntaxKind.PlusEqualsToken: 2886case SyntaxKind.MinusEqualsToken: 2887case SyntaxKind.AsteriskEqualsToken: 2888case SyntaxKind.SlashEqualsToken: 2889case SyntaxKind.PercentEqualsToken: 2890case SyntaxKind.AmpersandEqualsToken: 2891case SyntaxKind.CaretEqualsToken: 2892case SyntaxKind.BarEqualsToken: 2893case SyntaxKind.LessThanLessThanEqualsToken: 2894case SyntaxKind.GreaterThanGreaterThanEqualsToken: 2895case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 2896case SyntaxKind.QuestionQuestionEqualsToken: break; 2904public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) 2907private static SyntaxKind GetAssignmentExpressionOperatorTokenKind(SyntaxKind kind) 2910SyntaxKind.SimpleAssignmentExpression => SyntaxKind.EqualsToken, 2911SyntaxKind.AddAssignmentExpression => SyntaxKind.PlusEqualsToken, 2912SyntaxKind.SubtractAssignmentExpression => SyntaxKind.MinusEqualsToken, 2913SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.AsteriskEqualsToken, 2914SyntaxKind.DivideAssignmentExpression => SyntaxKind.SlashEqualsToken, 2915SyntaxKind.ModuloAssignmentExpression => SyntaxKind.PercentEqualsToken, 2916SyntaxKind.AndAssignmentExpression => SyntaxKind.AmpersandEqualsToken, 2917SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.CaretEqualsToken, 2918SyntaxKind.OrAssignmentExpression => SyntaxKind.BarEqualsToken, 2919SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LessThanLessThanEqualsToken, 2920SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanEqualsToken, 2921SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, 2922SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.QuestionQuestionEqualsToken, 2930if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 2932if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 2939=> SyntaxFactory.ConditionalExpression(condition, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenTrue, SyntaxFactory.Token(SyntaxKind.ColonToken), whenFalse); 2944if (token.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 2950=> SyntaxFactory.ThisExpression(SyntaxFactory.Token(SyntaxKind.ThisKeyword)); 2955if (token.Kind() != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 2961=> SyntaxFactory.BaseExpression(SyntaxFactory.Token(SyntaxKind.BaseKeyword)); 2964public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 2968case SyntaxKind.ArgListExpression: 2969case SyntaxKind.NumericLiteralExpression: 2970case SyntaxKind.StringLiteralExpression: 2971case SyntaxKind.Utf8StringLiteralExpression: 2972case SyntaxKind.CharacterLiteralExpression: 2973case SyntaxKind.TrueLiteralExpression: 2974case SyntaxKind.FalseLiteralExpression: 2975case SyntaxKind.NullLiteralExpression: 2976case SyntaxKind.DefaultLiteralExpression: break; 2981case SyntaxKind.ArgListKeyword: 2982case SyntaxKind.NumericLiteralToken: 2983case SyntaxKind.StringLiteralToken: 2984case SyntaxKind.Utf8StringLiteralToken: 2985case SyntaxKind.MultiLineRawStringLiteralToken: 2986case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 2987case SyntaxKind.SingleLineRawStringLiteralToken: 2988case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 2989case SyntaxKind.CharacterLiteralToken: 2990case SyntaxKind.TrueKeyword: 2991case SyntaxKind.FalseKeyword: 2992case SyntaxKind.NullKeyword: 2993case SyntaxKind.DefaultKeyword: break; 3002if (token.Kind() != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 3008=> SyntaxFactory.FieldExpression(SyntaxFactory.Token(SyntaxKind.FieldKeyword)); 3013if (keyword.Kind() != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 3014if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3016if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3022=> SyntaxFactory.MakeRefExpression(SyntaxFactory.Token(SyntaxKind.MakeRefKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3027if (keyword.Kind() != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 3028if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3030if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3036=> SyntaxFactory.RefTypeExpression(SyntaxFactory.Token(SyntaxKind.RefTypeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3041if (keyword.Kind() != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 3042if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3044if (comma.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 3046if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3052=> SyntaxFactory.RefValueExpression(SyntaxFactory.Token(SyntaxKind.RefValueKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CommaToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3055public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3059case SyntaxKind.CheckedExpression: 3060case SyntaxKind.UncheckedExpression: break; 3065case SyntaxKind.CheckedKeyword: 3066case SyntaxKind.UncheckedKeyword: break; 3069if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3071if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3076public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, ExpressionSyntax expression) 3077=> SyntaxFactory.CheckedExpression(kind, SyntaxFactory.Token(GetCheckedExpressionKeywordKind(kind)), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3079private static SyntaxKind GetCheckedExpressionKeywordKind(SyntaxKind kind) 3082SyntaxKind.CheckedExpression => SyntaxKind.CheckedKeyword, 3083SyntaxKind.UncheckedExpression => SyntaxKind.UncheckedKeyword, 3090if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 3091if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3093if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3099=> SyntaxFactory.DefaultExpression(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3104if (keyword.Kind() != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 3105if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3107if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3113=> SyntaxFactory.TypeOfExpression(SyntaxFactory.Token(SyntaxKind.TypeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3118if (keyword.Kind() != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 3119if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3121if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3127=> SyntaxFactory.SizeOfExpression(SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3156if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3157if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3163=> SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3168if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3169if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3175=> SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 3182case SyntaxKind.RefKeyword: 3183case SyntaxKind.OutKeyword: 3184case SyntaxKind.InKeyword: 3185case SyntaxKind.None: break; 3200if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 3208if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 3223if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3225if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3232=> SyntaxFactory.CastExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken), expression); 3237if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 3246if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 3253if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 3260=> SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), expression); 3266if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 3272=> SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); 3276=> SyntaxFactory.ParenthesizedLambdaExpression(default, default(SyntaxTokenList), default, SyntaxFactory.ParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); 3279public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 3283case SyntaxKind.ObjectInitializerExpression: 3284case SyntaxKind.CollectionInitializerExpression: 3285case SyntaxKind.ArrayInitializerExpression: 3286case SyntaxKind.ComplexElementInitializerExpression: 3287case SyntaxKind.WithInitializerExpression: break; 3290if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3291if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3296public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SeparatedSyntaxList<ExpressionSyntax> expressions = default) 3297=> SyntaxFactory.InitializerExpression(kind, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expressions, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3302if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3309=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), argumentList, initializer); 3313=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.ArgumentList(), default); 3318if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3325=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, argumentList, initializer); 3329=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default, default); 3335if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 3342=> SyntaxFactory.WithExpression(expression, SyntaxFactory.Token(SyntaxKind.WithKeyword), initializer); 3358if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3359if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3360if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3366=> SyntaxFactory.AnonymousObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), initializers, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3371if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3378=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, initializer); 3382=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default); 3387if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3388if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3389if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3396=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), commas, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3400=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3405if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 3412=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, initializer); 3416=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, default); 3421if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 3422if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3423if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3430=> SyntaxFactory.ImplicitStackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3435if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3436if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3442=> SyntaxFactory.CollectionExpression(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), elements, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 3454if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 3461=> SyntaxFactory.SpreadElement(SyntaxFactory.Token(SyntaxKind.DotDotToken), expression); 3467if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 3475=> SyntaxFactory.WithElement(SyntaxFactory.Token(SyntaxKind.WithKeyword), argumentList ?? SyntaxFactory.ArgumentList()); 3499if (fromKeyword.Kind() != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 3500if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3501if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 3508=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3512=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3516=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3521if (letKeyword.Kind() != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 3522if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3523if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 3530=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), identifier, SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); 3534=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); 3539if (joinKeyword.Kind() != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 3540if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3541if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 3543if (onKeyword.Kind() != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 3545if (equalsKeyword.Kind() != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 3552=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, into); 3556=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, default); 3560=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, default); 3565if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 3566if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3572=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier); 3576=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier)); 3581if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 3588=> SyntaxFactory.WhereClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), condition); 3593if (orderByKeyword.Kind() != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 3599=> SyntaxFactory.OrderByClause(SyntaxFactory.Token(SyntaxKind.OrderByKeyword), orderings); 3602public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) 3606case SyntaxKind.AscendingOrdering: 3607case SyntaxKind.DescendingOrdering: break; 3613case SyntaxKind.AscendingKeyword: 3614case SyntaxKind.DescendingKeyword: 3615case SyntaxKind.None: break; 3622public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression) 3625private static SyntaxKind GetOrderingAscendingOrDescendingKeywordKind(SyntaxKind kind) 3628SyntaxKind.AscendingOrdering => SyntaxKind.AscendingKeyword, 3629SyntaxKind.DescendingOrdering => SyntaxKind.DescendingKeyword, 3636if (selectKeyword.Kind() != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 3643=> SyntaxFactory.SelectClause(SyntaxFactory.Token(SyntaxKind.SelectKeyword), expression); 3648if (groupKeyword.Kind() != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 3650if (byKeyword.Kind() != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 3657=> SyntaxFactory.GroupClause(SyntaxFactory.Token(SyntaxKind.GroupKeyword), groupExpression, SyntaxFactory.Token(SyntaxKind.ByKeyword), byExpression); 3662if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 3663if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3670=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier, body); 3674=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier), body); 3679if (omittedArraySizeExpressionToken.Kind() != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 3685=> SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 3692case SyntaxKind.InterpolatedStringStartToken: 3693case SyntaxKind.InterpolatedVerbatimStringStartToken: 3694case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 3695case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 3700case SyntaxKind.InterpolatedStringEndToken: 3701case SyntaxKind.InterpolatedRawStringEndToken: break; 3715if (isKeyword.Kind() != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 3722=> SyntaxFactory.IsPatternExpression(expression, SyntaxFactory.Token(SyntaxKind.IsKeyword), pattern); 3727if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 3734=> SyntaxFactory.ThrowExpression(SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression); 3739if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 3746=> SyntaxFactory.WhenClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), condition); 3751if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 3757=> SyntaxFactory.DiscardPattern(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 3770if (varKeyword.Kind() != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 3777=> SyntaxFactory.VarPattern(SyntaxFactory.Token(SyntaxKind.VarKeyword), designation); 3792if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3793if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3799=> SyntaxFactory.PositionalPatternClause(SyntaxFactory.Token(SyntaxKind.OpenParenToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3804if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3805if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3811=> SyntaxFactory.PropertyPatternClause(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3834if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3836if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3842=> SyntaxFactory.ParenthesizedPattern(SyntaxFactory.Token(SyntaxKind.OpenParenToken), pattern, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3849case SyntaxKind.EqualsEqualsToken: 3850case SyntaxKind.ExclamationEqualsToken: 3851case SyntaxKind.LessThanToken: 3852case SyntaxKind.LessThanEqualsToken: 3853case SyntaxKind.GreaterThanToken: 3854case SyntaxKind.GreaterThanEqualsToken: break; 3869public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 3873case SyntaxKind.OrPattern: 3874case SyntaxKind.AndPattern: break; 3880case SyntaxKind.OrKeyword: 3881case SyntaxKind.AndKeyword: break; 3889public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, PatternSyntax right) 3892private static SyntaxKind GetBinaryPatternOperatorTokenKind(SyntaxKind kind) 3895SyntaxKind.OrPattern => SyntaxKind.OrKeyword, 3896SyntaxKind.AndPattern => SyntaxKind.AndKeyword, 3903if (operatorToken.Kind() != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 3910=> SyntaxFactory.UnaryPattern(SyntaxFactory.Token(SyntaxKind.NotKeyword), pattern); 3915if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3916if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3922=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), designation); 3926=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), default); 3931if (dotDotToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 3937=> SyntaxFactory.SlicePattern(SyntaxFactory.Token(SyntaxKind.DotDotToken), pattern); 3942if (textToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 3948=> SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 3953if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3955if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3961=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3965=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3977if (formatStringToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 3983=> SyntaxFactory.InterpolationFormatClause(colonToken, SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 3999if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4000if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4006=> SyntaxFactory.Block(attributeLists, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4011=> SyntaxFactory.Block(default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4018if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4022case SyntaxKind.SemicolonToken: 4023case SyntaxKind.None: break; 4046case SyntaxKind.AwaitKeyword: 4047case SyntaxKind.None: break; 4052case SyntaxKind.UsingKeyword: 4053case SyntaxKind.None: break; 4057if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4063=> SyntaxFactory.LocalDeclarationStatement(attributeLists, default, default, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4067=> SyntaxFactory.LocalDeclarationStatement(default, default, default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4083if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4098if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 4105=> SyntaxFactory.EqualsValueClause(SyntaxFactory.Token(SyntaxKind.EqualsToken), value); 4110if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4117if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 4123=> SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 4128if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4129if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4135=> SyntaxFactory.ParenthesizedVariableDesignation(SyntaxFactory.Token(SyntaxKind.OpenParenToken), variables, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4141if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4147=> SyntaxFactory.ExpressionStatement(attributeLists, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4151=> SyntaxFactory.ExpressionStatement(default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4156if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4162=> SyntaxFactory.EmptyStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4166=> SyntaxFactory.EmptyStatement(default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4171if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4172if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4179=> SyntaxFactory.LabeledStatement(attributeLists, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4183=> SyntaxFactory.LabeledStatement(default, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4187=> SyntaxFactory.LabeledStatement(default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4190public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 4194case SyntaxKind.GotoStatement: 4195case SyntaxKind.GotoCaseStatement: 4196case SyntaxKind.GotoDefaultStatement: break; 4199if (gotoKeyword.Kind() != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 4202case SyntaxKind.CaseKeyword: 4203case SyntaxKind.DefaultKeyword: 4204case SyntaxKind.None: break; 4207if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4212public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression) 4213=> SyntaxFactory.GotoStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.GotoKeyword), caseOrDefaultKeyword, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4217public static GotoStatementSyntax GotoStatement(SyntaxKind kind, ExpressionSyntax? expression = default) 4218=> SyntaxFactory.GotoStatement(kind, default, SyntaxFactory.Token(SyntaxKind.GotoKeyword), default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4224if (breakKeyword.Kind() != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 4225if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4231=> SyntaxFactory.BreakStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4235=> SyntaxFactory.BreakStatement(default, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4240if (continueKeyword.Kind() != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 4241if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4247=> SyntaxFactory.ContinueStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4251=> SyntaxFactory.ContinueStatement(default, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4256if (returnKeyword.Kind() != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 4257if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4263=> SyntaxFactory.ReturnStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4268=> SyntaxFactory.ReturnStatement(default, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4274if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 4275if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4281=> SyntaxFactory.ThrowStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4286=> SyntaxFactory.ThrowStatement(default, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4290public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 4294case SyntaxKind.YieldReturnStatement: 4295case SyntaxKind.YieldBreakStatement: break; 4298if (yieldKeyword.Kind() != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 4301case SyntaxKind.ReturnKeyword: 4302case SyntaxKind.BreakKeyword: break; 4305if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4310public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax? expression) 4311=> SyntaxFactory.YieldStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4315public static YieldStatementSyntax YieldStatement(SyntaxKind kind, ExpressionSyntax? expression = default) 4316=> SyntaxFactory.YieldStatement(kind, default, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4319private static SyntaxKind GetYieldStatementReturnOrBreakKeywordKind(SyntaxKind kind) 4322SyntaxKind.YieldReturnStatement => SyntaxKind.ReturnKeyword, 4323SyntaxKind.YieldBreakStatement => SyntaxKind.BreakKeyword, 4330if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 4331if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4333if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4340=> SyntaxFactory.WhileStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4344=> SyntaxFactory.WhileStatement(default, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4349if (doKeyword.Kind() != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 4351if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 4352if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4354if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4355if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4361=> SyntaxFactory.DoStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.DoKeyword), statement, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4365=> SyntaxFactory.DoStatement(default, SyntaxFactory.Token(SyntaxKind.DoKeyword), statement, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4370if (forKeyword.Kind() != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 4371if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4372if (firstSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 4373if (secondSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 4374if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4381=> SyntaxFactory.ForStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ForKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, initializers, SyntaxFactory.Token(SyntaxKind.SemicolonToken), condition, SyntaxFactory.Token(SyntaxKind.SemicolonToken), incrementors, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4385=> SyntaxFactory.ForStatement(default, SyntaxFactory.Token(SyntaxKind.ForKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default, default, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4392case SyntaxKind.AwaitKeyword: 4393case SyntaxKind.None: break; 4396if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 4397if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4399if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4400if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 4402if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4409=> SyntaxFactory.ForEachStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4413=> SyntaxFactory.ForEachStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4417=> SyntaxFactory.ForEachStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4424case SyntaxKind.AwaitKeyword: 4425case SyntaxKind.None: break; 4428if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 4429if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4431if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 4433if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4440=> SyntaxFactory.ForEachVariableStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4444=> SyntaxFactory.ForEachVariableStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4451case SyntaxKind.AwaitKeyword: 4452case SyntaxKind.None: break; 4455if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 4456if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4457if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4464=> SyntaxFactory.UsingStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4468=> SyntaxFactory.UsingStatement(default, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4473if (fixedKeyword.Kind() != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 4474if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4476if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4483=> SyntaxFactory.FixedStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4487=> SyntaxFactory.FixedStatement(default, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4490public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 4494case SyntaxKind.CheckedStatement: 4495case SyntaxKind.UncheckedStatement: break; 4500case SyntaxKind.CheckedKeyword: 4501case SyntaxKind.UncheckedKeyword: break; 4509public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, BlockSyntax block) 4514public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, BlockSyntax? block = default) 4518private static SyntaxKind GetCheckedStatementKeywordKind(SyntaxKind kind) 4521SyntaxKind.CheckedStatement => SyntaxKind.CheckedKeyword, 4522SyntaxKind.UncheckedStatement => SyntaxKind.UncheckedKeyword, 4529if (unsafeKeyword.Kind() != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 4536=> SyntaxFactory.UnsafeStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block); 4541=> SyntaxFactory.UnsafeStatement(default, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block ?? SyntaxFactory.Block()); 4547if (lockKeyword.Kind() != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 4548if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4550if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4557=> SyntaxFactory.LockStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4561=> SyntaxFactory.LockStatement(default, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4566if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 4567if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4569if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4576=> SyntaxFactory.IfStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, @else); 4580=> SyntaxFactory.IfStatement(default, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, default); 4585if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 4592=> SyntaxFactory.ElseClause(SyntaxFactory.Token(SyntaxKind.ElseKeyword), statement); 4597if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 4600case SyntaxKind.OpenParenToken: 4601case SyntaxKind.None: break; 4607case SyntaxKind.CloseParenToken: 4608case SyntaxKind.None: break; 4611if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4612if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4629if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 4631if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4637=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, whenClause, colonToken); 4641=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, default, colonToken); 4646if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 4648if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4654=> SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, colonToken); 4659if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 4660if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4666=> SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), colonToken); 4672if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 4673if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4674if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4680=> SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), arms, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4684=> SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4690if (equalsGreaterThanToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 4697=> SyntaxFactory.SwitchExpressionArm(pattern, whenClause, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 4701=> SyntaxFactory.SwitchExpressionArm(pattern, default, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 4706if (tryKeyword.Kind() != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 4713=> SyntaxFactory.TryStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.TryKeyword), block, catches, @finally); 4718=> SyntaxFactory.TryStatement(default, SyntaxFactory.Token(SyntaxKind.TryKeyword), SyntaxFactory.Block(), catches, default); 4724if (catchKeyword.Kind() != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 4731=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), declaration, filter, block); 4735=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), default, default, SyntaxFactory.Block()); 4740if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4744case SyntaxKind.IdentifierToken: 4745case SyntaxKind.None: break; 4748if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4754=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4758=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4763if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 4764if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4766if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4772=> SyntaxFactory.CatchFilterClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), filterExpression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4777if (finallyKeyword.Kind() != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 4784=> SyntaxFactory.FinallyClause(SyntaxFactory.Token(SyntaxKind.FinallyKeyword), block ?? SyntaxFactory.Block()); 4789if (endOfFileToken.Kind() != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 4795=> SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 4799=> SyntaxFactory.CompilationUnit(default, default, default, default, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 4804if (externKeyword.Kind() != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 4805if (aliasKeyword.Kind() != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 4806if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4807if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4813=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), identifier, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4817=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4824case SyntaxKind.GlobalKeyword: 4825case SyntaxKind.None: break; 4828if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 4831case SyntaxKind.StaticKeyword: 4832case SyntaxKind.None: break; 4837case SyntaxKind.UnsafeKeyword: 4838case SyntaxKind.None: break; 4842if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4848=> SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, alias, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4852=> SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, default, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4857if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 4859if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4860if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4863case SyntaxKind.SemicolonToken: 4864case SyntaxKind.None: break; 4872=> SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), externs, usings, members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 4876=> SyntaxFactory.NamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 4881if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 4883if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4889=> SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), externs, usings, members); 4893=> SyntaxFactory.FileScopedNamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, default, default); 4898if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 4899if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 4905=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), target, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 4909=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 4914if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4920=> SyntaxFactory.AttributeTargetSpecifier(identifier, SyntaxFactory.Token(SyntaxKind.ColonToken)); 4936if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4937if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4943=> SyntaxFactory.AttributeArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4960if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 4966=> SyntaxFactory.NameEquals(name, SyntaxFactory.Token(SyntaxKind.EqualsToken)); 4970=> SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.EqualsToken)); 4975if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 4976if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 4982=> SyntaxFactory.TypeParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 4989case SyntaxKind.InKeyword: 4990case SyntaxKind.OutKeyword: 4991case SyntaxKind.None: break; 4994if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5009if (keyword.Kind() != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 5010if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5013case SyntaxKind.OpenBraceToken: 5014case SyntaxKind.None: break; 5019case SyntaxKind.CloseBraceToken: 5020case SyntaxKind.None: break; 5025case SyntaxKind.SemicolonToken: 5026case SyntaxKind.None: break; 5035if (keyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); 5036if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5039case SyntaxKind.OpenBraceToken: 5040case SyntaxKind.None: break; 5045case SyntaxKind.CloseBraceToken: 5046case SyntaxKind.None: break; 5051case SyntaxKind.SemicolonToken: 5052case SyntaxKind.None: break; 5062if (keyword.Kind() != SyntaxKind.UnionKeyword) throw new ArgumentException(nameof(keyword)); 5063if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5066case SyntaxKind.OpenBraceToken: 5067case SyntaxKind.None: break; 5072case SyntaxKind.CloseBraceToken: 5073case SyntaxKind.None: break; 5078case SyntaxKind.SemicolonToken: 5079case SyntaxKind.None: break; 5088if (keyword.Kind() != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 5089if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5092case SyntaxKind.OpenBraceToken: 5093case SyntaxKind.None: break; 5098case SyntaxKind.CloseBraceToken: 5099case SyntaxKind.None: break; 5104case SyntaxKind.SemicolonToken: 5105case SyntaxKind.None: break; 5112public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) 5116case SyntaxKind.RecordDeclaration: 5117case SyntaxKind.RecordStructDeclaration: break; 5122case SyntaxKind.ClassKeyword: 5123case SyntaxKind.StructKeyword: 5124case SyntaxKind.None: break; 5127if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5130case SyntaxKind.OpenBraceToken: 5131case SyntaxKind.None: break; 5136case SyntaxKind.CloseBraceToken: 5137case SyntaxKind.None: break; 5142case SyntaxKind.SemicolonToken: 5143case SyntaxKind.None: break; 5150public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxList<MemberDeclarationSyntax> members) 5154public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, SyntaxToken identifier) 5158public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, string identifier) 5161private static SyntaxKind GetRecordDeclarationClassOrStructKeywordKind(SyntaxKind kind) 5164SyntaxKind.RecordDeclaration => SyntaxKind.ClassKeyword, 5165SyntaxKind.RecordStructDeclaration => SyntaxKind.StructKeyword, 5172if (enumKeyword.Kind() != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 5173if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5176case SyntaxKind.OpenBraceToken: 5177case SyntaxKind.None: break; 5182case SyntaxKind.CloseBraceToken: 5183case SyntaxKind.None: break; 5188case SyntaxKind.SemicolonToken: 5189case SyntaxKind.None: break; 5198if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 5200if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5202if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5208=> SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, typeParameterList, parameterList, constraintClauses, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5212=> SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5216=> SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5221if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5236if (keyword.Kind() != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 5239case SyntaxKind.OpenBraceToken: 5240case SyntaxKind.None: break; 5245case SyntaxKind.CloseBraceToken: 5246case SyntaxKind.None: break; 5251case SyntaxKind.SemicolonToken: 5252case SyntaxKind.None: break; 5260=> SyntaxFactory.ExtensionBlockDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), typeParameterList, parameterList, constraintClauses, default, members, default, default); 5264=> SyntaxFactory.ExtensionBlockDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), default, default, default, default, default, default, default); 5269if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5275=> SyntaxFactory.BaseList(SyntaxFactory.Token(SyntaxKind.ColonToken), types); 5299if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 5301if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5307=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), constraints); 5311=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), default); 5315=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.ColonToken), default); 5320if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 5321if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 5322if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 5328=> SyntaxFactory.ConstructorConstraint(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 5331public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken questionToken) 5335case SyntaxKind.ClassConstraint: 5336case SyntaxKind.StructConstraint: break; 5341case SyntaxKind.ClassKeyword: 5342case SyntaxKind.StructKeyword: break; 5347case SyntaxKind.QuestionToken: 5348case SyntaxKind.None: break; 5355public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind) 5358private static SyntaxKind GetClassOrStructConstraintClassOrStructKeywordKind(SyntaxKind kind) 5361SyntaxKind.ClassConstraint => SyntaxKind.ClassKeyword, 5362SyntaxKind.StructConstraint => SyntaxKind.StructKeyword, 5376if (defaultKeyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 5382=> SyntaxFactory.DefaultConstraint(SyntaxFactory.Token(SyntaxKind.DefaultKeyword)); 5387if (allowsKeyword.Kind() != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 5393=> SyntaxFactory.AllowsConstraintClause(SyntaxFactory.Token(SyntaxKind.AllowsKeyword), constraints); 5398if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 5399if (structKeyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 5405=> SyntaxFactory.RefStructConstraint(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.StructKeyword)); 5411if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5417=> SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5421=> SyntaxFactory.FieldDeclaration(default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5426if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 5428if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5434=> SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5438=> SyntaxFactory.EventFieldDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5444if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5450=> SyntaxFactory.ExplicitInterfaceSpecifier(name, SyntaxFactory.Token(SyntaxKind.DotToken)); 5456if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5460case SyntaxKind.SemicolonToken: 5461case SyntaxKind.None: break; 5483if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5486case SyntaxKind.CheckedKeyword: 5487case SyntaxKind.None: break; 5492case SyntaxKind.PlusToken: 5493case SyntaxKind.MinusToken: 5494case SyntaxKind.ExclamationToken: 5495case SyntaxKind.TildeToken: 5496case SyntaxKind.PlusPlusToken: 5497case SyntaxKind.MinusMinusToken: 5498case SyntaxKind.AsteriskToken: 5499case SyntaxKind.SlashToken: 5500case SyntaxKind.PercentToken: 5501case SyntaxKind.LessThanLessThanToken: 5502case SyntaxKind.GreaterThanGreaterThanToken: 5503case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 5504case SyntaxKind.BarToken: 5505case SyntaxKind.AmpersandToken: 5506case SyntaxKind.CaretToken: 5507case SyntaxKind.EqualsEqualsToken: 5508case SyntaxKind.ExclamationEqualsToken: 5509case SyntaxKind.LessThanToken: 5510case SyntaxKind.LessThanEqualsToken: 5511case SyntaxKind.GreaterThanToken: 5512case SyntaxKind.GreaterThanEqualsToken: 5513case SyntaxKind.FalseKeyword: 5514case SyntaxKind.TrueKeyword: 5515case SyntaxKind.IsKeyword: 5516case SyntaxKind.PlusEqualsToken: 5517case SyntaxKind.MinusEqualsToken: 5518case SyntaxKind.AsteriskEqualsToken: 5519case SyntaxKind.SlashEqualsToken: 5520case SyntaxKind.PercentEqualsToken: 5521case SyntaxKind.AmpersandEqualsToken: 5522case SyntaxKind.BarEqualsToken: 5523case SyntaxKind.CaretEqualsToken: 5524case SyntaxKind.LessThanLessThanEqualsToken: 5525case SyntaxKind.GreaterThanGreaterThanEqualsToken: 5526case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 5532case SyntaxKind.SemicolonToken: 5533case SyntaxKind.None: break; 5541=> SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameterList, body, expressionBody, default); 5545=> SyntaxFactory.OperatorDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, SyntaxFactory.ParameterList(), default, default, default); 5552case SyntaxKind.ImplicitKeyword: 5553case SyntaxKind.ExplicitKeyword: break; 5556if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5559case SyntaxKind.CheckedKeyword: 5560case SyntaxKind.None: break; 5567case SyntaxKind.SemicolonToken: 5568case SyntaxKind.None: break; 5576=> SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameterList, body, expressionBody, default); 5580=> SyntaxFactory.ConversionOperatorDeclaration(default, default(SyntaxTokenList), implicitOrExplicitKeyword, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, SyntaxFactory.ParameterList(), default, default, default); 5585if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5589case SyntaxKind.SemicolonToken: 5590case SyntaxKind.None: break; 5609public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 5613case SyntaxKind.BaseConstructorInitializer: 5614case SyntaxKind.ThisConstructorInitializer: break; 5617if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5620case SyntaxKind.BaseKeyword: 5621case SyntaxKind.ThisKeyword: break; 5629public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, ArgumentListSyntax? argumentList = default) 5630=> SyntaxFactory.ConstructorInitializer(kind, SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(GetConstructorInitializerThisOrBaseKeywordKind(kind)), argumentList ?? SyntaxFactory.ArgumentList()); 5632private static SyntaxKind GetConstructorInitializerThisOrBaseKeywordKind(SyntaxKind kind) 5635SyntaxKind.BaseConstructorInitializer => SyntaxKind.BaseKeyword, 5636SyntaxKind.ThisConstructorInitializer => SyntaxKind.ThisKeyword, 5643if (tildeToken.Kind() != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 5644if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5648case SyntaxKind.SemicolonToken: 5649case SyntaxKind.None: break; 5657=> SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, parameterList, body, expressionBody, default); 5661=> SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, SyntaxFactory.ParameterList(), default, default, default); 5665=> SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default); 5671if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5674case SyntaxKind.SemicolonToken: 5675case SyntaxKind.None: break; 5696if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 5703=> SyntaxFactory.ArrowExpressionClause(SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 5708if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 5710if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5713case SyntaxKind.SemicolonToken: 5714case SyntaxKind.None: break; 5722=> SyntaxFactory.EventDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), type, explicitInterfaceSpecifier, identifier, accessorList, default); 5726=> SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, identifier, default, default); 5730=> SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, SyntaxFactory.Identifier(identifier), default, default); 5736if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 5740case SyntaxKind.SemicolonToken: 5741case SyntaxKind.None: break; 5749=> SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameterList, accessorList, expressionBody, default); 5753=> SyntaxFactory.IndexerDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Token(SyntaxKind.ThisKeyword), SyntaxFactory.BracketedParameterList(), default, default, default); 5758if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 5759if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 5765=> SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), accessors, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 5768public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5772case SyntaxKind.GetAccessorDeclaration: 5773case SyntaxKind.SetAccessorDeclaration: 5774case SyntaxKind.InitAccessorDeclaration: 5775case SyntaxKind.AddAccessorDeclaration: 5776case SyntaxKind.RemoveAccessorDeclaration: 5777case SyntaxKind.UnknownAccessorDeclaration: break; 5782case SyntaxKind.GetKeyword: 5783case SyntaxKind.SetKeyword: 5784case SyntaxKind.InitKeyword: 5785case SyntaxKind.AddKeyword: 5786case SyntaxKind.RemoveKeyword: 5787case SyntaxKind.IdentifierToken: break; 5792case SyntaxKind.SemicolonToken: 5793case SyntaxKind.None: break; 5800public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 5804public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind) 5807private static SyntaxKind GetAccessorDeclarationKeywordKind(SyntaxKind kind) 5810SyntaxKind.GetAccessorDeclaration => SyntaxKind.GetKeyword, 5811SyntaxKind.SetAccessorDeclaration => SyntaxKind.SetKeyword, 5812SyntaxKind.InitAccessorDeclaration => SyntaxKind.InitKeyword, 5813SyntaxKind.AddAccessorDeclaration => SyntaxKind.AddKeyword, 5814SyntaxKind.RemoveAccessorDeclaration => SyntaxKind.RemoveKeyword, 5815SyntaxKind.UnknownAccessorDeclaration => SyntaxKind.IdentifierToken, 5822if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 5823if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 5829=> SyntaxFactory.ParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 5834if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 5835if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 5841=> SyntaxFactory.BracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 5848case SyntaxKind.IdentifierToken: 5849case SyntaxKind.ArgListKeyword: 5850case SyntaxKind.None: break; 5890public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 5894case SyntaxKind.SingleLineDocumentationCommentTrivia: 5895case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 5898if (endOfComment.Kind() != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 5903public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList<XmlNodeSyntax> content = default) 5904=> SyntaxFactory.DocumentationCommentTrivia(kind, content, SyntaxFactory.Token(SyntaxKind.EndOfDocumentationCommentToken)); 5917if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5924=> SyntaxFactory.QualifiedCref(container, SyntaxFactory.Token(SyntaxKind.DotToken), member); 5940if (extensionKeyword.Kind() != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 5942if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5949=> SyntaxFactory.ExtensionMemberCref(SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), typeArgumentList, parameters, SyntaxFactory.Token(SyntaxKind.DotToken), member); 5953=> SyntaxFactory.ExtensionMemberCref(SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), default, SyntaxFactory.CrefParameterList(), SyntaxFactory.Token(SyntaxKind.DotToken), member); 5958if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 5964=> SyntaxFactory.IndexerMemberCref(SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameters); 5969if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5972case SyntaxKind.CheckedKeyword: 5973case SyntaxKind.None: break; 5978case SyntaxKind.PlusToken: 5979case SyntaxKind.MinusToken: 5980case SyntaxKind.ExclamationToken: 5981case SyntaxKind.TildeToken: 5982case SyntaxKind.PlusPlusToken: 5983case SyntaxKind.MinusMinusToken: 5984case SyntaxKind.AsteriskToken: 5985case SyntaxKind.SlashToken: 5986case SyntaxKind.PercentToken: 5987case SyntaxKind.LessThanLessThanToken: 5988case SyntaxKind.GreaterThanGreaterThanToken: 5989case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 5990case SyntaxKind.BarToken: 5991case SyntaxKind.AmpersandToken: 5992case SyntaxKind.CaretToken: 5993case SyntaxKind.EqualsEqualsToken: 5994case SyntaxKind.ExclamationEqualsToken: 5995case SyntaxKind.LessThanToken: 5996case SyntaxKind.LessThanEqualsToken: 5997case SyntaxKind.GreaterThanToken: 5998case SyntaxKind.GreaterThanEqualsToken: 5999case SyntaxKind.FalseKeyword: 6000case SyntaxKind.TrueKeyword: 6001case SyntaxKind.PlusEqualsToken: 6002case SyntaxKind.MinusEqualsToken: 6003case SyntaxKind.AsteriskEqualsToken: 6004case SyntaxKind.SlashEqualsToken: 6005case SyntaxKind.PercentEqualsToken: 6006case SyntaxKind.AmpersandEqualsToken: 6007case SyntaxKind.BarEqualsToken: 6008case SyntaxKind.CaretEqualsToken: 6009case SyntaxKind.LessThanLessThanEqualsToken: 6010case SyntaxKind.GreaterThanGreaterThanEqualsToken: 6011case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 6019=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameters); 6023=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, default); 6030case SyntaxKind.ImplicitKeyword: 6031case SyntaxKind.ExplicitKeyword: break; 6034if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 6037case SyntaxKind.CheckedKeyword: 6038case SyntaxKind.None: break; 6047=> SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameters); 6051=> SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, default); 6056if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 6057if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 6063=> SyntaxFactory.CrefParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 6068if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 6069if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 6075=> SyntaxFactory.CrefBracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 6082case SyntaxKind.RefKeyword: 6083case SyntaxKind.OutKeyword: 6084case SyntaxKind.InKeyword: 6085case SyntaxKind.None: break; 6090case SyntaxKind.ReadOnlyKeyword: 6091case SyntaxKind.None: break; 6121if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 6123if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 6129=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6133=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6138if (lessThanSlashToken.Kind() != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 6140if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 6146=> SyntaxFactory.XmlElementEndTag(SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), name, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6151if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 6153if (slashGreaterThanToken.Kind() != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 6159=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 6163=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 6168if (localName.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 6183if (prefix.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 6184if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 6190=> SyntaxFactory.XmlPrefix(prefix, SyntaxFactory.Token(SyntaxKind.ColonToken)); 6194=> SyntaxFactory.XmlPrefix(SyntaxFactory.Identifier(prefix), SyntaxFactory.Token(SyntaxKind.ColonToken)); 6200if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6203case SyntaxKind.SingleQuoteToken: 6204case SyntaxKind.DoubleQuoteToken: break; 6209case SyntaxKind.SingleQuoteToken: 6210case SyntaxKind.DoubleQuoteToken: break; 6218=> SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, textTokens, endQuoteToken); 6222=> SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, default(SyntaxTokenList), endQuoteToken); 6228if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6231case SyntaxKind.SingleQuoteToken: 6232case SyntaxKind.DoubleQuoteToken: break; 6238case SyntaxKind.SingleQuoteToken: 6239case SyntaxKind.DoubleQuoteToken: break; 6247=> SyntaxFactory.XmlCrefAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, cref, endQuoteToken); 6253if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6256case SyntaxKind.SingleQuoteToken: 6257case SyntaxKind.DoubleQuoteToken: break; 6263case SyntaxKind.SingleQuoteToken: 6264case SyntaxKind.DoubleQuoteToken: break; 6272=> SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, identifier, endQuoteToken); 6276=> SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, SyntaxFactory.IdentifierName(identifier), endQuoteToken); 6291if (startCDataToken.Kind() != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 6292if (endCDataToken.Kind() != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 6298=> SyntaxFactory.XmlCDataSection(SyntaxFactory.Token(SyntaxKind.XmlCDataStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCDataEndToken)); 6303if (startProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 6305if (endProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 6311=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, textTokens, SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 6315=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 6320if (lessThanExclamationMinusMinusToken.Kind() != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 6321if (minusMinusGreaterThanToken.Kind() != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 6327=> SyntaxFactory.XmlComment(SyntaxFactory.Token(SyntaxKind.XmlCommentStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCommentEndToken)); 6332if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6333if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 6335if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6341=> SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.IfKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); 6346if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6347if (elifKeyword.Kind() != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 6349if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6355=> SyntaxFactory.ElifDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElifKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); 6360if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6361if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 6362if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6368=> SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElseKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken); 6373if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6374if (endIfKeyword.Kind() != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 6375if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6381=> SyntaxFactory.EndIfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndIfKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6386if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6387if (regionKeyword.Kind() != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 6388if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6394=> SyntaxFactory.RegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.RegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6399if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6400if (endRegionKeyword.Kind() != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 6401if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6407=> SyntaxFactory.EndRegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndRegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6412if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6413if (errorKeyword.Kind() != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 6414if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6420=> SyntaxFactory.ErrorDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ErrorKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6425if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6426if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 6427if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6433=> SyntaxFactory.WarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6438if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6439if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6445=> SyntaxFactory.BadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), identifier, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6450if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6451if (defineKeyword.Kind() != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 6452if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 6453if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6459=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6463=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6468if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6469if (undefKeyword.Kind() != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 6470if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 6471if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6477=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6481=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6486if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6487if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 6490case SyntaxKind.NumericLiteralToken: 6491case SyntaxKind.DefaultKeyword: 6492case SyntaxKind.HiddenKeyword: break; 6497case SyntaxKind.StringLiteralToken: 6498case SyntaxKind.None: break; 6501if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6507=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6511=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6516if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 6517if (line.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 6518if (commaToken.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 6519if (character.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 6520if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 6526=> SyntaxFactory.LineDirectivePosition(SyntaxFactory.Token(SyntaxKind.OpenParenToken), line, SyntaxFactory.Token(SyntaxKind.CommaToken), character, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 6531if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6532if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 6534if (minusToken.Kind() != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 6538case SyntaxKind.NumericLiteralToken: 6539case SyntaxKind.None: break; 6542if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6543if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6549=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, characterOffset, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6553=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, default, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6558if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6559if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 6560if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 6563case SyntaxKind.DisableKeyword: 6564case SyntaxKind.RestoreKeyword: break; 6567if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6573=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, errorCodes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6577=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6582if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6583if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 6584if (checksumKeyword.Kind() != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 6585if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6586if (guid.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 6587if (bytes.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 6588if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6594=> SyntaxFactory.PragmaChecksumDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.ChecksumKeyword), file, guid, bytes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6599if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6600if (referenceKeyword.Kind() != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 6601if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6602if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6608=> SyntaxFactory.ReferenceDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ReferenceKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6613if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6614if (loadKeyword.Kind() != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 6615if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6616if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6622=> SyntaxFactory.LoadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LoadKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6627if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6628if (exclamationToken.Kind() != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 6629if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6635=> SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6640if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6641if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 6644case SyntaxKind.StringLiteralToken: 6645case SyntaxKind.None: break; 6648if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6654=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), content, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6658=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6663if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6664if (nullableKeyword.Kind() != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 6667case SyntaxKind.EnableKeyword: 6668case SyntaxKind.DisableKeyword: 6669case SyntaxKind.RestoreKeyword: break; 6674case SyntaxKind.WarningsKeyword: 6675case SyntaxKind.AnnotationsKeyword: 6676case SyntaxKind.None: break; 6679if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6685=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, targetToken, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6689=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);
_generated\1\Syntax.xml.Internal.Generated.cs (3193)
17internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22internal NameSyntax(SyntaxKind kind) 31internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 36internal SimpleNameSyntax(SyntaxKind kind) 50internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 58internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) 67internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier) 117internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 129internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context) 142internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) 205internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 215internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context) 226internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) 285internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 300internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 316internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken) 383internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 395internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context) 408internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) 468internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 473internal TypeSyntax(SyntaxKind kind) 484internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 492internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context) 501internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword) 550internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 563internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context) 577internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers) 638internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 653internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 669internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken) 732internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 742internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context) 753internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken) 812internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 829internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context) 847internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) 919internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 934internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 950internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) 1016internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1029internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context) 1043internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) 1105internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1120internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 1136internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken) 1201internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1209internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context) 1218internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name) 1267internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1277internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context) 1288internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken) 1347internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1362internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context) 1378internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken) 1443internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1456internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context) 1470internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier) 1530internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1538internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context) 1547internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken) 1597internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1612internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) 1628internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) 1692internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1702internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, SyntaxFactoryContext context) 1713internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type) 1765internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1770internal ExpressionOrPatternSyntax(SyntaxKind kind) 1779internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1784internal ExpressionSyntax(SyntaxKind kind) 1797internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1809internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 1822internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 1886internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1901internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 1917internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 1983internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1993internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context) 2004internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 2062internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2072internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 2083internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression) 2141internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2151internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context) 2162internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 2221internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2233internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) 2246internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 2310internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2322internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context) 2335internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) 2398internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2408internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) 2419internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name) 2476internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2484internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 2493internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) 2543internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2561internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context) 2580internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) 2648internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2656internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 2665internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) 2715internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2727internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) 2740internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2804internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2816internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) 2829internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2895internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2911internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context) 2928internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) 2998internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3003internal InstanceExpressionSyntax(SyntaxKind kind) 3014internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3022internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3031internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3079internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3087internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3096internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3144internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3152internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3161internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3209internal FieldExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3217internal FieldExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3226internal FieldExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3277internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3291internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3306internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3376internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3390internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3405internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3477internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3495internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3514internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) 3594internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3608internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3623internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3693internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3707internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3722internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3792internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3806internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3821internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3891internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3905internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3920internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3988internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3998internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 4009internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) 4067internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4077internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 4088internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) 4143internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4148internal BaseArgumentListSyntax(SyntaxKind kind) 4164internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4179internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 4195internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 4262internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4277internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 4293internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) 4360internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4378internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 4397internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) 4462internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4467internal BaseExpressionColonSyntax(SyntaxKind kind) 4482internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4492internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) 4503internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) 4559internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4569internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) 4580internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) 4638internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4648internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) 4659internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) 4718internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4732internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) 4747internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) 4812internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4817internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) 4846internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4871internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 4897internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) 4981internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4986internal LambdaExpressionSyntax(SyntaxKind kind) 5007internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5037internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 5068internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 5161internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5171internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 5182internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) 5243internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5278internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 5314internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 5416internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5431internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 5447internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) 5509internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5514internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) 5536internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5551internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 5567internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) 5635internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5655internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 5676internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) 5750internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5762internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 5775internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) 5835internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5848internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) 5862internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) 5925internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5942internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 5960internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) 6032internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6047internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 6063internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) 6132internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6151internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 6171internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) 6248internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6263internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 6279internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) 6347internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6361internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 6376internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) 6444internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6459internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 6475internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) 6535internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6540internal CollectionElementSyntax(SyntaxKind kind) 6550internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6558internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) 6567internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) 6614internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6624internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) 6635internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) 6690internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6700internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 6711internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList) 6763internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6768internal QueryClauseSyntax(SyntaxKind kind) 6776internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6781internal SelectOrGroupClauseSyntax(SyntaxKind kind) 6792internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6802internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) 6813internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) 6869internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6887internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) 6906internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) 6974internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6993internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 7013internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) 7086internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7100internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) 7115internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) 7187internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7219internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, SyntaxFactoryContext context) 7252internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) 7346internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7356internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) 7367internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) 7423internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7433internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) 7444internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) 7499internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7512internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) 7526internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) 7584internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7597internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) 7611internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 7669internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7679internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 7690internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) 7747internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7761internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) 7776internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) 7840internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7852internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) 7865internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) 7925internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7933internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) 7942internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) 7991internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8006internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) 8022internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) 8089internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8101internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) 8114internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) 8175internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8185internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 8196internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) 8251internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8261internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) 8272internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) 8324internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8329internal PatternSyntax(SyntaxKind kind) 8339internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8347internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) 8356internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) 8403internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8413internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) 8424internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) 8479internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8489internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) 8500internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) 8557internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8583internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) 8610internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) 8686internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8701internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) 8717internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) 8780internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8795internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 8811internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) 8873internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8886internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) 8900internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) 8957internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8965internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) 8974internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) 9023internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9035internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) 9048internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) 9107internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9117internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) 9128internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) 9183internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9191internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 9200internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) 9249internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9261internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) 9274internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 9333internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9343internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) 9354internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) 9411internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9431internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) 9452internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) 9521internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9534internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) 9548internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) 9603internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9608internal InterpolatedStringContentSyntax(SyntaxKind kind) 9618internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9626internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) 9635internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) 9686internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9708internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 9731internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) 9808internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9818internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) 9829internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) 9884internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9894internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) 9905internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) 9963internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9981internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) 10000internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) 10063internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10068internal StatementSyntax(SyntaxKind kind) 10083internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10103internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 10124internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) 10201internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10248internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 10296internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 10410internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10440internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 10471internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 10555internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10568internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) 10582internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) 10641internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10659internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) 10678internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) 10744internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10754internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) 10765internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) 10817internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10822internal VariableDesignationSyntax(SyntaxKind kind) 10832internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10840internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) 10849internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) 10895internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10903internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) 10912internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) 10960internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10975internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) 10991internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) 11054internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11069internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11085internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) 11147internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11160internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11174internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) 11235internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11252internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) 11270internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) 11344internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11369internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11395internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11484internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11499internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11515internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) 11578internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11593internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11609internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) 11673internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11693internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11714internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11785internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11805internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11826internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11898internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11920internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11943internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 12020internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12041internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12063internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) 12143internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12168internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) 12194internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) 12285internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12328internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12372internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement) 12475internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12480internal CommonForEachStatementSyntax(SyntaxKind kind) 12513internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12545internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12578internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 12679internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12709internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12740internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 12841internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12875internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12910internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 13005internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13026internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13048internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) 13123internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13138internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) 13154internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) 13217internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13232internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) 13248internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) 13314internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13335internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13357internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 13439internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13465internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) 13492internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) 13592internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13602internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) 13613internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) 13678internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13712internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 13747internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) 13860internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13876internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) 13893internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) 13958internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13963internal SwitchLabelSyntax(SyntaxKind kind) 13987internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14004internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) 14022internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) 14094internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14106internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) 14119internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) 14183internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14193internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) 14204internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) 14263internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14282internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 14302internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) 14374internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14391internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) 14409internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) 14478internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14503internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) 14529internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) 14607internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14627internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) 14648internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) 14719internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14736internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) 14754internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) 14822internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14836internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 14851internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) 14914internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14924internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) 14935internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) 14993internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15021internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) 15050internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) 15135internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15149internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) 15164internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) 15236internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15268internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) 15301internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) 15386internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15391internal MemberDeclarationSyntax(SyntaxKind kind) 15405internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15410internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) 15439internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15483internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 15528internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) 15640internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15677internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) 15715internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) 15812internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15832internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 15853internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) 15927internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15937internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) 15948internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) 16006internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16020internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) 16035internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) 16097internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16112internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 16128internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 16195internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16213internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) 16232internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) 16299internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16309internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) 16320internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) 16378internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16393internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 16409internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) 16476internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16494internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) 16513internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) 16578internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16583internal BaseTypeDeclarationSyntax(SyntaxKind kind) 16607internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16612internal TypeDeclarationSyntax(SyntaxKind kind) 16647internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16707internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 16768internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 16905internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16965internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 17026internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 17163internal UnionDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 17223internal UnionDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 17284internal UnionDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 17421internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 17481internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 17542internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 17679internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 17744internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 17810internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 17950internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 17995internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 18041internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 18156internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18192internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) 18229internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) 18332internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18355internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) 18379internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) 18461internal ExtensionBlockDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18514internal ExtensionBlockDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 18568internal ExtensionBlockDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 18683internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18696internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) 18710internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) 18768internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18773internal BaseTypeSyntax(SyntaxKind kind) 18785internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18793internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 18802internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) 18849internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18859internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 18870internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) 18928internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18945internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) 18963internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) 19030internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19035internal TypeParameterConstraintSyntax(SyntaxKind kind) 19048internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19060internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) 19073internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) 19136internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19149internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) 19163internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 19223internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19231internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 19240internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) 19288internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19296internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) 19305internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) 19354internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19367internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints, SyntaxFactoryContext context) 19381internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints) 19438internal AllowsConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19443internal AllowsConstraintSyntax(SyntaxKind kind) 19455internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19465internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword, SyntaxFactoryContext context) 19476internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword) 19530internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19535internal BaseFieldDeclarationSyntax(SyntaxKind kind) 19552internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19572internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 19593internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 19665internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19687internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 19710internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 19783internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19793internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) 19804internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) 19857internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19862internal BaseMethodDeclarationSyntax(SyntaxKind kind) 19893internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19945internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 19998internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20127internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20176internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20226internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20353internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20402internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20452internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20576internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20616internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20657internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20758internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20770internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 20783internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 20851internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20888internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20926internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21021internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21026internal BasePropertyDeclarationSyntax(SyntaxKind kind) 21052internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21097internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21143internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) 21249internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21259internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) 21270internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) 21331internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21368internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21406internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) 21508internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21550internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21593internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21696internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21711internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 21727internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) 21793internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21826internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21860internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21950internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21955internal BaseParameterListSyntax(SyntaxKind kind) 21971internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21986internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) 22002internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) 22068internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22083internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 22099internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) 22161internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22166internal BaseParameterSyntax(SyntaxKind kind) 22189internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22220internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) 22252internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default) 22339internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22357internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) 22376internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) 22444internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22465internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) 22487internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) 22554internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22565internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) 22577internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) 22627internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22640internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) 22654internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) 22713internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22718internal CrefSyntax(SyntaxKind kind) 22735internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22743internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 22752internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) 22807internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22819internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) 22832internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) 22895internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22900internal MemberCrefSyntax(SyntaxKind kind) 22917internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22930internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 22944internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) 23005internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23024internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) 23044internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member) 23118internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23131internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) 23145internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) 23210internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23230internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 23251internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) 23328internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23350internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 23373internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) 23447internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23452internal BaseCrefParameterListSyntax(SyntaxKind kind) 23470internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23485internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) 23501internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) 23569internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23584internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 23600internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) 23671internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23689internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) 23708internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) 23770internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23775internal XmlNodeSyntax(SyntaxKind kind) 23787internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23802internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) 23818internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) 23882internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23899internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 23917internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) 23984internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23996internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 24009internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) 24070internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24087internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) 24105internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) 24171internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24184internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) 24198internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) 24256internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24266internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) 24277internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) 24329internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24334internal XmlAttributeSyntax(SyntaxKind kind) 24356internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24375internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24395internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) 24468internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24484internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24501internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) 24571internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24587internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24604internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) 24670internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24681internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) 24693internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) 24744internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24759internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) 24775internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) 24839internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24856internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) 24874internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) 24941internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24956internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) 24972internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) 25031internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25037internal DirectiveTriviaSyntax(SyntaxKind kind) 25052internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25057internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) 25067internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25072internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) 25092internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25109internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) 25127internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) 25201internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25218internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) 25236internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) 25308internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25322internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) 25337internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) 25402internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25415internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25429internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25492internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25505internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25519internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25582internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25595internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25609internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25672internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25685internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25699internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25762internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25775internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25789internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25852internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25865internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25879internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) 25943internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25958internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25974internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) 26042internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26057internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26073internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) 26135internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26140internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) 26159internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26179internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26200internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) 26275internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26291internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) 26308internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) 26382internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26408internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26435internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26524internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26546internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26569internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) 26651internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26672internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26694internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) 26774internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26789internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26805internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26873internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26888internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26904internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26971internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26984internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26998internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) 27062internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 27080internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 27099internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive) 27171internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 27191internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 27212internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) 28549case SyntaxKind.IdentifierToken: 28550case SyntaxKind.GlobalKeyword: break; 28556var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); 28559var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); 28573if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 28578var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); 28581var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); 28594if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 28599var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); 28602var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); 28615if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 28617if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 28621var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); 28624var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); 28638if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 28643var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); 28646var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); 28661case SyntaxKind.BoolKeyword: 28662case SyntaxKind.ByteKeyword: 28663case SyntaxKind.SByteKeyword: 28664case SyntaxKind.IntKeyword: 28665case SyntaxKind.UIntKeyword: 28666case SyntaxKind.ShortKeyword: 28667case SyntaxKind.UShortKeyword: 28668case SyntaxKind.LongKeyword: 28669case SyntaxKind.ULongKeyword: 28670case SyntaxKind.FloatKeyword: 28671case SyntaxKind.DoubleKeyword: 28672case SyntaxKind.DecimalKeyword: 28673case SyntaxKind.StringKeyword: 28674case SyntaxKind.CharKeyword: 28675case SyntaxKind.ObjectKeyword: 28676case SyntaxKind.VoidKeyword: break; 28682var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); 28685var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); 28701var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); 28704var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); 28717if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 28719if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 28723var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); 28726var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); 28740if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 28744var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); 28747var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); 28760if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 28762if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 28766return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); 28773if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 28775if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 28779var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); 28782var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); 28797case SyntaxKind.ManagedKeyword: 28798case SyntaxKind.UnmanagedKeyword: break; 28804var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); 28807var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); 28820if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 28822if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 28826var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); 28829var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); 28842if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 28846var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); 28849var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); 28863if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 28867var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); 28870var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); 28883if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 28885if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 28889var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); 28892var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); 28909case SyntaxKind.IdentifierToken: 28910case SyntaxKind.None: break; 28917var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); 28920var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); 28933if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 28937var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); 28940var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); 28953if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 28958case SyntaxKind.ReadOnlyKeyword: 28959case SyntaxKind.None: break; 28967var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); 28970var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); 28983if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 28988var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); 28991var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); 29004if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29007if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29011var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); 29014var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); 29027if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29029if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29033var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 29036var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); 29045public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 29049case SyntaxKind.UnaryPlusExpression: 29050case SyntaxKind.UnaryMinusExpression: 29051case SyntaxKind.BitwiseNotExpression: 29052case SyntaxKind.LogicalNotExpression: 29053case SyntaxKind.PreIncrementExpression: 29054case SyntaxKind.PreDecrementExpression: 29055case SyntaxKind.AddressOfExpression: 29056case SyntaxKind.PointerIndirectionExpression: 29057case SyntaxKind.IndexExpression: break; 29064case SyntaxKind.PlusToken: 29065case SyntaxKind.MinusToken: 29066case SyntaxKind.TildeToken: 29067case SyntaxKind.ExclamationToken: 29068case SyntaxKind.PlusPlusToken: 29069case SyntaxKind.MinusMinusToken: 29070case SyntaxKind.AmpersandToken: 29071case SyntaxKind.AsteriskToken: 29072case SyntaxKind.CaretToken: break; 29095if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 29100var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); 29103var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); 29112public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 29116case SyntaxKind.PostIncrementExpression: 29117case SyntaxKind.PostDecrementExpression: 29118case SyntaxKind.SuppressNullableWarningExpression: break; 29126case SyntaxKind.PlusPlusToken: 29127case SyntaxKind.MinusMinusToken: 29128case SyntaxKind.ExclamationToken: break; 29146public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 29150case SyntaxKind.SimpleMemberAccessExpression: 29151case SyntaxKind.PointerMemberAccessExpression: break; 29159case SyntaxKind.DotToken: 29160case SyntaxKind.MinusGreaterThanToken: break; 29184if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 29189var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); 29192var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); 29205if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 29210var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); 29213var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); 29229var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); 29232var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); 29245if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 29249var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); 29252var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); 29268var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); 29271var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); 29280public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 29284case SyntaxKind.AddExpression: 29285case SyntaxKind.SubtractExpression: 29286case SyntaxKind.MultiplyExpression: 29287case SyntaxKind.DivideExpression: 29288case SyntaxKind.ModuloExpression: 29289case SyntaxKind.LeftShiftExpression: 29290case SyntaxKind.RightShiftExpression: 29291case SyntaxKind.UnsignedRightShiftExpression: 29292case SyntaxKind.LogicalOrExpression: 29293case SyntaxKind.LogicalAndExpression: 29294case SyntaxKind.BitwiseOrExpression: 29295case SyntaxKind.BitwiseAndExpression: 29296case SyntaxKind.ExclusiveOrExpression: 29297case SyntaxKind.EqualsExpression: 29298case SyntaxKind.NotEqualsExpression: 29299case SyntaxKind.LessThanExpression: 29300case SyntaxKind.LessThanOrEqualExpression: 29301case SyntaxKind.GreaterThanExpression: 29302case SyntaxKind.GreaterThanOrEqualExpression: 29303case SyntaxKind.IsExpression: 29304case SyntaxKind.AsExpression: 29305case SyntaxKind.CoalesceExpression: break; 29313case SyntaxKind.PlusToken: 29314case SyntaxKind.MinusToken: 29315case SyntaxKind.AsteriskToken: 29316case SyntaxKind.SlashToken: 29317case SyntaxKind.PercentToken: 29318case SyntaxKind.LessThanLessThanToken: 29319case SyntaxKind.GreaterThanGreaterThanToken: 29320case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 29321case SyntaxKind.BarBarToken: 29322case SyntaxKind.AmpersandAmpersandToken: 29323case SyntaxKind.BarToken: 29324case SyntaxKind.AmpersandToken: 29325case SyntaxKind.CaretToken: 29326case SyntaxKind.EqualsEqualsToken: 29327case SyntaxKind.ExclamationEqualsToken: 29328case SyntaxKind.LessThanToken: 29329case SyntaxKind.LessThanEqualsToken: 29330case SyntaxKind.GreaterThanToken: 29331case SyntaxKind.GreaterThanEqualsToken: 29332case SyntaxKind.IsKeyword: 29333case SyntaxKind.AsKeyword: 29334case SyntaxKind.QuestionQuestionToken: break; 29353public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 29357case SyntaxKind.SimpleAssignmentExpression: 29358case SyntaxKind.AddAssignmentExpression: 29359case SyntaxKind.SubtractAssignmentExpression: 29360case SyntaxKind.MultiplyAssignmentExpression: 29361case SyntaxKind.DivideAssignmentExpression: 29362case SyntaxKind.ModuloAssignmentExpression: 29363case SyntaxKind.AndAssignmentExpression: 29364case SyntaxKind.ExclusiveOrAssignmentExpression: 29365case SyntaxKind.OrAssignmentExpression: 29366case SyntaxKind.LeftShiftAssignmentExpression: 29367case SyntaxKind.RightShiftAssignmentExpression: 29368case SyntaxKind.UnsignedRightShiftAssignmentExpression: 29369case SyntaxKind.CoalesceAssignmentExpression: break; 29377case SyntaxKind.EqualsToken: 29378case SyntaxKind.PlusEqualsToken: 29379case SyntaxKind.MinusEqualsToken: 29380case SyntaxKind.AsteriskEqualsToken: 29381case SyntaxKind.SlashEqualsToken: 29382case SyntaxKind.PercentEqualsToken: 29383case SyntaxKind.AmpersandEqualsToken: 29384case SyntaxKind.CaretEqualsToken: 29385case SyntaxKind.BarEqualsToken: 29386case SyntaxKind.LessThanLessThanEqualsToken: 29387case SyntaxKind.GreaterThanGreaterThanEqualsToken: 29388case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 29389case SyntaxKind.QuestionQuestionEqualsToken: break; 29413if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 29416if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 29420return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); 29427if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 29431var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); 29434var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); 29447if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 29451var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); 29454var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); 29463public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 29467case SyntaxKind.ArgListExpression: 29468case SyntaxKind.NumericLiteralExpression: 29469case SyntaxKind.StringLiteralExpression: 29470case SyntaxKind.Utf8StringLiteralExpression: 29471case SyntaxKind.CharacterLiteralExpression: 29472case SyntaxKind.TrueLiteralExpression: 29473case SyntaxKind.FalseLiteralExpression: 29474case SyntaxKind.NullLiteralExpression: 29475case SyntaxKind.DefaultLiteralExpression: break; 29482case SyntaxKind.ArgListKeyword: 29483case SyntaxKind.NumericLiteralToken: 29484case SyntaxKind.StringLiteralToken: 29485case SyntaxKind.Utf8StringLiteralToken: 29486case SyntaxKind.MultiLineRawStringLiteralToken: 29487case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 29488case SyntaxKind.SingleLineRawStringLiteralToken: 29489case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 29490case SyntaxKind.CharacterLiteralToken: 29491case SyntaxKind.TrueKeyword: 29492case SyntaxKind.FalseKeyword: 29493case SyntaxKind.NullKeyword: 29494case SyntaxKind.DefaultKeyword: break; 29516if (token.Kind != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 29520var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FieldExpression, token, this.context, out hash); 29523var result = new FieldExpressionSyntax(SyntaxKind.FieldExpression, token, this.context); 29536if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 29538if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29541if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29544return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29551if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 29553if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29556if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29559return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29566if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 29568if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29571if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 29574if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29577return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); 29580public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 29584case SyntaxKind.CheckedExpression: 29585case SyntaxKind.UncheckedExpression: break; 29592case SyntaxKind.CheckedKeyword: 29593case SyntaxKind.UncheckedKeyword: break; 29597if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29600if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29610if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 29612if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29615if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29618return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); 29625if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 29627if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29630if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29633return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); 29640if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 29642if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29645if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29648return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); 29659var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); 29662var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); 29679var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); 29682var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); 29695if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29697if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29701var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 29704var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); 29717if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 29719if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 29723var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); 29726var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); 29742case SyntaxKind.RefKeyword: 29743case SyntaxKind.OutKeyword: 29744case SyntaxKind.InKeyword: 29745case SyntaxKind.None: break; 29753var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); 29756var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); 29773var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); 29776var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); 29793var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); 29796var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); 29813var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); 29816var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); 29829if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29832if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29836return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); 29843if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 29847return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); 29855if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 29858return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); 29865if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 29870var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); 29873var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); 29887if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 29890return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); 29893public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 29897case SyntaxKind.ObjectInitializerExpression: 29898case SyntaxKind.CollectionInitializerExpression: 29899case SyntaxKind.ArrayInitializerExpression: 29900case SyntaxKind.ComplexElementInitializerExpression: 29901case SyntaxKind.WithInitializerExpression: break; 29906if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 29908if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 29928if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29933var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); 29936var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); 29949if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29953return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); 29961if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 29966var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); 29969var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); 29985var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); 29988var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); 30001if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30003if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30005if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30008return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); 30015if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30020var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); 30023var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); 30036if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30038if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30040if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30044return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); 30051if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 30056var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); 30059var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); 30072if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 30074if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30076if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30080return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); 30087if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30089if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30093var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); 30096var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); 30112var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); 30115var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); 30128if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 30133var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); 30136var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); 30149if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 30154var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithElement, withKeyword, argumentList, this.context, out hash); 30157var result = new WithElementSyntax(SyntaxKind.WithElement, withKeyword, argumentList, this.context); 30174var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); 30177var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); 30193var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); 30196var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); 30209if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 30211if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30213if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 30217return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); 30224if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 30226if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30228if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 30232return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); 30239if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 30241if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30243if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 30246if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 30249if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 30253return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); 30260if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 30262if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30266var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); 30269var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); 30282if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 30287var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); 30290var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); 30303if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 30307var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); 30310var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); 30319public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 30323case SyntaxKind.AscendingOrdering: 30324case SyntaxKind.DescendingOrdering: break; 30333case SyntaxKind.AscendingKeyword: 30334case SyntaxKind.DescendingKeyword: 30335case SyntaxKind.None: break; 30358if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 30363var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); 30366var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); 30379if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 30382if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 30386return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); 30393if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 30395if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30400var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); 30403var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); 30416if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 30420var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); 30423var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); 30438case SyntaxKind.InterpolatedStringStartToken: 30439case SyntaxKind.InterpolatedVerbatimStringStartToken: 30440case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 30441case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 30447case SyntaxKind.InterpolatedStringEndToken: 30448case SyntaxKind.InterpolatedRawStringEndToken: break; 30454var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); 30457var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); 30471if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 30476var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); 30479var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); 30492if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 30497var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); 30500var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); 30513if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 30518var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); 30521var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); 30534if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 30538var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); 30541var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); 30558var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); 30561var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); 30574if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 30579var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); 30582var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); 30596return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); 30603if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30605if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30609var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); 30612var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); 30625if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30627if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30631var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); 30634var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); 30650var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); 30653var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); 30669var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); 30672var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); 30685if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30688if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30692var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); 30695var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); 30710case SyntaxKind.EqualsEqualsToken: 30711case SyntaxKind.ExclamationEqualsToken: 30712case SyntaxKind.LessThanToken: 30713case SyntaxKind.LessThanEqualsToken: 30714case SyntaxKind.GreaterThanToken: 30715case SyntaxKind.GreaterThanEqualsToken: break; 30722var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); 30725var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); 30741var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); 30744var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); 30753public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 30757case SyntaxKind.OrPattern: 30758case SyntaxKind.AndPattern: break; 30766case SyntaxKind.OrKeyword: 30767case SyntaxKind.AndKeyword: break; 30790if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 30795var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); 30798var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); 30811if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30813if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30816return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); 30823if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 30827var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); 30830var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); 30843if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 30847var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); 30850var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); 30863if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30866if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30869return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); 30880var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); 30883var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); 30897if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 30901var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); 30904var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); 30920var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); 30923var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); 30936if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30938if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30941return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); 30949if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30955case SyntaxKind.SemicolonToken: 30956case SyntaxKind.None: break; 30962return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); 30972case SyntaxKind.AwaitKeyword: 30973case SyntaxKind.None: break; 30981case SyntaxKind.UsingKeyword: 30982case SyntaxKind.None: break; 30988if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30991return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); 31001var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); 31004var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); 31017if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31021var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); 31024var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); 31037if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 31042var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); 31045var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); 31058if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31062var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); 31065var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); 31078if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 31082var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); 31085var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); 31098if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31100if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31104var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); 31107var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); 31121if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31125var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); 31128var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); 31141if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31145var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); 31148var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); 31161if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31163if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 31167return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); 31170public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 31174case SyntaxKind.GotoStatement: 31175case SyntaxKind.GotoCaseStatement: 31176case SyntaxKind.GotoDefaultStatement: break; 31181if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 31186case SyntaxKind.CaseKeyword: 31187case SyntaxKind.DefaultKeyword: 31188case SyntaxKind.None: break; 31193if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31203if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 31205if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31209var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash); 31212var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context); 31225if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 31227if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31231var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash); 31234var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context); 31247if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 31249if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31252return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); 31259if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 31261if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31264return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); 31267public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 31271case SyntaxKind.YieldReturnStatement: 31272case SyntaxKind.YieldBreakStatement: break; 31277if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 31281case SyntaxKind.ReturnKeyword: 31282case SyntaxKind.BreakKeyword: break; 31286if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31296if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 31298if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31301if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31305return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); 31312if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 31315if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 31317if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31320if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31322if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31325return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); 31332if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 31334if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31336if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 31338if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 31340if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31344return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); 31354case SyntaxKind.AwaitKeyword: 31355case SyntaxKind.None: break; 31360if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 31362if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31365if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31367if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 31370if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31374return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); 31384case SyntaxKind.AwaitKeyword: 31385case SyntaxKind.None: break; 31390if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 31392if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31395if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 31398if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31402return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); 31412case SyntaxKind.AwaitKeyword: 31413case SyntaxKind.None: break; 31418if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 31420if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31422if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31426return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); 31433if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 31435if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31438if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31442return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); 31445public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 31449case SyntaxKind.CheckedStatement: 31450case SyntaxKind.UncheckedStatement: break; 31457case SyntaxKind.CheckedKeyword: 31458case SyntaxKind.UncheckedKeyword: break; 31481if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 31486var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); 31489var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); 31502if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 31504if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31507if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31511return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); 31518if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 31520if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31523if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31527return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); 31534if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 31539var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); 31542var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); 31555if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 31560case SyntaxKind.OpenParenToken: 31561case SyntaxKind.None: break; 31570case SyntaxKind.CloseParenToken: 31571case SyntaxKind.None: break; 31576if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31578if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31581return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); 31590var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); 31593var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); 31606if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 31611return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); 31618if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 31624var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); 31627var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); 31640if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 31645var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); 31648var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); 31662if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 31664if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31666if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31669return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); 31677if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 31681return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); 31688if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 31692return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); 31699if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 31703return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); 31710if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31716case SyntaxKind.IdentifierToken: 31717case SyntaxKind.None: break; 31722if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31725return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); 31732if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 31734if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31737if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31740return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); 31747if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 31752var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); 31755var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); 31768if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 31771return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); 31778if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 31780if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 31782if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31784if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31787return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); 31797case SyntaxKind.GlobalKeyword: 31798case SyntaxKind.None: break; 31803if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 31808case SyntaxKind.StaticKeyword: 31809case SyntaxKind.None: break; 31817case SyntaxKind.UnsafeKeyword: 31818case SyntaxKind.None: break; 31824if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31827return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); 31834if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 31837if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31839if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31844case SyntaxKind.SemicolonToken: 31845case SyntaxKind.None: break; 31851return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); 31858if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 31861if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31864return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); 31871if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 31873if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 31876return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); 31884if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 31888var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); 31891var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); 31906return new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); 31913if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31915if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31919var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 31922var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); 31938var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); 31941var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); 31955if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 31959var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); 31962var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); 31975if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 31977if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 31981var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); 31984var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); 32000case SyntaxKind.InKeyword: 32001case SyntaxKind.OutKeyword: 32002case SyntaxKind.None: break; 32007if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32011var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); 32014var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); 32027if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 32029if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32034case SyntaxKind.OpenBraceToken: 32035case SyntaxKind.None: break; 32043case SyntaxKind.CloseBraceToken: 32044case SyntaxKind.None: break; 32052case SyntaxKind.SemicolonToken: 32053case SyntaxKind.None: break; 32059return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32066if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); 32068if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32073case SyntaxKind.OpenBraceToken: 32074case SyntaxKind.None: break; 32082case SyntaxKind.CloseBraceToken: 32083case SyntaxKind.None: break; 32091case SyntaxKind.SemicolonToken: 32092case SyntaxKind.None: break; 32098return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32105if (keyword.Kind != SyntaxKind.UnionKeyword) throw new ArgumentException(nameof(keyword)); 32107if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32112case SyntaxKind.OpenBraceToken: 32113case SyntaxKind.None: break; 32121case SyntaxKind.CloseBraceToken: 32122case SyntaxKind.None: break; 32130case SyntaxKind.SemicolonToken: 32131case SyntaxKind.None: break; 32137return new UnionDeclarationSyntax(SyntaxKind.UnionDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32144if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 32146if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32151case SyntaxKind.OpenBraceToken: 32152case SyntaxKind.None: break; 32160case SyntaxKind.CloseBraceToken: 32161case SyntaxKind.None: break; 32169case SyntaxKind.SemicolonToken: 32170case SyntaxKind.None: break; 32176return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32179public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 32183case SyntaxKind.RecordDeclaration: 32184case SyntaxKind.RecordStructDeclaration: break; 32193case SyntaxKind.ClassKeyword: 32194case SyntaxKind.StructKeyword: 32195case SyntaxKind.None: break; 32200if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32205case SyntaxKind.OpenBraceToken: 32206case SyntaxKind.None: break; 32214case SyntaxKind.CloseBraceToken: 32215case SyntaxKind.None: break; 32223case SyntaxKind.SemicolonToken: 32224case SyntaxKind.None: break; 32237if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 32239if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32244case SyntaxKind.OpenBraceToken: 32245case SyntaxKind.None: break; 32253case SyntaxKind.CloseBraceToken: 32254case SyntaxKind.None: break; 32262case SyntaxKind.SemicolonToken: 32263case SyntaxKind.None: break; 32269return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32276if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 32279if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32282if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32285return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); 32292if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32295return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); 32302if (keyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 32307case SyntaxKind.OpenBraceToken: 32308case SyntaxKind.None: break; 32316case SyntaxKind.CloseBraceToken: 32317case SyntaxKind.None: break; 32325case SyntaxKind.SemicolonToken: 32326case SyntaxKind.None: break; 32332return new ExtensionBlockDeclarationSyntax(SyntaxKind.ExtensionBlockDeclaration, attributeLists.Node, modifiers.Node, keyword, typeParameterList, parameterList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32339if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32343var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); 32346var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); 32362var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); 32365var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); 32382var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); 32385var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); 32398if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 32401if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32404return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); 32411if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 32413if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32415if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32419var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); 32422var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); 32431public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 32435case SyntaxKind.ClassConstraint: 32436case SyntaxKind.StructConstraint: break; 32443case SyntaxKind.ClassKeyword: 32444case SyntaxKind.StructKeyword: break; 32451case SyntaxKind.QuestionToken: 32452case SyntaxKind.None: break; 32478var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); 32481var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); 32494if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 32498var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); 32501var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); 32514if (allowsKeyword.Kind != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 32518var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, this.context, out hash); 32521var result = new AllowsConstraintClauseSyntax(SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, this.context); 32534if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 32536if (structKeyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 32540var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefStructConstraint, refKeyword, structKeyword, this.context, out hash); 32543var result = new RefStructConstraintSyntax(SyntaxKind.RefStructConstraint, refKeyword, structKeyword, this.context); 32557if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32560return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); 32567if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 32570if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32573return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); 32581if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 32585var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); 32588var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); 32602if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32608case SyntaxKind.SemicolonToken: 32609case SyntaxKind.None: break; 32615return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); 32623if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32628case SyntaxKind.CheckedKeyword: 32629case SyntaxKind.None: break; 32636case SyntaxKind.PlusToken: 32637case SyntaxKind.MinusToken: 32638case SyntaxKind.ExclamationToken: 32639case SyntaxKind.TildeToken: 32640case SyntaxKind.PlusPlusToken: 32641case SyntaxKind.MinusMinusToken: 32642case SyntaxKind.AsteriskToken: 32643case SyntaxKind.SlashToken: 32644case SyntaxKind.PercentToken: 32645case SyntaxKind.LessThanLessThanToken: 32646case SyntaxKind.GreaterThanGreaterThanToken: 32647case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 32648case SyntaxKind.BarToken: 32649case SyntaxKind.AmpersandToken: 32650case SyntaxKind.CaretToken: 32651case SyntaxKind.EqualsEqualsToken: 32652case SyntaxKind.ExclamationEqualsToken: 32653case SyntaxKind.LessThanToken: 32654case SyntaxKind.LessThanEqualsToken: 32655case SyntaxKind.GreaterThanToken: 32656case SyntaxKind.GreaterThanEqualsToken: 32657case SyntaxKind.FalseKeyword: 32658case SyntaxKind.TrueKeyword: 32659case SyntaxKind.IsKeyword: 32660case SyntaxKind.PlusEqualsToken: 32661case SyntaxKind.MinusEqualsToken: 32662case SyntaxKind.AsteriskEqualsToken: 32663case SyntaxKind.SlashEqualsToken: 32664case SyntaxKind.PercentEqualsToken: 32665case SyntaxKind.AmpersandEqualsToken: 32666case SyntaxKind.BarEqualsToken: 32667case SyntaxKind.CaretEqualsToken: 32668case SyntaxKind.LessThanLessThanEqualsToken: 32669case SyntaxKind.GreaterThanGreaterThanEqualsToken: 32670case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 32678case SyntaxKind.SemicolonToken: 32679case SyntaxKind.None: break; 32685return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); 32694case SyntaxKind.ImplicitKeyword: 32695case SyntaxKind.ExplicitKeyword: break; 32699if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32704case SyntaxKind.CheckedKeyword: 32705case SyntaxKind.None: break; 32715case SyntaxKind.SemicolonToken: 32716case SyntaxKind.None: break; 32722return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); 32729if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32735case SyntaxKind.SemicolonToken: 32736case SyntaxKind.None: break; 32742return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); 32745public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 32749case SyntaxKind.BaseConstructorInitializer: 32750case SyntaxKind.ThisConstructorInitializer: break; 32755if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32759case SyntaxKind.BaseKeyword: 32760case SyntaxKind.ThisKeyword: break; 32783if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 32785if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32791case SyntaxKind.SemicolonToken: 32792case SyntaxKind.None: break; 32798return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); 32806if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32811case SyntaxKind.SemicolonToken: 32812case SyntaxKind.None: break; 32818return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); 32825if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 32830var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); 32833var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); 32846if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 32849if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32854case SyntaxKind.SemicolonToken: 32855case SyntaxKind.None: break; 32861return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); 32869if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 32875case SyntaxKind.SemicolonToken: 32876case SyntaxKind.None: break; 32882return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); 32889if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 32891if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 32895var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); 32898var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); 32907public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 32911case SyntaxKind.GetAccessorDeclaration: 32912case SyntaxKind.SetAccessorDeclaration: 32913case SyntaxKind.InitAccessorDeclaration: 32914case SyntaxKind.AddAccessorDeclaration: 32915case SyntaxKind.RemoveAccessorDeclaration: 32916case SyntaxKind.UnknownAccessorDeclaration: break; 32923case SyntaxKind.GetKeyword: 32924case SyntaxKind.SetKeyword: 32925case SyntaxKind.InitKeyword: 32926case SyntaxKind.AddKeyword: 32927case SyntaxKind.RemoveKeyword: 32928case SyntaxKind.IdentifierToken: break; 32935case SyntaxKind.SemicolonToken: 32936case SyntaxKind.None: break; 32949if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32951if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32955var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); 32958var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); 32971if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 32973if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 32977var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); 32980var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); 32996case SyntaxKind.IdentifierToken: 32997case SyntaxKind.ArgListKeyword: 32998case SyntaxKind.None: break; 33004return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); 33014var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); 33017var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); 33031return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); 33039return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); 33042public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 33046case SyntaxKind.SingleLineDocumentationCommentTrivia: 33047case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 33052if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 33065var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); 33068var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); 33082if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 33087var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); 33090var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); 33106var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); 33109var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); 33122if (extensionKeyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 33125if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 33129return new ExtensionMemberCrefSyntax(SyntaxKind.ExtensionMemberCref, extensionKeyword, typeArgumentList, parameters, dotToken, member, this.context); 33136if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 33140var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); 33143var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); 33156if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 33161case SyntaxKind.CheckedKeyword: 33162case SyntaxKind.None: break; 33169case SyntaxKind.PlusToken: 33170case SyntaxKind.MinusToken: 33171case SyntaxKind.ExclamationToken: 33172case SyntaxKind.TildeToken: 33173case SyntaxKind.PlusPlusToken: 33174case SyntaxKind.MinusMinusToken: 33175case SyntaxKind.AsteriskToken: 33176case SyntaxKind.SlashToken: 33177case SyntaxKind.PercentToken: 33178case SyntaxKind.LessThanLessThanToken: 33179case SyntaxKind.GreaterThanGreaterThanToken: 33180case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 33181case SyntaxKind.BarToken: 33182case SyntaxKind.AmpersandToken: 33183case SyntaxKind.CaretToken: 33184case SyntaxKind.EqualsEqualsToken: 33185case SyntaxKind.ExclamationEqualsToken: 33186case SyntaxKind.LessThanToken: 33187case SyntaxKind.LessThanEqualsToken: 33188case SyntaxKind.GreaterThanToken: 33189case SyntaxKind.GreaterThanEqualsToken: 33190case SyntaxKind.FalseKeyword: 33191case SyntaxKind.TrueKeyword: 33192case SyntaxKind.PlusEqualsToken: 33193case SyntaxKind.MinusEqualsToken: 33194case SyntaxKind.AsteriskEqualsToken: 33195case SyntaxKind.SlashEqualsToken: 33196case SyntaxKind.PercentEqualsToken: 33197case SyntaxKind.AmpersandEqualsToken: 33198case SyntaxKind.BarEqualsToken: 33199case SyntaxKind.CaretEqualsToken: 33200case SyntaxKind.LessThanLessThanEqualsToken: 33201case SyntaxKind.GreaterThanGreaterThanEqualsToken: 33202case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 33207return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); 33216case SyntaxKind.ImplicitKeyword: 33217case SyntaxKind.ExplicitKeyword: break; 33221if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 33226case SyntaxKind.CheckedKeyword: 33227case SyntaxKind.None: break; 33234return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); 33241if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 33243if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 33247var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); 33250var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); 33263if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 33265if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 33269var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); 33272var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); 33288case SyntaxKind.RefKeyword: 33289case SyntaxKind.OutKeyword: 33290case SyntaxKind.InKeyword: 33291case SyntaxKind.None: break; 33299case SyntaxKind.ReadOnlyKeyword: 33300case SyntaxKind.None: break; 33308var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); 33311var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); 33328var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); 33331var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); 33344if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33347if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33350return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); 33357if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 33360if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33364var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); 33367var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); 33380if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33383if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 33386return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); 33393if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 33397var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); 33400var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); 33413if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 33415if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 33419var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); 33422var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); 33436if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33440case SyntaxKind.SingleQuoteToken: 33441case SyntaxKind.DoubleQuoteToken: break; 33447case SyntaxKind.SingleQuoteToken: 33448case SyntaxKind.DoubleQuoteToken: break; 33453return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); 33461if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33465case SyntaxKind.SingleQuoteToken: 33466case SyntaxKind.DoubleQuoteToken: break; 33473case SyntaxKind.SingleQuoteToken: 33474case SyntaxKind.DoubleQuoteToken: break; 33479return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); 33487if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33491case SyntaxKind.SingleQuoteToken: 33492case SyntaxKind.DoubleQuoteToken: break; 33499case SyntaxKind.SingleQuoteToken: 33500case SyntaxKind.DoubleQuoteToken: break; 33505return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); 33514var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); 33517var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); 33530if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 33532if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 33536var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); 33539var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); 33552if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 33555if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 33558return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); 33565if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 33567if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 33571var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); 33574var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); 33587if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33589if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 33592if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33595return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); 33602if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33604if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 33607if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33610return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); 33617if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33619if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 33621if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33624return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); 33631if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33633if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 33635if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33638return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); 33645if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33647if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 33649if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33652return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); 33659if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33661if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 33663if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33666return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); 33673if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33675if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 33677if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33680return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); 33687if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33689if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 33691if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33694return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); 33701if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33704if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33707return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); 33714if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33716if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 33718if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33720if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33723return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); 33730if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33732if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 33734if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33736if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33739return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); 33746if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33748if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 33752case SyntaxKind.NumericLiteralToken: 33753case SyntaxKind.DefaultKeyword: 33754case SyntaxKind.HiddenKeyword: break; 33761case SyntaxKind.StringLiteralToken: 33762case SyntaxKind.None: break; 33767if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33770return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); 33777if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 33779if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 33781if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 33783if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 33785if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 33788return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); 33795if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33797if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 33800if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 33806case SyntaxKind.NumericLiteralToken: 33807case SyntaxKind.None: break; 33812if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33814if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33817return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); 33824if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33826if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 33828if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 33832case SyntaxKind.DisableKeyword: 33833case SyntaxKind.RestoreKeyword: break; 33837if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33840return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); 33847if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33849if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 33851if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 33853if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33855if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 33857if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 33859if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33862return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); 33869if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33871if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 33873if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33875if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33878return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); 33885if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33887if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 33889if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33891if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33894return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); 33901if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33903if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 33905if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33908return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); 33915if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33917if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 33922case SyntaxKind.StringLiteralToken: 33923case SyntaxKind.None: break; 33928if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33931return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive, this.context); 33938if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33940if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 33944case SyntaxKind.EnableKeyword: 33945case SyntaxKind.DisableKeyword: 33946case SyntaxKind.RestoreKeyword: break; 33953case SyntaxKind.WarningsKeyword: 33954case SyntaxKind.AnnotationsKeyword: 33955case SyntaxKind.None: break; 33960if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33963return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); 33976case SyntaxKind.IdentifierToken: 33977case SyntaxKind.GlobalKeyword: break; 33983var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); 33986var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); 34000if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 34005var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); 34008var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); 34021if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 34026var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); 34029var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); 34042if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 34044if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 34048var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); 34051var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); 34065if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 34070var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); 34073var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); 34088case SyntaxKind.BoolKeyword: 34089case SyntaxKind.ByteKeyword: 34090case SyntaxKind.SByteKeyword: 34091case SyntaxKind.IntKeyword: 34092case SyntaxKind.UIntKeyword: 34093case SyntaxKind.ShortKeyword: 34094case SyntaxKind.UShortKeyword: 34095case SyntaxKind.LongKeyword: 34096case SyntaxKind.ULongKeyword: 34097case SyntaxKind.FloatKeyword: 34098case SyntaxKind.DoubleKeyword: 34099case SyntaxKind.DecimalKeyword: 34100case SyntaxKind.StringKeyword: 34101case SyntaxKind.CharKeyword: 34102case SyntaxKind.ObjectKeyword: 34103case SyntaxKind.VoidKeyword: break; 34109var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); 34112var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); 34128var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); 34131var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); 34144if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 34146if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 34150var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); 34153var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); 34167if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 34171var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); 34174var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); 34187if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 34189if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 34193return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); 34200if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 34202if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 34206var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); 34209var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); 34224case SyntaxKind.ManagedKeyword: 34225case SyntaxKind.UnmanagedKeyword: break; 34231var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); 34234var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); 34247if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 34249if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 34253var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); 34256var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); 34269if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 34273var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); 34276var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); 34290if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 34294var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); 34297var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); 34310if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34312if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34316var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); 34319var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); 34336case SyntaxKind.IdentifierToken: 34337case SyntaxKind.None: break; 34344var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); 34347var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); 34360if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 34364var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); 34367var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); 34380if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 34385case SyntaxKind.ReadOnlyKeyword: 34386case SyntaxKind.None: break; 34394var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); 34397var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); 34410if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 34415var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); 34418var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); 34431if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34434if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34438var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); 34441var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); 34454if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34456if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34460var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); 34463var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); 34472public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 34476case SyntaxKind.UnaryPlusExpression: 34477case SyntaxKind.UnaryMinusExpression: 34478case SyntaxKind.BitwiseNotExpression: 34479case SyntaxKind.LogicalNotExpression: 34480case SyntaxKind.PreIncrementExpression: 34481case SyntaxKind.PreDecrementExpression: 34482case SyntaxKind.AddressOfExpression: 34483case SyntaxKind.PointerIndirectionExpression: 34484case SyntaxKind.IndexExpression: break; 34491case SyntaxKind.PlusToken: 34492case SyntaxKind.MinusToken: 34493case SyntaxKind.TildeToken: 34494case SyntaxKind.ExclamationToken: 34495case SyntaxKind.PlusPlusToken: 34496case SyntaxKind.MinusMinusToken: 34497case SyntaxKind.AmpersandToken: 34498case SyntaxKind.AsteriskToken: 34499case SyntaxKind.CaretToken: break; 34522if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 34527var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); 34530var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); 34539public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 34543case SyntaxKind.PostIncrementExpression: 34544case SyntaxKind.PostDecrementExpression: 34545case SyntaxKind.SuppressNullableWarningExpression: break; 34553case SyntaxKind.PlusPlusToken: 34554case SyntaxKind.MinusMinusToken: 34555case SyntaxKind.ExclamationToken: break; 34573public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 34577case SyntaxKind.SimpleMemberAccessExpression: 34578case SyntaxKind.PointerMemberAccessExpression: break; 34586case SyntaxKind.DotToken: 34587case SyntaxKind.MinusGreaterThanToken: break; 34611if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 34616var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); 34619var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); 34632if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 34637var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); 34640var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); 34656var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); 34659var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); 34672if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 34676var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); 34679var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); 34695var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); 34698var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); 34707public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 34711case SyntaxKind.AddExpression: 34712case SyntaxKind.SubtractExpression: 34713case SyntaxKind.MultiplyExpression: 34714case SyntaxKind.DivideExpression: 34715case SyntaxKind.ModuloExpression: 34716case SyntaxKind.LeftShiftExpression: 34717case SyntaxKind.RightShiftExpression: 34718case SyntaxKind.UnsignedRightShiftExpression: 34719case SyntaxKind.LogicalOrExpression: 34720case SyntaxKind.LogicalAndExpression: 34721case SyntaxKind.BitwiseOrExpression: 34722case SyntaxKind.BitwiseAndExpression: 34723case SyntaxKind.ExclusiveOrExpression: 34724case SyntaxKind.EqualsExpression: 34725case SyntaxKind.NotEqualsExpression: 34726case SyntaxKind.LessThanExpression: 34727case SyntaxKind.LessThanOrEqualExpression: 34728case SyntaxKind.GreaterThanExpression: 34729case SyntaxKind.GreaterThanOrEqualExpression: 34730case SyntaxKind.IsExpression: 34731case SyntaxKind.AsExpression: 34732case SyntaxKind.CoalesceExpression: break; 34740case SyntaxKind.PlusToken: 34741case SyntaxKind.MinusToken: 34742case SyntaxKind.AsteriskToken: 34743case SyntaxKind.SlashToken: 34744case SyntaxKind.PercentToken: 34745case SyntaxKind.LessThanLessThanToken: 34746case SyntaxKind.GreaterThanGreaterThanToken: 34747case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 34748case SyntaxKind.BarBarToken: 34749case SyntaxKind.AmpersandAmpersandToken: 34750case SyntaxKind.BarToken: 34751case SyntaxKind.AmpersandToken: 34752case SyntaxKind.CaretToken: 34753case SyntaxKind.EqualsEqualsToken: 34754case SyntaxKind.ExclamationEqualsToken: 34755case SyntaxKind.LessThanToken: 34756case SyntaxKind.LessThanEqualsToken: 34757case SyntaxKind.GreaterThanToken: 34758case SyntaxKind.GreaterThanEqualsToken: 34759case SyntaxKind.IsKeyword: 34760case SyntaxKind.AsKeyword: 34761case SyntaxKind.QuestionQuestionToken: break; 34780public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 34784case SyntaxKind.SimpleAssignmentExpression: 34785case SyntaxKind.AddAssignmentExpression: 34786case SyntaxKind.SubtractAssignmentExpression: 34787case SyntaxKind.MultiplyAssignmentExpression: 34788case SyntaxKind.DivideAssignmentExpression: 34789case SyntaxKind.ModuloAssignmentExpression: 34790case SyntaxKind.AndAssignmentExpression: 34791case SyntaxKind.ExclusiveOrAssignmentExpression: 34792case SyntaxKind.OrAssignmentExpression: 34793case SyntaxKind.LeftShiftAssignmentExpression: 34794case SyntaxKind.RightShiftAssignmentExpression: 34795case SyntaxKind.UnsignedRightShiftAssignmentExpression: 34796case SyntaxKind.CoalesceAssignmentExpression: break; 34804case SyntaxKind.EqualsToken: 34805case SyntaxKind.PlusEqualsToken: 34806case SyntaxKind.MinusEqualsToken: 34807case SyntaxKind.AsteriskEqualsToken: 34808case SyntaxKind.SlashEqualsToken: 34809case SyntaxKind.PercentEqualsToken: 34810case SyntaxKind.AmpersandEqualsToken: 34811case SyntaxKind.CaretEqualsToken: 34812case SyntaxKind.BarEqualsToken: 34813case SyntaxKind.LessThanLessThanEqualsToken: 34814case SyntaxKind.GreaterThanGreaterThanEqualsToken: 34815case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 34816case SyntaxKind.QuestionQuestionEqualsToken: break; 34840if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 34843if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 34847return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); 34854if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 34858var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); 34861var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); 34874if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 34878var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); 34881var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); 34890public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 34894case SyntaxKind.ArgListExpression: 34895case SyntaxKind.NumericLiteralExpression: 34896case SyntaxKind.StringLiteralExpression: 34897case SyntaxKind.Utf8StringLiteralExpression: 34898case SyntaxKind.CharacterLiteralExpression: 34899case SyntaxKind.TrueLiteralExpression: 34900case SyntaxKind.FalseLiteralExpression: 34901case SyntaxKind.NullLiteralExpression: 34902case SyntaxKind.DefaultLiteralExpression: break; 34909case SyntaxKind.ArgListKeyword: 34910case SyntaxKind.NumericLiteralToken: 34911case SyntaxKind.StringLiteralToken: 34912case SyntaxKind.Utf8StringLiteralToken: 34913case SyntaxKind.MultiLineRawStringLiteralToken: 34914case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 34915case SyntaxKind.SingleLineRawStringLiteralToken: 34916case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 34917case SyntaxKind.CharacterLiteralToken: 34918case SyntaxKind.TrueKeyword: 34919case SyntaxKind.FalseKeyword: 34920case SyntaxKind.NullKeyword: 34921case SyntaxKind.DefaultKeyword: break; 34943if (token.Kind != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 34947var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FieldExpression, token, out hash); 34950var result = new FieldExpressionSyntax(SyntaxKind.FieldExpression, token); 34963if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 34965if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34968if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34971return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); 34978if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 34980if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34983if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34986return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); 34993if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 34995if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34998if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 35001if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35004return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); 35007public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 35011case SyntaxKind.CheckedExpression: 35012case SyntaxKind.UncheckedExpression: break; 35019case SyntaxKind.CheckedKeyword: 35020case SyntaxKind.UncheckedKeyword: break; 35024if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35027if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35037if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 35039if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35042if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35045return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); 35052if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 35054if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35057if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35060return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); 35067if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 35069if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35072if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35075return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); 35086var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); 35089var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); 35106var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); 35109var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); 35122if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35124if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35128var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); 35131var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); 35144if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35146if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35150var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); 35153var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); 35169case SyntaxKind.RefKeyword: 35170case SyntaxKind.OutKeyword: 35171case SyntaxKind.InKeyword: 35172case SyntaxKind.None: break; 35180var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); 35183var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); 35200var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); 35203var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); 35220var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); 35223var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); 35240var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); 35243var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); 35256if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35259if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35263return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); 35270if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 35274return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); 35282if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 35285return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); 35292if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 35297var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); 35300var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); 35314if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 35317return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); 35320public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 35324case SyntaxKind.ObjectInitializerExpression: 35325case SyntaxKind.CollectionInitializerExpression: 35326case SyntaxKind.ArrayInitializerExpression: 35327case SyntaxKind.ComplexElementInitializerExpression: 35328case SyntaxKind.WithInitializerExpression: break; 35333if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35335if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35355if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35360var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); 35363var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); 35376if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35380return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); 35388if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 35393var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); 35396var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); 35412var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); 35415var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); 35428if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35430if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35432if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35435return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); 35442if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35447var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); 35450var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); 35463if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35465if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35467if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35471return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); 35478if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 35483var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); 35486var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); 35499if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 35501if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35503if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35507return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); 35514if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35516if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35520var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); 35523var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); 35539var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); 35542var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); 35555if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 35560var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); 35563var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); 35576if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 35581var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithElement, withKeyword, argumentList, out hash); 35584var result = new WithElementSyntax(SyntaxKind.WithElement, withKeyword, argumentList); 35601var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); 35604var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); 35620var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); 35623var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); 35636if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 35638if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35640if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 35644return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); 35651if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 35653if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35655if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 35659return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); 35666if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 35668if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35670if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 35673if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 35676if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 35680return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); 35687if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 35689if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35693var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); 35696var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); 35709if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 35714var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); 35717var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); 35730if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 35734var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); 35737var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); 35746public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 35750case SyntaxKind.AscendingOrdering: 35751case SyntaxKind.DescendingOrdering: break; 35760case SyntaxKind.AscendingKeyword: 35761case SyntaxKind.DescendingKeyword: 35762case SyntaxKind.None: break; 35785if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 35790var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); 35793var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); 35806if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 35809if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 35813return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); 35820if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 35822if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35827var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); 35830var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); 35843if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 35847var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); 35850var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); 35865case SyntaxKind.InterpolatedStringStartToken: 35866case SyntaxKind.InterpolatedVerbatimStringStartToken: 35867case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 35868case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 35874case SyntaxKind.InterpolatedStringEndToken: 35875case SyntaxKind.InterpolatedRawStringEndToken: break; 35881var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); 35884var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); 35898if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 35903var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); 35906var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); 35919if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 35924var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); 35927var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); 35940if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 35945var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); 35948var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); 35961if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 35965var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); 35968var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); 35985var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); 35988var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); 36001if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 36006var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); 36009var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); 36023return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); 36030if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36032if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36036var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); 36039var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); 36052if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36054if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36058var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); 36061var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); 36077var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); 36080var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); 36096var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); 36099var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); 36112if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36115if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36119var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); 36122var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); 36137case SyntaxKind.EqualsEqualsToken: 36138case SyntaxKind.ExclamationEqualsToken: 36139case SyntaxKind.LessThanToken: 36140case SyntaxKind.LessThanEqualsToken: 36141case SyntaxKind.GreaterThanToken: 36142case SyntaxKind.GreaterThanEqualsToken: break; 36149var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); 36152var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); 36168var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); 36171var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); 36180public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 36184case SyntaxKind.OrPattern: 36185case SyntaxKind.AndPattern: break; 36193case SyntaxKind.OrKeyword: 36194case SyntaxKind.AndKeyword: break; 36217if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 36222var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); 36225var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); 36238if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 36240if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 36243return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); 36250if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 36254var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); 36257var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); 36270if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 36274var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); 36277var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); 36290if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36293if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36296return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); 36307var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); 36310var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); 36324if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 36328var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); 36331var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); 36347var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); 36350var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); 36363if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36365if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36368return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); 36376if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36382case SyntaxKind.SemicolonToken: 36383case SyntaxKind.None: break; 36389return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); 36399case SyntaxKind.AwaitKeyword: 36400case SyntaxKind.None: break; 36408case SyntaxKind.UsingKeyword: 36409case SyntaxKind.None: break; 36415if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36418return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); 36428var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); 36431var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); 36444if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36448var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); 36451var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); 36464if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 36469var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); 36472var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); 36485if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36489var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); 36492var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); 36505if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 36509var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); 36512var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); 36525if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36527if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36531var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); 36534var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); 36548if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36552var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); 36555var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); 36568if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36572var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); 36575var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); 36588if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36590if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 36594return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); 36597public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 36601case SyntaxKind.GotoStatement: 36602case SyntaxKind.GotoCaseStatement: 36603case SyntaxKind.GotoDefaultStatement: break; 36608if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 36613case SyntaxKind.CaseKeyword: 36614case SyntaxKind.DefaultKeyword: 36615case SyntaxKind.None: break; 36620if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36630if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 36632if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36636var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash); 36639var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken); 36652if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 36654if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36658var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash); 36661var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken); 36674if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 36676if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36679return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); 36686if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 36688if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36691return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); 36694public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 36698case SyntaxKind.YieldReturnStatement: 36699case SyntaxKind.YieldBreakStatement: break; 36704if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 36708case SyntaxKind.ReturnKeyword: 36709case SyntaxKind.BreakKeyword: break; 36713if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36723if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 36725if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36728if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36732return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); 36739if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 36742if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 36744if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36747if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36749if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36752return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); 36759if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 36761if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36763if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 36765if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 36767if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36771return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); 36781case SyntaxKind.AwaitKeyword: 36782case SyntaxKind.None: break; 36787if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 36789if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36792if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36794if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 36797if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36801return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); 36811case SyntaxKind.AwaitKeyword: 36812case SyntaxKind.None: break; 36817if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 36819if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36822if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 36825if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36829return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); 36839case SyntaxKind.AwaitKeyword: 36840case SyntaxKind.None: break; 36845if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 36847if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36849if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36853return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); 36860if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 36862if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36865if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36869return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); 36872public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 36876case SyntaxKind.CheckedStatement: 36877case SyntaxKind.UncheckedStatement: break; 36884case SyntaxKind.CheckedKeyword: 36885case SyntaxKind.UncheckedKeyword: break; 36908if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 36913var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); 36916var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); 36929if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 36931if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36934if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36938return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); 36945if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 36947if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36950if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36954return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); 36961if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 36966var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); 36969var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); 36982if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 36987case SyntaxKind.OpenParenToken: 36988case SyntaxKind.None: break; 36997case SyntaxKind.CloseParenToken: 36998case SyntaxKind.None: break; 37003if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37005if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 37008return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); 37017var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); 37020var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); 37033if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 37038return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); 37045if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 37051var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); 37054var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); 37067if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 37072var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); 37075var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); 37089if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 37091if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37093if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 37096return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); 37104if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 37108return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); 37115if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 37119return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); 37126if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 37130return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); 37137if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37143case SyntaxKind.IdentifierToken: 37144case SyntaxKind.None: break; 37149if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37152return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); 37159if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 37161if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37164if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37167return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); 37174if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 37179var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); 37182var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); 37195if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 37198return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); 37205if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 37207if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 37209if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37211if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37214return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); 37224case SyntaxKind.GlobalKeyword: 37225case SyntaxKind.None: break; 37230if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 37235case SyntaxKind.StaticKeyword: 37236case SyntaxKind.None: break; 37244case SyntaxKind.UnsafeKeyword: 37245case SyntaxKind.None: break; 37251if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37254return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); 37261if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 37264if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37266if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 37271case SyntaxKind.SemicolonToken: 37272case SyntaxKind.None: break; 37278return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); 37285if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 37288if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37291return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); 37298if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 37300if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 37303return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); 37311if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37315var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); 37318var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); 37333return new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); 37340if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37342if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37346var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); 37349var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); 37365var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); 37368var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); 37382if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 37386var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); 37389var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); 37402if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 37404if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 37408var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); 37411var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); 37427case SyntaxKind.InKeyword: 37428case SyntaxKind.OutKeyword: 37429case SyntaxKind.None: break; 37434if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37438var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); 37441var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); 37454if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 37456if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37461case SyntaxKind.OpenBraceToken: 37462case SyntaxKind.None: break; 37470case SyntaxKind.CloseBraceToken: 37471case SyntaxKind.None: break; 37479case SyntaxKind.SemicolonToken: 37480case SyntaxKind.None: break; 37486return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37493if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); 37495if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37500case SyntaxKind.OpenBraceToken: 37501case SyntaxKind.None: break; 37509case SyntaxKind.CloseBraceToken: 37510case SyntaxKind.None: break; 37518case SyntaxKind.SemicolonToken: 37519case SyntaxKind.None: break; 37525return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37532if (keyword.Kind != SyntaxKind.UnionKeyword) throw new ArgumentException(nameof(keyword)); 37534if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37539case SyntaxKind.OpenBraceToken: 37540case SyntaxKind.None: break; 37548case SyntaxKind.CloseBraceToken: 37549case SyntaxKind.None: break; 37557case SyntaxKind.SemicolonToken: 37558case SyntaxKind.None: break; 37564return new UnionDeclarationSyntax(SyntaxKind.UnionDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37571if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 37573if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37578case SyntaxKind.OpenBraceToken: 37579case SyntaxKind.None: break; 37587case SyntaxKind.CloseBraceToken: 37588case SyntaxKind.None: break; 37596case SyntaxKind.SemicolonToken: 37597case SyntaxKind.None: break; 37603return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37606public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 37610case SyntaxKind.RecordDeclaration: 37611case SyntaxKind.RecordStructDeclaration: break; 37620case SyntaxKind.ClassKeyword: 37621case SyntaxKind.StructKeyword: 37622case SyntaxKind.None: break; 37627if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37632case SyntaxKind.OpenBraceToken: 37633case SyntaxKind.None: break; 37641case SyntaxKind.CloseBraceToken: 37642case SyntaxKind.None: break; 37650case SyntaxKind.SemicolonToken: 37651case SyntaxKind.None: break; 37664if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 37666if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37671case SyntaxKind.OpenBraceToken: 37672case SyntaxKind.None: break; 37680case SyntaxKind.CloseBraceToken: 37681case SyntaxKind.None: break; 37689case SyntaxKind.SemicolonToken: 37690case SyntaxKind.None: break; 37696return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37703if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 37706if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37709if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37712return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); 37719if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37722return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); 37729if (keyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 37734case SyntaxKind.OpenBraceToken: 37735case SyntaxKind.None: break; 37743case SyntaxKind.CloseBraceToken: 37744case SyntaxKind.None: break; 37752case SyntaxKind.SemicolonToken: 37753case SyntaxKind.None: break; 37759return new ExtensionBlockDeclarationSyntax(SyntaxKind.ExtensionBlockDeclaration, attributeLists.Node, modifiers.Node, keyword, typeParameterList, parameterList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37766if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37770var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); 37773var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); 37789var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); 37792var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); 37809var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); 37812var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); 37825if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 37828if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37831return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); 37838if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 37840if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37842if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37846var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); 37849var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); 37858public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 37862case SyntaxKind.ClassConstraint: 37863case SyntaxKind.StructConstraint: break; 37870case SyntaxKind.ClassKeyword: 37871case SyntaxKind.StructKeyword: break; 37878case SyntaxKind.QuestionToken: 37879case SyntaxKind.None: break; 37905var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); 37908var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); 37921if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 37925var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); 37928var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); 37941if (allowsKeyword.Kind != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 37945var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, out hash); 37948var result = new AllowsConstraintClauseSyntax(SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node); 37961if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 37963if (structKeyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 37967var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefStructConstraint, refKeyword, structKeyword, out hash); 37970var result = new RefStructConstraintSyntax(SyntaxKind.RefStructConstraint, refKeyword, structKeyword); 37984if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37987return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); 37994if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 37997if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 38000return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); 38008if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38012var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); 38015var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); 38029if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38035case SyntaxKind.SemicolonToken: 38036case SyntaxKind.None: break; 38042return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); 38050if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38055case SyntaxKind.CheckedKeyword: 38056case SyntaxKind.None: break; 38063case SyntaxKind.PlusToken: 38064case SyntaxKind.MinusToken: 38065case SyntaxKind.ExclamationToken: 38066case SyntaxKind.TildeToken: 38067case SyntaxKind.PlusPlusToken: 38068case SyntaxKind.MinusMinusToken: 38069case SyntaxKind.AsteriskToken: 38070case SyntaxKind.SlashToken: 38071case SyntaxKind.PercentToken: 38072case SyntaxKind.LessThanLessThanToken: 38073case SyntaxKind.GreaterThanGreaterThanToken: 38074case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 38075case SyntaxKind.BarToken: 38076case SyntaxKind.AmpersandToken: 38077case SyntaxKind.CaretToken: 38078case SyntaxKind.EqualsEqualsToken: 38079case SyntaxKind.ExclamationEqualsToken: 38080case SyntaxKind.LessThanToken: 38081case SyntaxKind.LessThanEqualsToken: 38082case SyntaxKind.GreaterThanToken: 38083case SyntaxKind.GreaterThanEqualsToken: 38084case SyntaxKind.FalseKeyword: 38085case SyntaxKind.TrueKeyword: 38086case SyntaxKind.IsKeyword: 38087case SyntaxKind.PlusEqualsToken: 38088case SyntaxKind.MinusEqualsToken: 38089case SyntaxKind.AsteriskEqualsToken: 38090case SyntaxKind.SlashEqualsToken: 38091case SyntaxKind.PercentEqualsToken: 38092case SyntaxKind.AmpersandEqualsToken: 38093case SyntaxKind.BarEqualsToken: 38094case SyntaxKind.CaretEqualsToken: 38095case SyntaxKind.LessThanLessThanEqualsToken: 38096case SyntaxKind.GreaterThanGreaterThanEqualsToken: 38097case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 38105case SyntaxKind.SemicolonToken: 38106case SyntaxKind.None: break; 38112return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); 38121case SyntaxKind.ImplicitKeyword: 38122case SyntaxKind.ExplicitKeyword: break; 38126if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38131case SyntaxKind.CheckedKeyword: 38132case SyntaxKind.None: break; 38142case SyntaxKind.SemicolonToken: 38143case SyntaxKind.None: break; 38149return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); 38156if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38162case SyntaxKind.SemicolonToken: 38163case SyntaxKind.None: break; 38169return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); 38172public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 38176case SyntaxKind.BaseConstructorInitializer: 38177case SyntaxKind.ThisConstructorInitializer: break; 38182if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 38186case SyntaxKind.BaseKeyword: 38187case SyntaxKind.ThisKeyword: break; 38210if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 38212if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38218case SyntaxKind.SemicolonToken: 38219case SyntaxKind.None: break; 38225return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); 38233if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38238case SyntaxKind.SemicolonToken: 38239case SyntaxKind.None: break; 38245return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); 38252if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 38257var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); 38260var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); 38273if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 38276if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38281case SyntaxKind.SemicolonToken: 38282case SyntaxKind.None: break; 38288return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); 38296if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 38302case SyntaxKind.SemicolonToken: 38303case SyntaxKind.None: break; 38309return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); 38316if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 38318if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 38322var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); 38325var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); 38334public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 38338case SyntaxKind.GetAccessorDeclaration: 38339case SyntaxKind.SetAccessorDeclaration: 38340case SyntaxKind.InitAccessorDeclaration: 38341case SyntaxKind.AddAccessorDeclaration: 38342case SyntaxKind.RemoveAccessorDeclaration: 38343case SyntaxKind.UnknownAccessorDeclaration: break; 38350case SyntaxKind.GetKeyword: 38351case SyntaxKind.SetKeyword: 38352case SyntaxKind.InitKeyword: 38353case SyntaxKind.AddKeyword: 38354case SyntaxKind.RemoveKeyword: 38355case SyntaxKind.IdentifierToken: break; 38362case SyntaxKind.SemicolonToken: 38363case SyntaxKind.None: break; 38376if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38378if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38382var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); 38385var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); 38398if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 38400if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 38404var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); 38407var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); 38423case SyntaxKind.IdentifierToken: 38424case SyntaxKind.ArgListKeyword: 38425case SyntaxKind.None: break; 38431return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); 38441var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); 38444var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); 38458return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); 38466return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); 38469public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 38473case SyntaxKind.SingleLineDocumentationCommentTrivia: 38474case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 38479if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 38492var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); 38495var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); 38509if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38514var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); 38517var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); 38533var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); 38536var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); 38549if (extensionKeyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 38552if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38556return new ExtensionMemberCrefSyntax(SyntaxKind.ExtensionMemberCref, extensionKeyword, typeArgumentList, parameters, dotToken, member); 38563if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 38567var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); 38570var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); 38583if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38588case SyntaxKind.CheckedKeyword: 38589case SyntaxKind.None: break; 38596case SyntaxKind.PlusToken: 38597case SyntaxKind.MinusToken: 38598case SyntaxKind.ExclamationToken: 38599case SyntaxKind.TildeToken: 38600case SyntaxKind.PlusPlusToken: 38601case SyntaxKind.MinusMinusToken: 38602case SyntaxKind.AsteriskToken: 38603case SyntaxKind.SlashToken: 38604case SyntaxKind.PercentToken: 38605case SyntaxKind.LessThanLessThanToken: 38606case SyntaxKind.GreaterThanGreaterThanToken: 38607case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 38608case SyntaxKind.BarToken: 38609case SyntaxKind.AmpersandToken: 38610case SyntaxKind.CaretToken: 38611case SyntaxKind.EqualsEqualsToken: 38612case SyntaxKind.ExclamationEqualsToken: 38613case SyntaxKind.LessThanToken: 38614case SyntaxKind.LessThanEqualsToken: 38615case SyntaxKind.GreaterThanToken: 38616case SyntaxKind.GreaterThanEqualsToken: 38617case SyntaxKind.FalseKeyword: 38618case SyntaxKind.TrueKeyword: 38619case SyntaxKind.PlusEqualsToken: 38620case SyntaxKind.MinusEqualsToken: 38621case SyntaxKind.AsteriskEqualsToken: 38622case SyntaxKind.SlashEqualsToken: 38623case SyntaxKind.PercentEqualsToken: 38624case SyntaxKind.AmpersandEqualsToken: 38625case SyntaxKind.BarEqualsToken: 38626case SyntaxKind.CaretEqualsToken: 38627case SyntaxKind.LessThanLessThanEqualsToken: 38628case SyntaxKind.GreaterThanGreaterThanEqualsToken: 38629case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 38634return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); 38643case SyntaxKind.ImplicitKeyword: 38644case SyntaxKind.ExplicitKeyword: break; 38648if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38653case SyntaxKind.CheckedKeyword: 38654case SyntaxKind.None: break; 38661return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); 38668if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38670if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38674var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); 38677var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); 38690if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 38692if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 38696var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); 38699var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); 38715case SyntaxKind.RefKeyword: 38716case SyntaxKind.OutKeyword: 38717case SyntaxKind.InKeyword: 38718case SyntaxKind.None: break; 38726case SyntaxKind.ReadOnlyKeyword: 38727case SyntaxKind.None: break; 38735var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); 38738var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); 38755var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); 38758var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); 38771if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 38774if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 38777return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); 38784if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 38787if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 38791var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); 38794var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); 38807if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 38810if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 38813return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); 38820if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 38824var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); 38827var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); 38840if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 38842if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 38846var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); 38849var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); 38863if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38867case SyntaxKind.SingleQuoteToken: 38868case SyntaxKind.DoubleQuoteToken: break; 38874case SyntaxKind.SingleQuoteToken: 38875case SyntaxKind.DoubleQuoteToken: break; 38880return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); 38888if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38892case SyntaxKind.SingleQuoteToken: 38893case SyntaxKind.DoubleQuoteToken: break; 38900case SyntaxKind.SingleQuoteToken: 38901case SyntaxKind.DoubleQuoteToken: break; 38906return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); 38914if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38918case SyntaxKind.SingleQuoteToken: 38919case SyntaxKind.DoubleQuoteToken: break; 38926case SyntaxKind.SingleQuoteToken: 38927case SyntaxKind.DoubleQuoteToken: break; 38932return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); 38941var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); 38944var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); 38957if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 38959if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 38963var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); 38966var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); 38979if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 38982if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 38985return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); 38992if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 38994if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 38998var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); 39001var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); 39014if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39016if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 39019if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39022return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); 39029if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39031if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 39034if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39037return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); 39044if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39046if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 39048if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39051return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); 39058if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39060if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 39062if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39065return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); 39072if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39074if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 39076if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39079return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); 39086if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39088if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 39090if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39093return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); 39100if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39102if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 39104if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39107return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); 39114if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39116if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 39118if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39121return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); 39128if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39131if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39134return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); 39141if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39143if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 39145if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 39147if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39150return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); 39157if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39159if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 39161if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 39163if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39166return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); 39173if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39175if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 39179case SyntaxKind.NumericLiteralToken: 39180case SyntaxKind.DefaultKeyword: 39181case SyntaxKind.HiddenKeyword: break; 39188case SyntaxKind.StringLiteralToken: 39189case SyntaxKind.None: break; 39194if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39197return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); 39204if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 39206if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 39208if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 39210if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 39212if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 39215return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); 39222if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39224if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 39227if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 39233case SyntaxKind.NumericLiteralToken: 39234case SyntaxKind.None: break; 39239if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39241if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39244return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); 39251if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39253if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 39255if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 39259case SyntaxKind.DisableKeyword: 39260case SyntaxKind.RestoreKeyword: break; 39264if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39267return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); 39274if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39276if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 39278if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 39280if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39282if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 39284if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 39286if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39289return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); 39296if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39298if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 39300if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39302if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39305return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); 39312if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39314if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 39316if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39318if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39321return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); 39328if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39330if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 39332if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39335return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); 39342if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39344if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 39349case SyntaxKind.StringLiteralToken: 39350case SyntaxKind.None: break; 39355if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39358return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive); 39365if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39367if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 39371case SyntaxKind.EnableKeyword: 39372case SyntaxKind.DisableKeyword: 39373case SyntaxKind.RestoreKeyword: break; 39380case SyntaxKind.WarningsKeyword: 39381case SyntaxKind.AnnotationsKeyword: 39382case SyntaxKind.None: break; 39387if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39390return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
_generated\2\Syntax.xml.Syntax.Generated.cs (321)
41/// <item><description><see cref="SyntaxKind.IdentifierName"/></description></item> 82/// <item><description><see cref="SyntaxKind.QualifiedName"/></description></item> 144/// <item><description><see cref="SyntaxKind.GenericName"/></description></item> 192/// <item><description><see cref="SyntaxKind.TypeArgumentList"/></description></item> 250/// <item><description><see cref="SyntaxKind.AliasQualifiedName"/></description></item> 321/// <item><description><see cref="SyntaxKind.PredefinedType"/></description></item> 361/// <item><description><see cref="SyntaxKind.ArrayType"/></description></item> 420/// <item><description><see cref="SyntaxKind.ArrayRankSpecifier"/></description></item> 475/// <item><description><see cref="SyntaxKind.PointerType"/></description></item> 519/// <item><description><see cref="SyntaxKind.FunctionPointerType"/></description></item> 587/// <item><description><see cref="SyntaxKind.FunctionPointerParameterList"/></description></item> 645/// <item><description><see cref="SyntaxKind.FunctionPointerCallingConvention"/></description></item> 696/// <item><description><see cref="SyntaxKind.FunctionPointerUnmanagedCallingConventionList"/></description></item> 754/// <item><description><see cref="SyntaxKind.FunctionPointerUnmanagedCallingConvention"/></description></item> 794/// <item><description><see cref="SyntaxKind.NullableType"/></description></item> 839/// <item><description><see cref="SyntaxKind.TupleType"/></description></item> 896/// <item><description><see cref="SyntaxKind.TupleElement"/></description></item> 948/// <item><description><see cref="SyntaxKind.OmittedTypeArgument"/></description></item> 988/// <item><description><see cref="SyntaxKind.RefType"/></description></item> 1042/// <item><description><see cref="SyntaxKind.ScopedType"/></description></item> 1102/// <item><description><see cref="SyntaxKind.ParenthesizedExpression"/></description></item> 1151/// <item><description><see cref="SyntaxKind.TupleExpression"/></description></item> 1209/// <item><description><see cref="SyntaxKind.UnaryPlusExpression"/></description></item> 1210/// <item><description><see cref="SyntaxKind.UnaryMinusExpression"/></description></item> 1211/// <item><description><see cref="SyntaxKind.BitwiseNotExpression"/></description></item> 1212/// <item><description><see cref="SyntaxKind.LogicalNotExpression"/></description></item> 1213/// <item><description><see cref="SyntaxKind.PreIncrementExpression"/></description></item> 1214/// <item><description><see cref="SyntaxKind.PreDecrementExpression"/></description></item> 1215/// <item><description><see cref="SyntaxKind.AddressOfExpression"/></description></item> 1216/// <item><description><see cref="SyntaxKind.PointerIndirectionExpression"/></description></item> 1217/// <item><description><see cref="SyntaxKind.IndexExpression"/></description></item> 1262/// <item><description><see cref="SyntaxKind.AwaitExpression"/></description></item> 1307/// <item><description><see cref="SyntaxKind.PostIncrementExpression"/></description></item> 1308/// <item><description><see cref="SyntaxKind.PostDecrementExpression"/></description></item> 1309/// <item><description><see cref="SyntaxKind.SuppressNullableWarningExpression"/></description></item> 1354/// <item><description><see cref="SyntaxKind.SimpleMemberAccessExpression"/></description></item> 1355/// <item><description><see cref="SyntaxKind.PointerMemberAccessExpression"/></description></item> 1417/// <item><description><see cref="SyntaxKind.ConditionalAccessExpression"/></description></item> 1479/// <item><description><see cref="SyntaxKind.MemberBindingExpression"/></description></item> 1524/// <item><description><see cref="SyntaxKind.ElementBindingExpression"/></description></item> 1567/// <item><description><see cref="SyntaxKind.RangeExpression"/></description></item> 1629/// <item><description><see cref="SyntaxKind.ImplicitElementAccess"/></description></item> 1672/// <item><description><see cref="SyntaxKind.AddExpression"/></description></item> 1673/// <item><description><see cref="SyntaxKind.SubtractExpression"/></description></item> 1674/// <item><description><see cref="SyntaxKind.MultiplyExpression"/></description></item> 1675/// <item><description><see cref="SyntaxKind.DivideExpression"/></description></item> 1676/// <item><description><see cref="SyntaxKind.ModuloExpression"/></description></item> 1677/// <item><description><see cref="SyntaxKind.LeftShiftExpression"/></description></item> 1678/// <item><description><see cref="SyntaxKind.RightShiftExpression"/></description></item> 1679/// <item><description><see cref="SyntaxKind.UnsignedRightShiftExpression"/></description></item> 1680/// <item><description><see cref="SyntaxKind.LogicalOrExpression"/></description></item> 1681/// <item><description><see cref="SyntaxKind.LogicalAndExpression"/></description></item> 1682/// <item><description><see cref="SyntaxKind.BitwiseOrExpression"/></description></item> 1683/// <item><description><see cref="SyntaxKind.BitwiseAndExpression"/></description></item> 1684/// <item><description><see cref="SyntaxKind.ExclusiveOrExpression"/></description></item> 1685/// <item><description><see cref="SyntaxKind.EqualsExpression"/></description></item> 1686/// <item><description><see cref="SyntaxKind.NotEqualsExpression"/></description></item> 1687/// <item><description><see cref="SyntaxKind.LessThanExpression"/></description></item> 1688/// <item><description><see cref="SyntaxKind.LessThanOrEqualExpression"/></description></item> 1689/// <item><description><see cref="SyntaxKind.GreaterThanExpression"/></description></item> 1690/// <item><description><see cref="SyntaxKind.GreaterThanOrEqualExpression"/></description></item> 1691/// <item><description><see cref="SyntaxKind.IsExpression"/></description></item> 1692/// <item><description><see cref="SyntaxKind.AsExpression"/></description></item> 1693/// <item><description><see cref="SyntaxKind.CoalesceExpression"/></description></item> 1755/// <item><description><see cref="SyntaxKind.SimpleAssignmentExpression"/></description></item> 1756/// <item><description><see cref="SyntaxKind.AddAssignmentExpression"/></description></item> 1757/// <item><description><see cref="SyntaxKind.SubtractAssignmentExpression"/></description></item> 1758/// <item><description><see cref="SyntaxKind.MultiplyAssignmentExpression"/></description></item> 1759/// <item><description><see cref="SyntaxKind.DivideAssignmentExpression"/></description></item> 1760/// <item><description><see cref="SyntaxKind.ModuloAssignmentExpression"/></description></item> 1761/// <item><description><see cref="SyntaxKind.AndAssignmentExpression"/></description></item> 1762/// <item><description><see cref="SyntaxKind.ExclusiveOrAssignmentExpression"/></description></item> 1763/// <item><description><see cref="SyntaxKind.OrAssignmentExpression"/></description></item> 1764/// <item><description><see cref="SyntaxKind.LeftShiftAssignmentExpression"/></description></item> 1765/// <item><description><see cref="SyntaxKind.RightShiftAssignmentExpression"/></description></item> 1766/// <item><description><see cref="SyntaxKind.UnsignedRightShiftAssignmentExpression"/></description></item> 1767/// <item><description><see cref="SyntaxKind.CoalesceAssignmentExpression"/></description></item> 1829/// <item><description><see cref="SyntaxKind.ConditionalExpression"/></description></item> 1911/// <item><description><see cref="SyntaxKind.ThisExpression"/></description></item> 1951/// <item><description><see cref="SyntaxKind.BaseExpression"/></description></item> 1991/// <item><description><see cref="SyntaxKind.ArgListExpression"/></description></item> 1992/// <item><description><see cref="SyntaxKind.NumericLiteralExpression"/></description></item> 1993/// <item><description><see cref="SyntaxKind.StringLiteralExpression"/></description></item> 1994/// <item><description><see cref="SyntaxKind.Utf8StringLiteralExpression"/></description></item> 1995/// <item><description><see cref="SyntaxKind.CharacterLiteralExpression"/></description></item> 1996/// <item><description><see cref="SyntaxKind.TrueLiteralExpression"/></description></item> 1997/// <item><description><see cref="SyntaxKind.FalseLiteralExpression"/></description></item> 1998/// <item><description><see cref="SyntaxKind.NullLiteralExpression"/></description></item> 1999/// <item><description><see cref="SyntaxKind.DefaultLiteralExpression"/></description></item> 2039/// <item><description><see cref="SyntaxKind.FieldExpression"/></description></item> 2079/// <item><description><see cref="SyntaxKind.MakeRefExpression"/></description></item> 2132/// <item><description><see cref="SyntaxKind.RefTypeExpression"/></description></item> 2185/// <item><description><see cref="SyntaxKind.RefValueExpression"/></description></item> 2259/// <item><description><see cref="SyntaxKind.CheckedExpression"/></description></item> 2260/// <item><description><see cref="SyntaxKind.UncheckedExpression"/></description></item> 2313/// <item><description><see cref="SyntaxKind.DefaultExpression"/></description></item> 2366/// <item><description><see cref="SyntaxKind.TypeOfExpression"/></description></item> 2419/// <item><description><see cref="SyntaxKind.SizeOfExpression"/></description></item> 2472/// <item><description><see cref="SyntaxKind.InvocationExpression"/></description></item> 2532/// <item><description><see cref="SyntaxKind.ElementAccessExpression"/></description></item> 2609/// <item><description><see cref="SyntaxKind.ArgumentList"/></description></item> 2669/// <item><description><see cref="SyntaxKind.BracketedArgumentList"/></description></item> 2729/// <item><description><see cref="SyntaxKind.Argument"/></description></item> 2813/// <item><description><see cref="SyntaxKind.ExpressionColon"/></description></item> 2858/// <item><description><see cref="SyntaxKind.NameColon"/></description></item> 2904/// <item><description><see cref="SyntaxKind.DeclarationExpression"/></description></item> 2961/// <item><description><see cref="SyntaxKind.CastExpression"/></description></item> 3065/// <item><description><see cref="SyntaxKind.AnonymousMethodExpression"/></description></item> 3196/// <item><description><see cref="SyntaxKind.SimpleLambdaExpression"/></description></item> 3310/// <item><description><see cref="SyntaxKind.RefExpression"/></description></item> 3353/// <item><description><see cref="SyntaxKind.ParenthesizedLambdaExpression"/></description></item> 3473/// <item><description><see cref="SyntaxKind.ObjectInitializerExpression"/></description></item> 3474/// <item><description><see cref="SyntaxKind.CollectionInitializerExpression"/></description></item> 3475/// <item><description><see cref="SyntaxKind.ArrayInitializerExpression"/></description></item> 3476/// <item><description><see cref="SyntaxKind.ComplexElementInitializerExpression"/></description></item> 3477/// <item><description><see cref="SyntaxKind.WithInitializerExpression"/></description></item> 3561/// <item><description><see cref="SyntaxKind.ImplicitObjectCreationExpression"/></description></item> 3629/// <item><description><see cref="SyntaxKind.ObjectCreationExpression"/></description></item> 3707/// <item><description><see cref="SyntaxKind.WithExpression"/></description></item> 3768/// <item><description><see cref="SyntaxKind.AnonymousObjectMemberDeclarator"/></description></item> 3826/// <item><description><see cref="SyntaxKind.AnonymousObjectCreationExpression"/></description></item> 3888/// <item><description><see cref="SyntaxKind.ArrayCreationExpression"/></description></item> 3952/// <item><description><see cref="SyntaxKind.ImplicitArrayCreationExpression"/></description></item> 4019/// <item><description><see cref="SyntaxKind.StackAllocArrayCreationExpression"/></description></item> 4081/// <item><description><see cref="SyntaxKind.ImplicitStackAllocArrayCreationExpression"/></description></item> 4135/// <item><description><see cref="SyntaxKind.CollectionExpression"/></description></item> 4198/// <item><description><see cref="SyntaxKind.ExpressionElement"/></description></item> 4237/// <item><description><see cref="SyntaxKind.SpreadElement"/></description></item> 4279/// <item><description><see cref="SyntaxKind.WithElement"/></description></item> 4341/// <item><description><see cref="SyntaxKind.QueryExpression"/></description></item> 4398/// <item><description><see cref="SyntaxKind.QueryBody"/></description></item> 4461/// <item><description><see cref="SyntaxKind.FromClause"/></description></item> 4526/// <item><description><see cref="SyntaxKind.LetClause"/></description></item> 4575/// <item><description><see cref="SyntaxKind.JoinClause"/></description></item> 4664/// <item><description><see cref="SyntaxKind.JoinIntoClause"/></description></item> 4706/// <item><description><see cref="SyntaxKind.WhereClause"/></description></item> 4748/// <item><description><see cref="SyntaxKind.OrderByClause"/></description></item> 4799/// <item><description><see cref="SyntaxKind.AscendingOrdering"/></description></item> 4800/// <item><description><see cref="SyntaxKind.DescendingOrdering"/></description></item> 4849/// <item><description><see cref="SyntaxKind.SelectClause"/></description></item> 4891/// <item><description><see cref="SyntaxKind.GroupClause"/></description></item> 4952/// <item><description><see cref="SyntaxKind.QueryContinuation"/></description></item> 5001/// <item><description><see cref="SyntaxKind.OmittedArraySizeExpression"/></description></item> 5040/// <item><description><see cref="SyntaxKind.InterpolatedStringExpression"/></description></item> 5091/// <item><description><see cref="SyntaxKind.IsPatternExpression"/></description></item> 5151/// <item><description><see cref="SyntaxKind.ThrowExpression"/></description></item> 5193/// <item><description><see cref="SyntaxKind.WhenClause"/></description></item> 5243/// <item><description><see cref="SyntaxKind.DiscardPattern"/></description></item> 5281/// <item><description><see cref="SyntaxKind.DeclarationPattern"/></description></item> 5336/// <item><description><see cref="SyntaxKind.VarPattern"/></description></item> 5378/// <item><description><see cref="SyntaxKind.RecursivePattern"/></description></item> 5456/// <item><description><see cref="SyntaxKind.PositionalPatternClause"/></description></item> 5510/// <item><description><see cref="SyntaxKind.PropertyPatternClause"/></description></item> 5564/// <item><description><see cref="SyntaxKind.Subpattern"/></description></item> 5619/// <item><description><see cref="SyntaxKind.ConstantPattern"/></description></item> 5659/// <item><description><see cref="SyntaxKind.ParenthesizedPattern"/></description></item> 5704/// <item><description><see cref="SyntaxKind.RelationalPattern"/></description></item> 5747/// <item><description><see cref="SyntaxKind.TypePattern"/></description></item> 5787/// <item><description><see cref="SyntaxKind.OrPattern"/></description></item> 5788/// <item><description><see cref="SyntaxKind.AndPattern"/></description></item> 5846/// <item><description><see cref="SyntaxKind.NotPattern"/></description></item> 5888/// <item><description><see cref="SyntaxKind.ListPattern"/></description></item> 5958/// <item><description><see cref="SyntaxKind.SlicePattern"/></description></item> 6008/// <item><description><see cref="SyntaxKind.InterpolatedStringText"/></description></item> 6047/// <item><description><see cref="SyntaxKind.Interpolation"/></description></item> 6118/// <item><description><see cref="SyntaxKind.InterpolationAlignmentClause"/></description></item> 6160/// <item><description><see cref="SyntaxKind.InterpolationFormatClause"/></description></item> 6203/// <item><description><see cref="SyntaxKind.GlobalStatement"/></description></item> 6291/// <item><description><see cref="SyntaxKind.Block"/></description></item> 6357/// <item><description><see cref="SyntaxKind.LocalFunctionStatement"/></description></item> 6489/// <item><description><see cref="SyntaxKind.LocalDeclarationStatement"/></description></item> 6584/// <item><description><see cref="SyntaxKind.VariableDeclaration"/></description></item> 6648/// <item><description><see cref="SyntaxKind.VariableDeclarator"/></description></item> 6713/// <item><description><see cref="SyntaxKind.EqualsValueClause"/></description></item> 6763/// <item><description><see cref="SyntaxKind.SingleVariableDesignation"/></description></item> 6801/// <item><description><see cref="SyntaxKind.DiscardDesignation"/></description></item> 6839/// <item><description><see cref="SyntaxKind.ParenthesizedVariableDesignation"/></description></item> 6893/// <item><description><see cref="SyntaxKind.ExpressionStatement"/></description></item> 6955/// <item><description><see cref="SyntaxKind.EmptyStatement"/></description></item> 7002/// <item><description><see cref="SyntaxKind.LabeledStatement"/></description></item> 7072/// <item><description><see cref="SyntaxKind.GotoStatement"/></description></item> 7073/// <item><description><see cref="SyntaxKind.GotoCaseStatement"/></description></item> 7074/// <item><description><see cref="SyntaxKind.GotoDefaultStatement"/></description></item> 7161/// <item><description><see cref="SyntaxKind.BreakStatement"/></description></item> 7210/// <item><description><see cref="SyntaxKind.ContinueStatement"/></description></item> 7259/// <item><description><see cref="SyntaxKind.ReturnStatement"/></description></item> 7324/// <item><description><see cref="SyntaxKind.ThrowStatement"/></description></item> 7389/// <item><description><see cref="SyntaxKind.YieldReturnStatement"/></description></item> 7390/// <item><description><see cref="SyntaxKind.YieldBreakStatement"/></description></item> 7458/// <item><description><see cref="SyntaxKind.WhileStatement"/></description></item> 7532/// <item><description><see cref="SyntaxKind.DoStatement"/></description></item> 7612/// <item><description><see cref="SyntaxKind.ForStatement"/></description></item> 7766/// <item><description><see cref="SyntaxKind.ForEachStatement"/></description></item> 7870/// <item><description><see cref="SyntaxKind.ForEachVariableStatement"/></description></item> 7976/// <item><description><see cref="SyntaxKind.UsingStatement"/></description></item> 8066/// <item><description><see cref="SyntaxKind.FixedStatement"/></description></item> 8141/// <item><description><see cref="SyntaxKind.CheckedStatement"/></description></item> 8142/// <item><description><see cref="SyntaxKind.UncheckedStatement"/></description></item> 8206/// <item><description><see cref="SyntaxKind.UnsafeStatement"/></description></item> 8270/// <item><description><see cref="SyntaxKind.LockStatement"/></description></item> 8347/// <item><description><see cref="SyntaxKind.IfStatement"/></description></item> 8446/// <item><description><see cref="SyntaxKind.ElseClause"/></description></item> 8492/// <item><description><see cref="SyntaxKind.SwitchStatement"/></description></item> 8609/// <item><description><see cref="SyntaxKind.SwitchSection"/></description></item> 8697/// <item><description><see cref="SyntaxKind.CasePatternSwitchLabel"/></description></item> 8765/// <item><description><see cref="SyntaxKind.CaseSwitchLabel"/></description></item> 8817/// <item><description><see cref="SyntaxKind.DefaultSwitchLabel"/></description></item> 8861/// <item><description><see cref="SyntaxKind.SwitchExpression"/></description></item> 8934/// <item><description><see cref="SyntaxKind.SwitchExpressionArm"/></description></item> 8998/// <item><description><see cref="SyntaxKind.TryStatement"/></description></item> 9075/// <item><description><see cref="SyntaxKind.CatchClause"/></description></item> 9142/// <item><description><see cref="SyntaxKind.CatchDeclaration"/></description></item> 9197/// <item><description><see cref="SyntaxKind.CatchFilterClause"/></description></item> 9245/// <item><description><see cref="SyntaxKind.FinallyClause"/></description></item> 9290/// <item><description><see cref="SyntaxKind.CompilationUnit"/></description></item> 9369/// <item><description><see cref="SyntaxKind.ExternAliasDirective"/></description></item> 9420/// <item><description><see cref="SyntaxKind.UsingDirective"/></description></item> 9580/// <item><description><see cref="SyntaxKind.NamespaceDeclaration"/></description></item> 9701/// <item><description><see cref="SyntaxKind.FileScopedNamespaceDeclaration"/></description></item> 9809/// <item><description><see cref="SyntaxKind.AttributeList"/></description></item> 9884/// <item><description><see cref="SyntaxKind.AttributeTargetSpecifier"/></description></item> 9928/// <item><description><see cref="SyntaxKind.Attribute"/></description></item> 9991/// <item><description><see cref="SyntaxKind.AttributeArgumentList"/></description></item> 10049/// <item><description><see cref="SyntaxKind.AttributeArgument"/></description></item> 10112/// <item><description><see cref="SyntaxKind.NameEquals"/></description></item> 10156/// <item><description><see cref="SyntaxKind.TypeParameterList"/></description></item> 10214/// <item><description><see cref="SyntaxKind.TypeParameter"/></description></item> 10367/// <item><description><see cref="SyntaxKind.ClassDeclaration"/></description></item> 10533/// <item><description><see cref="SyntaxKind.StructDeclaration"/></description></item> 10699/// <item><description><see cref="SyntaxKind.UnionDeclaration"/></description></item> 10867/// <item><description><see cref="SyntaxKind.InterfaceDeclaration"/></description></item> 11032/// <item><description><see cref="SyntaxKind.RecordDeclaration"/></description></item> 11033/// <item><description><see cref="SyntaxKind.RecordStructDeclaration"/></description></item> 11208/// <item><description><see cref="SyntaxKind.EnumDeclaration"/></description></item> 11345/// <item><description><see cref="SyntaxKind.DelegateDeclaration"/></description></item> 11457/// <item><description><see cref="SyntaxKind.EnumMemberDeclaration"/></description></item> 11534/// <item><description><see cref="SyntaxKind.ExtensionBlockDeclaration"/></description></item> 11682/// <item><description><see cref="SyntaxKind.BaseList"/></description></item> 11748/// <item><description><see cref="SyntaxKind.SimpleBaseType"/></description></item> 11788/// <item><description><see cref="SyntaxKind.PrimaryConstructorBaseType"/></description></item> 11847/// <item><description><see cref="SyntaxKind.TypeParameterConstraintClause"/></description></item> 11930/// <item><description><see cref="SyntaxKind.ConstructorConstraint"/></description></item> 11978/// <item><description><see cref="SyntaxKind.ClassConstraint"/></description></item> 11979/// <item><description><see cref="SyntaxKind.StructConstraint"/></description></item> 12030/// <item><description><see cref="SyntaxKind.TypeConstraint"/></description></item> 12071/// <item><description><see cref="SyntaxKind.DefaultConstraint"/></description></item> 12111/// <item><description><see cref="SyntaxKind.AllowsConstraintClause"/></description></item> 12173/// <item><description><see cref="SyntaxKind.RefStructConstraint"/></description></item> 12242/// <item><description><see cref="SyntaxKind.FieldDeclaration"/></description></item> 12321/// <item><description><see cref="SyntaxKind.EventFieldDeclaration"/></description></item> 12403/// <item><description><see cref="SyntaxKind.ExplicitInterfaceSpecifier"/></description></item> 12489/// <item><description><see cref="SyntaxKind.MethodDeclaration"/></description></item> 12639/// <item><description><see cref="SyntaxKind.OperatorDeclaration"/></description></item> 12785/// <item><description><see cref="SyntaxKind.ConversionOperatorDeclaration"/></description></item> 12931/// <item><description><see cref="SyntaxKind.ConstructorDeclaration"/></description></item> 13055/// <item><description><see cref="SyntaxKind.BaseConstructorInitializer"/></description></item> 13056/// <item><description><see cref="SyntaxKind.ThisConstructorInitializer"/></description></item> 13106/// <item><description><see cref="SyntaxKind.DestructorDeclaration"/></description></item> 13260/// <item><description><see cref="SyntaxKind.PropertyDeclaration"/></description></item> 13380/// <item><description><see cref="SyntaxKind.ArrowExpressionClause"/></description></item> 13422/// <item><description><see cref="SyntaxKind.EventDeclaration"/></description></item> 13532/// <item><description><see cref="SyntaxKind.IndexerDeclaration"/></description></item> 13652/// <item><description><see cref="SyntaxKind.AccessorList"/></description></item> 13699/// <item><description><see cref="SyntaxKind.GetAccessorDeclaration"/></description></item> 13700/// <item><description><see cref="SyntaxKind.SetAccessorDeclaration"/></description></item> 13701/// <item><description><see cref="SyntaxKind.InitAccessorDeclaration"/></description></item> 13702/// <item><description><see cref="SyntaxKind.AddAccessorDeclaration"/></description></item> 13703/// <item><description><see cref="SyntaxKind.RemoveAccessorDeclaration"/></description></item> 13704/// <item><description><see cref="SyntaxKind.UnknownAccessorDeclaration"/></description></item> 13825/// <item><description><see cref="SyntaxKind.ParameterList"/></description></item> 13884/// <item><description><see cref="SyntaxKind.BracketedParameterList"/></description></item> 13972/// <item><description><see cref="SyntaxKind.Parameter"/></description></item> 14068/// <item><description><see cref="SyntaxKind.FunctionPointerParameter"/></description></item> 14143/// <item><description><see cref="SyntaxKind.IncompleteMember"/></description></item> 14215/// <item><description><see cref="SyntaxKind.SkippedTokensTrivia"/></description></item> 14262/// <item><description><see cref="SyntaxKind.SingleLineDocumentationCommentTrivia"/></description></item> 14263/// <item><description><see cref="SyntaxKind.MultiLineDocumentationCommentTrivia"/></description></item> 14326/// <item><description><see cref="SyntaxKind.TypeCref"/></description></item> 14372/// <item><description><see cref="SyntaxKind.QualifiedCref"/></description></item> 14451/// <item><description><see cref="SyntaxKind.NameMemberCref"/></description></item> 14512/// <item><description><see cref="SyntaxKind.ExtensionMemberCref"/></description></item> 14590/// <item><description><see cref="SyntaxKind.IndexerMemberCref"/></description></item> 14643/// <item><description><see cref="SyntaxKind.OperatorMemberCref"/></description></item> 14709/// <item><description><see cref="SyntaxKind.ConversionOperatorMemberCref"/></description></item> 14809/// <item><description><see cref="SyntaxKind.CrefParameterList"/></description></item> 14870/// <item><description><see cref="SyntaxKind.CrefBracketedParameterList"/></description></item> 14934/// <item><description><see cref="SyntaxKind.CrefParameter"/></description></item> 15001/// <item><description><see cref="SyntaxKind.XmlElement"/></description></item> 15065/// <item><description><see cref="SyntaxKind.XmlElementStartTag"/></description></item> 15128/// <item><description><see cref="SyntaxKind.XmlElementEndTag"/></description></item> 15173/// <item><description><see cref="SyntaxKind.XmlEmptyElement"/></description></item> 15236/// <item><description><see cref="SyntaxKind.XmlName"/></description></item> 15278/// <item><description><see cref="SyntaxKind.XmlPrefix"/></description></item> 15343/// <item><description><see cref="SyntaxKind.XmlTextAttribute"/></description></item> 15407/// <item><description><see cref="SyntaxKind.XmlCrefAttribute"/></description></item> 15475/// <item><description><see cref="SyntaxKind.XmlNameAttribute"/></description></item> 15543/// <item><description><see cref="SyntaxKind.XmlText"/></description></item> 15590/// <item><description><see cref="SyntaxKind.XmlCDataSection"/></description></item> 15643/// <item><description><see cref="SyntaxKind.XmlProcessingInstruction"/></description></item> 15700/// <item><description><see cref="SyntaxKind.XmlComment"/></description></item> 15798/// <item><description><see cref="SyntaxKind.IfDirectiveTrivia"/></description></item> 15858/// <item><description><see cref="SyntaxKind.ElifDirectiveTrivia"/></description></item> 15918/// <item><description><see cref="SyntaxKind.ElseDirectiveTrivia"/></description></item> 15970/// <item><description><see cref="SyntaxKind.EndIfDirectiveTrivia"/></description></item> 16019/// <item><description><see cref="SyntaxKind.RegionDirectiveTrivia"/></description></item> 16068/// <item><description><see cref="SyntaxKind.EndRegionDirectiveTrivia"/></description></item> 16117/// <item><description><see cref="SyntaxKind.ErrorDirectiveTrivia"/></description></item> 16166/// <item><description><see cref="SyntaxKind.WarningDirectiveTrivia"/></description></item> 16215/// <item><description><see cref="SyntaxKind.BadDirectiveTrivia"/></description></item> 16264/// <item><description><see cref="SyntaxKind.DefineDirectiveTrivia"/></description></item> 16316/// <item><description><see cref="SyntaxKind.UndefDirectiveTrivia"/></description></item> 16387/// <item><description><see cref="SyntaxKind.LineDirectiveTrivia"/></description></item> 16451/// <item><description><see cref="SyntaxKind.LineDirectivePosition"/></description></item> 16501/// <item><description><see cref="SyntaxKind.LineSpanDirectiveTrivia"/></description></item> 16588/// <item><description><see cref="SyntaxKind.PragmaWarningDirectiveTrivia"/></description></item> 16656/// <item><description><see cref="SyntaxKind.PragmaChecksumDirectiveTrivia"/></description></item> 16717/// <item><description><see cref="SyntaxKind.ReferenceDirectiveTrivia"/></description></item> 16769/// <item><description><see cref="SyntaxKind.LoadDirectiveTrivia"/></description></item> 16821/// <item><description><see cref="SyntaxKind.ShebangDirectiveTrivia"/></description></item> 16870/// <item><description><see cref="SyntaxKind.IgnoredDirectiveTrivia"/></description></item> 16929/// <item><description><see cref="SyntaxKind.NullableDirectiveTrivia"/></description></item>
Binder\Binder.cs (2)
89assignment.Parent?.Kind() == SyntaxKind.ObjectInitializerExpression; 93initializer.Kind() == SyntaxKind.ObjectInitializerExpression:
Binder\Binder.IdentifierUsedAsValueFinder.cs (13)
69assignment.Parent?.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 77!(id.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 135case GotoStatementSyntax { RawKind: (int)SyntaxKind.GotoStatement }: 157!(expression.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 224case MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess when memberAccess.Expression == id: 369case SyntaxKind.SelectClause: 380case SyntaxKind.GroupClause: 412case SyntaxKind.WhereClause: 414case SyntaxKind.JoinClause: 416case SyntaxKind.OrderByClause: 418case SyntaxKind.FromClause: 420case SyntaxKind.LetClause:
Binder\Binder.ValueChecks.cs (3)
750Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 1286!parenthesized.Expression.IsKind(SyntaxKind.ParenthesizedExpression) && 1297return parenthesized.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.SubtractExpression } binary &&
Binder\Binder_AnonymousTypes.cs (8)
70if (nameToken.Kind() == SyntaxKind.IdentifierToken) 91fieldSyntaxNodes[i] = (nameToken.Kind() == SyntaxKind.IdentifierToken) ? (CSharpSyntaxNode)nameToken.Parent! : fieldInitializer; 157case SyntaxKind.QualifiedName: 160case SyntaxKind.ConditionalAccessExpression: 162if (expr.Kind() == SyntaxKind.MemberBindingExpression) 168case SyntaxKind.IdentifierName: 169case SyntaxKind.SimpleMemberAccessExpression: 224expressionType = CreateErrorType(SyntaxFacts.GetText(SyntaxKind.VoidKeyword));
Binder\Binder_Attributes.cs (1)
290Debug.Assert(boundAttribute.Syntax.Kind() == SyntaxKind.Attribute);
Binder\Binder_Constraints.cs (9)
134case SyntaxKind.ClassConstraint: 152if (questionToken.IsKind(SyntaxKind.QuestionToken)) 175case SyntaxKind.StructConstraint: 193case SyntaxKind.ConstructorConstraint: 209if (i != n - 1 && constraintsSyntax[i + 1].Kind() != SyntaxKind.AllowsConstraintClause) 216case SyntaxKind.DefaultConstraint: 239case SyntaxKind.TypeConstraint: 295case SyntaxKind.AllowsConstraintClause: 312if (allowsConstraint.Kind() == SyntaxKind.RefStructConstraint)
Binder\Binder_Conversions.cs (4)
1790((ParameterSyntax)node).Modifiers.First(static m => m.IsKind(SyntaxKind.ParamsKeyword)).GetLocation(), 3054if (!lambdaSymbol.SyntaxNode.IsKind(SyntaxKind.AnonymousMethodExpression)) 3413else if (node.Kind() == SyntaxKind.AwaitExpression && memberSymbol.Name == WellKnownMemberNames.GetAwaiter) 3435if (node.Parent != null && node.Parent.Kind() == SyntaxKind.InvocationExpression)
Binder\Binder_Crefs.cs (21)
31case SyntaxKind.TypeCref: 33case SyntaxKind.QualifiedCref: 35case SyntaxKind.NameMemberCref: 36case SyntaxKind.IndexerMemberCref: 37case SyntaxKind.OperatorMemberCref: 38case SyntaxKind.ConversionOperatorMemberCref: 39case SyntaxKind.ExtensionMemberCref: 118case SyntaxKind.NameMemberCref: 121case SyntaxKind.IndexerMemberCref: 124case SyntaxKind.OperatorMemberCref: 127case SyntaxKind.ConversionOperatorMemberCref: 130case SyntaxKind.ExtensionMemberCref: 420bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 422SyntaxKind operatorTokenKind = syntax.OperatorToken.Kind(); 442if (operatorTokenKind is SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken && parameterListSyntax?.Parameters.Count == 0) 466bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 470if (syntax.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword) 1137if (refKind == RefKind.Ref && parameter.ReadOnlyKeyword.IsKind(SyntaxKind.ReadOnlyKeyword)) 1183if (typeSyntax.Parent.Kind() == SyntaxKind.ConversionOperatorMemberCref) 1229return parentSyntax == null || parentSyntax.IsKind(SyntaxKind.XmlCrefAttribute)
Binder\Binder_Deconstruct.cs (13)
42case SyntaxKind.ExpressionStatement: 49case SyntaxKind.ForStatement: 180if (parent is null || parent.Kind() == SyntaxKind.ForEachVariableStatement) 185Debug.Assert(parent.Kind() == SyntaxKind.SimpleAssignmentExpression); 195case SyntaxKind.ExpressionStatement: 198case SyntaxKind.ForStatement: 304var elementSyntax = syntax.Kind() == SyntaxKind.TupleExpression ? ((TupleExpressionSyntax)syntax).Arguments[i] : syntax; 743case SyntaxKind.DeclarationExpression: 756if (component.Designation.Kind() == SyntaxKind.ParenthesizedVariableDesignation) 774case SyntaxKind.TupleExpression: 812case SyntaxKind.SingleVariableDesignation: 817case SyntaxKind.DiscardDesignation: 839case SyntaxKind.ParenthesizedVariableDesignation:
Binder\Binder_Expressions.cs (220)
632case SyntaxKind.AnonymousMethodExpression: 633case SyntaxKind.ParenthesizedLambdaExpression: 634case SyntaxKind.SimpleLambdaExpression: 636case SyntaxKind.ThisExpression: 638case SyntaxKind.BaseExpression: 640case SyntaxKind.FieldExpression: 642case SyntaxKind.InvocationExpression: 644case SyntaxKind.ArrayInitializerExpression: 646case SyntaxKind.ArrayCreationExpression: 648case SyntaxKind.ImplicitArrayCreationExpression: 650case SyntaxKind.StackAllocArrayCreationExpression: 652case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 654case SyntaxKind.ObjectCreationExpression: 656case SyntaxKind.ImplicitObjectCreationExpression: 658case SyntaxKind.IdentifierName: 659case SyntaxKind.GenericName: 661case SyntaxKind.SimpleMemberAccessExpression: 662case SyntaxKind.PointerMemberAccessExpression: 664case SyntaxKind.SimpleAssignmentExpression: 666case SyntaxKind.CastExpression: 668case SyntaxKind.ElementAccessExpression: 670case SyntaxKind.AddExpression: 671case SyntaxKind.MultiplyExpression: 672case SyntaxKind.SubtractExpression: 673case SyntaxKind.DivideExpression: 674case SyntaxKind.ModuloExpression: 675case SyntaxKind.EqualsExpression: 676case SyntaxKind.NotEqualsExpression: 677case SyntaxKind.GreaterThanExpression: 678case SyntaxKind.LessThanExpression: 679case SyntaxKind.GreaterThanOrEqualExpression: 680case SyntaxKind.LessThanOrEqualExpression: 681case SyntaxKind.BitwiseAndExpression: 682case SyntaxKind.BitwiseOrExpression: 683case SyntaxKind.ExclusiveOrExpression: 684case SyntaxKind.LeftShiftExpression: 685case SyntaxKind.RightShiftExpression: 686case SyntaxKind.UnsignedRightShiftExpression: 689case SyntaxKind.LogicalAndExpression: 690case SyntaxKind.LogicalOrExpression: 692case SyntaxKind.CoalesceExpression: 694case SyntaxKind.ConditionalAccessExpression: 697case SyntaxKind.MemberBindingExpression: 700case SyntaxKind.ElementBindingExpression: 703case SyntaxKind.IsExpression: 706case SyntaxKind.AsExpression: 709case SyntaxKind.UnaryPlusExpression: 710case SyntaxKind.UnaryMinusExpression: 711case SyntaxKind.LogicalNotExpression: 712case SyntaxKind.BitwiseNotExpression: 715case SyntaxKind.IndexExpression: 718case SyntaxKind.RangeExpression: 721case SyntaxKind.AddressOfExpression: 724case SyntaxKind.PointerIndirectionExpression: 727case SyntaxKind.PostIncrementExpression: 728case SyntaxKind.PostDecrementExpression: 731case SyntaxKind.PreIncrementExpression: 732case SyntaxKind.PreDecrementExpression: 735case SyntaxKind.ConditionalExpression: 738case SyntaxKind.SwitchExpression: 741case SyntaxKind.NumericLiteralExpression: 742case SyntaxKind.StringLiteralExpression: 743case SyntaxKind.CharacterLiteralExpression: 744case SyntaxKind.TrueLiteralExpression: 745case SyntaxKind.FalseLiteralExpression: 746case SyntaxKind.NullLiteralExpression: 749case SyntaxKind.Utf8StringLiteralExpression: 752case SyntaxKind.DefaultLiteralExpression: 756case SyntaxKind.ParenthesizedExpression: 761case SyntaxKind.UncheckedExpression: 762case SyntaxKind.CheckedExpression: 765case SyntaxKind.DefaultExpression: 768case SyntaxKind.TypeOfExpression: 771case SyntaxKind.SizeOfExpression: 774case SyntaxKind.AddAssignmentExpression: 775case SyntaxKind.AndAssignmentExpression: 776case SyntaxKind.DivideAssignmentExpression: 777case SyntaxKind.ExclusiveOrAssignmentExpression: 778case SyntaxKind.LeftShiftAssignmentExpression: 779case SyntaxKind.ModuloAssignmentExpression: 780case SyntaxKind.MultiplyAssignmentExpression: 781case SyntaxKind.OrAssignmentExpression: 782case SyntaxKind.RightShiftAssignmentExpression: 783case SyntaxKind.UnsignedRightShiftAssignmentExpression: 784case SyntaxKind.SubtractAssignmentExpression: 787case SyntaxKind.CoalesceAssignmentExpression: 790case SyntaxKind.AliasQualifiedName: 791case SyntaxKind.PredefinedType: 794case SyntaxKind.QueryExpression: 797case SyntaxKind.AnonymousObjectCreationExpression: 800case SyntaxKind.QualifiedName: 803case SyntaxKind.ComplexElementInitializerExpression: 806case SyntaxKind.ArgListExpression: 809case SyntaxKind.RefTypeExpression: 812case SyntaxKind.MakeRefExpression: 815case SyntaxKind.RefValueExpression: 818case SyntaxKind.AwaitExpression: 821case SyntaxKind.OmittedArraySizeExpression: 822case SyntaxKind.OmittedTypeArgument: 823case SyntaxKind.ObjectInitializerExpression: 828case SyntaxKind.CollectionExpression: 831case SyntaxKind.NullableType: 840case SyntaxKind.InterpolatedStringExpression: 843case SyntaxKind.IsPatternExpression: 846case SyntaxKind.TupleExpression: 849case SyntaxKind.ThrowExpression: 852case SyntaxKind.RefType: 855case SyntaxKind.ScopedType: 858case SyntaxKind.RefExpression: 861case SyntaxKind.DeclarationExpression: 864case SyntaxKind.SuppressNullableWarningExpression: 867case SyntaxKind.WithExpression: 936case SyntaxKind.ConditionalExpression: // ?: 941case SyntaxKind.CoalesceExpression: // ?? 946case SyntaxKind.SwitchExpressionArm: 947case SyntaxKind.ArrowExpressionClause: 948case SyntaxKind.ParenthesizedLambdaExpression: 949case SyntaxKind.SimpleLambdaExpression: 983case SyntaxKind.SingleVariableDesignation: 989case SyntaxKind.DiscardDesignation: 993case SyntaxKind.ParenthesizedVariableDesignation: 1680SeparatedSyntaxList<TypeSyntax> typeArgumentList = node.Kind() == SyntaxKind.GenericName 1735if (!isNamedType && (hasTypeArguments || node.Kind() == SyntaxKind.GenericName)) 1941return (parent?.Kind() == SyntaxKind.Argument && 1942((ArgumentSyntax)parent).RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword); 2486if (node.Kind() == SyntaxKind.PredefinedType) 2644else if (this.ContainingType is null || node.Parent is null || (node.Parent.Kind() != SyntaxKind.SimpleMemberAccessExpression && node.Parent.Kind() != SyntaxKind.ElementAccessExpression)) 2678Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken)); 3072case SyntaxKind.PredefinedType: 3075case SyntaxKind.SimpleLambdaExpression: 3078case SyntaxKind.ParenthesizedExpression: 3081case SyntaxKind.CastExpression: 3084case SyntaxKind.SimpleMemberAccessExpression: 3085case SyntaxKind.PointerMemberAccessExpression: 3087case SyntaxKind.MemberBindingExpression: 3145case SyntaxKind.ParenthesizedLambdaExpression: 3146case SyntaxKind.SimpleLambdaExpression: 3147case SyntaxKind.AnonymousMethodExpression: 3148case SyntaxKind.InvocationExpression: 3149case SyntaxKind.ObjectCreationExpression: 3150case SyntaxKind.ImplicitObjectCreationExpression: 3151case SyntaxKind.ParenthesizedExpression: // this is never allowed in legacy compiler 3152case SyntaxKind.DeclarationExpression: 3202if (argumentSyntax.RefOrOutKeyword.Kind() != SyntaxKind.None) 3210if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.InKeyword)) 3213if (argumentSyntax.Expression.Kind() == SyntaxKind.DeclarationExpression) 3215if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.OutKeyword)) 3235case SyntaxKind.DiscardDesignation: 3258case SyntaxKind.SingleVariableDesignation: 4157if (arg.Kind() != SyntaxKind.OmittedArraySizeExpression) 4178if (dimension.Kind() != SyntaxKind.OmittedArraySizeExpression) 4305if (expression.Kind() == SyntaxKind.ArrayInitializerExpression) 4384if (expr.Kind() == SyntaxKind.ArrayInitializerExpression) 4508creationSyntax.Kind() == SyntaxKind.ArrayCreationExpression || 4509creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4512Debug.Assert(boundInitExprOpt.IsDefault || creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4542var isInferred = creationSyntax.IsKind(SyntaxKind.ImplicitArrayCreationExpression); 4577initSyntax.Parent.Kind() != SyntaxKind.EqualsValueClause || 4587if (typeSyntax.Kind() != SyntaxKind.ArrayType) 4623if (size.Kind() != SyntaxKind.OmittedArraySizeExpression) 4640if (countSyntax.Kind() != SyntaxKind.OmittedArraySizeExpression) 4698typeSyntax: node.Kind() == SyntaxKind.StackAllocArrayCreationExpression 4719if (!equalsValueClause.IsKind(SyntaxKind.EqualsValueClause)) 4726if (!variableDeclarator.IsKind(SyntaxKind.VariableDeclarator)) 4732if (!variableDeclaration.IsKind(SyntaxKind.VariableDeclaration)) 4738variableDeclaration.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) || 4739variableDeclaration.Parent.IsKind(SyntaxKind.ForStatement); 4754Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 4791bool isInferred = node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression); 4940initializerArgumentListOpt.Parent.Kind() != SyntaxKind.ThisConstructorInitializer; 4983Debug.Assert(initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer); 5090(initializerArgumentListOpt != null && initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer)); 5698else if (node.Type.Kind() == SyntaxKind.TupleType) 5793case SyntaxKind.ObjectInitializerExpression: 5797case SyntaxKind.WithInitializerExpression: 5801case SyntaxKind.CollectionInitializerExpression: 5822case SyntaxKind.ObjectInitializerExpression: 5823case SyntaxKind.CollectionInitializerExpression: 5824Debug.Assert(syntax.Parent.Parent.Kind() != SyntaxKind.WithInitializerExpression); 5844Debug.Assert(initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression || 5845initializerSyntax.Kind() == SyntaxKind.WithInitializerExpression); 5848if (initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression) 5882case SyntaxKind.SimpleAssignmentExpression: 5913case SyntaxKind.IdentifierName: 5952SyntaxKind rhsKind = namedAssignment.Right.Kind(); 5953bool isRef = rhsKind is SyntaxKind.RefExpression; 5954bool isRhsNestedInitializer = rhsKind is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression; 5985if (leftSyntax.Kind() == SyntaxKind.IdentifierName) 6029else if (leftSyntax.Kind() == SyntaxKind.ImplicitElementAccess) 6265Debug.Assert(memberInitializerSyntax.Kind() == SyntaxKind.SimpleAssignmentExpression); 6399Debug.Assert(initializerSyntax.Kind() == SyntaxKind.CollectionInitializerExpression); 6487if (elementInitializer.Kind() == SyntaxKind.ComplexElementInitializerExpression) 6553Debug.Assert(node.Kind() == SyntaxKind.ComplexElementInitializerExpression); 7528if (node.Kind() is SyntaxKind.NumericLiteralExpression) 7571if (node.Token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 7581Debug.Assert(node.Kind() == SyntaxKind.Utf8StringLiteralExpression); 7582Debug.Assert(node.Token.Kind() is SyntaxKind.Utf8StringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken); 7584if (node.Token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 7618if (node.Kind() == SyntaxKind.SimpleMemberAccessExpression) 7625Debug.Assert(node.Kind() == SyntaxKind.PointerMemberAccessExpression); 7679Debug.Assert((left.Parent is MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess && memberAccess.Expression == left) || 7807SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? 7838if (!hasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 7936var typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? ((GenericNameSyntax)right).TypeArgumentList.Arguments : default(SeparatedSyntaxList<TypeSyntax>); 8372if (!boundMethodGroup.HasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 8438(node.Kind() == SyntaxKind.AwaitExpression && plainName == WellKnownMemberNames.GetResult) || 10458var name = candidate.IsIndexer ? SyntaxFacts.GetText(SyntaxKind.ThisKeyword) : candidate.Name; 11712case SyntaxKind.ExpressionStatement: 11716case SyntaxKind.SimpleLambdaExpression: 11720case SyntaxKind.ParenthesizedLambdaExpression: 11724case SyntaxKind.ArrowExpressionClause: 11728case SyntaxKind.ForStatement: 11777while (receiver.IsKind(SyntaxKind.ParenthesizedExpression))
Binder\Binder_Flags.cs (1)
112return !withoutUnsafe && modifiers.Any(SyntaxKind.UnsafeKeyword) && !this.Compilation.SourceModule.UseUpdatedMemorySafetyRules
Binder\Binder_InterpolatedString.cs (7)
25if (node.StringStartToken.Kind() is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken) 51var isNonVerbatimInterpolatedString = node.StringStartToken.Kind() != SyntaxKind.InterpolatedVerbatimStringStartToken; 52var isRawInterpolatedString = node.StringStartToken.Kind() is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken; 60case SyntaxKind.Interpolation: 154case SyntaxKind.InterpolatedStringText:
Binder\Binder_Invocation.cs (22)
29case SyntaxKind.IdentifierName: 30case SyntaxKind.GenericName: 32case SyntaxKind.SimpleMemberAccessExpression: 33case SyntaxKind.PointerMemberAccessExpression: 35case SyntaxKind.ParenthesizedExpression: 194bool isArglist = node.Expression.Kind() == SyntaxKind.ArgListExpression; 226Debug.Assert(node.Expression.Kind() is SyntaxKind.SimpleMemberAccessExpression); 254if (node.Expression is MemberAccessExpressionSyntax { Expression: InvocationExpressionSyntax receiver, RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } && !receiver.MayBeNameofOperator()) 1357WarnOnAccessOfOffDefault(node.Kind() == SyntaxKind.InvocationExpression ? 1935case SyntaxKind.QualifiedName: 1938case SyntaxKind.SimpleMemberAccessExpression: 1939case SyntaxKind.PointerMemberAccessExpression: 2461case SyntaxKind.IdentifierName: 2467case SyntaxKind.GenericName: 2473case SyntaxKind.SimpleMemberAccessExpression: 2479case SyntaxKind.BaseExpression: 2480case SyntaxKind.ThisExpression: 2489case SyntaxKind.AliasQualifiedName: 2501case SyntaxKind.ThisExpression: 2502case SyntaxKind.BaseExpression: 2503case SyntaxKind.PredefinedType: 2525this.LookupSymbolsWithFallback(lookupResult, SyntaxFacts.GetText(SyntaxKind.NameOfKeyword), useSiteInfo: ref discardedUseSiteInfo, arity: 0, options: options);
Binder\Binder_Lambda.cs (12)
71case SyntaxKind.SimpleLambdaExpression: 78case SyntaxKind.ParenthesizedLambdaExpression: 91case SyntaxKind.AnonymousMethodExpression: 111if (modifier.IsKind(SyntaxKind.AsyncKeyword)) 116else if (modifier.IsKind(SyntaxKind.StaticKeyword)) 125var isAnonymousMethod = syntax.IsKind(SyntaxKind.AnonymousMethodExpression); 183var isParams = paramsKeyword.Kind() != SyntaxKind.None; 192paramsKeyword.Kind() != SyntaxKind.None && 208attributesBuilder.Add(syntax.Kind() == SyntaxKind.ParenthesizedLambdaExpression ? p.AttributeLists : default); 279if (syntax.Kind() == SyntaxKind.ParenthesizedLambdaExpression) 285Error(diagnostics, syntax.Kind() == SyntaxKind.SimpleLambdaExpression ? ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression : ErrorCode.ERR_AttributesNotAllowed, attributeList); 298if (syntax is IdentifierNameSyntax { Identifier.RawContextualKind: (int)SyntaxKind.VarKeyword })
Binder\Binder_Operators.cs (99)
856protected static bool IsSimpleBinaryOperator(SyntaxKind kind) 861case SyntaxKind.AddExpression: 862case SyntaxKind.MultiplyExpression: 863case SyntaxKind.SubtractExpression: 864case SyntaxKind.DivideExpression: 865case SyntaxKind.ModuloExpression: 866case SyntaxKind.EqualsExpression: 867case SyntaxKind.NotEqualsExpression: 868case SyntaxKind.GreaterThanExpression: 869case SyntaxKind.LessThanExpression: 870case SyntaxKind.GreaterThanOrEqualExpression: 871case SyntaxKind.LessThanOrEqualExpression: 872case SyntaxKind.BitwiseAndExpression: 873case SyntaxKind.BitwiseOrExpression: 874case SyntaxKind.ExclusiveOrExpression: 875case SyntaxKind.LeftShiftExpression: 876case SyntaxKind.RightShiftExpression: 877case SyntaxKind.UnsignedRightShiftExpression: 908&& !parenthesizedExpression.Expression.IsKind(SyntaxKind.ParenthesizedExpression)) 914if (parenthesizedExpression.Expression.IsKind(SyntaxKind.IdentifierName) 1030case SyntaxKind.EqualsExpression: 1031case SyntaxKind.NotEqualsExpression: 1032case SyntaxKind.LessThanExpression: 1033case SyntaxKind.LessThanOrEqualExpression: 1034case SyntaxKind.GreaterThanExpression: 1035case SyntaxKind.GreaterThanOrEqualExpression: 1308node.OperatorToken.RawKind is (int)SyntaxKind.PlusEqualsToken or (int)SyntaxKind.MinusEqualsToken && 1332bool isEquality = operatorToken.Kind() == SyntaxKind.EqualsEqualsToken || operatorToken.Kind() == SyntaxKind.ExclamationEqualsToken; 1367case LookupResultKind.OverloadResolutionFailure when operatorToken.Kind() is SyntaxKind.PlusToken && isReadOnlySpanOfByte(left.Type) && isReadOnlySpanOfByte(right.Type): 1389Debug.Assert(node.Kind() == SyntaxKind.LogicalOrExpression || node.Kind() == SyntaxKind.LogicalAndExpression); 1402(childAsBinary.Kind() != SyntaxKind.LogicalOrExpression && childAsBinary.Kind() != SyntaxKind.LogicalAndExpression)) 3216public static BinaryOperatorKind SyntaxKindToBinaryOperatorKind(SyntaxKind kind) 3220case SyntaxKind.MultiplyAssignmentExpression: 3221case SyntaxKind.MultiplyExpression: return BinaryOperatorKind.Multiplication; 3222case SyntaxKind.DivideAssignmentExpression: 3223case SyntaxKind.DivideExpression: return BinaryOperatorKind.Division; 3224case SyntaxKind.ModuloAssignmentExpression: 3225case SyntaxKind.ModuloExpression: return BinaryOperatorKind.Remainder; 3226case SyntaxKind.AddAssignmentExpression: 3227case SyntaxKind.AddExpression: return BinaryOperatorKind.Addition; 3228case SyntaxKind.SubtractAssignmentExpression: 3229case SyntaxKind.SubtractExpression: return BinaryOperatorKind.Subtraction; 3230case SyntaxKind.RightShiftAssignmentExpression: 3231case SyntaxKind.RightShiftExpression: return BinaryOperatorKind.RightShift; 3232case SyntaxKind.UnsignedRightShiftAssignmentExpression: 3233case SyntaxKind.UnsignedRightShiftExpression: return BinaryOperatorKind.UnsignedRightShift; 3234case SyntaxKind.LeftShiftAssignmentExpression: 3235case SyntaxKind.LeftShiftExpression: return BinaryOperatorKind.LeftShift; 3236case SyntaxKind.EqualsExpression: return BinaryOperatorKind.Equal; 3237case SyntaxKind.NotEqualsExpression: return BinaryOperatorKind.NotEqual; 3238case SyntaxKind.GreaterThanExpression: return BinaryOperatorKind.GreaterThan; 3239case SyntaxKind.LessThanExpression: return BinaryOperatorKind.LessThan; 3240case SyntaxKind.GreaterThanOrEqualExpression: return BinaryOperatorKind.GreaterThanOrEqual; 3241case SyntaxKind.LessThanOrEqualExpression: return BinaryOperatorKind.LessThanOrEqual; 3242case SyntaxKind.AndAssignmentExpression: 3243case SyntaxKind.BitwiseAndExpression: return BinaryOperatorKind.And; 3244case SyntaxKind.OrAssignmentExpression: 3245case SyntaxKind.BitwiseOrExpression: return BinaryOperatorKind.Or; 3246case SyntaxKind.ExclusiveOrAssignmentExpression: 3247case SyntaxKind.ExclusiveOrExpression: return BinaryOperatorKind.Xor; 3248case SyntaxKind.LogicalAndExpression: return BinaryOperatorKind.LogicalAnd; 3249case SyntaxKind.LogicalOrExpression: return BinaryOperatorKind.LogicalOr; 4069Debug.Assert(node.Operand.SkipParens().GetLastToken().Kind() == SyntaxKind.ExclamationToken); 4636public static UnaryOperatorKind SyntaxKindToUnaryOperatorKind(SyntaxKind kind) 4640case SyntaxKind.PreIncrementExpression: return UnaryOperatorKind.PrefixIncrement; 4641case SyntaxKind.PostIncrementExpression: return UnaryOperatorKind.PostfixIncrement; 4642case SyntaxKind.PreDecrementExpression: return UnaryOperatorKind.PrefixDecrement; 4643case SyntaxKind.PostDecrementExpression: return UnaryOperatorKind.PostfixDecrement; 4644case SyntaxKind.UnaryPlusExpression: return UnaryOperatorKind.UnaryPlus; 4645case SyntaxKind.UnaryMinusExpression: return UnaryOperatorKind.UnaryMinus; 4646case SyntaxKind.LogicalNotExpression: return UnaryOperatorKind.LogicalNegation; 4647case SyntaxKind.BitwiseNotExpression: return UnaryOperatorKind.BitwiseComplement; 4652private static BindValueKind GetBinaryAssignmentKind(SyntaxKind kind) 4656case SyntaxKind.SimpleAssignmentExpression: 4658case SyntaxKind.AddAssignmentExpression: 4659case SyntaxKind.AndAssignmentExpression: 4660case SyntaxKind.DivideAssignmentExpression: 4661case SyntaxKind.ExclusiveOrAssignmentExpression: 4662case SyntaxKind.LeftShiftAssignmentExpression: 4663case SyntaxKind.ModuloAssignmentExpression: 4664case SyntaxKind.MultiplyAssignmentExpression: 4665case SyntaxKind.OrAssignmentExpression: 4666case SyntaxKind.RightShiftAssignmentExpression: 4667case SyntaxKind.UnsignedRightShiftAssignmentExpression: 4668case SyntaxKind.SubtractAssignmentExpression: 4669case SyntaxKind.CoalesceAssignmentExpression: 4676private static BindValueKind GetUnaryAssignmentKind(SyntaxKind kind) 4680case SyntaxKind.PreDecrementExpression: 4681case SyntaxKind.PreIncrementExpression: 4682case SyntaxKind.PostDecrementExpression: 4683case SyntaxKind.PostIncrementExpression: 4685case SyntaxKind.AddressOfExpression: 4707if (node.Kind() != SyntaxKind.UnaryMinusExpression) 4712if (node.Operand != operand.Syntax || operand.Syntax.Kind() != SyntaxKind.NumericLiteralExpression) 4805Error(diagnostics, ErrorCode.ERR_BadUnaryOp, node, SyntaxFacts.GetText(SyntaxKind.IsKeyword), operand.Display);
Binder\Binder_Patterns.cs (17)
969case SyntaxKind.DefaultLiteralExpression: 973case SyntaxKind.ParenthesizedExpression: 976case SyntaxKind.SuppressNullableWarningExpression: 1837if (node.Designation?.Kind() == SyntaxKind.SingleVariableDesignation) 1942if ((inputType.IsPointerOrFunctionPointer() && node.Designation.Kind() == SyntaxKind.ParenthesizedVariableDesignation) 1972case SyntaxKind.DiscardDesignation: 1977case SyntaxKind.SingleVariableDesignation: 1990node.Parent.Kind() == SyntaxKind.VarPattern ? node.Parent : node, // for `var x` use whole pattern, otherwise use designation for the syntax 1994case SyntaxKind.ParenthesizedVariableDesignation: 2193case MemberAccessExpressionSyntax { Name: IdentifierNameSyntax name } memberAccess when memberAccess.IsKind(SyntaxKind.SimpleMemberAccessExpression): 2382static BinaryOperatorKind tokenKindToBinaryOperatorKind(SyntaxKind kind) => kind switch 2384SyntaxKind.LessThanEqualsToken => BinaryOperatorKind.LessThanOrEqual, 2385SyntaxKind.LessThanToken => BinaryOperatorKind.LessThan, 2386SyntaxKind.GreaterThanToken => BinaryOperatorKind.GreaterThan, 2387SyntaxKind.GreaterThanEqualsToken => BinaryOperatorKind.GreaterThanOrEqual, 2452permitDesignations = permitDesignations && currentNode.IsKind(SyntaxKind.AndPattern); 2499bool isDisjunction = node.Kind() == SyntaxKind.OrPattern;
Binder\Binder_Query.cs (18)
134case SyntaxKind.FromClause: 136case SyntaxKind.LetClause: 138case SyntaxKind.WhereClause: 140case SyntaxKind.JoinClause: 142case SyntaxKind.OrderByClause: 144return firstOrdering.IsKind(SyntaxKind.DescendingOrdering) ? "OrderByDescending" : "OrderBy"; 155case SyntaxKind.SelectClause: 157case SyntaxKind.GroupClause: 222case SyntaxKind.SelectClause: 243case SyntaxKind.GroupClause: 338case SyntaxKind.WhereClause: 341case SyntaxKind.JoinClause: 344case SyntaxKind.OrderByClause: 347case SyntaxKind.FromClause: 350case SyntaxKind.LetClause: 412if (state.clauses.IsEmpty() && state.selectOrGroup.Kind() == SyntaxKind.SelectClause) 566string methodName = (first ? "OrderBy" : "ThenBy") + (ordering.IsKind(SyntaxKind.DescendingOrdering) ? "Descending" : ""); 599if (state.clauses.IsEmpty() && state.selectOrGroup.IsKind(SyntaxKind.SelectClause))
Binder\Binder_QueryErrors.cs (21)
138if (parent.Kind() == SyntaxKind.JoinClause) 154if (parent.Kind() == SyntaxKind.JoinClause) 170case SyntaxKind.JoinClause: 171clauseKind = SyntaxFacts.GetText(SyntaxKind.JoinKeyword); 174case SyntaxKind.LetClause: 175clauseKind = SyntaxFacts.GetText(SyntaxKind.LetKeyword); 177case SyntaxKind.SelectClause: 178clauseKind = SyntaxFacts.GetText(SyntaxKind.SelectKeyword); 180case SyntaxKind.WhereClause: 181clauseKind = SyntaxFacts.GetText(SyntaxKind.WhereKeyword); 183case SyntaxKind.OrderByClause: 184case SyntaxKind.AscendingOrdering: 185case SyntaxKind.DescendingOrdering: 186clauseKind = SyntaxFacts.GetText(SyntaxKind.OrderByKeyword); 189case SyntaxKind.QueryContinuation: 190clauseKind = SyntaxFacts.GetText(SyntaxKind.IntoKeyword); 192case SyntaxKind.GroupClause: 193clauseKind = SyntaxFacts.GetText(SyntaxKind.GroupKeyword) + " " + SyntaxFacts.GetText(SyntaxKind.ByKeyword); 196case SyntaxKind.FromClause: 201clauseKind = SyntaxFacts.GetText(SyntaxKind.FromKeyword);
Binder\Binder_Statements.cs (85)
47if (node.Kind() == SyntaxKind.LocalFunctionStatement) 51else if (node.Kind() != SyntaxKind.Block) 63case SyntaxKind.Block: 66case SyntaxKind.LocalDeclarationStatement: 69case SyntaxKind.LocalFunctionStatement: 72case SyntaxKind.ExpressionStatement: 75case SyntaxKind.IfStatement: 78case SyntaxKind.SwitchStatement: 81case SyntaxKind.DoStatement: 84case SyntaxKind.WhileStatement: 87case SyntaxKind.ForStatement: 90case SyntaxKind.ForEachStatement: 91case SyntaxKind.ForEachVariableStatement: 94case SyntaxKind.BreakStatement: 97case SyntaxKind.ContinueStatement: 100case SyntaxKind.ReturnStatement: 103case SyntaxKind.FixedStatement: 106case SyntaxKind.LabeledStatement: 109case SyntaxKind.GotoStatement: 110case SyntaxKind.GotoCaseStatement: 111case SyntaxKind.GotoDefaultStatement: 114case SyntaxKind.TryStatement: 117case SyntaxKind.EmptyStatement: 120case SyntaxKind.ThrowStatement: 123case SyntaxKind.UnsafeStatement: 126case SyntaxKind.UncheckedStatement: 127case SyntaxKind.CheckedStatement: 130case SyntaxKind.UsingStatement: 133case SyntaxKind.YieldBreakStatement: 136case SyntaxKind.YieldReturnStatement: 139case SyntaxKind.LockStatement: 325case SyntaxKind.LocalDeclarationStatement: 330goto case SyntaxKind.ExpressionStatement; 332case SyntaxKind.ExpressionStatement: 333case SyntaxKind.LockStatement: 334case SyntaxKind.IfStatement: 335case SyntaxKind.YieldReturnStatement: 336case SyntaxKind.ReturnStatement: 337case SyntaxKind.ThrowStatement: 342case SyntaxKind.LabeledStatement: 343case SyntaxKind.LocalFunctionStatement: 351case SyntaxKind.SwitchStatement: 357case SyntaxKind.EmptyStatement: 363case SyntaxKind.ForStatement: 364case SyntaxKind.ForEachStatement: 365case SyntaxKind.ForEachVariableStatement: 366case SyntaxKind.WhileStatement: 370if (emptyStatement.SemicolonToken.GetNextToken().Kind() != SyntaxKind.OpenBraceToken) 514case SyntaxKind.GotoStatement: 525case SyntaxKind.GotoCaseStatement: 526case SyntaxKind.GotoDefaultStatement: 602if (modifier.IsKind(SyntaxKind.StaticKeyword)) 604else if (modifier.IsKind(SyntaxKind.ExternKeyword)) 795declarationNode.Kind() == SyntaxKind.VariableDeclaration || 796declarationNode.Kind() == SyntaxKind.DeclarationExpression || 797declarationNode.Kind() == SyntaxKind.DiscardDesignation); 835if (declarationNode.Parent.Kind() == SyntaxKind.LocalDeclarationStatement && 890if (initializer.Kind() == SyntaxKind.ArrayInitializerExpression) 1416if (node.Left.Kind() == SyntaxKind.TupleExpression || node.Left.Kind() == SyntaxKind.DeclarationExpression) 1722case SyntaxKind.SimpleMemberAccessExpression: 1723case SyntaxKind.PointerMemberAccessExpression: 1726case SyntaxKind.IdentifierName: 1729case SyntaxKind.ElementAccessExpression: 1771case SyntaxKind.SimpleMemberAccessExpression: 1772case SyntaxKind.PointerMemberAccessExpression: 1774case SyntaxKind.QualifiedName: 1777case SyntaxKind.IdentifierName: 1779case SyntaxKind.MemberBindingExpression: 1873if (node.Kind() != SyntaxKind.ArrayInitializerExpression) 1945hasUnsafeModifier: node.Parent?.Kind() == SyntaxKind.UnsafeStatement, 2290if (sourceType.SpecialType == SpecialType.System_Double && syntax.Kind() == SyntaxKind.NumericLiteralExpression && 2493while (nodeForError.Kind() == SyntaxKind.ParenthesizedExpression) 2498if (nodeForError.Kind() == SyntaxKind.SimpleMemberAccessExpression || nodeForError.Kind() == SyntaxKind.PointerMemberAccessExpression) 3599return new BoundBlock(node, locals, ImmutableArray.Create(statement)) { WasCompilerGenerated = node.Kind() != SyntaxKind.ArrowExpressionClause }; 3604return IsValidStatementExpression(expressionSyntax, expression) || expressionSyntax.Kind() == SyntaxKind.ThrowExpression; 3668Debug.Assert(body.Kind() != SyntaxKind.RefExpression); 3694if (method.Kind() == SyntaxKind.ConstructorDeclaration) 3747Debug.Assert(typeDecl.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration); 3790bool thisInitializer = initializer?.IsKind(SyntaxKind.ThisConstructorInitializer) == true; 3976if (ctorDecl.Modifiers.Any(SyntaxKind.UnsafeKeyword))
Binder\Binder_Symbols.cs (26)
367if (node.Identifier.Kind() == SyntaxKind.GlobalKeyword) 424case SyntaxKind.NullableType: 427case SyntaxKind.PredefinedType: 430case SyntaxKind.IdentifierName: 433case SyntaxKind.GenericName: 436case SyntaxKind.AliasQualifiedName: 439case SyntaxKind.QualifiedName: 445case SyntaxKind.SimpleMemberAccessExpression: 451case SyntaxKind.ArrayType: 456case SyntaxKind.PointerType: 459case SyntaxKind.FunctionPointerType: 479case SyntaxKind.OmittedTypeArgument: 484case SyntaxKind.TupleType: 490case SyntaxKind.RefType: 512case SyntaxKind.ScopedType: 674if (!permitDimensions && dimension.Count != 0 && dimension[0].Kind() != SyntaxKind.OmittedArraySizeExpression) 711if (nameToken.Kind() == SyntaxKind.IdentifierToken) 848case SyntaxKind.IdentifierName: 851case SyntaxKind.GenericName: 950if (node.Parent.Kind() == SyntaxKind.Attribute) 1029(invocation.Expression as IdentifierNameSyntax)?.Identifier.ContextualKind() == SyntaxKind.NameOfKeyword): 1385var arg = typeArgument.Kind() == SyntaxKind.OmittedTypeArgument 1397if (typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 1450if (!hasErrors && lookupResult.IsMultiViable && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 2392if (node.Kind() == SyntaxKind.AliasQualifiedName) 2667Debug.Assert(aliasOpt == null || aliasOpt == SyntaxFacts.GetText(SyntaxKind.GlobalKeyword));
Binder\Binder_Unsafe.cs (1)
175Debug.Assert((node.Kind() == SyntaxKind.SizeOfExpression) == ((object?)sizeOfTypeOpt != null), "Should have a type for (only) sizeof expressions.");
Binder\BinderFactory.BinderFactoryVisitor.cs (36)
286case SyntaxKind.PropertyDeclaration: 287case SyntaxKind.IndexerDeclaration: 292accessor = (parent.Kind() == SyntaxKind.GetAccessorDeclaration) ? propertySymbol.GetMethod : propertySymbol.SetMethod; 297case SyntaxKind.EventDeclaration: 298case SyntaxKind.EventFieldDeclaration: 306accessor = (parent.Kind() == SyntaxKind.AddAccessorDeclaration) ? eventSymbol.AddMethod : eventSymbol.RemoveMethod; 441if (node.Parent.Kind() == SyntaxKind.CompilationUnit && syntaxTree.Options.Kind != SourceCodeKind.Regular) 463case SyntaxKind.ConstructorDeclaration: 464return (baseMethodDeclarationSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) ? WellKnownMemberNames.StaticConstructorName : WellKnownMemberNames.InstanceConstructorName); 465case SyntaxKind.DestructorDeclaration: 467case SyntaxKind.OperatorDeclaration: 470case SyntaxKind.ConversionOperatorDeclaration: 473case SyntaxKind.MethodDeclaration: 492case SyntaxKind.PropertyDeclaration: 495case SyntaxKind.IndexerDeclaration: 497case SyntaxKind.EventDeclaration: 498case SyntaxKind.EventFieldDeclaration: 526Debug.Assert(basePropertyDeclarationSyntax.Kind() == SyntaxKind.PropertyDeclaration || basePropertyDeclarationSyntax.Kind() == SyntaxKind.IndexerDeclaration); 701var container = ((NamespaceOrTypeSymbol)outer.ContainingMemberOrLambda).GetSourceTypeMember(parent.Identifier.ValueText, 0, SyntaxKind.EnumDeclaration, parent); 870if (InScript && container.Kind() == SyntaxKind.CompilationUnit) 1040Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 1073if (containingNode.Kind() != SyntaxKind.CompilationUnit && _position == containingSpan.End) 1095if (node.IsKind(SyntaxKind.UsingDirective) && node.Parent == containingNode) 1287SyntaxKind memberKind = memberSyntax.Kind(); 1288if (memberKind == SyntaxKind.PropertyDeclaration || memberKind == SyntaxKind.IndexerDeclaration) 1317else if (memberKind == SyntaxKind.DelegateDeclaration) 1363if (memberSyntax.Kind() == SyntaxKind.MethodDeclaration) 1373else if (memberSyntax.Kind() == SyntaxKind.DelegateDeclaration) 1416if (baseTypeDeclaration is TypeDeclarationSyntax { SemicolonToken: { RawKind: (int)SyntaxKind.SemicolonToken }, OpenBraceToken: { RawKind: (int)SyntaxKind.None } } noBlockBodyTypeDeclarationWithSemicolon) 1448Debug.Assert(xmlSyntax is XmlAttributeSyntax || xmlSyntax.Kind() == SyntaxKind.XmlEmptyElement || xmlSyntax.Kind() == SyntaxKind.XmlElementStartTag);
Binder\BinderFactory.cs (4)
116if ((!InScript || node.Kind() != SyntaxKind.CompilationUnit) && node.Parent != null) 188case SyntaxKind.NamespaceDeclaration: 189case SyntaxKind.FileScopedNamespaceDeclaration: 197case SyntaxKind.CompilationUnit:
Binder\CatchClauseBinder.cs (1)
32if ((declarationOpt != null) && (declarationOpt.Identifier.Kind() != SyntaxKind.None))
Binder\DecisionDagBuilder.cs (2)
155if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 3507if (e.Syntax.IsKind(SyntaxKind.ListPattern))
Binder\DecisionDagBuilder_CheckOrReachability.cs (3)
178if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 195if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 284return syntax.Kind() == SyntaxKind.NotPattern;
Binder\EarlyWellKnownAttributeBinder.cs (48)
63case SyntaxKind.ObjectCreationExpression: 64case SyntaxKind.ImplicitObjectCreationExpression: 71case SyntaxKind.SizeOfExpression: 74case SyntaxKind.TypeOfExpression: 81case SyntaxKind.NumericLiteralExpression: 82case SyntaxKind.StringLiteralExpression: 83case SyntaxKind.Utf8StringLiteralExpression: 84case SyntaxKind.InterpolatedStringExpression: 85case SyntaxKind.CharacterLiteralExpression: 86case SyntaxKind.TrueLiteralExpression: 87case SyntaxKind.FalseLiteralExpression: 88case SyntaxKind.NullLiteralExpression: 92case SyntaxKind.IdentifierName: 93case SyntaxKind.GenericName: 94case SyntaxKind.AliasQualifiedName: 95case SyntaxKind.QualifiedName: 96case SyntaxKind.PredefinedType: 97case SyntaxKind.SimpleMemberAccessExpression: 102case SyntaxKind.ParenthesizedExpression: 105case SyntaxKind.CastExpression: 108case SyntaxKind.UncheckedExpression: 109case SyntaxKind.CheckedExpression: 112case SyntaxKind.DefaultExpression: 115case SyntaxKind.UnaryPlusExpression: 116case SyntaxKind.UnaryMinusExpression: 117case SyntaxKind.LogicalNotExpression: 118case SyntaxKind.BitwiseNotExpression: 121case SyntaxKind.AddExpression: 122case SyntaxKind.MultiplyExpression: 123case SyntaxKind.SubtractExpression: 124case SyntaxKind.DivideExpression: 125case SyntaxKind.ModuloExpression: 126case SyntaxKind.LeftShiftExpression: 127case SyntaxKind.RightShiftExpression: 128case SyntaxKind.UnsignedRightShiftExpression: 129case SyntaxKind.BitwiseAndExpression: 130case SyntaxKind.BitwiseOrExpression: 131case SyntaxKind.ExclusiveOrExpression: 132case SyntaxKind.LogicalAndExpression: 133case SyntaxKind.LogicalOrExpression: 134case SyntaxKind.EqualsExpression: 135case SyntaxKind.NotEqualsExpression: 136case SyntaxKind.GreaterThanExpression: 137case SyntaxKind.LessThanExpression: 138case SyntaxKind.GreaterThanOrEqualExpression: 139case SyntaxKind.LessThanOrEqualExpression: 140case SyntaxKind.InvocationExpression: // To support nameof(); anything else will be a compile-time error 141case SyntaxKind.ConditionalExpression: // The ?: conditional operator.
Binder\ExpressionVariableFinder.cs (34)
37case SyntaxKind.EqualsValueClause: 38case SyntaxKind.ArrowExpressionClause: 39case SyntaxKind.SwitchSection: 40case SyntaxKind.Attribute: 41case SyntaxKind.ThrowStatement: 42case SyntaxKind.ReturnStatement: 43case SyntaxKind.YieldReturnStatement: 44case SyntaxKind.ExpressionStatement: 45case SyntaxKind.LockStatement: 46case SyntaxKind.IfStatement: 47case SyntaxKind.SwitchStatement: 48case SyntaxKind.VariableDeclarator: 49case SyntaxKind.ConstructorDeclaration: 50case SyntaxKind.SwitchExpressionArm: 51case SyntaxKind.GotoCaseStatement: 52case SyntaxKind.PrimaryConstructorBaseType: 54case SyntaxKind.ArgumentList: 99if (node.Kind() == SyntaxKind.GotoCaseStatement) 143case SyntaxKind.CasePatternSwitchLabel: 157case SyntaxKind.CaseSwitchLabel: 215if (node.Designation?.Kind() == SyntaxKind.SingleVariableDesignation) 226Debug.Assert(node.Designation == null || node.Designation.Kind() == SyntaxKind.DiscardDesignation); 242case SyntaxKind.SingleVariableDesignation: 249case SyntaxKind.DiscardDesignation: 251case SyntaxKind.ParenthesizedVariableDesignation: 307if (clause.Kind() == SyntaxKind.JoinClause) 419case SyntaxKind.SingleVariableDesignation: 427case SyntaxKind.DiscardDesignation: 430case SyntaxKind.ParenthesizedVariableDesignation: 472case SyntaxKind.TupleExpression: 481case SyntaxKind.DeclarationExpression: 502case SyntaxKind.SingleVariableDesignation: 512case SyntaxKind.ParenthesizedVariableDesignation: 521case SyntaxKind.DiscardDesignation:
Binder\FixedStatementBinder.cs (1)
39if (size.Kind() != SyntaxKind.OmittedArraySizeExpression)
Binder\ForEachLoopBinder.cs (11)
33return (_syntax.Kind() == SyntaxKind.ForEachStatement) ? (SourceLocalSymbol)this.Locals[0] : null; 74case SyntaxKind.ForEachVariableStatement: 85case SyntaxKind.ForEachStatement: 110case SyntaxKind.TupleExpression: 119case SyntaxKind.DeclarationExpression: 128case SyntaxKind.IdentifierName: 147case SyntaxKind.SingleVariableDesignation: 161case SyntaxKind.ParenthesizedVariableDesignation: 170case SyntaxKind.DiscardDesignation: 280case SyntaxKind.ForEachStatement: 377case SyntaxKind.ForEachVariableStatement:
Binder\ForLoopBinder.cs (1)
39if (size.Kind() != SyntaxKind.OmittedArraySizeExpression)
Binder\LocalBinderFactory.cs (22)
60if (size.Kind() != SyntaxKind.OmittedArraySizeExpression) 93else if (syntax.Kind() != SyntaxKind.Block && (statement = syntax as StatementSyntax) != null) 127if (member.Kind() == SyntaxKind.GlobalStatement) 176Debug.Assert(node.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration); 387if (body.Kind() == SyntaxKind.Block) 497if (node.Parent is ConstructorDeclarationSyntax { Modifiers: var modifiers } && modifiers.Any(SyntaxKind.UnsafeKeyword)) 679Binder binder = _enclosing.WithCheckedOrUncheckedRegion(@checked: node.Kind() == SyntaxKind.CheckedExpression); 686Binder binder = _enclosing.WithCheckedOrUncheckedRegion(@checked: node.Kind() == SyntaxKind.CheckedStatement); 760case SyntaxKind.CasePatternSwitchLabel: 770case SyntaxKind.CaseSwitchLabel: 1047case SyntaxKind.LocalDeclarationStatement: 1048case SyntaxKind.LabeledStatement: 1049case SyntaxKind.LocalFunctionStatement: 1053case SyntaxKind.ExpressionStatement: 1054case SyntaxKind.LockStatement: 1055case SyntaxKind.IfStatement: 1056case SyntaxKind.YieldReturnStatement: 1057case SyntaxKind.ReturnStatement: 1058case SyntaxKind.ThrowStatement: 1063case SyntaxKind.SwitchStatement: 1112if (clause.Kind() == SyntaxKind.JoinClause)
Binder\LocalScopeBinder.cs (15)
179while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 186case SyntaxKind.LocalDeclarationStatement: 225case SyntaxKind.LocalFunctionStatement: 260case SyntaxKind.ExpressionStatement: 261case SyntaxKind.IfStatement: 262case SyntaxKind.YieldReturnStatement: 263case SyntaxKind.ReturnStatement: 264case SyntaxKind.ThrowStatement: 265case SyntaxKind.GotoCaseStatement: 269case SyntaxKind.SwitchStatement: 274case SyntaxKind.LockStatement: 289if (expression.Kind() != SyntaxKind.OmittedArraySizeExpression) 313while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 318if (innerStatement.Kind() == SyntaxKind.LocalFunctionStatement) 364while (statement.Kind() == SyntaxKind.LabeledStatement)
Binder\LockOrUsingBinder.cs (3)
44Debug.Assert(targetExpressionSyntax.Parent.Kind() == SyntaxKind.LockStatement || 45targetExpressionSyntax.Parent.Kind() == SyntaxKind.UsingStatement); 54if (targetExpressionSyntax.Kind() == SyntaxKind.IdentifierName)
Binder\ScriptLocalScopeBinder.cs (1)
84if (member.Kind() != SyntaxKind.GlobalStatement)
Binder\Semantics\Conversions\ConversionsBase.cs (3)
1624if (anonymousFunction.Syntax.Kind() == SyntaxKind.AnonymousMethodExpression) 1768var greenNode = new Syntax.InternalSyntax.LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression, new Syntax.InternalSyntax.SyntaxToken(SyntaxKind.NumericLiteralToken));
Binder\Semantics\Operators\OperatorFacts.cs (50)
63public static string BinaryOperatorNameFromSyntaxKind(SyntaxKind kind, bool isChecked) 69internal static string BinaryOperatorNameFromSyntaxKindIfAny(SyntaxKind kind, bool isChecked) 73case SyntaxKind.PlusToken: return isChecked ? WellKnownMemberNames.CheckedAdditionOperatorName : WellKnownMemberNames.AdditionOperatorName; 74case SyntaxKind.MinusToken: return isChecked ? WellKnownMemberNames.CheckedSubtractionOperatorName : WellKnownMemberNames.SubtractionOperatorName; 75case SyntaxKind.AsteriskToken: return isChecked ? WellKnownMemberNames.CheckedMultiplyOperatorName : WellKnownMemberNames.MultiplyOperatorName; 76case SyntaxKind.SlashToken: return isChecked ? WellKnownMemberNames.CheckedDivisionOperatorName : WellKnownMemberNames.DivisionOperatorName; 77case SyntaxKind.PercentToken: return WellKnownMemberNames.ModulusOperatorName; 78case SyntaxKind.CaretToken: return WellKnownMemberNames.ExclusiveOrOperatorName; 79case SyntaxKind.AmpersandToken: return WellKnownMemberNames.BitwiseAndOperatorName; 80case SyntaxKind.BarToken: return WellKnownMemberNames.BitwiseOrOperatorName; 81case SyntaxKind.EqualsEqualsToken: return WellKnownMemberNames.EqualityOperatorName; 82case SyntaxKind.LessThanToken: return WellKnownMemberNames.LessThanOperatorName; 83case SyntaxKind.LessThanEqualsToken: return WellKnownMemberNames.LessThanOrEqualOperatorName; 84case SyntaxKind.LessThanLessThanToken: return WellKnownMemberNames.LeftShiftOperatorName; 85case SyntaxKind.GreaterThanToken: return WellKnownMemberNames.GreaterThanOperatorName; 86case SyntaxKind.GreaterThanEqualsToken: return WellKnownMemberNames.GreaterThanOrEqualOperatorName; 87case SyntaxKind.GreaterThanGreaterThanToken: return WellKnownMemberNames.RightShiftOperatorName; 88case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: return WellKnownMemberNames.UnsignedRightShiftOperatorName; 89case SyntaxKind.ExclamationEqualsToken: return WellKnownMemberNames.InequalityOperatorName; 95internal static string CompoundAssignmentOperatorNameFromSyntaxKind(SyntaxKind kind, bool isChecked) 99case SyntaxKind.PlusEqualsToken: return isChecked ? WellKnownMemberNames.CheckedAdditionAssignmentOperatorName : WellKnownMemberNames.AdditionAssignmentOperatorName; 100case SyntaxKind.MinusEqualsToken: return isChecked ? WellKnownMemberNames.CheckedSubtractionAssignmentOperatorName : WellKnownMemberNames.SubtractionAssignmentOperatorName; 101case SyntaxKind.AsteriskEqualsToken: return isChecked ? WellKnownMemberNames.CheckedMultiplicationAssignmentOperatorName : WellKnownMemberNames.MultiplicationAssignmentOperatorName; 102case SyntaxKind.SlashEqualsToken: return isChecked ? WellKnownMemberNames.CheckedDivisionAssignmentOperatorName : WellKnownMemberNames.DivisionAssignmentOperatorName; 103case SyntaxKind.PercentEqualsToken: return WellKnownMemberNames.ModulusAssignmentOperatorName; 104case SyntaxKind.CaretEqualsToken: return WellKnownMemberNames.ExclusiveOrAssignmentOperatorName; 105case SyntaxKind.AmpersandEqualsToken: return WellKnownMemberNames.BitwiseAndAssignmentOperatorName; 106case SyntaxKind.BarEqualsToken: return WellKnownMemberNames.BitwiseOrAssignmentOperatorName; 107case SyntaxKind.LessThanLessThanEqualsToken: return WellKnownMemberNames.LeftShiftAssignmentOperatorName; 108case SyntaxKind.GreaterThanGreaterThanEqualsToken: return WellKnownMemberNames.RightShiftAssignmentOperatorName; 109case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: return WellKnownMemberNames.UnsignedRightShiftAssignmentOperatorName; 110case SyntaxKind.PlusPlusToken: return isChecked ? WellKnownMemberNames.CheckedIncrementAssignmentOperatorName : WellKnownMemberNames.IncrementAssignmentOperatorName; 111case SyntaxKind.MinusMinusToken: return isChecked ? WellKnownMemberNames.CheckedDecrementAssignmentOperatorName : WellKnownMemberNames.DecrementAssignmentOperatorName; 147public static string UnaryOperatorNameFromSyntaxKind(SyntaxKind kind, bool isChecked) 153internal static string UnaryOperatorNameFromSyntaxKindIfAny(SyntaxKind kind, bool isChecked) 157case SyntaxKind.PlusToken: return WellKnownMemberNames.UnaryPlusOperatorName; 158case SyntaxKind.MinusToken: return isChecked ? WellKnownMemberNames.CheckedUnaryNegationOperatorName : WellKnownMemberNames.UnaryNegationOperatorName; 159case SyntaxKind.TildeToken: return WellKnownMemberNames.OnesComplementOperatorName; 160case SyntaxKind.ExclamationToken: return WellKnownMemberNames.LogicalNotOperatorName; 161case SyntaxKind.PlusPlusToken: return isChecked ? WellKnownMemberNames.CheckedIncrementOperatorName : WellKnownMemberNames.IncrementOperatorName; 162case SyntaxKind.MinusMinusToken: return isChecked ? WellKnownMemberNames.CheckedDecrementOperatorName : WellKnownMemberNames.DecrementOperatorName; 163case SyntaxKind.TrueKeyword: return WellKnownMemberNames.TrueOperatorName; 164case SyntaxKind.FalseKeyword: return WellKnownMemberNames.FalseOperatorName; 177var opTokenKind = declaration.OperatorToken.Kind; 178bool isChecked = declaration.CheckedKeyword?.Kind == SyntaxKind.CheckedKeyword; 183if (opTokenKind != SyntaxKind.AsteriskToken && // IsPrefixUnaryExpressionOperatorToken treats it as pointer dereference operator 194if (opTokenKind is SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken && 222case SyntaxKind.ImplicitKeyword: 225return declaration.CheckedKeyword?.Kind == SyntaxKind.CheckedKeyword ?
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (2)
691else if (nodeOpt?.Kind() == SyntaxKind.AwaitExpression && symbol.Name == WellKnownMemberNames.GetAwaiter) 940badParamName = SyntaxFacts.GetText(SyntaxKind.ArgListKeyword);
Binder\SwitchBinder.cs (10)
100SyntaxKind labelKind = label.IdentifierNodeOrToken.Kind(); 101if (labelKind == SyntaxKind.IdentifierToken) 113else if (labelKind == SyntaxKind.DefaultSwitchLabel) 208case SyntaxKind.CaseSwitchLabel: 223case SyntaxKind.CasePatternSwitchLabel: 496Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement || node.Kind() == SyntaxKind.GotoDefaultStatement); 516Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement); 541Debug.Assert(node.Kind() == SyntaxKind.GotoDefaultStatement); 551if (node.Kind() == SyntaxKind.GotoCaseStatement)
Binder\SwitchBinder_Patterns.cs (4)
104if (!label.HasErrors && isSubsumed(label, reachableLabels) && label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 246case SyntaxKind.CaseSwitchLabel: 259case SyntaxKind.DefaultSwitchLabel: 277case SyntaxKind.CasePatternSwitchLabel:
Binder\UsingStatementBinder.cs (3)
49if (size.Kind() != SyntaxKind.OmittedArraySizeExpression) 92bool isUsingDeclaration = syntax.Kind() == SyntaxKind.LocalDeclarationStatement; 93bool isExpression = !isUsingDeclaration && syntax.Kind() != SyntaxKind.VariableDeclaration;
Binder\WhileBinder.cs (4)
24Debug.Assert(syntax != null && (syntax.IsKind(SyntaxKind.WhileStatement) || syntax.IsKind(SyntaxKind.DoStatement))); 55case SyntaxKind.WhileStatement: 58case SyntaxKind.DoStatement:
Binder\WithCrefTypeParametersBinder.cs (13)
50case SyntaxKind.TypeCref: 55case SyntaxKind.QualifiedCref: 62case SyntaxKind.NameMemberCref: 63case SyntaxKind.IndexerMemberCref: 64case SyntaxKind.OperatorMemberCref: 65case SyntaxKind.ConversionOperatorMemberCref: 66case SyntaxKind.ExtensionMemberCref: 83case SyntaxKind.AliasQualifiedName: 86case SyntaxKind.QualifiedName: 93case SyntaxKind.GenericName: 96case SyntaxKind.IdentifierName: 97case SyntaxKind.PredefinedType: 133if (typeArguments[i].Kind() == SyntaxKind.IdentifierName)
Binder\WithExternAliasesBinder.cs (3)
91Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration);
Binder\WithExternAndUsingAliasesBinder.cs (3)
120Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration);
Binder\WithUsingNamespacesAndTypesBinder.cs (5)
264Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 294Debug.Assert(declarationSyntax.IsKind(SyntaxKind.CompilationUnit) || declarationSyntax.IsKind(SyntaxKind.NamespaceDeclaration));
BoundTree\UnboundLambda.cs (7)
75public MessageID MessageID { get { return Syntax.Kind() == SyntaxKind.AnonymousMethodExpression ? MessageID.IDS_AnonMethod : MessageID.IDS_Lambda; } } 713else if (type.IsRefLikeOrAllowsRefLikeType() && ParameterSyntax(i)?.Modifiers.Any(SyntaxKind.ParamsKeyword) == true) 1561public override MessageID MessageID { get { return this.UnboundLambda.Syntax.Kind() == SyntaxKind.AnonymousMethodExpression ? MessageID.IDS_AnonMethod : MessageID.IDS_Lambda; } } 1578case SyntaxKind.SimpleLambdaExpression: 1580case SyntaxKind.ParenthesizedLambdaExpression: 1582case SyntaxKind.AnonymousMethodExpression: 1587private bool IsExpressionLambda { get { return Body.Kind() != SyntaxKind.Block; } }
BoundTree\VariablePendingInference.cs (6)
37Debug.Assert(this.Syntax.Kind() == SyntaxKind.SingleVariableDesignation || 38(this.Syntax.Kind() == SyntaxKind.DeclarationExpression && 39((DeclarationExpressionSyntax)this.Syntax).Designation.Kind() == SyntaxKind.SingleVariableDesignation)); 61SyntaxNode typeOrDesignationSyntax = this.Syntax.Kind() == SyntaxKind.DeclarationExpression ? 124case SyntaxKind.DeclarationExpression: 127case SyntaxKind.SingleVariableDesignation:
CodeGen\EmitStatement.cs (6)
812(local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchSection || local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchExpressionArm)); 857return _ilEmitStyle == ILEmitStyle.Debug && _method.GenerateDebugInfo && _methodBodySyntaxOpt?.IsKind(SyntaxKind.Block) == true || 868(boundReturnStatement.Syntax.IsKind(SyntaxKind.Block) || _method?.IsImplicitConstructor == true) && 1866(local.ScopeDesignatorOpt?.Kind() is SyntaxKind.SwitchSection or SyntaxKind.SwitchExpressionArm)))
CommandLine\CSharpCompiler.cs (1)
351d => d.IsActive && !d.HasErrors && d.Kind() == SyntaxKind.LineDirectiveTrivia))
Compilation\AttributeSemanticModel.cs (3)
65case SyntaxKind.Attribute: 68case SyntaxKind.AttributeArgument: 87if (node.Kind() == SyntaxKind.Attribute)
Compilation\CSharpCompilation.cs (16)
870if (root.DescendantNodes(n => n is GlobalStatementSyntax || n is StatementSyntax || n is CompilationUnitSyntax).Any(n => n.IsKind(SyntaxKind.ReturnStatement))) 876var lastGlobalStatement = (GlobalStatementSyntax?)root.Members.LastOrDefault(m => m.IsKind(SyntaxKind.GlobalStatement)); 880if (statement.IsKind(SyntaxKind.ExpressionStatement)) 2769ErrorCode code = info.Kind == SyntaxKind.ExternAliasDirective 2783else if (info.Kind == SyntaxKind.ExternAliasDirective) 2892public readonly SyntaxKind Kind; 2895public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) 4020var checksumDirectives = tree.GetRoot().GetDirectives(d => d.Kind() == SyntaxKind.PragmaChecksumDirectiveTrivia && 4451var syntaxKind = SyntaxFacts.GetOperatorKind(name); 4452if (syntaxKind == SyntaxKind.None) 4674var syntaxKind = SyntaxFacts.GetOperatorKind(name); 4678if (syntaxKind == SyntaxKind.None || name is WellKnownMemberNames.TrueOperatorName or WellKnownMemberNames.FalseOperatorName) 4967Func<SyntaxNode, SyntaxKind> getKind = node => node.Kind(); 4968Func<SyntaxTrivia, bool> isComment = trivia => trivia.Kind() == SyntaxKind.SingleLineCommentTrivia || trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 4969return new AnalyzerDriver<SyntaxKind>(analyzers, getKind, analyzerManager, severityFilter, isComment);
Compilation\CSharpSemanticModel.cs (64)
71case SyntaxKind.CollectionInitializerExpression: 72case SyntaxKind.ObjectInitializerExpression: 84case SyntaxKind.ComplexElementInitializerExpression: 92case SyntaxKind.IdentifierName: 94if (!isSpeculative && node.Parent != null && node.Parent.Kind() == SyntaxKind.NameEquals && node.Parent.Parent.Kind() == SyntaxKind.UsingDirective) 101case SyntaxKind.OmittedTypeArgument: 102case SyntaxKind.RefExpression: 103case SyntaxKind.RefType: 104case SyntaxKind.ScopedType: 305if (expression.IsKind(SyntaxKind.QualifiedName)) 347while (crefSyntax.Kind() == SyntaxKind.QualifiedCref) 354case SyntaxKind.NameMemberCref: 356case SyntaxKind.IndexerMemberCref: 358case SyntaxKind.OperatorMemberCref: 360case SyntaxKind.ConversionOperatorMemberCref: 362case SyntaxKind.ExtensionMemberCref: 540case SyntaxKind.SingleVariableDesignation: 543case SyntaxKind.DiscardDesignation: 546case SyntaxKind.ParenthesizedVariableDesignation: 563if (declaration.Designation.Kind() != SyntaxKind.SingleVariableDesignation) 616if (expression.Parent != null && expression.Parent.Kind() == SyntaxKind.CollectionInitializerExpression) 624initializer.Parent.Kind() == SyntaxKind.SimpleAssignmentExpression && 627initializer.Parent.Parent.Kind() == SyntaxKind.ObjectInitializerExpression) 978case SyntaxKind.SingleVariableDesignation: 984case SyntaxKind.DiscardDesignation: 988case SyntaxKind.ParenthesizedVariableDesignation: 1256if (node.Kind() == SyntaxKind.XmlCrefAttribute || node.Kind() == SyntaxKind.XmlNameAttribute) 1874if (curr.IsKind(SyntaxKind.TypeOfExpression)) 2410return parent.IsKind(SyntaxKind.GotoStatement) 2846if (expression.Kind() == SyntaxKind.DeclarationExpression) 3314Debug.Assert(catchClause.Kind() == SyntaxKind.CatchClause); 3382if (expr.Syntax.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ImplicitObjectCreationExpression) 3409boundNodeForSyntacticParent.Syntax.Kind() == SyntaxKind.ObjectCreationExpression && 4001parentSyntax.Kind() == SyntaxKind.Attribute && ((AttributeSyntax)parentSyntax).Name == boundNode.Syntax) 4519if (parent3.IsKind(SyntaxKind.TupleExpression)) 4526if (parent3.IsKind(SyntaxKind.PropertyPatternClause) || parent3.IsKind(SyntaxKind.PositionalPatternClause)) 4894var kind = parentNode.Kind(); 4897case SyntaxKind.IfDirectiveTrivia: 4902case SyntaxKind.ElifDirectiveTrivia: 5155case SyntaxKind.LocalFunctionStatement: 5157case SyntaxKind.LabeledStatement: 5159case SyntaxKind.CaseSwitchLabel: 5160case SyntaxKind.DefaultSwitchLabel: 5162case SyntaxKind.AnonymousObjectCreationExpression: 5164case SyntaxKind.AnonymousObjectMemberDeclarator: 5166case SyntaxKind.TupleExpression: 5168case SyntaxKind.Argument: 5170case SyntaxKind.VariableDeclarator: 5172case SyntaxKind.SingleVariableDesignation: 5174case SyntaxKind.TupleElement: 5176case SyntaxKind.NamespaceDeclaration: 5178case SyntaxKind.FileScopedNamespaceDeclaration: 5180case SyntaxKind.Parameter: 5182case SyntaxKind.TypeParameter: 5184case SyntaxKind.UsingDirective: 5192case SyntaxKind.ForEachStatement: 5194case SyntaxKind.CatchDeclaration: 5196case SyntaxKind.JoinIntoClause: 5198case SyntaxKind.QueryContinuation: 5200case SyntaxKind.CompilationUnit:
Compilation\InitializerSemanticModel.cs (14)
42Debug.Assert(syntax.IsKind(SyntaxKind.VariableDeclarator) || syntax.IsKind(SyntaxKind.EnumMemberDeclaration)); 52Debug.Assert(syntax.IsKind(SyntaxKind.PropertyDeclaration)); 84case SyntaxKind.VariableDeclarator: 88case SyntaxKind.Parameter: 92case SyntaxKind.EqualsValueClause: 96case SyntaxKind.EnumMemberDeclaration: 100case SyntaxKind.PropertyDeclaration: 117case SyntaxKind.EqualsValueClause: 121case SyntaxKind.VariableDeclarator: 125case SyntaxKind.PropertyDeclaration: 129case SyntaxKind.Parameter: 133case SyntaxKind.EnumMemberDeclaration: 194case SyntaxKind.EqualsValueClause:
Compilation\MemberSemanticModel.cs (60)
240SyntaxKind kind = current.Kind(); 252else if (kind == SyntaxKind.LocalFunctionStatement) 263else if (kind == SyntaxKind.CatchClause) 270else if (kind == SyntaxKind.CatchFilterClause) 285else if (kind == SyntaxKind.TypeOfExpression && 294else if (kind == SyntaxKind.SwitchSection) 301else if (kind == SyntaxKind.ArgumentList) 310else if (kind == SyntaxKind.EqualsValueClause) 314else if (kind == SyntaxKind.Attribute) 318else if (kind == SyntaxKind.ArrowExpressionClause) 322else if (kind == SyntaxKind.ThisConstructorInitializer || kind == SyntaxKind.BaseConstructorInitializer || kind == SyntaxKind.PrimaryConstructorBaseType) 326else if (kind == SyntaxKind.ConstructorDeclaration) 330else if (kind == SyntaxKind.SwitchExpression) 334else if (kind == SyntaxKind.SwitchExpressionArm) 390case SyntaxKind.SwitchStatement: 399case SyntaxKind.ForStatement: 415case SyntaxKind.ForEachStatement: 416case SyntaxKind.ForEachVariableStatement: 418var start = stmt.Kind() == SyntaxKind.ForEachVariableStatement ? foreachStmt.InKeyword : foreachStmt.OpenParenToken; 442if (expression.Kind() == SyntaxKind.DeclarationExpression) 851else if (paramList.Parent.Kind() == SyntaxKind.LocalFunctionStatement) 919if (node.Kind() != SyntaxKind.AwaitExpression) 931if (node.UsingKeyword.IsKind(SyntaxKind.None) || node.AwaitKeyword.IsKind(SyntaxKind.None)) 943if (node.AwaitKeyword.IsKind(SyntaxKind.None)) 1371if (bindableParent != null && bindableParent.Kind() == SyntaxKind.SimpleMemberAccessExpression && ((MemberAccessExpressionSyntax)bindableParent).Expression == bindableNode) 1586case SyntaxKind.ThisConstructorInitializer: 1587case SyntaxKind.BaseConstructorInitializer: 1588case SyntaxKind.PrimaryConstructorBaseType: 1590case SyntaxKind.ArrowExpressionClause: 1593if (current.Parent == null || current.Parent.Kind() != SyntaxKind.LocalFunctionStatement) 2205case SyntaxKind.GetAccessorDeclaration: 2206case SyntaxKind.SetAccessorDeclaration: 2207case SyntaxKind.InitAccessorDeclaration: 2208case SyntaxKind.AddAccessorDeclaration: 2209case SyntaxKind.RemoveAccessorDeclaration: 2210case SyntaxKind.MethodDeclaration: 2211case SyntaxKind.ConstructorDeclaration: 2212case SyntaxKind.DestructorDeclaration: 2213case SyntaxKind.OperatorDeclaration: 2214case SyntaxKind.ConversionOperatorDeclaration: 2215case SyntaxKind.GlobalStatement: 2216case SyntaxKind.Subpattern: 2218case SyntaxKind.PositionalPatternClause: 2235case PostfixUnaryExpressionSyntax { RawKind: (int)SyntaxKind.SuppressNullableWarningExpression } n: 2256case SyntaxKind.IdentifierName: 2257case SyntaxKind.GenericName: 2266case SyntaxKind.AnonymousObjectMemberDeclarator: 2269case SyntaxKind.VariableDeclarator: // declarators are mapped in SyntaxBinder 2275Debug.Assert(parent.Kind() == SyntaxKind.VariableDeclaration); 2277if (grandparent != null && grandparent.Kind() == SyntaxKind.LocalDeclarationStatement && 2339case SyntaxKind.ParenthesizedExpression: 2340case SyntaxKind.RefExpression: 2341case SyntaxKind.RefType: 2342case SyntaxKind.ScopedType: 2362case { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, Parent.RawKind: (int)SyntaxKind.InvocationExpression }: 2368case { RawKind: (int)SyntaxKind.ComplexElementInitializerExpression }:
Compilation\MethodBodySemanticModel.cs (20)
55Debug.Assert((syntax.Kind() == SyntaxKind.CompilationUnit) == (!IsSpeculativeSemanticModel && owner is SynthesizedSimpleProgramEntryPointSymbol)); 78case SyntaxKind.ArrowExpressionClause: 81case SyntaxKind.BaseConstructorInitializer: 82case SyntaxKind.ThisConstructorInitializer: 85case SyntaxKind.PrimaryConstructorBaseType: 88case SyntaxKind.MethodDeclaration: 89case SyntaxKind.ConversionOperatorDeclaration: 90case SyntaxKind.OperatorDeclaration: 91case SyntaxKind.ConstructorDeclaration: 92case SyntaxKind.DestructorDeclaration: 93case SyntaxKind.GetAccessorDeclaration: 94case SyntaxKind.SetAccessorDeclaration: 95case SyntaxKind.InitAccessorDeclaration: 96case SyntaxKind.AddAccessorDeclaration: 97case SyntaxKind.RemoveAccessorDeclaration: 98case SyntaxKind.CompilationUnit: 99case SyntaxKind.RecordDeclaration: 100case SyntaxKind.ClassDeclaration: 262Debug.Assert(typeDecl.Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration));
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
150var attributeOrParameter = node.FirstAncestorOrSelf<SyntaxNode>(static n => n.Kind() is SyntaxKind.Attribute or SyntaxKind.Parameter);
Compilation\SyntaxTreeSemanticModel.cs (112)
247else if (node.Parent.Kind() == SyntaxKind.XmlNameAttribute && (attrSyntax = (XmlNameAttributeSyntax)node.Parent).Identifier == node) 508if (parent is BaseTypeSyntax baseType && parent.Parent != null && parent.Parent.Kind() == SyntaxKind.BaseList && baseType.Type == expression) 524if (expression.Kind() == SyntaxKind.DeclarationExpression) 788case SyntaxKind.AddAccessorDeclaration: 789case SyntaxKind.RemoveAccessorDeclaration: 790case SyntaxKind.GetAccessorDeclaration: 791case SyntaxKind.SetAccessorDeclaration: 792case SyntaxKind.InitAccessorDeclaration: 796case SyntaxKind.ConstructorDeclaration: 802case SyntaxKind.ClassDeclaration: 803case SyntaxKind.RecordDeclaration: 818case SyntaxKind.ConversionOperatorDeclaration: 819case SyntaxKind.DestructorDeclaration: 820case SyntaxKind.MethodDeclaration: 821case SyntaxKind.OperatorDeclaration: 852case SyntaxKind.MethodDeclaration: 853case SyntaxKind.ConversionOperatorDeclaration: 854case SyntaxKind.OperatorDeclaration: 862case SyntaxKind.ConstructorDeclaration: 872case SyntaxKind.ClassDeclaration: 873case SyntaxKind.RecordDeclaration: 881case SyntaxKind.DestructorDeclaration: 889case SyntaxKind.GetAccessorDeclaration: 890case SyntaxKind.SetAccessorDeclaration: 891case SyntaxKind.InitAccessorDeclaration: 892case SyntaxKind.AddAccessorDeclaration: 893case SyntaxKind.RemoveAccessorDeclaration: 901case SyntaxKind.IndexerDeclaration: 907case SyntaxKind.FieldDeclaration: 908case SyntaxKind.EventFieldDeclaration: 922case SyntaxKind.EnumMemberDeclaration: 930case SyntaxKind.PropertyDeclaration: 937case SyntaxKind.GlobalStatement: 945case SyntaxKind.CompilationUnit: 952case SyntaxKind.Attribute: 955case SyntaxKind.Parameter: 1076case SyntaxKind.CompilationUnit: 1079case SyntaxKind.MethodDeclaration: 1080case SyntaxKind.ConversionOperatorDeclaration: 1081case SyntaxKind.OperatorDeclaration: 1082case SyntaxKind.ConstructorDeclaration: 1083case SyntaxKind.DestructorDeclaration: 1090case SyntaxKind.ClassDeclaration: 1091case SyntaxKind.RecordDeclaration: 1103case SyntaxKind.GetAccessorDeclaration: 1104case SyntaxKind.SetAccessorDeclaration: 1105case SyntaxKind.InitAccessorDeclaration: 1106case SyntaxKind.AddAccessorDeclaration: 1107case SyntaxKind.RemoveAccessorDeclaration: 1114case SyntaxKind.Block: 1119case SyntaxKind.EqualsValueClause: 1122case SyntaxKind.VariableDeclarator: 1135case SyntaxKind.PropertyDeclaration: 1146case SyntaxKind.Parameter: 1163case SyntaxKind.EnumMemberDeclaration: 1180case SyntaxKind.ArrowExpressionClause: 1206case SyntaxKind.GlobalStatement: 1210if (parent.Kind() == SyntaxKind.CompilationUnit && 1235case SyntaxKind.Attribute: 1265case SyntaxKind.FieldDeclaration: 1268case SyntaxKind.EventFieldDeclaration: 1292(node.Kind() == SyntaxKind.Attribute) || (node.Kind() == SyntaxKind.Parameter); 1326if (declarationSyntax.Parent.Kind() == SyntaxKind.CompilationUnit) 1475case SyntaxKind.GlobalStatement: 1479case SyntaxKind.IncompleteMember: 1483case SyntaxKind.EventFieldDeclaration: 1484case SyntaxKind.FieldDeclaration: 1598if (declarationSyntax.Kind() == SyntaxKind.UnknownAccessorDeclaration) 1608case SyntaxKind.PropertyDeclaration: 1609case SyntaxKind.IndexerDeclaration: 1610case SyntaxKind.EventDeclaration: 1611case SyntaxKind.EventFieldDeclaration: 1616Debug.Assert(declarationSyntax.Keyword.Kind() != SyntaxKind.IdentifierToken); 1633case SyntaxKind.PropertyDeclaration: 1634case SyntaxKind.IndexerDeclaration: 1653case SyntaxKind.MethodDeclaration: 1659case SyntaxKind.PropertyDeclaration: 1665case SyntaxKind.IndexerDeclaration: 1671case SyntaxKind.EventDeclaration: 1677case SyntaxKind.DelegateDeclaration: 1680case SyntaxKind.InterfaceDeclaration: 1681case SyntaxKind.StructDeclaration: 1682case SyntaxKind.UnionDeclaration: 1683case SyntaxKind.ClassDeclaration: 1684case SyntaxKind.EnumDeclaration: 1685case SyntaxKind.RecordDeclaration: 1686case SyntaxKind.RecordStructDeclaration: 1689case SyntaxKind.VariableDeclarator: 1692case SyntaxKind.EnumMemberDeclaration: 1695case SyntaxKind.DestructorDeclaration: 1698case SyntaxKind.ConstructorDeclaration: 1699if (((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword)) 1708case SyntaxKind.OperatorDeclaration: 1714case SyntaxKind.ConversionOperatorDeclaration: 1720case SyntaxKind.EventFieldDeclaration: 1721case SyntaxKind.FieldDeclaration: 1724case SyntaxKind.IncompleteMember: 1752case SyntaxKind.GenericName: 1753case SyntaxKind.IdentifierName: 1756case SyntaxKind.QualifiedName: 1762case SyntaxKind.AliasQualifiedName: 2355if (memberDeclaration.Parent.Kind() == SyntaxKind.CompilationUnit) 2358if (memberDeclaration.Kind() is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration) 2389if (memberDeclaration.Kind() is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration 2481return (node) => node.Kind() != SyntaxKind.GlobalStatement || node.Parent != unit; 2486return (node) => node.Parent != unit || node.Kind() == SyntaxKind.GlobalStatement; 2499if (typeDeclaration.Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration)) 2528!(node.Kind() == SyntaxKind.ArgumentList && node == typeDeclaration.PrimaryConstructorBaseTypeIfClass?.ArgumentList);
Compilation\SyntaxTreeSemanticModel_RegionAnalysisContext.cs (1)
22while (expression.Kind() == SyntaxKind.ParenthesizedExpression)
Compiler\DocumentationCommentCompiler.cs (2)
407if (trivia.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia)
Compiler\DocumentationCommentCompiler.DocumentationCommentWalker.cs (7)
83if (!startLessThanToken.LeadingTrivia.Any(SyntaxKind.DocumentationCommentExteriorTrivia)) 103if (endGreaterThanToken.GetNextToken() is SyntaxToken newLineToken && newLineToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 141SyntaxKind nodeKind = node.Kind(); 144if (nodeKind == SyntaxKind.XmlCrefAttribute) 182else if (diagnose && nodeKind == SyntaxKind.XmlNameAttribute) 200if (nodeKind == SyntaxKind.XmlEmptyElement) 204else if (nodeKind == SyntaxKind.XmlElementStartTag)
Compiler\MethodBodySynthesizer.cs (3)
535Debug.Assert(syntax.Kind() == SyntaxKind.Block || syntax.Kind() == SyntaxKind.ArrowExpressionClause); 556if (syntax.Kind() == SyntaxKind.Block)
Compiler\MethodCompiler.cs (6)
2202case GotoStatementSyntax { RawKind: (int)SyntaxKind.GotoStatement }: 2210!(expression.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 2242assignment.Parent?.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 2250!(id.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 2297if (parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && isExpression.Right == child)
CSharpExtensions.cs (47)
25public static bool IsKind(this SyntaxToken token, SyntaxKind kind) 36public static bool IsKind(this SyntaxTrivia trivia, SyntaxKind kind) 47public static bool IsKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 58public static bool IsKind(this SyntaxNodeOrToken nodeOrToken, SyntaxKind kind) 64public static bool ContainsDirective(this SyntaxNode node, SyntaxKind kind) 67internal static SyntaxKind ContextualKind(this SyntaxToken token) 69return (object)token.Language == (object)LanguageNames.CSharp ? (SyntaxKind)token.RawContextualKind : SyntaxKind.None; 74return identifier.ContextualKind() == SyntaxKind.UnderscoreToken; 81/// <param name="kind">The <see cref="SyntaxKind"/> to find.</param> 83public static int IndexOf<TNode>(this SyntaxList<TNode> list, SyntaxKind kind) 92public static bool Any<TNode>(this SyntaxList<TNode> list, SyntaxKind kind) 102/// <param name="kind">The <see cref="SyntaxKind"/> to find.</param> 104public static int IndexOf<TNode>(this SeparatedSyntaxList<TNode> list, SyntaxKind kind) 113public static bool Any<TNode>(this SeparatedSyntaxList<TNode> list, SyntaxKind kind) 123/// <param name="kind">The <see cref="SyntaxKind"/> to find.</param> 125public static int IndexOf(this SyntaxTriviaList list, SyntaxKind kind) 133public static bool Any(this SyntaxTriviaList list, SyntaxKind kind) 142/// <param name="kind">The <see cref="SyntaxKind"/> to find.</param> 144public static int IndexOf(this SyntaxTokenList list, SyntaxKind kind) 153/// <param name="kind">The <see cref="CSharp.SyntaxKind"/> to test for.</param> 155public static bool Any(this SyntaxTokenList list, SyntaxKind kind) 160internal static SyntaxToken FirstOrDefault(this SyntaxTokenList list, SyntaxKind kind) 173/// Determines if the given raw kind value belongs to the C# <see cref="SyntaxKind"/> enumeration. 179const int FirstVisualBasicKind = (int)SyntaxKind.List + 1; 180const int FirstCSharpKind = (int)SyntaxKind.TildeToken; 187/// Returns <see cref="SyntaxKind"/> for <see cref="SyntaxToken"/> from <see cref="SyntaxToken.RawKind"/> property. 189public static SyntaxKind Kind(this SyntaxToken token) 192return IsCSharpKind(rawKind) ? (SyntaxKind)rawKind : SyntaxKind.None; 196/// Returns <see cref="SyntaxKind"/> for <see cref="SyntaxTrivia"/> from <see cref="SyntaxTrivia.RawKind"/> property. 198public static SyntaxKind Kind(this SyntaxTrivia trivia) 201return IsCSharpKind(rawKind) ? (SyntaxKind)rawKind : SyntaxKind.None; 205/// Returns <see cref="SyntaxKind"/> for <see cref="SyntaxNode"/> from <see cref="SyntaxNode.RawKind"/> property. 207public static SyntaxKind Kind(this SyntaxNode node) 210return IsCSharpKind(rawKind) ? (SyntaxKind)rawKind : SyntaxKind.None; 214/// Returns <see cref="SyntaxKind"/> for <see cref="SyntaxNode"/> from <see cref="SyntaxNodeOrToken.RawKind"/> property. 216public static SyntaxKind Kind(this SyntaxNodeOrToken nodeOrToken) 219return IsCSharpKind(rawKind) ? (SyntaxKind)rawKind : SyntaxKind.None; 239return token.Kind() is (SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken) && token.Text.Length > 0 && token.Text[0] == '@'; 244return token.IsKind(SyntaxKind.IdentifierToken) && token.Text.Length > 0 && token.Text[0] == '@'; 251case SyntaxKind.OutKeyword: return VarianceKind.Out; 252case SyntaxKind.InKeyword: return VarianceKind.In;
Declarations\DeclarationKind.cs (12)
33internal static DeclarationKind ToDeclarationKind(this SyntaxKind kind) 37case SyntaxKind.ClassDeclaration: return DeclarationKind.Class; 38case SyntaxKind.InterfaceDeclaration: return DeclarationKind.Interface; 39case SyntaxKind.StructDeclaration: return DeclarationKind.Struct; 40case SyntaxKind.UnionDeclaration: return DeclarationKind.Union; 41case SyntaxKind.NamespaceDeclaration: 42case SyntaxKind.FileScopedNamespaceDeclaration: 44case SyntaxKind.EnumDeclaration: return DeclarationKind.Enum; 45case SyntaxKind.DelegateDeclaration: return DeclarationKind.Delegate; 46case SyntaxKind.RecordDeclaration: return DeclarationKind.Record; 47case SyntaxKind.RecordStructDeclaration: return DeclarationKind.RecordStruct; 48case SyntaxKind.ExtensionBlockDeclaration: return DeclarationKind.Extension;
Declarations\DeclarationTreeBuilder.cs (77)
131node.Kind() is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration || 132(node.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind == SourceCodeKind.Regular)); 142bool acceptSimpleProgram = node.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind == SourceCodeKind.Regular; 157else if (acceptSimpleProgram && member.IsKind(SyntaxKind.GlobalStatement)) 163if (!topLevelStatement.IsKind(SyntaxKind.EmptyStatement)) 183else if (!hasGlobalMembers && member.Kind() != SyntaxKind.IncompleteMember) 328Debug.Assert(parent.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind != SourceCodeKind.Regular); 375var isGlobal = directive.GlobalKeyword.Kind() != SyntaxKind.None; 444if (directive.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword)) 603if (directive.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword)) 630case SyntaxKind.GenericName: 632case SyntaxKind.AliasQualifiedName: 634case SyntaxKind.QualifiedName: 646case SyntaxKind.GenericName: 648case SyntaxKind.AliasQualifiedName: 650case SyntaxKind.QualifiedName: 667SyntaxKind.StructDeclaration => DeclarationKind.Struct, 678SyntaxKind.UnionDeclaration => DeclarationKind.Union, 694SyntaxKind.RecordDeclaration => DeclarationKind.Record, 695SyntaxKind.RecordStructDeclaration => DeclarationKind.RecordStruct, 744else if (node.Kind() is SyntaxKind.UnionDeclaration) 759if (record.ClassOrStructKeyword.Kind() != SyntaxKind.None) 764else if (node.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.InterfaceDeclaration) 768if (node.Kind() is SyntaxKind.InterfaceDeclaration) 782else if (node.Kind() is SyntaxKind.UnionDeclaration) 792if (modifier.IsKind(SyntaxKind.StaticKeyword) && kind == DeclarationKind.Class) 796else if (modifier.IsKind(SyntaxKind.ReadOnlyKeyword) && kind is DeclarationKind.Struct or DeclarationKind.RecordStruct) 800else if (modifier.IsKind(SyntaxKind.RefKeyword) && kind is DeclarationKind.Struct or DeclarationKind.RecordStruct) 978if (!anyExtensionDeclarationSyntax && member.Kind == SyntaxKind.ExtensionBlockDeclaration) 1046return modifiers.Any((int)SyntaxKind.RequiredKeyword); 1103if (member.Kind == SyntaxKind.MethodDeclaration) 1117if (modifier.Kind == SyntaxKind.ThisKeyword) 1132case SyntaxKind.CompilationUnit: 1135case SyntaxKind.ClassDeclaration: 1136case SyntaxKind.StructDeclaration: 1137case SyntaxKind.UnionDeclaration: 1138case SyntaxKind.InterfaceDeclaration: 1139case SyntaxKind.EnumDeclaration: 1140case SyntaxKind.RecordDeclaration: 1141case SyntaxKind.RecordStructDeclaration: 1142case SyntaxKind.ExtensionBlockDeclaration: 1145case SyntaxKind.DelegateDeclaration: 1148case SyntaxKind.FieldDeclaration: 1149case SyntaxKind.EventFieldDeclaration: 1152case SyntaxKind.MethodDeclaration: 1153case SyntaxKind.OperatorDeclaration: 1154case SyntaxKind.ConversionOperatorDeclaration: 1155case SyntaxKind.ConstructorDeclaration: 1156case SyntaxKind.DestructorDeclaration: 1159case SyntaxKind.PropertyDeclaration: 1160case SyntaxKind.EventDeclaration: 1161case SyntaxKind.IndexerDeclaration: 1184case SyntaxKind.FieldDeclaration: 1194case SyntaxKind.EventFieldDeclaration: 1204case SyntaxKind.MethodDeclaration: 1216case SyntaxKind.PropertyDeclaration: 1225case SyntaxKind.EventDeclaration: 1234case SyntaxKind.ConstructorDeclaration: 1235set.Add(((Syntax.InternalSyntax.ConstructorDeclarationSyntax)member).Modifiers.Any((int)SyntaxKind.StaticKeyword) 1241case SyntaxKind.DestructorDeclaration: 1245case SyntaxKind.IndexerDeclaration: 1249case SyntaxKind.OperatorDeclaration: 1262case SyntaxKind.ConversionOperatorDeclaration: 1282case SyntaxKind.FieldDeclaration: 1283case SyntaxKind.EventFieldDeclaration: 1284case SyntaxKind.MethodDeclaration: 1285case SyntaxKind.PropertyDeclaration: 1286case SyntaxKind.EventDeclaration: 1287case SyntaxKind.ConstructorDeclaration: 1288case SyntaxKind.DestructorDeclaration: 1289case SyntaxKind.IndexerDeclaration: 1290case SyntaxKind.OperatorDeclaration: 1291case SyntaxKind.ConversionOperatorDeclaration: 1294case SyntaxKind.GlobalStatement:
Declarations\MergedTypeDeclaration.cs (9)
77case SyntaxKind.ClassDeclaration: 78case SyntaxKind.StructDeclaration: 79case SyntaxKind.UnionDeclaration: 80case SyntaxKind.InterfaceDeclaration: 81case SyntaxKind.RecordDeclaration: 82case SyntaxKind.RecordStructDeclaration: 83case SyntaxKind.ExtensionBlockDeclaration: 87case SyntaxKind.DelegateDeclaration: 91case SyntaxKind.EnumDeclaration:
DocumentationComments\SourceDocumentationCommentUtils.cs (8)
42if (syntaxNode.Kind() == SyntaxKind.VariableDeclarator) 47SyntaxKind kind = curr.Kind(); 48if (kind == SyntaxKind.FieldDeclaration || kind == SyntaxKind.EventFieldDeclaration) 68case SyntaxKind.SingleLineDocumentationCommentTrivia: 69case SyntaxKind.MultiLineDocumentationCommentTrivia: 95case SyntaxKind.WhitespaceTrivia: 96case SyntaxKind.EndOfLineTrivia:
FlowAnalysis\AbstractFlowPass_Switch.cs (1)
110if (label.Kind() == SyntaxKind.CasePatternSwitchLabel)
FlowAnalysis\ControlFlowAnalysis.cs (2)
131return ExitPoints.WhereAsArray(s => s.IsKind(SyntaxKind.ReturnStatement) || s.IsKind(SyntaxKind.YieldBreakStatement));
FlowAnalysis\FlowAnalysisPass.cs (4)
198syntax.IsKind(SyntaxKind.Block) || 199syntax.IsKind(SyntaxKind.ArrowExpressionClause) || 200syntax.IsKind(SyntaxKind.ConstructorDeclaration) || 201syntax.IsKind(SyntaxKind.CompilationUnit));
FlowAnalysis\NullableWalker.cs (4)
933if (initializerKind == (int)SyntaxKind.ThisConstructorInitializer) 939else if (initializerKind == (int)SyntaxKind.BaseConstructorInitializer) 7486if (syntax.Kind() != SyntaxKind.InvocationExpression) 7503return nameSyntax.Kind() != SyntaxKind.GenericName;
FlowAnalysis\UnassignedAddressTakenVariablesWalker.cs (1)
54if (node.Parent.Kind() == SyntaxKind.AddressOfExpression)
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (2)
608Debug.Assert(node.Syntax.IsKind(SyntaxKind.CatchClause)); 1154Debug.Assert(pendingCatch.SyntaxOpt.IsKind(SyntaxKind.TryStatement));
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
377Debug.Assert(node.Syntax.IsKind(SyntaxKind.AwaitExpression) || node.WasCompilerGenerated);
Lowering\ClosureConversion\ClosureConversion.cs (7)
1786case SyntaxKind.ForStatement: 1787case SyntaxKind.ForEachStatement: 1788case SyntaxKind.ForEachVariableStatement: 1789case SyntaxKind.WhileStatement: 1790case SyntaxKind.DoStatement: 1791case SyntaxKind.SimpleLambdaExpression: 1792case SyntaxKind.ParenthesizedLambdaExpression:
Lowering\ClosureConversion\LambdaCapturedVariable.cs (2)
101(local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchSection || 102local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchExpressionArm))
Lowering\DiagnosticsPass_ExpressionTrees.cs (9)
639case SyntaxKind.ParenthesizedLambdaExpression: 642if (lambdaSyntax.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword) 646else if (lambdaSyntax.Body.Kind() == SyntaxKind.Block) 650else if (lambdaSyntax.Body.Kind() == SyntaxKind.RefExpression) 657case SyntaxKind.SimpleLambdaExpression: 660if (lambdaSyntax.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword) 664else if (lambdaSyntax.Body.Kind() == SyntaxKind.Block) 668else if (lambdaSyntax.Body.Kind() == SyntaxKind.RefExpression) 675case SyntaxKind.AnonymousMethodExpression:
Lowering\DiagnosticsPass_Warnings.cs (1)
38if (local.Syntax.Kind() == SyntaxKind.DeclarationExpression)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (19)
419SyntaxKind parentKind = returnStatement.ExpressionOpt.Syntax.Parent.Kind(); 422case SyntaxKind.ParenthesizedLambdaExpression: 423case SyntaxKind.SimpleLambdaExpression: 424case SyntaxKind.ArrowExpressionClause: 460if (!original.IsConstructorInitializer() || original.Syntax.Kind() != SyntaxKind.ConstructorDeclaration) 577case SyntaxKind.MethodDeclaration: 578case SyntaxKind.PropertyDeclaration: 579case SyntaxKind.GetAccessorDeclaration: 580case SyntaxKind.SetAccessorDeclaration: 581case SyntaxKind.InitAccessorDeclaration: 582case SyntaxKind.ConstructorDeclaration: 583case SyntaxKind.OperatorDeclaration: 597case SyntaxKind.MethodDeclaration: 601case SyntaxKind.PropertyDeclaration: 605case SyntaxKind.GetAccessorDeclaration: 606case SyntaxKind.SetAccessorDeclaration: 607case SyntaxKind.InitAccessorDeclaration: 611case SyntaxKind.ConstructorDeclaration: 615case SyntaxKind.OperatorDeclaration:
Lowering\Instrumentation\DebugInfoInjector.cs (9)
68if (ctorDecl.Modifiers.Any(SyntaxKind.StaticKeyword)) 134if (syntax.IsKind(SyntaxKind.Parameter)) 145case SyntaxKind.VariableDeclarator: 149case SyntaxKind.PropertyDeclaration: 172if (original.WasCompilerGenerated && original.Syntax.Kind() == SyntaxKind.Block) 316case SyntaxKind.ForEachStatement: 322case SyntaxKind.ForEachVariableStatement: 388return AddSequencePoint(original.Syntax.Kind() == SyntaxKind.VariableDeclarator ? 406if (original.WasCompilerGenerated && original.ExpressionOpt == null && original.Syntax.Kind() == SyntaxKind.Block)
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (7)
97case SyntaxKind.EventFieldDeclaration: 98case SyntaxKind.FieldDeclaration: 105case SyntaxKind.LocalDeclarationStatement: 109Debug.Assert(!modifiers.Any(SyntaxKind.ConstKeyword)); // const locals don't have a sequence point 119case SyntaxKind.UsingStatement: 120case SyntaxKind.FixedStatement: 121case SyntaxKind.ForStatement:
Lowering\Instrumentation\Instrumenter.cs (19)
50Debug.Assert(!original.WasCompilerGenerated || original.Syntax.Kind() == SyntaxKind.Block); 115Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 123Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 131Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 138Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 159Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachStatement); 166Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachVariableStatement); 180Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 187Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 194Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 201Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 208Debug.Assert(original.Syntax.Kind() == SyntaxKind.LabeledStatement); 214Debug.Assert(original.Syntax.Kind() == SyntaxKind.VariableDeclarator || 215(original.Syntax.Kind() == SyntaxKind.LocalDeclarationStatement && 259Debug.Assert(original.Syntax.Kind() == SyntaxKind.LockStatement); 270Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement); 289Debug.Assert(original.Syntax.Kind() == SyntaxKind.UsingStatement); 302Debug.Assert(original.Syntax.Kind() == SyntaxKind.CatchClause); 309Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement);
Lowering\LocalRewriter\LocalRewriter.cs (4)
875if (syntax.IsKind(SyntaxKind.Parameter)) 881if (syntax is ExpressionSyntax { Parent: { } parent } && parent.Kind() == SyntaxKind.EqualsValueClause) // Should be the initial value. 886case SyntaxKind.VariableDeclarator: 887case SyntaxKind.PropertyDeclaration:
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
589loweredInput.Syntax.Kind() == SyntaxKind.TupleExpression &&
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (11)
89case SyntaxKind.TryStatement: 93case SyntaxKind.UsingStatement: 120case SyntaxKind.ForEachStatement: 121case SyntaxKind.ForEachVariableStatement: 127case SyntaxKind.SimpleLambdaExpression: 128case SyntaxKind.ParenthesizedLambdaExpression: 129case SyntaxKind.AnonymousMethodExpression: 132case SyntaxKind.CatchClause: 140goto case SyntaxKind.FinallyClause; 141case SyntaxKind.FinallyClause: 144Debug.Assert(node is { } && node.Kind() == SyntaxKind.TryStatement);
Lowering\LocalRewriter\LocalRewriter_LocalDeclaration.cs (2)
76(originalOpt.Syntax.Kind() == SyntaxKind.VariableDeclarator || 77(originalOpt.Syntax.Kind() == SyntaxKind.LocalDeclarationStatement &&
Lowering\LocalRewriter\LocalRewriter_PatternSwitchStatement.cs (1)
56if (section?.Kind() == SyntaxKind.SwitchSection)
Lowering\LocalRewriter\LocalRewriter_ReturnStatement.cs (1)
32(node.Syntax.Kind() == SyntaxKind.Block && (currentFunction?.IsAsync == false || isRuntimeAsync)))))
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
51SyntaxToken awaitKeyword = node.Syntax.Kind() == SyntaxKind.UsingStatement ? ((UsingStatementSyntax)node.Syntax).AwaitKeyword : default;
Lowering\LocalRewriter\LocalRewriter_Yield.cs (1)
25(!node.WasCompilerGenerated || (node.Syntax.Kind() == SyntaxKind.Block && (currentFunction?.IsAsync == false || isRuntimeAsync))))
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (5)
335if ((local.SynthesizedKind == SynthesizedLocalKind.UserDefined && local.ScopeDesignatorOpt?.Kind() != SyntaxKind.SwitchSection) || 548(local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchSection || 549local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchExpressionArm)); 672SynthesizedLocalKind.Spill => awaitSyntax.IsKind(SyntaxKind.AwaitExpression) || awaitSyntax.IsKind(SyntaxKind.SwitchExpression),
Operations\CSharpOperationFactory.cs (6)
2168var kind = node.Kind(); 2174case SyntaxKind.LocalDeclarationStatement: 2185case SyntaxKind.VariableDeclarator: 2222SyntaxNode declarationSyntax = declarationGroupSyntax.IsKind(SyntaxKind.LocalDeclarationStatement) ? 2817if (boundSwitchLabel.Syntax.Kind() == SyntaxKind.DefaultSwitchLabel) 2849if (boundQueryClause.Syntax.Kind() != SyntaxKind.QueryExpression)
Parser\Blender.cs (2)
134Debug.Assert(token.Kind() != SyntaxKind.None, "how could we not get a real token back?"); 167if (parent.Kind() == SyntaxKind.InterpolatedStringExpression)
Parser\Blender.Cursor.cs (5)
48this.CurrentNodeOrToken.Kind() == SyntaxKind.None || 49this.CurrentNodeOrToken.Kind() == SyntaxKind.EndOfFileToken; 55return token.Kind() == SyntaxKind.EndOfFileToken || token.FullWidth != 0; 146if (node.Kind() == SyntaxKind.InterpolatedStringExpression) 182for (var node = cursor.CurrentNodeOrToken; node.Kind() != SyntaxKind.None && !SyntaxFacts.IsAnyToken(node.Kind()); node = cursor.CurrentNodeOrToken)
Parser\Blender.Reader.cs (6)
299internal static bool IsFabricatedToken(SyntaxKind kind) 303case SyntaxKind.GreaterThanGreaterThanToken: 304case SyntaxKind.GreaterThanGreaterThanEqualsToken: 305case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 306case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 307case SyntaxKind.DotDotToken:
Parser\DirectiveParser.cs (103)
37var hash = this.EatToken(SyntaxKind.HashToken, false); 50SyntaxKind contextualKind = this.CurrentToken.ContextualKind; 53case SyntaxKind.IfKeyword: 57case SyntaxKind.ElifKeyword: 61case SyntaxKind.ElseKeyword: 65case SyntaxKind.EndIfKeyword: 69case SyntaxKind.RegionKeyword: 73case SyntaxKind.EndRegionKeyword: 77case SyntaxKind.DefineKeyword: 78case SyntaxKind.UndefKeyword: 82case SyntaxKind.ErrorKeyword: 83case SyntaxKind.WarningKeyword: 87case SyntaxKind.LineKeyword: 89result = (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) ? 94case SyntaxKind.PragmaKeyword: 98case SyntaxKind.ReferenceKeyword: 102case SyntaxKind.LoadKeyword: 106case SyntaxKind.NullableKeyword: 111if (contextualKind == SyntaxKind.ExclamationToken) 119result = this.ParseShebangDirective(hash, this.EatToken(SyntaxKind.ExclamationToken), isActive); 121else if (contextualKind == SyntaxKind.ColonToken && !hash.HasTrailingTrivia) 123result = this.ParseIgnoredDirective(hash, this.EatToken(SyntaxKind.ColonToken), isActive, isFollowingToken); 127var id = this.EatToken(SyntaxKind.IdentifierToken, false); 254var name = this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_IdentifierExpected); 257if (keyword.Kind == SyntaxKind.DefineKeyword) 292bool isError = keyword.Kind == SyntaxKind.ErrorKeyword; 306if (t.Kind == SyntaxKind.WhitespaceTrivia) 379case SyntaxKind.DefaultKeyword: 380case SyntaxKind.HiddenKeyword: 384line = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_InvalidLineNumber, reportError: isActive); 386if (isActive && !line.IsMissing && line.Kind == SyntaxKind.NumericLiteralToken) 398if (this.CurrentToken.Kind == SyntaxKind.StringLiteralToken && 414Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 423var minus = EatToken(SyntaxKind.MinusToken, reportError: reportError); 433var characterOffset = (CurrentToken.Kind == SyntaxKind.NumericLiteralToken) ? 442var file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError); 463var openParen = EatToken(SyntaxKind.OpenParenToken, reportError); 468var comma = EatToken(SyntaxKind.CommaToken, reportError); 473var closeParen = EatToken(SyntaxKind.CloseParenToken, reportError); 481var token = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_LineSpanDirectiveInvalidValue, reportError: reportError); 487else if (token.Kind == SyntaxKind.NumericLiteralToken) 513SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); 533SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); 548SyntaxKind.EnableKeyword => EatToken(), 549SyntaxKind.DisableKeyword => EatToken(), 550SyntaxKind.RestoreKeyword => EatToken(), 551_ => EatToken(SyntaxKind.DisableKeyword, ErrorCode.ERR_NullableDirectiveQualifierExpected, reportError: isActive) 556SyntaxKind.WarningsKeyword => EatToken(), 557SyntaxKind.AnnotationsKeyword => EatToken(), 558SyntaxKind.EndOfDirectiveToken => null, 559SyntaxKind.EndOfFileToken => null, 560_ => EatToken(SyntaxKind.WarningsKeyword, ErrorCode.ERR_NullableDirectiveTargetExpected, reportError: !setting.IsMissing && isActive) 575if (this.CurrentToken.ContextualKind == SyntaxKind.WarningKeyword) 577var warning = this.EatContextualToken(SyntaxKind.WarningKeyword); 579if (this.CurrentToken.Kind == SyntaxKind.DisableKeyword || this.CurrentToken.Kind == SyntaxKind.RestoreKeyword) 584while (this.CurrentToken.Kind != SyntaxKind.EndOfDirectiveToken) 589if (this.CurrentToken.Kind == SyntaxKind.NumericLiteralToken) 599idExpression = SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, id); 601else if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 615id = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.WRN_IdentifierOrNumericLiteralExpected, reportError: isActive); 616idExpression = SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, id); 622if (this.CurrentToken.Kind != SyntaxKind.CommaToken) 635style = this.EatToken(SyntaxKind.DisableKeyword, ErrorCode.WRN_IllegalPPWarning, reportError: isActive); 640else if (this.CurrentToken.Kind == SyntaxKind.ChecksumKeyword) 643var file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive); 644var guid = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !file.IsMissing); 654var bytes = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !guid.IsMissing); 680var warning = this.EatToken(SyntaxKind.WarningKeyword, ErrorCode.WRN_IllegalPragma, reportError: isActive); 681var style = this.EatToken(SyntaxKind.DisableKeyword, reportError: false); 729if (this.CurrentToken.Kind != SyntaxKind.EndOfDirectiveToken && 730this.CurrentToken.Kind != SyntaxKind.EndOfFileToken) 749while (this.CurrentToken.Kind != SyntaxKind.EndOfDirectiveToken && 750this.CurrentToken.Kind != SyntaxKind.EndOfFileToken) 757SyntaxToken endOfDirective = this.CurrentToken.Kind == SyntaxKind.EndOfDirectiveToken 759: SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken); 778while (this.CurrentToken.Kind == SyntaxKind.BarBarToken) 782left = SyntaxFactory.BinaryExpression(SyntaxKind.LogicalOrExpression, left, op, right); 791while (this.CurrentToken.Kind == SyntaxKind.AmpersandAmpersandToken) 795left = SyntaxFactory.BinaryExpression(SyntaxKind.LogicalAndExpression, left, op, right); 804while (this.CurrentToken.Kind == SyntaxKind.EqualsEqualsToken || this.CurrentToken.Kind == SyntaxKind.ExclamationEqualsToken) 816if (this.CurrentToken.Kind == SyntaxKind.ExclamationToken) 819return SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, op, this.ParseLogicalNot()); 827var k = this.CurrentToken.Kind; 830case SyntaxKind.OpenParenToken: 833var close = this.EatToken(SyntaxKind.CloseParenToken); 835case SyntaxKind.IdentifierToken: 838case SyntaxKind.TrueKeyword: 839case SyntaxKind.FalseKeyword: 842return SyntaxFactory.IdentifierName(this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_InvalidPreprocExpr)); 858identifier = SyntaxFactory.Identifier(SyntaxKind.IdentifierToken, leading, text, identifierPart, trailing); 878case SyntaxKind.ParenthesizedExpression: 880case SyntaxKind.TrueLiteralExpression: 881case SyntaxKind.FalseLiteralExpression: 883case SyntaxKind.LogicalAndExpression: 884case SyntaxKind.BitwiseAndExpression: 886case SyntaxKind.LogicalOrExpression: 887case SyntaxKind.BitwiseOrExpression: 889case SyntaxKind.EqualsExpression: 891case SyntaxKind.NotEqualsExpression: 893case SyntaxKind.LogicalNotExpression: 895case SyntaxKind.IdentifierName:
Parser\Directives.cs (39)
26public SyntaxKind Kind 57case SyntaxKind.DefineDirectiveTrivia: 58case SyntaxKind.UndefDirectiveTrivia: 60case SyntaxKind.IfDirectiveTrivia: 61case SyntaxKind.ElifDirectiveTrivia: 62case SyntaxKind.ElseDirectiveTrivia: 81case SyntaxKind.DefineDirectiveTrivia: 83case SyntaxKind.UndefDirectiveTrivia: 158case SyntaxKind.DefineDirectiveTrivia: 165case SyntaxKind.UndefDirectiveTrivia: 173case SyntaxKind.ElifDirectiveTrivia: 174case SyntaxKind.ElseDirectiveTrivia: 185while (current.Head.Kind != SyntaxKind.IfDirectiveTrivia); 203else if (current.Head.Kind == SyntaxKind.IfDirectiveTrivia) 215return prev != null && prev.Any() && prev.Head.Kind != SyntaxKind.RegionDirectiveTrivia; 221return prev != null && prev.Any() && (prev.Head.Kind == SyntaxKind.IfDirectiveTrivia || prev.Head.Kind == SyntaxKind.ElifDirectiveTrivia); 227return prev != null && prev.Any() && prev.Head.Kind == SyntaxKind.RegionDirectiveTrivia; 234case SyntaxKind.EndIfDirectiveTrivia: 243case SyntaxKind.EndRegionDirectiveTrivia: 254seenAnyIfDirectives: _seenAnyIfDirectives || directive.Kind is SyntaxKind.IfDirectiveTrivia); 271if (stack.Head.Kind == SyntaxKind.IfDirectiveTrivia) 280case SyntaxKind.ElifDirectiveTrivia: 281case SyntaxKind.ElseDirectiveTrivia: 305if (stack.Head.Kind == SyntaxKind.RegionDirectiveTrivia) 322case SyntaxKind.IfDirectiveTrivia: 339case SyntaxKind.IfDirectiveTrivia: 340case SyntaxKind.ElifDirectiveTrivia: 341case SyntaxKind.ElseDirectiveTrivia: 342case SyntaxKind.RegionDirectiveTrivia: 355while (current != null && current.Any() && current.Head.Kind != SyntaxKind.RegionDirectiveTrivia) 417case SyntaxKind.IfDirectiveTrivia: 418case SyntaxKind.ElifDirectiveTrivia: 419case SyntaxKind.ElseDirectiveTrivia: 420case SyntaxKind.EndIfDirectiveTrivia: 421case SyntaxKind.DefineDirectiveTrivia: 422case SyntaxKind.UndefDirectiveTrivia: 423case SyntaxKind.RegionDirectiveTrivia: 424case SyntaxKind.EndRegionDirectiveTrivia:
Parser\DocumentationCommentParser.cs (210)
81if (this.CurrentToken.Kind != SyntaxKind.EndOfDocumentationCommentToken) 86var eoc = this.EatToken(SyntaxKind.EndOfDocumentationCommentToken); 89SyntaxKind kind = _isDelimited ? SyntaxKind.MultiLineDocumentationCommentTrivia : SyntaxKind.SingleLineDocumentationCommentTrivia; 101bool endTag = this.CurrentToken.Kind == SyntaxKind.LessThanSlashToken; 108while (this.CurrentToken.Kind != SyntaxKind.EndOfDocumentationCommentToken) 149case SyntaxKind.XmlTextLiteralToken: 150case SyntaxKind.XmlTextLiteralNewLineToken: 151case SyntaxKind.XmlEntityLiteralToken: 153case SyntaxKind.LessThanToken: 155case SyntaxKind.XmlCommentStartToken: 157case SyntaxKind.XmlCDataStartToken: 159case SyntaxKind.XmlProcessingInstructionStartToken: 161case SyntaxKind.EndOfDocumentationCommentToken: 173case SyntaxKind.LessThanToken: 174case SyntaxKind.LessThanSlashToken: 175case SyntaxKind.XmlCommentStartToken: 176case SyntaxKind.XmlCDataStartToken: 177case SyntaxKind.XmlProcessingInstructionStartToken: 178case SyntaxKind.GreaterThanToken: 179case SyntaxKind.SlashGreaterThanToken: 180case SyntaxKind.EndOfDocumentationCommentToken: 190while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 191|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken 192|| this.CurrentToken.Kind == SyntaxKind.XmlEntityLiteralToken) 204var lessThan = this.EatToken(SyntaxKind.LessThanToken); // guaranteed 218if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 231var lessThanSlash = this.EatToken(SyntaxKind.LessThanSlashToken, reportError: false); 239endName = SyntaxFactory.XmlName(prefix: null, localName: SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken)); 240greaterThan = SyntaxFactory.MissingToken(SyntaxKind.GreaterThanToken); 258if (this.CurrentToken.Kind != SyntaxKind.GreaterThanToken) 261p => p.CurrentToken.Kind != SyntaxKind.GreaterThanToken, 267greaterThan = this.EatToken(SyntaxKind.GreaterThanToken); 281var slashGreater = this.EatToken(SyntaxKind.SlashGreaterThanToken, false); 328if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 344p => p.CurrentToken.Kind != SyntaxKind.IdentifierName, 347p => p.CurrentToken.Kind == SyntaxKind.GreaterThanToken 348|| p.CurrentToken.Kind == SyntaxKind.SlashGreaterThanToken 349|| p.CurrentToken.Kind == SyntaxKind.LessThanToken 350|| p.CurrentToken.Kind == SyntaxKind.LessThanSlashToken 351|| p.CurrentToken.Kind == SyntaxKind.EndOfDocumentationCommentToken 352|| p.CurrentToken.Kind == SyntaxKind.EndOfFileToken, 447var equals = this.EatToken(SyntaxKind.EqualsToken, false); 454case SyntaxKind.SingleQuoteToken: 455case SyntaxKind.DoubleQuoteToken: 463SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken), 465SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken)); 525SyntaxToken openQuote = EatToken(this.CurrentToken.Kind == SyntaxKind.SingleQuoteToken 526? SyntaxKind.SingleQuoteToken 527: SyntaxKind.DoubleQuoteToken); 533if ((current.Kind == SyntaxKind.XmlTextLiteralToken || current.Kind == SyntaxKind.XmlEntityLiteralToken) && 540if ((current.Kind == SyntaxKind.XmlTextLiteralToken || current.Kind == SyntaxKind.XmlEntityLiteralToken) && 556SyntaxKind quoteKind = startQuote.Kind; 559var saveMode = this.SetMode(quoteKind == SyntaxKind.SingleQuoteToken 574SyntaxKind quoteKind = startQuote.Kind; 577var saveMode = this.SetMode(quoteKind == SyntaxKind.SingleQuoteToken 592SyntaxKind quoteKind = startQuote.Kind; 602var saveMode = this.SetMode(quoteKind == SyntaxKind.SingleQuoteToken 606while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 607|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken 608|| this.CurrentToken.Kind == SyntaxKind.XmlEntityLiteralToken 609|| this.CurrentToken.Kind == SyntaxKind.LessThanToken) 612if (token.Kind == SyntaxKind.LessThanToken) 636var quoteKind = this.CurrentToken.Kind == SyntaxKind.SingleQuoteToken 637? SyntaxKind.SingleQuoteToken 638: SyntaxKind.DoubleQuoteToken; 648private SyntaxToken ParseXmlAttributeEndQuote(SyntaxKind quoteKind) 665var quote = SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken); 683var id = this.EatToken(SyntaxKind.IdentifierToken); 685if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 701id = this.EatToken(SyntaxKind.IdentifierToken); 722var lessThanExclamationMinusMinusToken = this.EatToken(SyntaxKind.XmlCommentStartToken); 725while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 726|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken 727|| this.CurrentToken.Kind == SyntaxKind.MinusMinusToken) 730if (token.Kind == SyntaxKind.MinusMinusToken) 742var minusMinusGreaterThanToken = this.EatToken(SyntaxKind.XmlCommentEndToken); 749var startCDataToken = this.EatToken(SyntaxKind.XmlCDataStartToken); 752while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 753|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken) 758var endCDataToken = this.EatToken(SyntaxKind.XmlCDataEndToken); 765var startProcessingInstructionToken = this.EatToken(SyntaxKind.XmlProcessingInstructionStartToken); 774while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 775|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken) 785var endProcessingInstructionToken = this.EatToken(SyntaxKind.XmlProcessingInstructionEndToken); 790protected override SyntaxDiagnosticInfo GetExpectedTokenError(SyntaxKind expected, SyntaxKind actual, int offset, int length) 802case SyntaxKind.IdentifierToken: 811GreenNode missingNodeOrToken, SyntaxKind expected, SyntaxKind actual) 823case SyntaxKind.IdentifierToken: 900else if (type.Kind != SyntaxKind.QualifiedName && this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 908SyntaxToken dot = EatToken(SyntaxKind.DotToken); 942case SyntaxKind.ThisKeyword: 944case SyntaxKind.OperatorKeyword: 946case SyntaxKind.ExplicitKeyword: 947case SyntaxKind.ImplicitKeyword: 949case SyntaxKind.IdentifierToken when CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword: 973Debug.Assert(CurrentToken.Kind == SyntaxKind.ThisKeyword); 987Debug.Assert(CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword); 990TypeArgumentListSyntax? typeArguments = (CurrentToken.Kind == SyntaxKind.LessThanToken) ? ParseTypeArguments(typeArgumentsMustBeIdentifiers: true) : null; 991CrefParameterListSyntax? parameters = (CurrentToken.Kind == SyntaxKind.OpenParenToken) ? ParseCrefParameterList() : null; 993if (parameters is null || CurrentToken.Kind != SyntaxKind.DotToken) 1002SyntaxToken dotToken = EatToken(SyntaxKind.DotToken); 1018Debug.Assert(CurrentToken.Kind == SyntaxKind.OperatorKeyword); 1030operatorToken = SyntaxFactory.MissingToken(SyntaxKind.PlusToken); 1048if (operatorToken.Kind == SyntaxKind.GreaterThanToken && LanguageParser.NoTriviaBetween(operatorToken, CurrentToken)) 1050if (CurrentToken.Kind == SyntaxKind.GreaterThanToken) 1055CurrentToken.Kind is (SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken)) 1059if (operatorToken3.Kind == SyntaxKind.GreaterThanToken) 1063SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 1074SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, 1085SyntaxKind.GreaterThanGreaterThanToken, 1091else if (CurrentToken.Kind == SyntaxKind.EqualsToken) 1096SyntaxKind.GreaterThanEqualsToken, 1101else if (CurrentToken.Kind == SyntaxKind.GreaterThanEqualsToken) 1106SyntaxKind.GreaterThanGreaterThanEqualsToken, 1116case SyntaxKind.PlusToken: 1117operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.PlusEqualsToken); 1119case SyntaxKind.MinusToken: 1120operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.MinusEqualsToken); 1122case SyntaxKind.AsteriskToken: 1123operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.AsteriskEqualsToken); 1125case SyntaxKind.SlashToken: 1126operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.SlashEqualsToken); 1128case SyntaxKind.PercentToken: 1129operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.PercentEqualsToken); 1131case SyntaxKind.AmpersandToken: 1132operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.AmpersandEqualsToken); 1134case SyntaxKind.BarToken: 1135operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.BarEqualsToken); 1137case SyntaxKind.CaretToken: 1138operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.CaretEqualsToken); 1140case SyntaxKind.LessThanLessThanToken: 1141operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.LessThanLessThanEqualsToken); 1143case SyntaxKind.GreaterThanGreaterThanToken: 1144operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.GreaterThanGreaterThanEqualsToken); 1146case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1147operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken); 1157SyntaxToken tryParseCompoundAssignmentOperatorToken(SyntaxToken operatorToken, SyntaxKind kind) 1159if (LanguageParser.NoTriviaBetween(operatorToken, CurrentToken) && CurrentToken.Kind == SyntaxKind.EqualsToken) 1161Debug.Assert(kind is not (SyntaxKind.GreaterThanGreaterThanEqualsToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken)); // Reaching this code path is not expected 1190if (CurrentToken.Kind == SyntaxKind.UncheckedKeyword) 1198return TryEatToken(SyntaxKind.CheckedKeyword); 1207Debug.Assert(CurrentToken.Kind == SyntaxKind.ExplicitKeyword || 1208CurrentToken.Kind == SyntaxKind.ImplicitKeyword); 1211SyntaxToken operatorKeyword = EatToken(SyntaxKind.OperatorKeyword); 1242SyntaxKind openKind = useSquareBrackets ? SyntaxKind.OpenBracketToken : SyntaxKind.OpenParenToken; 1243SyntaxKind closeKind = useSquareBrackets ? SyntaxKind.CloseBracketToken : SyntaxKind.CloseParenToken; 1255while (CurrentToken.Kind == SyntaxKind.CommaToken || IsPossibleCrefParameter()) 1261SyntaxToken comma = EatToken(SyntaxKind.CommaToken); 1270Debug.Assert(CurrentToken.Kind != SyntaxKind.CommaToken); 1295SyntaxKind kind = this.CurrentToken.Kind; 1298case SyntaxKind.RefKeyword: 1299case SyntaxKind.OutKeyword: 1300case SyntaxKind.InKeyword: 1301case SyntaxKind.IdentifierToken: 1319case SyntaxKind.RefKeyword: 1320case SyntaxKind.OutKeyword: 1321case SyntaxKind.InKeyword: 1327if (CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword && refKindOpt is not null) 1329if (refKindOpt.Kind != SyntaxKind.RefKeyword) 1352SyntaxToken identifierToken = EatToken(SyntaxKind.IdentifierToken); 1354if (CurrentToken.Kind != SyntaxKind.LessThanToken) 1364Debug.Assert(CurrentToken.Kind == SyntaxKind.LessThanToken); 1374if (typeArgumentsMustBeIdentifiers && typeSyntax.Kind != SyntaxKind.IdentifierName) 1382var currentKind = CurrentToken.Kind; 1383if (currentKind == SyntaxKind.CommaToken || currentKind == SyntaxKind.IdentifierToken || 1388list.AddSeparator(EatToken(SyntaxKind.CommaToken)); 1396SyntaxToken close = EatToken(SyntaxKind.GreaterThanToken); 1453else if (CurrentToken.Kind == SyntaxKind.IdentifierToken && PeekToken(1).Kind == SyntaxKind.ColonColonToken) 1457if (alias.ContextualKind == SyntaxKind.GlobalKeyword) 1473if (checkForMember && (leftName.IsMissing || CurrentToken.Kind != SyntaxKind.DotToken)) 1485while (CurrentToken.Kind == SyntaxKind.DotToken) 1494if (checkForMember && (rightName.IsMissing || CurrentToken.Kind != SyntaxKind.DotToken)) 1516if (CurrentToken.Kind == SyntaxKind.QuestionToken) 1521while (CurrentToken.Kind == SyntaxKind.AsteriskToken) 1526if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 1528var omittedArraySizeExpressionInstance = SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 1532while (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 1538while (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 1540if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 1563var close = this.EatToken(SyntaxKind.CloseBracketToken); 1592case SyntaxKind.SingleQuoteToken: 1594case SyntaxKind.DoubleQuoteToken: 1596case SyntaxKind.EndOfFileToken: 1597case SyntaxKind.EndOfDocumentationCommentToken: 1599case SyntaxKind.BadToken: 1602return CurrentToken.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken) || 1635SyntaxToken identifierToken = this.EatToken(SyntaxKind.IdentifierToken, reportError: false); 1660case SyntaxKind.SingleQuoteToken: 1662case SyntaxKind.DoubleQuoteToken: 1664case SyntaxKind.EndOfFileToken: 1665case SyntaxKind.EndOfDocumentationCommentToken: 1667case SyntaxKind.BadToken: 1670return CurrentToken.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken) ||
Parser\DocumentationCommentXmlTokens.cs (2)
40return SyntaxFactory.Identifier(SyntaxKind.None, null, text, text, trailing: null); 45return SyntaxFactory.Identifier(SyntaxKind.None, SyntaxFactory.Space, text, text, trailing: null);
Parser\LanguageParser.cs (2284)
49private static bool IsSomeWord(SyntaxKind kind) 51return kind == SyntaxKind.IdentifierToken || SyntaxFacts.IsKeywordKind(kind); 96if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) 177SyntaxFactory.Token(SyntaxKind.EndOfFileToken))); 187this.ParseNamespaceBody(ref tmp, ref body, ref initialBadNodes, SyntaxKind.CompilationUnit); 189var eof = this.EatToken(SyntaxKind.EndOfFileToken); 251Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NamespaceKeyword); 252var namespaceToken = this.EatToken(SyntaxKind.NamespaceKeyword); 264if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 266semicolon = this.EatToken(SyntaxKind.SemicolonToken); 268else if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || IsPossibleNamespaceMemberDeclaration()) 272openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 279this.EatTokenEvenWithIncorrectKind(SyntaxKind.OpenBraceToken), SyntaxKind.OpenBraceToken); 292this.ParseNamespaceBody(ref semicolon, ref body, ref initialBadNodes, SyntaxKind.FileScopedNamespaceDeclaration); 308this.ParseNamespaceBody(ref openBrace, ref body, ref initialBadNodes, SyntaxKind.NamespaceDeclaration); 320this.EatToken(SyntaxKind.CloseBraceToken), 321this.TryEatToken(SyntaxKind.SemicolonToken)); 331private static bool IsPossibleStartOfTypeDeclaration(SyntaxKind kind) 333return IsTypeModifierOrTypeKeyword(kind) || kind == SyntaxKind.OpenBracketToken; 337private static bool IsTypeModifierOrTypeKeyword(SyntaxKind kind) 341case SyntaxKind.EnumKeyword: 342case SyntaxKind.DelegateKeyword: 343case SyntaxKind.ClassKeyword: 344case SyntaxKind.InterfaceKeyword: 345case SyntaxKind.StructKeyword: 346case SyntaxKind.AbstractKeyword: 347case SyntaxKind.InternalKeyword: 348case SyntaxKind.NewKeyword: 349case SyntaxKind.PrivateKeyword: 350case SyntaxKind.ProtectedKeyword: 351case SyntaxKind.PublicKeyword: 352case SyntaxKind.SealedKeyword: 353case SyntaxKind.StaticKeyword: 354case SyntaxKind.UnsafeKeyword: 414SyntaxKind parentKind) 430if (IsScript && parentKind == SyntaxKind.CompilationUnit) 526? EatToken(SyntaxKind.CloseBraceToken) 528SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken), ErrorCode.ERR_RbraceExpected); 550is SyntaxKind.ConstructorDeclaration 551or SyntaxKind.ConversionOperatorDeclaration 552or SyntaxKind.DestructorDeclaration 553or SyntaxKind.EventDeclaration 554or SyntaxKind.EventFieldDeclaration 555or SyntaxKind.FieldDeclaration 556or SyntaxKind.IndexerDeclaration 557or SyntaxKind.MethodDeclaration 558or SyntaxKind.OperatorDeclaration 559or SyntaxKind.PropertyDeclaration; 566SyntaxKind parentKind, 588case SyntaxKind.NamespaceKeyword: 603case SyntaxKind.CloseBraceToken: 629case SyntaxKind.EndOfFileToken: 633case SyntaxKind.ExternKeyword: 660case SyntaxKind.UsingKeyword: 661if (isGlobal && (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken || (!IsScript && IsPossibleTopLevelUsingLocalDeclarationStatement()))) 674case SyntaxKind.IdentifierToken: 675if (this.CurrentToken.ContextualKind != SyntaxKind.GlobalKeyword || this.PeekToken(1).Kind != SyntaxKind.UsingKeyword) 687case SyntaxKind.OpenBracketToken: 693var attribute = this.TryParseAttributeDeclaration(inExpressionContext: parentKind == SyntaxKind.CompilationUnit); 750else if (memberOrStatement.Kind == SyntaxKind.IncompleteMember && seen < NamespaceParts.MembersAndStatements) 780case SyntaxKind.GlobalStatement: 797case SyntaxKind.NamespaceDeclaration: 798case SyntaxKind.FileScopedNamespaceDeclaration: 799case SyntaxKind.EnumDeclaration: 800case SyntaxKind.StructDeclaration: 801case SyntaxKind.UnionDeclaration: 802case SyntaxKind.ClassDeclaration: 803case SyntaxKind.InterfaceDeclaration: 804case SyntaxKind.DelegateDeclaration: 805case SyntaxKind.RecordDeclaration: 806case SyntaxKind.RecordStructDeclaration: 873case SyntaxKind.ExternKeyword: 874case SyntaxKind.UsingKeyword: 875case SyntaxKind.NamespaceKeyword: 877case SyntaxKind.IdentifierToken: 886if (this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword) 892else if (this.PeekToken(1).Kind == SyntaxKind.NamespaceKeyword) 903return this.CurrentToken.Kind == SyntaxKind.CloseBraceToken; 928return this.CurrentToken.Kind == SyntaxKind.ExternKeyword 929&& this.PeekToken(1) is { Kind: SyntaxKind.IdentifierToken, ContextualKind: SyntaxKind.AliasKeyword } 930&& this.PeekToken(2).Kind == SyntaxKind.IdentifierToken 931&& this.PeekToken(3).Kind == SyntaxKind.SemicolonToken; 936if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.ExternAliasDirective) 941Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ExternKeyword); 944this.EatToken(SyntaxKind.ExternKeyword), 945this.EatContextualToken(SyntaxKind.AliasKeyword), 947this.EatToken(SyntaxKind.SemicolonToken)); 955this.EatToken(SyntaxKind.EqualsToken)); 960if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.UsingDirective) 965var globalToken = this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword 969Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UsingKeyword); 971var usingToken = this.EatToken(SyntaxKind.UsingKeyword); 972var staticToken = this.TryEatToken(SyntaxKind.StaticKeyword); 973var unsafeToken = this.TryEatToken(SyntaxKind.UnsafeKeyword); 976if (staticToken is null && unsafeToken != null && this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 979staticToken = SyntaxFactory.MissingToken(SyntaxKind.StaticKeyword); 988var isAliasToFunctionPointer = alias != null && this.CurrentToken.Kind == SyntaxKind.DelegateKeyword; 1007type = _syntaxFactory.IdentifierName(CreateMissingToken(SyntaxKind.IdentifierToken, this.CurrentToken.Kind)); 1008semicolon = SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken); 1019if (type.IsMissing && this.PeekToken(1).Kind == SyntaxKind.SemicolonToken) 1022semicolon = this.EatToken(SyntaxKind.SemicolonToken); 1030return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken 1032&& this.PeekToken(2).Kind == SyntaxKind.ColonToken; 1050if (this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 1112return this.CurrentToken.Kind == SyntaxKind.CloseBracketToken 1117=> IsSomeWord(this.CurrentToken.Kind) && this.PeekToken(1).Kind == SyntaxKind.ColonToken; 1122this.CurrentNodeKind == SyntaxKind.AttributeList && 1131var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 1135? _syntaxFactory.AttributeTargetSpecifier(ConvertToKeyword(this.EatToken()), this.EatToken(SyntaxKind.ColonToken)) 1140SyntaxKind.CloseBracketToken, 1148var closeBracket = this.EatToken(SyntaxKind.CloseBracketToken); 1162if (this.CurrentToken.Kind == SyntaxKind.DotToken) 1168if (this.CurrentToken.Kind == SyntaxKind.MinusGreaterThanToken) 1173if (this.CurrentToken.Kind == SyntaxKind.QuestionToken && 1174this.PeekToken(1).Kind == SyntaxKind.DotToken) 1183LanguageParser @this, ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<AttributeSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 1186static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleAttribute(), 1199if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.Attribute) 1211if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.AttributeArgumentList) 1216if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 1219var openParen = this.EatToken(SyntaxKind.OpenParenToken); 1223SyntaxKind.CloseParenToken, 1235this.EatToken(SyntaxKind.CloseParenToken)); 1238LanguageParser @this, ref SyntaxToken openParen, SeparatedSyntaxListBuilder<AttributeArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 1241static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleAttributeArgument(), 1251if (argument.expression is LiteralExpressionSyntax { Kind: SyntaxKind.StringLiteralExpression, Token: var literalToken } && 1257if (argument.expression is InterpolatedStringExpressionSyntax { StringStartToken.Kind: SyntaxKind.InterpolatedStringStartToken, StringEndToken.IsMissing: true }) 1276if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 1280case SyntaxKind.EqualsToken: 1283this.EatToken(SyntaxKind.EqualsToken)); 1286case SyntaxKind.ColonToken: 1289this.EatToken(SyntaxKind.ColonToken)); 1302internal static DeclarationModifiers GetModifierExcludingScoped(SyntaxKind kind, SyntaxKind contextualKind) 1306case SyntaxKind.PublicKeyword: 1308case SyntaxKind.InternalKeyword: 1310case SyntaxKind.ProtectedKeyword: 1312case SyntaxKind.PrivateKeyword: 1314case SyntaxKind.SealedKeyword: 1316case SyntaxKind.AbstractKeyword: 1318case SyntaxKind.StaticKeyword: 1320case SyntaxKind.VirtualKeyword: 1322case SyntaxKind.ExternKeyword: 1324case SyntaxKind.NewKeyword: 1326case SyntaxKind.OverrideKeyword: 1328case SyntaxKind.ReadOnlyKeyword: 1330case SyntaxKind.VolatileKeyword: 1332case SyntaxKind.UnsafeKeyword: 1334case SyntaxKind.PartialKeyword: 1336case SyntaxKind.AsyncKeyword: 1338case SyntaxKind.RefKeyword: 1340case SyntaxKind.IdentifierToken: 1343case SyntaxKind.PartialKeyword: 1345case SyntaxKind.AsyncKeyword: 1347case SyntaxKind.RequiredKeyword: 1349case SyntaxKind.FileKeyword: 1351case SyntaxKind.ClosedKeyword: 1353case SyntaxKind.SafeKeyword: 1400else if (nextToken.Kind == SyntaxKind.NamespaceKeyword) 1406nextToken.Kind is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword || 1427(next.ContextualKind == SyntaxKind.PartialKeyword && 1493Debug.Assert(modTok.Kind is not (SyntaxKind.OutKeyword or SyntaxKind.InKeyword)); 1516if (token.Kind == SyntaxKind.StructKeyword) 1523case SyntaxKind.RecordKeyword: 1532case SyntaxKind.UnionKeyword: 1548Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.CurrentToken) != DeclarationModifiers.None); 1567(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword)) 1584var currentTokenKind = this.CurrentToken.Kind; 1586currentTokenKind == SyntaxKind.EventKeyword || 1587(currentTokenKind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && PeekToken(1).Kind == SyntaxKind.OperatorKeyword)) 1606var currentTokenKind = this.CurrentToken.Kind; 1610if (currentTokenKind == SyntaxKind.EndOfFileToken) 1617if (currentTokenKind == SyntaxKind.CloseBraceToken) 1645if (currentTokenKind == SyntaxKind.NamespaceKeyword) 1650if (!parsingStatementNotDeclaration && currentTokenKind == SyntaxKind.OperatorKeyword) 1666Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1670case SyntaxKind.StructKeyword: 1671case SyntaxKind.ClassKeyword: 1672case SyntaxKind.InterfaceKeyword: 1678case SyntaxKind.RecordKeyword: 1687case SyntaxKind.UnionKeyword: 1702Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1706if (this.PeekToken(1).Kind == SyntaxKind.EventKeyword) 1713if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 1714this.PeekToken(2).Kind == SyntaxKind.OpenParenToken) 1737case SyntaxKind.IdentifierToken: 1738if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 1744case SyntaxKind.ThisKeyword: 1760case SyntaxKind.ClassKeyword: 1763case SyntaxKind.StructKeyword: 1766case SyntaxKind.InterfaceKeyword: 1769case SyntaxKind.DelegateKeyword: 1772case SyntaxKind.EnumKeyword: 1775case SyntaxKind.IdentifierToken: 1776Debug.Assert(CurrentToken.ContextualKind is SyntaxKind.RecordKeyword or SyntaxKind.ExtensionKeyword or SyntaxKind.UnionKeyword); 1786Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword or SyntaxKind.InterfaceKeyword || 1787this.CurrentToken.ContextualKind is SyntaxKind.RecordKeyword or SyntaxKind.ExtensionKeyword or SyntaxKind.UnionKeyword); 1797bool isExtension = keyword.Kind == SyntaxKind.ExtensionKeyword; 1798bool isUnion = keyword.Kind == SyntaxKind.UnionKeyword; 1809if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 1822var paramList = CurrentToken.Kind == SyntaxKind.OpenParenToken || isExtension 1834if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 1845if (CurrentToken.Kind == SyntaxKind.SemicolonToken) 1847semicolon = EatToken(SyntaxKind.SemicolonToken); 1853openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 1869SyntaxKind kind = this.CurrentToken.Kind; 1891else if (kind is SyntaxKind.CloseBraceToken or SyntaxKind.EndOfFileToken || this.IsTerminator()) 1905? this.CreateMissingToken(SyntaxKind.CloseBraceToken, this.CurrentToken.Kind) 1906: this.EatToken(SyntaxKind.CloseBraceToken); 1908semicolon = TryEatToken(SyntaxKind.SemicolonToken); 1928if (this.CurrentToken.ContextualKind == SyntaxKind.RecordKeyword) 1931recordModifier = this.CurrentToken.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword 1938if (this.CurrentToken.Kind is SyntaxKind.StructKeyword or SyntaxKind.ClassKeyword && 1939this.PeekToken(1).ContextualKind == SyntaxKind.RecordKeyword && 1940this.PeekToken(2).Kind is SyntaxKind.IdentifierToken) 1969case SyntaxKind.ClassKeyword: 1985case SyntaxKind.StructKeyword: 2001case SyntaxKind.UnionKeyword: 2017case SyntaxKind.InterfaceKeyword: 2033case SyntaxKind.RecordKeyword: 2038SyntaxKind declarationKind = recordModifier?.Kind == SyntaxKind.StructKeyword ? SyntaxKind.RecordStructDeclaration : SyntaxKind.RecordDeclaration; 2055case SyntaxKind.ExtensionKeyword: 2108SyntaxKind kind = this.CurrentToken.Kind; 2112!(kind == SyntaxKind.DelegateKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken or SyntaxKind.OpenParenToken)) 2125case SyntaxKind.OpenBraceToken: 2129case SyntaxKind.CloseBraceToken: 2138case SyntaxKind.EndOfFileToken: 2156return this.IsPossibleMemberStart() || this.CurrentToken.Kind == SyntaxKind.CloseBraceToken; 2161return this.CurrentToken.Kind is SyntaxKind.ColonToken or SyntaxKind.OpenBraceToken 2170var colon = this.TryEatToken(SyntaxKind.ColonToken); 2178list.Add(this.CurrentToken.Kind == SyntaxKind.OpenParenToken 2185if (this.CurrentToken.Kind is SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken || 2191if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 2193list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 2212list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 2217if (skipBadBaseListTokens(ref colon, list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 2225PostSkipAction skipBadBaseListTokens(ref SyntaxToken colon, SeparatedSyntaxListBuilder<BaseTypeSyntax> list, SyntaxKind expected) 2228static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleAttribute(), 2229static (p, _) => p.CurrentToken.Kind == SyntaxKind.OpenBraceToken || p.IsCurrentTokenWhereOfConstraintClause(), 2237this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword && 2238this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 2239this.PeekToken(2).Kind == SyntaxKind.ColonToken; 2244while (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 2252var where = this.EatContextualToken(SyntaxKind.WhereKeyword); 2257var colon = this.EatToken(SyntaxKind.ColonToken); 2262if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.IsCurrentTokenWhereOfConstraintClause()) 2276if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 2277|| ((_termState & TerminatorState.IsEndOfTypeSignature) != 0 && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 2278|| this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 2279|| this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 2283else if (haveComma = (this.CurrentToken.Kind == SyntaxKind.CommaToken) || this.IsPossibleTypeParameterConstraint()) 2285SyntaxToken separatorToken = this.EatToken(SyntaxKind.CommaToken); 2287if (constraint.Kind == SyntaxKind.AllowsConstraintClause && haveComma && !this.IsPossibleTypeParameterConstraint()) 2289AddTrailingSkippedSyntax(bounds, this.AddError(separatorToken, ErrorCode.ERR_UnexpectedToken, SyntaxFacts.GetText(SyntaxKind.CommaToken))); 2305else if (skipBadTypeParameterConstraintTokens(bounds, SyntaxKind.CommaToken) == PostSkipAction.Abort) 2318PostSkipAction skipBadTypeParameterConstraintTokens(SeparatedSyntaxListBuilder<TypeParameterConstraintSyntax> list, SyntaxKind expected) 2323static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleTypeParameterConstraint(), 2324static (p, _) => p.CurrentToken.Kind == SyntaxKind.OpenBraceToken || p.IsCurrentTokenWhereOfConstraintClause(), 2333case SyntaxKind.NewKeyword: 2334case SyntaxKind.ClassKeyword: 2335case SyntaxKind.StructKeyword: 2336case SyntaxKind.DefaultKeyword: 2338case SyntaxKind.IdentifierToken: 2340return (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && PeekToken(1).Kind == SyntaxKind.RefKeyword) || this.IsTrueIdentifier(); 2350SyntaxKind.NewKeyword => 2353this.EatToken(SyntaxKind.OpenParenToken), 2354this.EatToken(SyntaxKind.CloseParenToken)), 2356SyntaxKind.StructKeyword => 2358SyntaxKind.StructConstraint, 2360this.CurrentToken.Kind == SyntaxKind.QuestionToken 2361? this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedToken, SyntaxFacts.GetText(SyntaxKind.QuestionToken)) 2364SyntaxKind.ClassKeyword => 2366SyntaxKind.ClassConstraint, 2368this.TryEatToken(SyntaxKind.QuestionToken)), 2370SyntaxKind.DefaultKeyword => 2373SyntaxKind.EnumKeyword => 2380SyntaxKind.DelegateKeyword => 2381PeekToken(1).Kind == SyntaxKind.AsteriskToken 2392if (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && 2393PeekToken(1).Kind == SyntaxKind.RefKeyword) 2395var allows = this.EatContextualToken(SyntaxKind.AllowsKeyword); 2403this.EatToken(SyntaxKind.RefKeyword), 2404this.EatToken(SyntaxKind.StructKeyword))); 2406if (this.CurrentToken.Kind == SyntaxKind.CommaToken && PeekToken(1).Kind == SyntaxKind.RefKeyword) 2408bounds.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 2427private static bool CanStartMember(SyntaxKind kind) 2431case SyntaxKind.AbstractKeyword: 2432case SyntaxKind.BoolKeyword: 2433case SyntaxKind.ByteKeyword: 2434case SyntaxKind.CharKeyword: 2435case SyntaxKind.ClassKeyword: 2436case SyntaxKind.ConstKeyword: 2437case SyntaxKind.DecimalKeyword: 2438case SyntaxKind.DelegateKeyword: 2439case SyntaxKind.DoubleKeyword: 2440case SyntaxKind.EnumKeyword: 2441case SyntaxKind.EventKeyword: 2442case SyntaxKind.ExternKeyword: 2443case SyntaxKind.FixedKeyword: 2444case SyntaxKind.FloatKeyword: 2445case SyntaxKind.IntKeyword: 2446case SyntaxKind.InterfaceKeyword: 2447case SyntaxKind.InternalKeyword: 2448case SyntaxKind.LongKeyword: 2449case SyntaxKind.NewKeyword: 2450case SyntaxKind.ObjectKeyword: 2451case SyntaxKind.OverrideKeyword: 2452case SyntaxKind.PrivateKeyword: 2453case SyntaxKind.ProtectedKeyword: 2454case SyntaxKind.PublicKeyword: 2455case SyntaxKind.ReadOnlyKeyword: 2456case SyntaxKind.SByteKeyword: 2457case SyntaxKind.SealedKeyword: 2458case SyntaxKind.ShortKeyword: 2459case SyntaxKind.StaticKeyword: 2460case SyntaxKind.StringKeyword: 2461case SyntaxKind.StructKeyword: 2462case SyntaxKind.UIntKeyword: 2463case SyntaxKind.ULongKeyword: 2464case SyntaxKind.UnsafeKeyword: 2465case SyntaxKind.UShortKeyword: 2466case SyntaxKind.VirtualKeyword: 2467case SyntaxKind.VoidKeyword: 2468case SyntaxKind.VolatileKeyword: 2469case SyntaxKind.IdentifierToken: 2470case SyntaxKind.TildeToken: 2471case SyntaxKind.OpenBracketToken: 2472case SyntaxKind.ImplicitKeyword: 2473case SyntaxKind.ExplicitKeyword: 2474case SyntaxKind.OpenParenToken: //tuple 2475case SyntaxKind.RefKeyword: 2487case SyntaxKind.ClassKeyword: 2488case SyntaxKind.DelegateKeyword when !IsFunctionPointerStart(): 2489case SyntaxKind.EnumKeyword: 2490case SyntaxKind.InterfaceKeyword: 2491case SyntaxKind.StructKeyword: 2494case SyntaxKind.IdentifierToken: 2498case SyntaxKind.RecordKeyword: 2507case SyntaxKind.UnionKeyword: 2529private bool CanReuseMemberDeclaration(SyntaxKind kind, bool isGlobal) 2533case SyntaxKind.ClassDeclaration: 2534case SyntaxKind.StructDeclaration: 2535case SyntaxKind.UnionDeclaration: 2536case SyntaxKind.InterfaceDeclaration: 2537case SyntaxKind.EnumDeclaration: 2538case SyntaxKind.DelegateDeclaration: 2539case SyntaxKind.EventFieldDeclaration: 2540case SyntaxKind.PropertyDeclaration: 2541case SyntaxKind.EventDeclaration: 2542case SyntaxKind.IndexerDeclaration: 2543case SyntaxKind.OperatorDeclaration: 2544case SyntaxKind.ConversionOperatorDeclaration: 2545case SyntaxKind.DestructorDeclaration: 2546case SyntaxKind.ConstructorDeclaration: 2547case SyntaxKind.NamespaceDeclaration: 2548case SyntaxKind.FileScopedNamespaceDeclaration: 2549case SyntaxKind.RecordDeclaration: 2550case SyntaxKind.RecordStructDeclaration: 2552case SyntaxKind.FieldDeclaration: 2553case SyntaxKind.MethodDeclaration: 2562case SyntaxKind.GlobalStatement: 2574const SyntaxKind parentKind = SyntaxKind.StructDeclaration; 2590internal MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind parentKind) 2605private MemberDeclarationSyntax ParseMemberDeclarationOrStatementCore(SyntaxKind parentKind) 2609Debug.Assert(parentKind == SyntaxKind.CompilationUnit); 2648case SyntaxKind.UnsafeKeyword: 2649if (this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 2655case SyntaxKind.FixedKeyword: 2656if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2662case SyntaxKind.DelegateKeyword: 2672case SyntaxKind.NewKeyword: 2688if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2701this.AddError(SyntaxFactory.MissingToken(SyntaxKind.VoidKeyword), ErrorCode.ERR_MemberNeedsType)); 2722if (this.CurrentToken.Kind == SyntaxKind.ConstKeyword) 2735if (this.CurrentToken.Kind == SyntaxKind.EventKeyword) 2741if (this.CurrentToken.Kind == SyntaxKind.FixedKeyword) 2753if (this.CurrentToken.Kind == SyntaxKind.NamespaceKeyword) 2771if ((!haveAttributes || !IsScript) && !haveModifiers && (type.Kind == SyntaxKind.RefType || !IsOperatorStart(out _, advanceParser: false))) 2775if (this.CurrentToken.Kind is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken && 2863!type.IsMissing && type.Kind != SyntaxKind.RefType && 2997case SyntaxKind.LocalFunctionStatement: 2998case SyntaxKind.ExpressionStatement when 3002statement is ExpressionStatementSyntax { Expression.Kind: SyntaxKind.IdentifierName, SemicolonToken.IsMissing: true }: 3006case SyntaxKind.LocalDeclarationStatement: 3016if (CurrentToken.Kind == SyntaxKind.UsingKeyword) 3021if (CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3037this.CurrentToken.ContextualKind is not (SyntaxKind.PartialKeyword or SyntaxKind.AsyncKeyword or SyntaxKind.RequiredKeyword or SyntaxKind.FileKeyword or SyntaxKind.ClosedKeyword or SyntaxKind.SafeKeyword) && 3060SyntaxKind parentKind, 3077if (attributes.Count == 0 && modifiers.Count == 0 && type.IsMissing && type.Kind != SyntaxKind.RefType) 3089else if (parentKind is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration || 3090parentKind == SyntaxKind.CompilationUnit && !IsScript) 3167if (type.Kind != SyntaxKind.RefType && 3170|| this.CurrentToken.Kind is not SyntaxKind.OpenParenToken and not SyntaxKind.OpenBraceToken and not SyntaxKind.EqualsGreaterThanToken) && 3195if (identifierOrThisOpt?.Kind == SyntaxKind.ThisKeyword) 3216var kind = this.PeekToken(index).Kind; 3219if (kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken) 3223if (kind is SyntaxKind.SemicolonToken) 3226if (kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken) 3234internal MemberDeclarationSyntax ParseMemberDeclaration(SyntaxKind parentKind) 3249private MemberDeclarationSyntax ParseMemberDeclarationCore(SyntaxKind parentKind) 3253Debug.Assert(parentKind != SyntaxKind.CompilationUnit); 3278if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 3284if (this.CurrentToken.Kind == SyntaxKind.TildeToken) 3290if (this.CurrentToken.Kind == SyntaxKind.ConstKeyword) 3296if (this.CurrentToken.Kind == SyntaxKind.EventKeyword) 3302if (this.CurrentToken.Kind == SyntaxKind.FixedKeyword) 3342if (type.Kind != SyntaxKind.RefType) 3410return this.CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword && 3411(IsFeatureEnabled(MessageID.IDS_FeatureExtensions) || this.PeekToken(1).Kind == SyntaxKind.LessThanToken); 3422if (type.Kind != SyntaxKind.IdentifierName) 3425if (identifierOrThisOpt.Kind != SyntaxKind.IdentifierToken) 3429var contextualKind = identifier.ContextualKind; 3430if (contextualKind != SyntaxKind.AsyncKeyword || 3442if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 3447if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3470case SyntaxKind.DotToken: // Goo. explicit 3471case SyntaxKind.ColonColonToken: // Goo:: explicit 3472case SyntaxKind.LessThanToken: // Goo< explicit or generic method 3473case SyntaxKind.OpenBraceToken: // Goo { property 3474case SyntaxKind.EqualsGreaterThanToken: // Goo => property 3476case SyntaxKind.OpenParenToken: // Goo( method 3485return this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword or SyntaxKind.OperatorKeyword; 3507if (token.Kind != SyntaxKind.None) 3543var currentTokenKind = this.CurrentToken.Kind; 3544var shouldParse = currentTokenKind is SyntaxKind.ColonToken || 3545(currentTokenKind is SyntaxKind.EqualsGreaterThanToken && 3546this.PeekToken(1).Kind is SyntaxKind.ThisKeyword or SyntaxKind.BaseKeyword && 3547this.PeekToken(2).Kind is SyntaxKind.OpenParenToken); 3560Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ColonToken or SyntaxKind.EqualsGreaterThanToken); 3561var colon = this.EatTokenAsKind(SyntaxKind.ColonToken); 3563var token = this.CurrentToken.Kind is SyntaxKind.BaseKeyword or SyntaxKind.ThisKeyword 3565: this.EatToken(SyntaxKind.ThisKeyword, ErrorCode.ERR_ThisOrBaseExpected); 3567var argumentList = this.CurrentToken.Kind == SyntaxKind.OpenParenToken 3570this.EatToken(SyntaxKind.OpenParenToken, reportError: !token.ContainsDiagnostics), 3572this.EatToken(SyntaxKind.CloseParenToken, reportError: !token.ContainsDiagnostics)); 3575token.Kind == SyntaxKind.BaseKeyword 3576? SyntaxKind.BaseConstructorInitializer 3577: SyntaxKind.ThisConstructorInitializer, 3585Debug.Assert(this.CurrentToken.Kind == SyntaxKind.TildeToken); 3586var tilde = this.EatToken(SyntaxKind.TildeToken); 3590this.EatToken(SyntaxKind.OpenParenToken), 3592this.EatToken(SyntaxKind.CloseParenToken)); 3611if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 3615semicolon = this.EatToken(SyntaxKind.SemicolonToken); 3619blockBody = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 3623expressionBody = this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 3631semicolon = this.EatToken(SyntaxKind.SemicolonToken); 3634else if (parseSemicolonAfterBlock && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 3646if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 3652if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 3658if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 3674=> this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken; 3678return this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken; 3682=> this.CurrentToken.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken; 3685=> this.CurrentToken.Kind == (errored ? SyntaxKind.CloseParenToken : SyntaxKind.GreaterThanToken); 3688=> this.CurrentToken.Kind == SyntaxKind.CloseBracketToken; 3705if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 3710else if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 3732using var _ = new ParserSyntaxContextResetter(this, isInAsyncContext: modifiers.Any((int)SyntaxKind.AsyncKeyword)); 3762case SyntaxKind.OpenParenToken: 3763case SyntaxKind.OpenBraceToken: 3764case SyntaxKind.SemicolonToken: 3779if (this.CurrentToken.Kind is not (SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)) 3781SyntaxKind separatorKind = SyntaxKind.None; 3783if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 3793if (this.CurrentToken.Kind == SyntaxKind.OperatorKeyword) 3807(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.Kind != SyntaxKind.OpenParenToken)) 3818separatorKind = SyntaxKind.None; 3835if (this.CurrentToken.Kind != SyntaxKind.OperatorKeyword || 3836(haveExplicitInterfaceName && separatorKind is not SyntaxKind.DotToken)) 3840else if (this.PeekToken(1).Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword) 3857var style = this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword 3859: this.EatToken(SyntaxKind.ExplicitKeyword); 3867if (!style.IsMissing && explicitInterfaceOpt is not null && this.CurrentToken.Kind != SyntaxKind.OperatorKeyword && style.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 3873opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3885SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken), 3887SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken)), 3890semicolonToken: SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken)); 3893opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3899bool couldBeParameterList = this.CurrentToken.Kind == SyntaxKind.OpenParenToken; 3904this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 3935if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 3952if (this.CurrentToken.Kind == SyntaxKind.OperatorKeyword) 3962(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.Kind != SyntaxKind.OpenParenToken); 3969if (separator?.Kind == SyntaxKind.ColonColonToken) 3972separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 3989if (separator.Kind != SyntaxKind.DotToken) 3991separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 3992separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 4001if (CurrentToken.Kind == SyntaxKind.UncheckedKeyword) 4009return TryEatToken(SyntaxKind.CheckedKeyword); 4021if (firstToken.Kind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && 4022this.PeekToken(1).Kind is SyntaxKind.OperatorKeyword) 4047var opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 4062if (this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 4066opToken = this.ConvertToMissingWithTrailingTrivia(this.EatToken(), SyntaxKind.PlusToken); 4073SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken)); 4079type = this.AddError(type, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken)); 4095if (opToken.Kind == SyntaxKind.GreaterThanToken) 4099if (tk.Kind == SyntaxKind.GreaterThanToken) 4106if (tk.Kind == SyntaxKind.GreaterThanToken && 4110opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanToken, opToken2.GetTrailingTrivia()); 4113else if (tk.Kind == SyntaxKind.GreaterThanEqualsToken && 4117opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, opToken2.GetTrailingTrivia()); 4122opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanToken, opToken2.GetTrailingTrivia()); 4127else if (tk.Kind == SyntaxKind.GreaterThanEqualsToken && 4131opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanEqualsToken, opToken2.GetTrailingTrivia()); 4136var opKind = opToken.Kind; 4169if (opKind is not (SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken) || paramList.Parameters.Count != 0) 4190if (!(opKind == SyntaxKind.IsKeyword || 4195opToken = ConvertToMissingWithTrailingTrivia(opToken, SyntaxKind.PlusToken); 4220Debug.Assert(thisKeyword.Kind == SyntaxKind.ThisKeyword); 4236if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 4239semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4244if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 4253if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 4257semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4288if (this.CurrentToken.Kind is SyntaxKind.SemicolonToken) 4290identifier = AddTrailingSkippedSyntax(identifier, this.EatTokenEvenWithIncorrectKind(SyntaxKind.OpenBraceToken)); 4296var accessorList = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 4304if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 4310else if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 4312var equals = this.EatToken(SyntaxKind.EqualsToken); 4320semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4322else if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 4397var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 4407if (this.CurrentToken.Kind == SyntaxKind.CloseBraceToken) 4429this.EatToken(SyntaxKind.CloseBraceToken)); 4435this.EatToken(SyntaxKind.EqualsGreaterThanToken), 4442var refKeyword = this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 4453static p => p.CurrentToken.Kind != SyntaxKind.CloseBraceToken && !p.IsPossibleAccessor(), 4460return this.CurrentToken.Kind == SyntaxKind.IdentifierToken 4462|| SyntaxFacts.GetAccessorDeclarationKind(this.CurrentToken.ContextualKind) != SyntaxKind.None 4463|| this.CurrentToken.Kind == SyntaxKind.OpenBraceToken // for accessor blocks w/ missing keyword 4464|| this.CurrentToken.Kind == SyntaxKind.SemicolonToken // for empty body accessors w/ missing keyword 4498if (token.Kind is SyntaxKind.CloseBraceToken or SyntaxKind.EndOfFileToken) 4507case SyntaxKind.GetKeyword: 4508case SyntaxKind.SetKeyword: 4509case SyntaxKind.InitKeyword: 4510case SyntaxKind.AddKeyword: 4511case SyntaxKind.RemoveKeyword: 4528Func<LanguageParser, SyntaxKind, bool> abortFunction, 4529SyntaxKind expected, 4530SyntaxKind closeKind = SyntaxKind.None) 4570Func<LanguageParser, SyntaxKind, bool> abortFunction, 4571SyntaxKind expected, 4572SyntaxKind closeKind, 4618Func<LanguageParser, SyntaxKind, bool> abortFunction, 4619SyntaxKind expected, 4620SyntaxKind closeKind, 4683var accessorName = this.EatToken(SyntaxKind.IdentifierToken, 4685var accessorKind = GetAccessorKind(accessorName); 4690if (accessorKind == SyntaxKind.UnknownAccessorDeclaration) 4716bool currentTokenIsSemicolon = this.CurrentToken.Kind == SyntaxKind.SemicolonToken; 4717bool currentTokenIsArrow = this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken; 4718bool currentTokenIsOpenBraceToken = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken; 4738if (accessorKind != SyntaxKind.UnknownAccessorDeclaration) 4769=> this.EatToken(SyntaxKind.SemicolonToken, 4774private static SyntaxKind GetAccessorKind(SyntaxToken accessorName) 4778SyntaxKind.GetKeyword => SyntaxKind.GetAccessorDeclaration, 4779SyntaxKind.SetKeyword => SyntaxKind.SetAccessorDeclaration, 4780SyntaxKind.InitKeyword => SyntaxKind.InitAccessorDeclaration, 4781SyntaxKind.AddKeyword => SyntaxKind.AddAccessorDeclaration, 4782SyntaxKind.RemoveKeyword => SyntaxKind.RemoveAccessorDeclaration, 4783_ => SyntaxKind.UnknownAccessorDeclaration, 4794var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, forExtensionOrUnion); 4805var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, forExtensionOrUnion: false); 4868SyntaxKind openKind, 4869SyntaxKind closeKind, 4897LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 4900static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleParameter(), 4908return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken; 4915case SyntaxKind.OpenBracketToken: // attribute 4916case SyntaxKind.ArgListKeyword: 4917case SyntaxKind.OpenParenToken: // tuple 4918case SyntaxKind.DelegateKeyword when IsFunctionPointerStart(): // Function pointer type 4921case SyntaxKind.IdentifierToken: 4949if (parent.Kind() == SyntaxKind.SimpleLambdaExpression) 4955if (grandparent != null && grandparent.Kind() == SyntaxKind.ParenthesizedLambdaExpression) 4957Debug.Assert(parent.Kind() == SyntaxKind.ParameterList); 4965if (!identifierIsOptional && parameter.Identifier.Kind() == SyntaxKind.None) 4987if (this.CurrentToken.Kind == SyntaxKind.ArgListKeyword) 4992attributes, modifiers.ToList(), type: null, this.EatToken(SyntaxKind.ArgListKeyword), @default: null); 4998if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && IsCurrentTokenWhereOfConstraintClause()) 5005identifier = identifierIsOptional && this.CurrentToken.Kind != SyntaxKind.IdentifierToken 5011if (identifier is not null && this.CurrentToken.Kind is SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 5018var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 5034=> IsParameterModifierExcludingScoped(token) || token.ContextualKind == SyntaxKind.ScopedKeyword; 5040case SyntaxKind.ThisKeyword: 5041case SyntaxKind.RefKeyword: 5042case SyntaxKind.OutKeyword: 5043case SyntaxKind.InKeyword: 5044case SyntaxKind.ParamsKeyword: 5045case SyntaxKind.ReadOnlyKeyword: 5074modifiers.Add(this.EatContextualToken(SyntaxKind.ScopedKeyword)); 5088if (this.PeekToken(1).Kind is not (SyntaxKind.CloseParenToken or SyntaxKind.CommaToken or SyntaxKind.EqualsToken)) 5090modifiers.Add(this.EatContextualToken(SyntaxKind.ScopedKeyword)); 5104SyntaxKind parentKind) 5106Debug.Assert(this.CurrentToken.Kind == SyntaxKind.FixedKeyword); 5116this.EatToken(SyntaxKind.SemicolonToken)); 5122SyntaxKind parentKind) 5124Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EventKeyword); 5129return IsFieldDeclaration(isEvent: true, isGlobalScriptLevel: parentKind == SyntaxKind.CompilationUnit) 5148if (explicitInterfaceOpt != null && this.CurrentToken.Kind is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken) 5161SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 5163SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)), 5173else if (identifierOrThisOpt.Kind != SyntaxKind.IdentifierToken) 5175Debug.Assert(identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword); 5176identifier = ConvertToMissingWithTrailingTrivia(identifierOrThisOpt, SyntaxKind.IdentifierToken); 5184Debug.Assert(identifier.Kind == SyntaxKind.IdentifierToken); 5200if (explicitInterfaceOpt != null && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5202semicolon = this.EatToken(SyntaxKind.SemicolonToken); 5227if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5241SyntaxKind parentKind) 5246if (modifiers is [.., SyntaxToken { Kind: SyntaxKind.ScopedKeyword } scopedKeyword]) 5256this.EatToken(SyntaxKind.SemicolonToken)); 5264SyntaxKind parentKind) 5280if (this.CurrentToken.Kind == SyntaxKind.DotToken) 5291this.EatToken(SyntaxKind.SemicolonToken)); 5296return this.CurrentToken.Kind == SyntaxKind.SemicolonToken; 5300TypeSyntax type, VariableFlags flags, SyntaxKind parentKind) 5305parentKind is not SyntaxKind.NamespaceDeclaration and not SyntaxKind.FileScopedNamespaceDeclaration && 5306(parentKind != SyntaxKind.CompilationUnit || IsScript); 5361if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5365else if (stopOnCloseParen && this.CurrentToken.Kind == SyntaxKind.CloseParenToken) 5369else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 5384if (flags.HasFlag(VariableFlags.ForStatement) && this.PeekToken(1).Kind != SyntaxKind.SemicolonToken) 5388this.PeekToken(2).Kind is SyntaxKind.CommaToken or SyntaxKind.EqualsToken or SyntaxKind.SemicolonToken; 5394variables.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 5407else if (!variableDeclarationsExpected || this.SkipBadVariableListTokens(variables, SyntaxKind.CommaToken) == PostSkipAction.Abort) 5414private PostSkipAction SkipBadVariableListTokens(SeparatedSyntaxListBuilder<VariableDeclaratorSyntax> list, SyntaxKind expected) 5419static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 5420static (p, _) => p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 5440case SyntaxKind.FieldDeclaration: 5442case SyntaxKind.MethodDeclaration: 5444case SyntaxKind.ConstructorDeclaration: 5446case SyntaxKind.DestructorDeclaration: 5448case SyntaxKind.PropertyDeclaration: 5450case SyntaxKind.EventFieldDeclaration: 5452case SyntaxKind.AddAccessorDeclaration: 5453case SyntaxKind.RemoveAccessorDeclaration: 5454case SyntaxKind.GetAccessorDeclaration: 5455case SyntaxKind.SetAccessorDeclaration: 5456case SyntaxKind.InitAccessorDeclaration: 5458case SyntaxKind.ClassDeclaration: 5459case SyntaxKind.StructDeclaration: 5460case SyntaxKind.UnionDeclaration: 5461case SyntaxKind.InterfaceDeclaration: 5462case SyntaxKind.RecordDeclaration: 5463case SyntaxKind.RecordStructDeclaration: 5465case SyntaxKind.DelegateDeclaration: 5488if (mods.Any(SyntaxKind.FixedKeyword)) 5493if (mods.Any(SyntaxKind.ConstKeyword)) 5498if (parent != null && (parent.Kind() == SyntaxKind.VariableDeclaration || parent.Kind() == SyntaxKind.LocalDeclarationStatement)) 5513SyntaxKind oldKind; 5518&& (oldKind = GetOldParent(old).Kind()) != SyntaxKind.VariableDeclaration // or in a method body 5519&& oldKind != SyntaxKind.LocalDeclarationStatement; 5575var currentTokenKind = this.CurrentToken.Kind; 5576if (currentTokenKind == SyntaxKind.IdentifierToken && !parentType.IsMissing) 5578var isAfterNewLine = parentType.GetLastToken().TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia); 5589currentTokenKind != SyntaxKind.EqualsToken && 5592if (currentTokenKind is SyntaxKind.DotToken or SyntaxKind.OpenParenToken or SyntaxKind.MinusGreaterThanToken || 5595var isPossibleLocalFunctionToken = currentTokenKind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken; 5638case SyntaxKind.EqualsToken: 5647var refKeyword = isLocalOrField && !isConst && this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 5657case SyntaxKind.LessThanToken: 5668case SyntaxKind.OpenParenToken: 5686case SyntaxKind.OpenBracketToken: 5705bool isOmitted = expression.Kind == SyntaxKind.OmittedArraySizeExpression; 5724if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5726goto case SyntaxKind.EqualsToken; 5742Debug.Assert(this.CurrentToken.Kind != SyntaxKind.EqualsToken); 5749this.EatToken(SyntaxKind.EqualsToken), 5759if (parentType.Kind == SyntaxKind.ArrayType) 5766goto case SyntaxKind.OpenBracketToken; 5782if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5796this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 5797this.PeekToken(1).Kind is SyntaxKind.IdentifierToken or SyntaxKind.CommaToken or SyntaxKind.EqualsToken or SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.EndOfFileToken; 5821Debug.Assert(this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken); 5829(this.CurrentToken.Kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken || 5830this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword)) 5842case SyntaxKind.CommaToken: 5843case SyntaxKind.SemicolonToken: 5852return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 5859return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.IsPossibleExpression(); 5862private FieldDeclarationSyntax ParseConstantFieldDeclaration(SyntaxList<AttributeListSyntax> attributes, SyntaxListBuilder modifiers, SyntaxKind parentKind) 5864modifiers.Add(this.EatToken(SyntaxKind.ConstKeyword)); 5873this.EatToken(SyntaxKind.SemicolonToken)); 5878Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 5880var delegateToken = this.EatToken(SyntaxKind.DelegateKeyword); 5889if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 5906this.EatToken(SyntaxKind.SemicolonToken)); 5911Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EnumKeyword); 5913var enumToken = this.EatToken(SyntaxKind.EnumKeyword); 5926if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 5928var colon = this.EatToken(SyntaxKind.ColonToken); 5942if (CurrentToken.Kind == SyntaxKind.SemicolonToken) 5944semicolon = EatToken(SyntaxKind.SemicolonToken); 5950openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 5959SyntaxKind.CloseBraceToken, 5968closeBrace = this.EatToken(SyntaxKind.CloseBraceToken); 5969semicolon = TryEatToken(SyntaxKind.SemicolonToken); 5984LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<EnumMemberDeclarationSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 5987static p => p.CurrentToken.Kind is not SyntaxKind.CommaToken and not SyntaxKind.SemicolonToken && !p.IsPossibleEnumMemberDeclaration(), 5995if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.EnumMemberDeclaration) 6003if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 6007this.EatToken(SyntaxKind.EqualsToken), 6008this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseBraceToken 6018return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken || this.IsTrueIdentifier(); 6023return this.CurrentToken.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken; 6039return SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken); 6062if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 6082token.Kind == SyntaxKind.IdentifierToken && 6088if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.IdentifierName) 6102var ctk = this.CurrentToken.Kind; 6103if (ctk == SyntaxKind.IdentifierToken) 6120if (this.IsInAsync && identifierToken.ContextualKind == SyntaxKind.AwaitKeyword) 6140if (this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword) 6153return CurrentToken.ContextualKind == SyntaxKind.FieldKeyword && 6160if (this.CurrentToken.Kind != SyntaxKind.LessThanToken) 6168var open = this.EatToken(SyntaxKind.LessThanToken); 6171SyntaxKind.GreaterThanToken, 6184this.EatToken(SyntaxKind.GreaterThanToken)); 6187LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<TypeParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 6190static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 6203if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 6212if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 6231this.CurrentToken.Kind is SyntaxKind.InKeyword or SyntaxKind.OutKeyword ? EatToken() : null, 6248if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) 6258Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6283if (this.CurrentToken.Kind != SyntaxKind.LessThanToken) 6331Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6335case SyntaxKind.OpenParenToken: 6336case SyntaxKind.CloseParenToken: 6337case SyntaxKind.CloseBracketToken: 6338case SyntaxKind.CloseBraceToken: 6339case SyntaxKind.ColonToken: 6340case SyntaxKind.SemicolonToken: 6341case SyntaxKind.CommaToken: 6342case SyntaxKind.DotToken: 6343case SyntaxKind.QuestionToken: 6344case SyntaxKind.EqualsEqualsToken: 6345case SyntaxKind.ExclamationEqualsToken: 6346case SyntaxKind.BarToken: 6347case SyntaxKind.CaretToken: 6351case SyntaxKind.AmpersandAmpersandToken: // e.g. `e is A<B> && e` 6352case SyntaxKind.BarBarToken: // e.g. `e is A<B> || e` 6353case SyntaxKind.AmpersandToken: // e.g. `e is A<B> & e` 6354case SyntaxKind.OpenBracketToken: // e.g. `e is A<B>[]` 6355case SyntaxKind.LessThanToken: // e.g. `e is A<B> < C` 6356case SyntaxKind.LessThanEqualsToken: // e.g. `e is A<B> <= C` 6357case SyntaxKind.GreaterThanEqualsToken: // e.g. `e is A<B> >= C` 6358case SyntaxKind.IsKeyword: // e.g. `e is A<B> is bool` 6359case SyntaxKind.AsKeyword: // e.g. `e is A<B> as bool` 6363case SyntaxKind.OpenBraceToken: // e.g. `e is A<B> {}` 6367case SyntaxKind.GreaterThanToken when ((options & NameOptions.AfterIs) != 0) && this.PeekToken(1).Kind != SyntaxKind.GreaterThanToken: 6377case SyntaxKind.IdentifierToken: 6388(options & NameOptions.AfterTupleComma) != 0 && this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken || 6389(options & NameOptions.FirstElementOfPossibleTupleLiteral) != 0 && this.PeekToken(1).Kind == SyntaxKind.CommaToken) 6397case SyntaxKind.EndOfFileToken: // e.g. `e is A<B>` 6401case SyntaxKind.EqualsGreaterThanToken: // e.g. `e switch { A<B> => 1 }` 6415Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6425while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6428Debug.Assert(start.Kind == SyntaxKind.LessThanToken); 6429Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6442if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 6448if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 6457if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6492isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 6519isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 6541isDefinitelyTypeArgumentList = this.CurrentToken.Kind == SyntaxKind.CommaToken; 6559while (this.CurrentToken.Kind == SyntaxKind.CommaToken); 6561if (this.CurrentToken.Kind != SyntaxKind.GreaterThanToken) 6567if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken) 6569greaterThanToken = this.EatToken(SyntaxKind.GreaterThanToken); 6576if (lastScannedType is ScanTypeFlags.TupleType && this.CurrentToken.Kind is SyntaxKind.OpenParenToken) 6578greaterThanToken = this.EatToken(SyntaxKind.GreaterThanToken); 6589isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CloseParenToken; 6601Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6603open = this.EatToken(SyntaxKind.LessThanToken); 6609var omittedTypeArgumentInstance = _syntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 6611while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6613types.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 6617close = this.EatToken(SyntaxKind.GreaterThanToken); 6628if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 6644if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1))) 6653if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken 6654&& this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 6659if (this.CurrentToken.Kind == SyntaxKind.CommaToken || this.IsPossibleType()) 6661types.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 6664else if (this.SkipBadTypeArgumentListTokens(types, SyntaxKind.CommaToken) == PostSkipAction.Abort) 6670close = this.EatToken(SyntaxKind.GreaterThanToken); 6674var contextualKind = SyntaxFacts.GetContextualKeywordKind(token.ValueText); 6678case SyntaxKind.OrKeyword: 6680case SyntaxKind.AndKeyword: 6692case SyntaxKind.OpenParenToken: 6695case SyntaxKind.LessThanToken: 6697case SyntaxKind.CloseParenToken: 6699case SyntaxKind.SemicolonToken: 6701case SyntaxKind.OpenBraceToken: 6706case SyntaxKind.CloseBraceToken: 6710case SyntaxKind.EqualsToken: 6712case SyntaxKind.EqualsGreaterThanToken: 6714case SyntaxKind.ThisKeyword: 6716case SyntaxKind.OperatorKeyword: 6724private PostSkipAction SkipBadTypeArgumentListTokens(SeparatedSyntaxListBuilder<TypeSyntax> list, SyntaxKind expected) 6729static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleType(), 6730static (p, _) => p.CurrentToken.Kind == SyntaxKind.GreaterThanToken, 6738if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 6754var varianceToken = this.CurrentToken.Kind is SyntaxKind.InKeyword or SyntaxKind.OutKeyword 6781this.CurrentToken.Kind is not SyntaxKind.CommaToken and not SyntaxKind.GreaterThanToken && 6782this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken) 6803=> this.CurrentToken.Kind == SyntaxKind.GreaterThanToken; 6807Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6809while (this.PeekToken(n).Kind == SyntaxKind.CommaToken) 6812return this.PeekToken(n).Kind == SyntaxKind.GreaterThanToken; 6845if (this.CurrentToken.Kind == SyntaxKind.ThisKeyword) 6871if (separator != null && separator.Kind == SyntaxKind.ColonColonToken) 6874separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6890if (separator.Kind != SyntaxKind.DotToken) 6892separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 6893separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6896if (isEvent && this.CurrentToken.Kind is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken) 6929if (separator.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 6967separator = this.CurrentToken.Kind == SyntaxKind.ColonColonToken 6969: this.EatToken(SyntaxKind.DotToken); 6980if (this.CurrentToken.Kind == SyntaxKind.ColonColonToken) 6984separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6988separator = this.EatToken(SyntaxKind.DotToken); 7009if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 7045if (separator != null && separator.Kind == SyntaxKind.ColonColonToken) 7048separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7072if (separator.Kind != SyntaxKind.DotToken) 7074separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 7075separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7085return this.CurrentToken.Kind == SyntaxKind.ColonColonToken 7097if (this.PeekToken(1).Kind == SyntaxKind.ThisKeyword) 7114Debug.Assert(separator.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken); 7119case SyntaxKind.DotToken: 7122case SyntaxKind.ColonColonToken: 7123if (left.Kind != SyntaxKind.IdentifierName) 7134separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7139if (identifierLeft.Identifier.ContextualKind == SyntaxKind.GlobalKeyword) 7154private SyntaxToken ConvertToMissingWithTrailingTrivia(SyntaxToken token, SyntaxKind expectedKind) 7215var tk = this.CurrentToken.Kind; 7236if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken || !this.IsTrueIdentifier()) 7243if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) 7258if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 7263if (this.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword) 7270if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken or SyntaxKind.ColonColonToken) 7273if (this.CurrentToken.Kind is SyntaxKind.ColonColonToken) 7287Debug.Assert(this.CurrentToken.Kind is SyntaxKind.IdentifierToken); 7290isAlias = this.PeekToken(1).Kind == SyntaxKind.ColonColonToken; 7333else if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 7338if (result == ScanTypeFlags.NotType || mode == ParseTypeMode.DefinitePattern && this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 7360case SyntaxKind.QuestionToken 7361when lastTokenOfType.Kind is not SyntaxKind.QuestionToken // don't allow `Type??` 7362and not SyntaxKind.AsteriskToken: // don't allow `Type*?` 7366case SyntaxKind.AsteriskToken: 7396case SyntaxKind.OpenBracketToken: 7399while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7404if (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7437if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7455while (this.CurrentToken.Kind == SyntaxKind.CommaToken); 7457if (this.CurrentToken.Kind == SyntaxKind.CloseParenToken) 7474_ = EatToken(SyntaxKind.DelegateKeyword); 7475lastTokenOfType = EatToken(SyntaxKind.AsteriskToken); 7479if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 7484case { ContextualKind: SyntaxKind.ManagedKeyword }: 7485case { ContextualKind: SyntaxKind.UnmanagedKeyword }: 7487case var _ when peek1.Kind == SyntaxKind.OpenBracketToken: 7497if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 7499lastTokenOfType = EatToken(SyntaxKind.OpenBracketToken); 7507lastTokenOfType = TryEatToken(SyntaxKind.IdentifierToken) ?? lastTokenOfType; 7514Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 7518lastTokenOfType = TryEatToken(SyntaxKind.CloseBracketToken) ?? lastTokenOfType; 7537var validStartingToken = EatToken().Kind == SyntaxKind.LessThanToken; 7557_ = EatToken(SyntaxKind.CommaToken); 7567if (!validStartingToken && CurrentToken.Kind == SyntaxKind.CloseParenToken) 7569lastTokenOfType = EatTokenAsKind(SyntaxKind.GreaterThanToken); 7573lastTokenOfType = EatToken(SyntaxKind.GreaterThanToken); 7581isNotExpectedFunction: static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 7583expected: SyntaxKind.CommaToken, 7584closeKind: SyntaxKind.None, 7590private static bool IsPredefinedType(SyntaxKind keyword) 7602if (this.CurrentToken.Kind == SyntaxKind.VoidKeyword && this.PeekToken(1).Kind != SyntaxKind.AsteriskToken) 7627if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 7631this.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword ? this.EatToken() : null, 7677case SyntaxKind.QuestionToken: 7689case SyntaxKind.AsteriskToken: 7715case SyntaxKind.OpenBracketToken: 7723while (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 7744Debug.Assert(this.CurrentToken.Kind == SyntaxKind.QuestionToken); 7750if (typeParsedSoFar.Kind is SyntaxKind.NullableType or SyntaxKind.PointerType) 7767if (mode == ParseTypeMode.AfterIs && this.CurrentToken.Kind is SyntaxKind.OpenBracketToken) 7780case SyntaxKind.CommaToken: 7786case SyntaxKind.CloseBracketToken: 7794return this.CurrentToken.Kind != SyntaxKind.ColonToken; 7830if (this.CurrentToken.ContextualKind is SyntaxKind.AsyncKeyword or SyntaxKind.AwaitKeyword or SyntaxKind.FromKeyword) 7836if (nextToken.ContextualKind == SyntaxKind.WithKeyword) 7839var nextTokenKind = nextToken.Kind; 7856if (nextTokenKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseBraceToken) 7861if (nextTokenKind == SyntaxKind.OpenBraceToken) 7866if (nextTokenKind == SyntaxKind.CommaToken) 7870if (nextTokenKind == SyntaxKind.SemicolonToken) 7875if (nextTokenKind == SyntaxKind.EndOfFileToken) 7884if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken) 7893this.CurrentToken.Kind is SyntaxKind.OpenParenToken or // ctor parameters 7894SyntaxKind.OpenBracketToken or // array type 7895SyntaxKind.OpenBraceToken; // object initializer 7909case SyntaxKind.AsteriskToken: 7911case SyntaxKind.OpenBracketToken: 7923var open = this.EatToken(SyntaxKind.OpenBracketToken); 7926var omittedArraySizeExpressionInstance = _syntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 7928while (IsMakingProgress(ref lastTokenPosition) && this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7930if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7943if (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7945list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 7948else if (this.SkipBadArrayRankSpecifierTokens(ref open, list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 7968if (list[i].RawKind == (int)SyntaxKind.OmittedArraySizeExpression) 7976this.EatToken(SyntaxKind.CloseBracketToken)); 7981var open = this.EatToken(SyntaxKind.OpenParenToken); 7984if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 7988while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7990list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 8002list.AddSeparator(SyntaxFactory.MissingToken(SyntaxKind.CommaToken)); 8010this.EatToken(SyntaxKind.CloseParenToken)); 8020private PostSkipAction SkipBadArrayRankSpecifierTokens(ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expected) 8023static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 8024static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseBracketToken, 8034if (token.Kind == SyntaxKind.VoidKeyword && this.CurrentToken.Kind != SyntaxKind.AsteriskToken) 8043if (IsTrueIdentifier() || this.CurrentToken.Kind == SyntaxKind.ColonColonToken) 8048if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 8066var @delegate = EatToken(SyntaxKind.DelegateKeyword); 8067var asterisk = EatToken(SyntaxKind.AsteriskToken); 8073var lessThanTokenError = CreateMissingToken(SyntaxKind.LessThanToken, SyntaxKind.None); 8088TryEatToken(SyntaxKind.GreaterThanToken) ?? SyntaxFactory.MissingToken(SyntaxKind.GreaterThanToken))); 8091var lessThanToken = EatTokenAsKind(SyntaxKind.LessThanToken); 8114Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8115types.AddSeparator(EatToken(SyntaxKind.CommaToken)); 8125lessThanToken.IsMissing && CurrentToken.Kind == SyntaxKind.CloseParenToken 8126? EatTokenAsKind(SyntaxKind.GreaterThanToken) 8127: EatToken(SyntaxKind.GreaterThanToken))); 8140isNotExpectedFunction: static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 8143expected: SyntaxKind.CommaToken); 8148if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 8154case { ContextualKind: SyntaxKind.ManagedKeyword }: 8155case { ContextualKind: SyntaxKind.UnmanagedKeyword }: 8161managedSpecifier = EatTokenAsKind(SyntaxKind.ManagedKeyword); 8164case var _ when peek1.Kind == SyntaxKind.OpenBracketToken: 8166managedSpecifier = EatTokenAsKind(SyntaxKind.UnmanagedKeyword); 8176if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 8178var openBracket = EatToken(SyntaxKind.OpenBracketToken); 8187callingConventionModifiers.Add(SyntaxFactory.FunctionPointerUnmanagedCallingConvention(EatToken(SyntaxKind.IdentifierToken))); 8194Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8195callingConventionModifiers.AddSeparator(EatToken(SyntaxKind.CommaToken)); 8198var closeBracket = EatToken(SyntaxKind.CloseBracketToken); 8210if (managedSpecifier.Kind == SyntaxKind.ManagedKeyword && unmanagedCallingConventions != null) 8224=> CurrentToken.Kind == SyntaxKind.DelegateKeyword && PeekToken(1).Kind == SyntaxKind.AsteriskToken; 8229=> token.Kind == SyntaxKind.LessThanToken || token.Kind == SyntaxKind.OpenParenToken; 8235while (this.CurrentToken.Kind == SyntaxKind.AsteriskToken) 8247static @this => SyntaxFactory.EmptyStatement(attributeLists: default, SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken))); 8255if (this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 8269while (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 8280is SyntaxKind.DotToken 8281or SyntaxKind.QuestionToken 8282or SyntaxKind.ExclamationToken 8283or SyntaxKind.PlusPlusToken 8284or SyntaxKind.MinusMinusToken 8285or SyntaxKind.MinusGreaterThanToken; 8294|| (this.CurrentToken.ContextualKind is SyntaxKind.SwitchKeyword or SyntaxKind.WithKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken); 8298this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 8359case SyntaxKind.FixedKeyword: 8361case SyntaxKind.BreakKeyword: 8363case SyntaxKind.ContinueKeyword: 8365case SyntaxKind.TryKeyword: 8366case SyntaxKind.CatchKeyword: 8367case SyntaxKind.FinallyKeyword: 8369case SyntaxKind.CheckedKeyword: 8370case SyntaxKind.UncheckedKeyword: 8372case SyntaxKind.DoKeyword: 8374case SyntaxKind.ForKeyword: 8376case SyntaxKind.ForEachKeyword: 8378case SyntaxKind.GotoKeyword: 8380case SyntaxKind.IfKeyword: 8382case SyntaxKind.ElseKeyword: 8385case SyntaxKind.LockKeyword: 8387case SyntaxKind.ReturnKeyword: 8389case SyntaxKind.SwitchKeyword: 8390case SyntaxKind.CaseKeyword: // error recovery case. 8392case SyntaxKind.ThrowKeyword: 8394case SyntaxKind.UnsafeKeyword: 8399case SyntaxKind.UsingKeyword: 8401case SyntaxKind.WhileKeyword: 8403case SyntaxKind.OpenBraceToken: 8405case SyntaxKind.SemicolonToken: 8407case SyntaxKind.IdentifierToken: 8453bool beginsWithAwait = this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword; 8488if (this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && 8489this.PeekToken(1).Kind == SyntaxKind.ForEachKeyword) 8491return this.ParseForEachStatement(attributes, this.EatContextualToken(SyntaxKind.AwaitKeyword)); 8495if (PeekToken(2).Kind == SyntaxKind.OpenParenToken) 8498return this.ParseUsingStatement(attributes, this.EatContextualToken(SyntaxKind.AwaitKeyword)); 8522=> PeekToken(1).Kind == SyntaxKind.OpenParenToken ? ParseUsingStatement(attributes) : ParseLocalDeclarationStatement(attributes); 8529=> CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && PeekToken(1).Kind == SyntaxKind.UsingKeyword; 8533return this.PeekToken(1).Kind == SyntaxKind.ColonToken && this.IsTrueIdentifier(); 8538return this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 8543return this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword && 8544this.PeekToken(1).Kind is SyntaxKind.ReturnKeyword or SyntaxKind.BreakKeyword; 8553var tk = this.CurrentToken.Kind; 8554if (tk == SyntaxKind.RefKeyword || 8557this.PeekToken(1).Kind is not SyntaxKind.DotToken // e.g. `int.Parse()` is an expression 8558and not SyntaxKind.OpenParenToken)) // e.g. `int (x, y)` is an error decl expression 8564if (tk == SyntaxKind.UsingKeyword) 8566Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8572Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8585&& (tk is not (SyntaxKind.AsyncKeyword or SyntaxKind.SafeKeyword or SyntaxKind.ScopedKeyword) || ShouldContextualKeywordBeTreatedAsModifier(parsingStatementNotDeclaration: true)); 8617var tk = this.CurrentToken.ContextualKind; 8619if (tk == SyntaxKind.IdentifierToken) 8622if (token1.Kind == SyntaxKind.DotToken && 8623token1.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 8625if (PeekToken(2).Kind == SyntaxKind.IdentifierToken && 8626PeekToken(3).Kind == SyntaxKind.IdentifierToken) 8641var token4Kind = PeekToken(4).Kind; 8642if (token4Kind != SyntaxKind.SemicolonToken && 8643token4Kind != SyntaxKind.EqualsToken && 8644token4Kind != SyntaxKind.CommaToken && 8645token4Kind != SyntaxKind.OpenParenToken && 8646token4Kind != SyntaxKind.LessThanToken) 8661if (st == ScanTypeFlags.MustBeType && this.CurrentToken.Kind is not SyntaxKind.DotToken and not SyntaxKind.OpenParenToken) 8671if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 8700if (this.CurrentToken.Kind != SyntaxKind.UsingKeyword) 8705var tk = PeekToken(1).Kind; 8707if (tk == SyntaxKind.RefKeyword) 8714if (tk != SyntaxKind.StaticKeyword) // For `static` we still need to make sure we have a typed identifier after it, because `using static type;` is a valid using directive. 8734if (tk == SyntaxKind.StaticKeyword) 8766if (this.CurrentToken.Kind is SyntaxKind.OpenBraceToken) 8772if (identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword) 8787if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 8794if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 8803return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.SemicolonToken; 8821if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 8828if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 8853if (parameter.Modifiers[i].Kind == SyntaxKind.ParamsKeyword) 8863if (parameter.Identifier.Kind == SyntaxKind.ArgListKeyword) 8868else if (parameter.Type.Kind == SyntaxKind.NullableType) 8888else if (parameter.Type.Kind == SyntaxKind.IdentifierName && 8889((IdentifierNameSyntax)parameter.Type).Identifier.ContextualKind == SyntaxKind.FromKeyword) 8920Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 8925if (nextToken.Kind == SyntaxKind.OpenBraceToken) 8931if (nextToken.Kind != SyntaxKind.OpenParenToken) 8948Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 8957if (scanResult == ScanTypeFlags.TupleType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 8968Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 8977case SyntaxKind.OpenBraceToken: 8978case SyntaxKind.OpenBracketToken: 9003if (SyntaxFacts.GetBaseTypeDeclarationKind(nextToken.Kind) != SyntaxKind.None) 9059case SyntaxKind.DotToken: 9060case SyntaxKind.AsteriskToken: 9061case SyntaxKind.QuestionToken: 9062case SyntaxKind.OpenBracketToken: 9063case SyntaxKind.LessThanToken: 9064case SyntaxKind.ColonColonToken: 9067case SyntaxKind.OpenParenToken: 9079case SyntaxKind.IdentifierToken: 9082case SyntaxKind.ThisKeyword: 9106this.CurrentNodeKind == SyntaxKind.Block && 9113CSharpSyntaxNode openBrace = isAccessorBody && this.CurrentToken.Kind != SyntaxKind.OpenBraceToken 9115SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 9119: this.EatToken(SyntaxKind.OpenBraceToken); 9131this.EatToken(SyntaxKind.CloseBraceToken)); 9147if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.Block && attributes.Count == 0) 9150CSharpSyntaxNode openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 9159this.EatToken(SyntaxKind.CloseBraceToken)); 9194while (this.CurrentToken.Kind is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken 9209var action = this.SkipBadStatementListTokens(statements, SyntaxKind.CloseBraceToken, out trailingTrivia); 9226return this.CurrentToken.Kind == SyntaxKind.SemicolonToken 9230private PostSkipAction SkipBadStatementListTokens(SyntaxListBuilder<StatementSyntax> statements, SyntaxKind expected, out GreenNode trailingTrivia) 9238static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseBraceToken, 9240closeKind: SyntaxKind.None, 9246var tk = this.CurrentToken.Kind; 9250case SyntaxKind.FixedKeyword: 9251case SyntaxKind.BreakKeyword: 9252case SyntaxKind.ContinueKeyword: 9253case SyntaxKind.TryKeyword: 9254case SyntaxKind.ConstKeyword: 9255case SyntaxKind.DoKeyword: 9256case SyntaxKind.ForKeyword: 9257case SyntaxKind.ForEachKeyword: 9258case SyntaxKind.GotoKeyword: 9259case SyntaxKind.IfKeyword: 9260case SyntaxKind.ElseKeyword: 9261case SyntaxKind.LockKeyword: 9262case SyntaxKind.ReturnKeyword: 9263case SyntaxKind.UnsafeKeyword: 9264case SyntaxKind.UsingKeyword: 9265case SyntaxKind.WhileKeyword: 9266case SyntaxKind.VolatileKeyword: 9267case SyntaxKind.ExternKeyword: 9268case SyntaxKind.CaseKeyword: // for parsing an errant case without a switch. 9283var tk = this.CurrentToken.Kind; 9286case SyntaxKind.CheckedKeyword: 9287case SyntaxKind.UncheckedKeyword: 9288case SyntaxKind.ThrowKeyword: 9289case SyntaxKind.SwitchKeyword: 9290case SyntaxKind.OpenBraceToken: 9291case SyntaxKind.SemicolonToken: 9292case SyntaxKind.StaticKeyword: 9293case SyntaxKind.ReadOnlyKeyword: 9294case SyntaxKind.RefKeyword: 9295case SyntaxKind.OpenBracketToken: 9298case SyntaxKind.IdentifierToken: 9309var @fixed = this.EatToken(SyntaxKind.FixedKeyword); 9310var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9322this.EatToken(SyntaxKind.CloseParenToken), 9328return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken; 9348return SyntaxFactory.EmptyStatement(attributeLists: default, EatToken(SyntaxKind.SemicolonToken)); 9354if (statement.Kind == SyntaxKind.ExpressionStatement && 9377this.EatToken(SyntaxKind.BreakKeyword), 9378this.EatToken(SyntaxKind.SemicolonToken)); 9385this.EatToken(SyntaxKind.ContinueKeyword), 9386this.EatToken(SyntaxKind.SemicolonToken)); 9391Debug.Assert(this.CurrentToken.Kind is SyntaxKind.TryKeyword or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9394var @try = this.EatToken(SyntaxKind.TryKeyword); 9404Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9418if (this.CurrentToken.Kind == SyntaxKind.CatchKeyword) 9421while (this.CurrentToken.Kind == SyntaxKind.CatchKeyword) 9427if (this.CurrentToken.Kind == SyntaxKind.FinallyKeyword) 9441SyntaxFactory.MissingToken(SyntaxKind.FinallyKeyword), 9455SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 9457SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)); 9462return this.CurrentToken.Kind is SyntaxKind.CloseBraceToken or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword; 9467Debug.Assert(this.CurrentToken.Kind == SyntaxKind.CatchKeyword); 9474if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 9488var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9494var keywordKind = this.CurrentToken.ContextualKind; 9495if (keywordKind == SyntaxKind.WhenKeyword || keywordKind == SyntaxKind.IfKeyword) 9497var whenKeyword = this.EatContextualToken(SyntaxKind.WhenKeyword); 9498if (keywordKind == SyntaxKind.IfKeyword) 9509var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9513var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9526return this.CurrentToken.Kind is SyntaxKind.CloseParenToken 9527or SyntaxKind.OpenBraceToken 9528or SyntaxKind.CloseBraceToken 9529or SyntaxKind.CatchKeyword 9530or SyntaxKind.FinallyKeyword; 9535return this.CurrentToken.Kind is SyntaxKind.CloseParenToken 9536or SyntaxKind.OpenBraceToken 9537or SyntaxKind.CloseBraceToken 9538or SyntaxKind.CatchKeyword 9539or SyntaxKind.FinallyKeyword; 9543return this.CurrentToken.Kind is SyntaxKind.CloseBraceToken 9544or SyntaxKind.CatchKeyword 9545or SyntaxKind.FinallyKeyword; 9550Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 9552if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 9567Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DoKeyword); 9568var @do = this.EatToken(SyntaxKind.DoKeyword); 9570var @while = this.EatToken(SyntaxKind.WhileKeyword); 9571var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9585this.EatToken(SyntaxKind.CloseParenToken), 9586this.EatToken(SyntaxKind.SemicolonToken)); 9591return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken; 9608Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9610if (this.EatToken().Kind == SyntaxKind.OpenParenToken && 9612this.EatToken().Kind == SyntaxKind.IdentifierToken && 9613this.EatToken().Kind == SyntaxKind.InKeyword) 9629Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9634var forToken = this.EatToken(SyntaxKind.ForKeyword); 9635var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9639var condition = this.CurrentToken.Kind is not SyntaxKind.SemicolonToken and not SyntaxKind.CommaToken 9648var incrementors = this.CurrentToken.Kind != SyntaxKind.CloseParenToken 9677if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword) 9679if (this.PeekToken(1).Kind == SyntaxKind.RefKeyword) 9686isDeclaration = ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; 9690else if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 9707else if (this.CurrentToken.Kind != SyntaxKind.SemicolonToken) 9722=> this.CurrentToken.Kind is SyntaxKind.CommaToken 9723? this.EatTokenAsKind(SyntaxKind.SemicolonToken) 9724: this.EatToken(SyntaxKind.SemicolonToken); 9730while (this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.CommaToken) 9731skippedTokens.Add(this.EatTokenEvenWithIncorrectKind(SyntaxKind.CloseParenToken)); 9733var result = this.EatToken(SyntaxKind.CloseParenToken); 9743SyntaxKind.CloseParenToken, 9752LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 9754if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken) 9758static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 9759static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 9766return this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken; 9773Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForEachKeyword || this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9784if (this.CurrentToken.Kind == SyntaxKind.ForKeyword) 9787skippedForToken = this.AddError(skippedForToken, ErrorCode.ERR_SyntaxError, SyntaxFacts.GetText(SyntaxKind.ForEachKeyword)); 9788@foreach = ConvertToMissingWithTrailingTrivia(skippedForToken, SyntaxKind.ForEachKeyword); 9792@foreach = this.EatToken(SyntaxKind.ForEachKeyword); 9795var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9798var @in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected); 9805var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9810if (decl.designation.Kind != SyntaxKind.ParenthesizedVariableDesignation) 9816case SyntaxKind.SingleVariableDesignation: 9819case SyntaxKind.DiscardDesignation: 9822Debug.Assert(discard.Kind == SyntaxKind.UnderscoreToken); 9823identifier = SyntaxToken.WithValue(SyntaxKind.IdentifierToken, discard.LeadingTrivia.Node, discard.Text, discard.ValueText, discard.TrailingTrivia.Node); 9878if (this.IsInAsync && this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword) 9886if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword) 9889if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 9894if (this.PeekToken(1).Kind == SyntaxKind.CommaToken) 9902if (this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken) 9936return this.CurrentToken.Kind == SyntaxKind.CommaToken; 9938return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken; 9958case SyntaxKind.DotToken: 9959case SyntaxKind.ColonColonToken: 9960case SyntaxKind.OpenBracketToken: 9961case SyntaxKind.AsteriskToken: 9962case SyntaxKind.QuestionToken: 9963case SyntaxKind.LessThanToken: 9974case SyntaxKind.DeclarationExpression: 9977case SyntaxKind.TupleExpression: 9980case SyntaxKind.IdentifierName: 9982return ((IdentifierNameSyntax)variable).Identifier.ContextualKind == SyntaxKind.UnderscoreToken; 9990Debug.Assert(this.CurrentToken.Kind == SyntaxKind.GotoKeyword); 9992var @goto = this.EatToken(SyntaxKind.GotoKeyword); 9996SyntaxKind kind; 9998if (this.CurrentToken.Kind is SyntaxKind.CaseKeyword or SyntaxKind.DefaultKeyword) 10001if (caseOrDefault.Kind == SyntaxKind.CaseKeyword) 10003kind = SyntaxKind.GotoCaseStatement; 10008kind = SyntaxKind.GotoDefaultStatement; 10013kind = SyntaxKind.GotoStatement; 10018kind, attributes, @goto, caseOrDefault, arg, this.EatToken(SyntaxKind.SemicolonToken)); 10026if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 10037if (this.CurrentToken.Kind == SyntaxKind.CloseParenToken && 10038this.PeekToken(1).Kind != SyntaxKind.EqualsGreaterThanToken && 10056Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IfKeyword); 10063var ifKeyword = this.EatToken(SyntaxKind.IfKeyword); 10064var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10066var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 10069var elseKeyword = this.CurrentToken.Kind != SyntaxKind.ElseKeyword ? 10071this.EatToken(SyntaxKind.ElseKeyword); 10080if (this.CurrentToken.Kind != SyntaxKind.IfKeyword) 10121Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ElseKeyword); 10125this.EatToken(SyntaxKind.IfKeyword, ErrorCode.ERR_ElseCannotStartStatement), 10126this.EatToken(SyntaxKind.OpenParenToken), 10128this.EatToken(SyntaxKind.CloseParenToken), 10135return this.CurrentToken.Kind != SyntaxKind.ElseKeyword 10138this.EatToken(SyntaxKind.ElseKeyword), 10144Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LockKeyword); 10147this.EatToken(SyntaxKind.LockKeyword), 10148this.EatToken(SyntaxKind.OpenParenToken), 10150this.EatToken(SyntaxKind.CloseParenToken), 10156Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ReturnKeyword); 10159this.EatToken(SyntaxKind.ReturnKeyword), 10160this.CurrentToken.Kind != SyntaxKind.SemicolonToken ? this.ParsePossibleRefExpression() : null, 10161this.EatToken(SyntaxKind.SemicolonToken)); 10166Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword); 10171SyntaxKind kind; 10173if (this.CurrentToken.Kind == SyntaxKind.BreakKeyword) 10175kind = SyntaxKind.YieldBreakStatement; 10180kind = SyntaxKind.YieldReturnStatement; 10181returnOrBreak = this.EatToken(SyntaxKind.ReturnKeyword); 10182if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 10198this.EatToken(SyntaxKind.SemicolonToken)); 10203Debug.Assert(this.CurrentToken.Kind is SyntaxKind.SwitchKeyword or SyntaxKind.CaseKeyword); 10219this.EatToken(SyntaxKind.CloseBraceToken)); 10228if (this.CurrentToken.Kind is SyntaxKind.CaseKeyword) 10232switchKeyword = EatToken(SyntaxKind.SwitchKeyword); 10233openParen = SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken); 10235closeParen = SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken); 10236openBrace = SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken); 10240switchKeyword = this.EatToken(SyntaxKind.SwitchKeyword); 10242if (expression.Kind == SyntaxKind.ParenthesizedExpression) 10251else if (expression.Kind == SyntaxKind.TupleExpression) 10261openParen = SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken); 10263closeParen = SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken); 10266openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 10273return this.CurrentToken.Kind == SyntaxKind.CaseKeyword || 10274(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword && this.PeekToken(1).Kind != SyntaxKind.OpenParenToken); 10288if (this.CurrentToken.Kind == SyntaxKind.CaseKeyword) 10292if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 10297this.EatToken(SyntaxKind.ColonToken)); 10304if (this.CurrentToken.ContextualKind == SyntaxKind.WhenKeyword && node is ExpressionSyntax ex) 10307if (node.Kind == SyntaxKind.DiscardPattern) 10316this.EatToken(SyntaxKind.ColonToken)); 10323this.EatToken(SyntaxKind.ColonToken)); 10329Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword); 10331this.EatToken(SyntaxKind.DefaultKeyword), 10332this.EatToken(SyntaxKind.ColonToken)); 10351Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ThrowKeyword); 10354this.EatToken(SyntaxKind.ThrowKeyword), 10355this.CurrentToken.Kind != SyntaxKind.SemicolonToken ? this.ParseExpressionCore() : null, 10356this.EatToken(SyntaxKind.SemicolonToken)); 10361Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UnsafeKeyword); 10364this.EatToken(SyntaxKind.UnsafeKeyword), 10370var @using = this.EatToken(SyntaxKind.UsingKeyword); 10371var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10387this.EatToken(SyntaxKind.CloseParenToken), 10429if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 10443case SyntaxKind.CommaToken: 10444case SyntaxKind.CloseParenToken: 10449case SyntaxKind.EqualsToken: 10456if (this.CurrentToken.Kind == SyntaxKind.ColonToken && 10457declaration.Type.Kind == SyntaxKind.NullableType && 10488bool condition1 = st == ScanTypeFlags.MustBeType && this.CurrentToken.Kind != SyntaxKind.DotToken; 10489bool condition2 = st != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; 10490bool condition3 = st == ScanTypeFlags.NonGenericTypeOrExpression || this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 10497Debug.Assert(this.CurrentToken.Kind == SyntaxKind.WhileKeyword); 10500this.EatToken(SyntaxKind.WhileKeyword), 10501this.EatToken(SyntaxKind.OpenParenToken), 10503this.EatToken(SyntaxKind.CloseParenToken), 10511Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10516this.EatToken(SyntaxKind.ColonToken), 10517this.ParsePossiblyAttributedStatement() ?? SyntaxFactory.EmptyStatement(attributeLists: default, EatToken(SyntaxKind.SemicolonToken))); 10529awaitKeyword = this.EatContextualToken(SyntaxKind.AwaitKeyword); 10532else if (this.CurrentToken.Kind == SyntaxKind.UsingKeyword) 10615this.EatToken(SyntaxKind.SemicolonToken)); 10628if (this.CurrentToken.ContextualKind != SyntaxKind.ScopedKeyword) 10640var scopedKeyword = this.EatContextualToken(SyntaxKind.ScopedKeyword); 10662return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 10664else if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 10678? this.EatContextualToken(SyntaxKind.ScopedKeyword) 10689if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 10691var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10697done = (this.CurrentToken.Kind == SyntaxKind.CloseParenToken); 10702listOfDesignations.AddSeparator(EatToken(SyntaxKind.CommaToken)); 10710if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 10712listOfDesignations.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 10724this.EatToken(SyntaxKind.CloseParenToken)); 10740return CurrentToken.ContextualKind == SyntaxKind.UnderscoreToken 10741? _syntaxFactory.DiscardDesignation(this.EatContextualToken(SyntaxKind.UnderscoreToken)) 10742: _syntaxFactory.SingleVariableDesignation(this.EatToken(SyntaxKind.IdentifierToken)); 10747if (this.CurrentToken.ContextualKind != SyntaxKind.WhenKeyword) 10753this.EatContextualToken(SyntaxKind.WhenKeyword), 10802if (mods.Any((int)SyntaxKind.ConstKeyword)) 10821if (allowLocalFunctions && localFunction == null && type is PredefinedTypeSyntax { Keyword.Kind: SyntaxKind.VoidKeyword }) 10833case SyntaxKind.SemicolonToken: 10834case SyntaxKind.ColonToken: 10843SyntaxKind k; 10847if (k is SyntaxKind.AsyncKeyword or SyntaxKind.SafeKeyword) 10866else if (k is SyntaxKind.ReadOnlyKeyword or SyntaxKind.VolatileKeyword) 10881Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken); 10895if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 10909private static bool IsDeclarationModifier(SyntaxKind kind) 10913case SyntaxKind.ConstKeyword: 10914case SyntaxKind.StaticKeyword: 10915case SyntaxKind.ReadOnlyKeyword: 10916case SyntaxKind.VolatileKeyword: 10923private static bool IsAdditionalLocalFunctionModifier(SyntaxKind kind) 10927case SyntaxKind.StaticKeyword: 10928case SyntaxKind.AsyncKeyword: 10929case SyntaxKind.UnsafeKeyword: 10930case SyntaxKind.SafeKeyword: 10931case SyntaxKind.ExternKeyword: 10934case SyntaxKind.PublicKeyword: 10935case SyntaxKind.InternalKeyword: 10936case SyntaxKind.ProtectedKeyword: 10937case SyntaxKind.PrivateKeyword: 10945private static bool IsAccessibilityModifier(SyntaxKind kind) 10951case SyntaxKind.PublicKeyword: 10952case SyntaxKind.InternalKeyword: 10953case SyntaxKind.ProtectedKeyword: 10954case SyntaxKind.PrivateKeyword: 10980if (type.Kind == SyntaxKind.IdentifierName) 10983forceLocalFunc = id.ContextualKind != SyntaxKind.AwaitKeyword; 10992case SyntaxKind.AsyncKeyword: 10995case SyntaxKind.UnsafeKeyword: 10998case SyntaxKind.SafeKeyword: 11001case SyntaxKind.ReadOnlyKeyword: 11002case SyntaxKind.VolatileKeyword: 11004case SyntaxKind.StaticKeyword: 11006case SyntaxKind.ExternKeyword: 11028using var _ = new ParserSyntaxContextResetter(this, isInAsyncContext: modifiers.Any((int)SyntaxKind.AsyncKeyword)); 11047if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 11086if (IsScript && this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) 11088semicolon = SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken); 11094semicolon = this.EatToken(SyntaxKind.SemicolonToken); 11130SyntaxKind tk = this.CurrentToken.Kind; 11133case SyntaxKind.TypeOfKeyword: 11134case SyntaxKind.DefaultKeyword: 11135case SyntaxKind.SizeOfKeyword: 11136case SyntaxKind.MakeRefKeyword: 11137case SyntaxKind.RefTypeKeyword: 11138case SyntaxKind.CheckedKeyword: 11139case SyntaxKind.UncheckedKeyword: 11140case SyntaxKind.RefValueKeyword: 11141case SyntaxKind.ArgListKeyword: 11142case SyntaxKind.BaseKeyword: 11143case SyntaxKind.FalseKeyword: 11144case SyntaxKind.ThisKeyword: 11145case SyntaxKind.TrueKeyword: 11146case SyntaxKind.NullKeyword: 11147case SyntaxKind.OpenParenToken: 11148case SyntaxKind.NumericLiteralToken: 11149case SyntaxKind.StringLiteralToken: 11150case SyntaxKind.Utf8StringLiteralToken: 11151case SyntaxKind.SingleLineRawStringLiteralToken: 11152case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 11153case SyntaxKind.MultiLineRawStringLiteralToken: 11154case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 11155case SyntaxKind.InterpolatedStringToken: 11156case SyntaxKind.InterpolatedStringStartToken: 11157case SyntaxKind.InterpolatedVerbatimStringStartToken: 11158case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 11159case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 11160case SyntaxKind.CharacterLiteralToken: 11161case SyntaxKind.NewKeyword: 11162case SyntaxKind.DelegateKeyword: 11163case SyntaxKind.ColonColonToken: // bad aliased name 11164case SyntaxKind.ThrowKeyword: 11165case SyntaxKind.StackAllocKeyword: 11166case SyntaxKind.RefKeyword: 11167case SyntaxKind.OpenBracketToken: // attributes on a lambda, or a collection expression. 11169case SyntaxKind.DotToken when IsAtDotDotToken(): 11171case SyntaxKind.StaticKeyword: 11173case SyntaxKind.IdentifierToken: 11176return this.IsTrueIdentifier() || this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword; 11185private static bool IsInvalidSubExpression(SyntaxKind kind) 11189case SyntaxKind.BreakKeyword: 11190case SyntaxKind.CaseKeyword: 11191case SyntaxKind.CatchKeyword: 11192case SyntaxKind.ConstKeyword: 11193case SyntaxKind.ContinueKeyword: 11194case SyntaxKind.DoKeyword: 11195case SyntaxKind.FinallyKeyword: 11196case SyntaxKind.ForKeyword: 11197case SyntaxKind.ForEachKeyword: 11198case SyntaxKind.GotoKeyword: 11199case SyntaxKind.IfKeyword: 11200case SyntaxKind.ElseKeyword: 11201case SyntaxKind.LockKeyword: 11202case SyntaxKind.ReturnKeyword: 11203case SyntaxKind.SwitchKeyword: 11204case SyntaxKind.TryKeyword: 11205case SyntaxKind.UsingKeyword: 11206case SyntaxKind.WhileKeyword: 11213internal static bool IsRightAssociative(SyntaxKind op) 11217case SyntaxKind.SimpleAssignmentExpression: 11218case SyntaxKind.AddAssignmentExpression: 11219case SyntaxKind.SubtractAssignmentExpression: 11220case SyntaxKind.MultiplyAssignmentExpression: 11221case SyntaxKind.DivideAssignmentExpression: 11222case SyntaxKind.ModuloAssignmentExpression: 11223case SyntaxKind.AndAssignmentExpression: 11224case SyntaxKind.ExclusiveOrAssignmentExpression: 11225case SyntaxKind.OrAssignmentExpression: 11226case SyntaxKind.LeftShiftAssignmentExpression: 11227case SyntaxKind.RightShiftAssignmentExpression: 11228case SyntaxKind.UnsignedRightShiftAssignmentExpression: 11229case SyntaxKind.CoalesceAssignmentExpression: 11230case SyntaxKind.CoalesceExpression: 11263private static Precedence GetPrecedence(SyntaxKind op) 11267case SyntaxKind.QueryExpression: 11269case SyntaxKind.ParenthesizedLambdaExpression: 11270case SyntaxKind.SimpleLambdaExpression: 11271case SyntaxKind.AnonymousMethodExpression: 11273case SyntaxKind.SimpleAssignmentExpression: 11274case SyntaxKind.AddAssignmentExpression: 11275case SyntaxKind.SubtractAssignmentExpression: 11276case SyntaxKind.MultiplyAssignmentExpression: 11277case SyntaxKind.DivideAssignmentExpression: 11278case SyntaxKind.ModuloAssignmentExpression: 11279case SyntaxKind.AndAssignmentExpression: 11280case SyntaxKind.ExclusiveOrAssignmentExpression: 11281case SyntaxKind.OrAssignmentExpression: 11282case SyntaxKind.LeftShiftAssignmentExpression: 11283case SyntaxKind.RightShiftAssignmentExpression: 11284case SyntaxKind.UnsignedRightShiftAssignmentExpression: 11285case SyntaxKind.CoalesceAssignmentExpression: 11287case SyntaxKind.CoalesceExpression: 11288case SyntaxKind.ThrowExpression: 11290case SyntaxKind.LogicalOrExpression: 11292case SyntaxKind.LogicalAndExpression: 11294case SyntaxKind.BitwiseOrExpression: 11296case SyntaxKind.ExclusiveOrExpression: 11298case SyntaxKind.BitwiseAndExpression: 11300case SyntaxKind.EqualsExpression: 11301case SyntaxKind.NotEqualsExpression: 11303case SyntaxKind.LessThanExpression: 11304case SyntaxKind.LessThanOrEqualExpression: 11305case SyntaxKind.GreaterThanExpression: 11306case SyntaxKind.GreaterThanOrEqualExpression: 11307case SyntaxKind.IsExpression: 11308case SyntaxKind.AsExpression: 11309case SyntaxKind.IsPatternExpression: 11311case SyntaxKind.SwitchExpression: 11312case SyntaxKind.WithExpression: 11314case SyntaxKind.LeftShiftExpression: 11315case SyntaxKind.RightShiftExpression: 11316case SyntaxKind.UnsignedRightShiftExpression: 11318case SyntaxKind.AddExpression: 11319case SyntaxKind.SubtractExpression: 11321case SyntaxKind.MultiplyExpression: 11322case SyntaxKind.DivideExpression: 11323case SyntaxKind.ModuloExpression: 11325case SyntaxKind.UnaryPlusExpression: 11326case SyntaxKind.UnaryMinusExpression: 11327case SyntaxKind.BitwiseNotExpression: 11328case SyntaxKind.LogicalNotExpression: 11329case SyntaxKind.PreIncrementExpression: 11330case SyntaxKind.PreDecrementExpression: 11331case SyntaxKind.TypeOfExpression: 11332case SyntaxKind.SizeOfExpression: 11333case SyntaxKind.CheckedExpression: 11334case SyntaxKind.UncheckedExpression: 11335case SyntaxKind.MakeRefExpression: 11336case SyntaxKind.RefValueExpression: 11337case SyntaxKind.RefTypeExpression: 11338case SyntaxKind.AwaitExpression: 11339case SyntaxKind.IndexExpression: 11341case SyntaxKind.CastExpression: 11343case SyntaxKind.PointerIndirectionExpression: 11345case SyntaxKind.AddressOfExpression: 11347case SyntaxKind.RangeExpression: 11349case SyntaxKind.ConditionalExpression: 11351case SyntaxKind.AliasQualifiedName: 11352case SyntaxKind.AnonymousObjectCreationExpression: 11353case SyntaxKind.ArgListExpression: 11354case SyntaxKind.ArrayCreationExpression: 11355case SyntaxKind.BaseExpression: 11356case SyntaxKind.CharacterLiteralExpression: 11357case SyntaxKind.CollectionExpression: 11358case SyntaxKind.ConditionalAccessExpression: 11359case SyntaxKind.DeclarationExpression: 11360case SyntaxKind.DefaultExpression: 11361case SyntaxKind.DefaultLiteralExpression: 11362case SyntaxKind.ElementAccessExpression: 11363case SyntaxKind.FalseLiteralExpression: 11364case SyntaxKind.FieldExpression: 11365case SyntaxKind.GenericName: 11366case SyntaxKind.IdentifierName: 11367case SyntaxKind.ImplicitArrayCreationExpression: 11368case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 11369case SyntaxKind.ImplicitObjectCreationExpression: 11370case SyntaxKind.InterpolatedStringExpression: 11371case SyntaxKind.InvocationExpression: 11372case SyntaxKind.NullLiteralExpression: 11373case SyntaxKind.NumericLiteralExpression: 11374case SyntaxKind.ObjectCreationExpression: 11375case SyntaxKind.ParenthesizedExpression: 11376case SyntaxKind.PointerMemberAccessExpression: 11377case SyntaxKind.PostDecrementExpression: 11378case SyntaxKind.PostIncrementExpression: 11379case SyntaxKind.PredefinedType: 11380case SyntaxKind.RefExpression: 11381case SyntaxKind.SimpleMemberAccessExpression: 11382case SyntaxKind.StackAllocArrayCreationExpression: 11383case SyntaxKind.StringLiteralExpression: 11384case SyntaxKind.Utf8StringLiteralExpression: 11385case SyntaxKind.SuppressNullableWarningExpression: 11386case SyntaxKind.ThisExpression: 11387case SyntaxKind.TrueLiteralExpression: 11388case SyntaxKind.TupleExpression: 11395private static bool IsExpectedPrefixUnaryOperator(SyntaxKind kind) 11397return SyntaxFacts.IsPrefixUnaryExpression(kind) && kind is not SyntaxKind.RefKeyword and not SyntaxKind.OutKeyword; 11400private static bool IsExpectedBinaryOperator(SyntaxKind kind) 11405private static bool IsExpectedAssignmentOperator(SyntaxKind kind) 11412return (this.IsScript || this.IsInAsync) && this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword; 11417if (this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword) 11431case SyntaxKind.IdentifierToken: 11432return next.ContextualKind != SyntaxKind.WithKeyword; 11435case SyntaxKind.NewKeyword: 11436case SyntaxKind.ThisKeyword: 11437case SyntaxKind.BaseKeyword: 11438case SyntaxKind.DelegateKeyword: 11439case SyntaxKind.TypeOfKeyword: 11440case SyntaxKind.CheckedKeyword: 11441case SyntaxKind.UncheckedKeyword: 11442case SyntaxKind.DefaultKeyword: 11445case SyntaxKind.TrueKeyword: 11446case SyntaxKind.FalseKeyword: 11447case SyntaxKind.StringLiteralToken: 11448case SyntaxKind.SingleLineRawStringLiteralToken: 11449case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 11450case SyntaxKind.MultiLineRawStringLiteralToken: 11451case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 11452case SyntaxKind.InterpolatedStringToken: 11453case SyntaxKind.Utf8StringLiteralToken: 11454case SyntaxKind.InterpolatedStringStartToken: 11455case SyntaxKind.InterpolatedVerbatimStringStartToken: 11456case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 11457case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 11458case SyntaxKind.NumericLiteralToken: 11459case SyntaxKind.NullKeyword: 11460case SyntaxKind.CharacterLiteralToken: 11495var tk = this.CurrentToken.Kind; 11507var opKind = SyntaxFacts.GetPrefixUnaryExpression(tk); 11530this.EatContextualToken(SyntaxKind.AwaitKeyword), 11531this.ParseSubExpression(GetPrecedence(SyntaxKind.AwaitExpression))); 11537if (this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword && IsInQuery) 11547if (tk == SyntaxKind.ThrowKeyword) 11591if (this.CurrentToken.Kind == SyntaxKind.QuestionToken && precedence <= Precedence.Conditional) 11604if (operatorTokenKind == SyntaxKind.None) 11637leftOperand.Kind == SyntaxKind.IsPatternExpression ? ErrorCode.ERR_UnexpectedToken : ErrorCode.WRN_PrecedenceInversion, 11641if (operatorExpressionKind == SyntaxKind.AsExpression) 11647if (operatorExpressionKind == SyntaxKind.IsExpression) 11650if (operatorExpressionKind == SyntaxKind.SwitchExpression) 11653if (operatorExpressionKind == SyntaxKind.WithExpression) 11656if (operatorExpressionKind == SyntaxKind.RangeExpression) 11689if (this.CurrentToken.Kind != SyntaxKind.ColonToken && 11707if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 11719if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken && this.lexer.InterpolationFollowedByColon) 11729SyntaxFactory.MissingToken(SyntaxKind.ColonToken), 11730_syntaxFactory.IdentifierName(SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))); 11739this.EatToken(SyntaxKind.ColonToken), 11753conditionalExpression.WhenTrue.GetFirstToken().Kind == SyntaxKind.OpenBracketToken) 11772private (SyntaxKind operatorTokenKind, SyntaxKind operatorExpressionKind) GetExpressionOperatorTokenKindAndExpressionKind() 11779var token1Kind = token1.ContextualKind; 11783return (SyntaxKind.DotDotToken, SyntaxKind.RangeExpression); 11788if (token1Kind == SyntaxKind.GreaterThanToken 11789&& this.PeekToken(1) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token2 11792if (token2.Kind == SyntaxKind.GreaterThanToken) 11794if (this.PeekToken(2) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token3 11798token1Kind = token3.Kind == SyntaxKind.GreaterThanToken 11799? SyntaxKind.GreaterThanGreaterThanGreaterThanToken 11800: SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 11805token1Kind = SyntaxKind.GreaterThanGreaterThanToken; 11811token1Kind = SyntaxKind.GreaterThanGreaterThanEqualsToken; 11821if (token1Kind == SyntaxKind.SwitchKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11822return (token1Kind, SyntaxKind.SwitchExpression); 11824if (token1Kind == SyntaxKind.WithKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11825return (token1Kind, SyntaxKind.WithExpression); 11829return (SyntaxKind.None, SyntaxKind.None); 11832private SyntaxToken EatExpressionOperatorToken(SyntaxKind operatorTokenKind) 11836if (operatorTokenKind is SyntaxKind.DotDotToken) 11839if (operatorTokenKind is SyntaxKind.GreaterThanGreaterThanToken or SyntaxKind.GreaterThanGreaterThanEqualsToken) 11852else if (operatorTokenKind is SyntaxKind.GreaterThanGreaterThanGreaterThanToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) 11873private AssignmentExpressionSyntax ParseAssignmentExpression(SyntaxKind operatorExpressionKind, ExpressionSyntax leftOperand, SyntaxToken operatorToken) 11880if (operatorExpressionKind == SyntaxKind.SimpleAssignmentExpression && CurrentToken.Kind == SyntaxKind.RefKeyword && 11897/// <summary>Check if we're currently at a .. sequence that can then be parsed out as a <see cref="SyntaxKind.DotDotToken"/>.</summary> 11900if (this.CurrentToken.Kind != SyntaxKind.DotToken) 11904return nextToken.Kind == SyntaxKind.DotToken && NoTriviaBetween(this.CurrentToken, nextToken); 11908=> token1.Kind == SyntaxKind.DotToken && 11909token2.Kind == SyntaxKind.DotToken && 11912/// <summary>Consume the next two tokens as a <see cref="SyntaxKind.DotDotToken"/>. Note: if three dot tokens 11921var dotDotToken = SyntaxFactory.Token(token1.GetLeadingTrivia(), SyntaxKind.DotDotToken, token2.GetTrailingTrivia()); 11922if (this.CurrentToken is { Kind: SyntaxKind.DotToken } token3 && 11939if (this.PeekToken(1) is not { Kind: SyntaxKind.DotToken } token4 || 11954? EatContextualToken(SyntaxKind.ScopedKeyword) 11966this.EatToken(SyntaxKind.ThrowKeyword), 11976TypeSyntax type => _syntaxFactory.BinaryExpression(SyntaxKind.IsExpression, leftOperand, opToken, type), 11992var tk = this.CurrentToken.Kind; 11995case SyntaxKind.TypeOfKeyword: 11997case SyntaxKind.DefaultKeyword: 11999case SyntaxKind.SizeOfKeyword: 12001case SyntaxKind.MakeRefKeyword: 12003case SyntaxKind.RefTypeKeyword: 12005case SyntaxKind.CheckedKeyword: 12006case SyntaxKind.UncheckedKeyword: 12008case SyntaxKind.RefValueKeyword: 12010case SyntaxKind.ColonColonToken: 12015case SyntaxKind.EqualsGreaterThanToken: 12017case SyntaxKind.StaticKeyword: 12030case SyntaxKind.IdentifierToken: 12046else if (IsCurrentTokenFieldInKeywordContext() && PeekToken(1).Kind != SyntaxKind.ColonColonToken) 12048return _syntaxFactory.FieldExpression(this.EatContextualToken(SyntaxKind.FieldKeyword)); 12060case SyntaxKind.OpenBracketToken: 12064case SyntaxKind.ThisKeyword: 12066case SyntaxKind.BaseKeyword: 12069case SyntaxKind.ArgListKeyword: 12070case SyntaxKind.FalseKeyword: 12071case SyntaxKind.TrueKeyword: 12072case SyntaxKind.NullKeyword: 12073case SyntaxKind.NumericLiteralToken: 12074case SyntaxKind.StringLiteralToken: 12075case SyntaxKind.Utf8StringLiteralToken: 12076case SyntaxKind.CharacterLiteralToken: 12078case SyntaxKind.InterpolatedStringStartToken: 12079case SyntaxKind.InterpolatedVerbatimStringStartToken: 12080case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 12081case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 12083case SyntaxKind.InterpolatedStringToken: 12085case SyntaxKind.SingleLineRawStringLiteralToken: 12086case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 12087case SyntaxKind.MultiLineRawStringLiteralToken: 12088case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 12090case SyntaxKind.OpenParenToken: 12096case SyntaxKind.NewKeyword: 12098case SyntaxKind.StackAllocKeyword: 12100case SyntaxKind.DelegateKeyword: 12105case SyntaxKind.RefKeyword: 12125if (this.CurrentToken.Kind != SyntaxKind.DotToken || tk == SyntaxKind.VoidKeyword) 12136if (tk == SyntaxKind.EndOfFileToken) 12177case SyntaxKind.OpenParenToken: 12181case SyntaxKind.OpenBracketToken: 12185case SyntaxKind.PlusPlusToken: 12186case SyntaxKind.MinusMinusToken: 12190case SyntaxKind.ColonColonToken: 12191if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken) 12194SyntaxKind.SimpleMemberAccessExpression, 12197this.ConvertToMissingWithTrailingTrivia(this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedAliasedName), SyntaxKind.DotToken), 12203expr = AddTrailingSkippedSyntax(expr, this.EatTokenEvenWithIncorrectKind(SyntaxKind.DotToken)); 12208case SyntaxKind.MinusGreaterThanToken: 12209expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.PointerMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 12212case SyntaxKind.DotToken when !IsAtDotDotToken(): 12222if (this.CurrentToken.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia) && 12223this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 12224this.PeekToken(2).ContextualKind == SyntaxKind.IdentifierToken) 12227SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), 12231expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 12234case SyntaxKind.QuestionToken: 12243case SyntaxKind.ExclamationToken: 12244expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, this.EatToken()); 12256Debug.Assert(this.CurrentToken.Kind == SyntaxKind.BaseKeyword); 12279this.CurrentToken.Kind == SyntaxKind.OpenParenToken && ScanDesignator() && 12280this.CurrentToken.Kind == SyntaxKind.EqualsToken; 12287case SyntaxKind.IdentifierToken: 12295case SyntaxKind.OpenParenToken: 12306case SyntaxKind.CommaToken: 12308case SyntaxKind.CloseParenToken: 12324while (this.PeekToken(tokenIndex).Kind == SyntaxKind.StaticKeyword || 12325this.PeekToken(tokenIndex).ContextualKind == SyntaxKind.AsyncKeyword) 12330return this.PeekToken(tokenIndex).Kind == SyntaxKind.DelegateKeyword && 12331this.PeekToken(tokenIndex + 1).Kind != SyntaxKind.AsteriskToken; 12378if (this.CurrentToken.Kind == SyntaxKind.QuestionToken) 12381var nextTokenKind = nextToken.Kind; 12386if (nextTokenKind == SyntaxKind.DotToken && !IsAtDotDotToken(nextToken, this.PeekToken(2))) 12398bool isStartOfElementBindingExpression(SyntaxKind nextTokenKind) 12400if (nextTokenKind != SyntaxKind.OpenBracketToken) 12417return this.CurrentToken.Kind != SyntaxKind.ColonToken; 12430while (this.CurrentToken.Kind == SyntaxKind.ExclamationToken) 12431expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, EatToken()); 12468SyntaxKind.OpenParenToken 12470SyntaxKind.OpenBracketToken 12472SyntaxKind.DotToken 12473=> _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)), 12482if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.ArgumentList) 12491openKind: SyntaxKind.OpenParenToken, 12492closeKind: SyntaxKind.CloseParenToken); 12498if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.BracketedArgumentList) 12507openKind: SyntaxKind.OpenBracketToken, 12508closeKind: SyntaxKind.CloseBracketToken); 12516SyntaxKind openKind, 12517SyntaxKind closeKind) 12519Debug.Assert(openKind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken); 12520Debug.Assert(closeKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken); 12521Debug.Assert((openKind == SyntaxKind.OpenParenToken) == (closeKind == SyntaxKind.CloseParenToken)); 12522bool isIndexer = openKind == SyntaxKind.OpenBracketToken; 12525openToken = this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken 12532if (this.CurrentToken.Kind != closeKind && this.CurrentToken.Kind != SyntaxKind.SemicolonToken) 12539SyntaxKind.CloseBracketToken, 12551SyntaxKind.CloseParenToken, 12576closeToken = this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken 12583LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 12585if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken) 12589static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleArgumentExpression(), 12590static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 12597return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken; 12605private static bool IsValidArgumentRefKindKeyword(SyntaxKind kind) 12609case SyntaxKind.RefKeyword: 12610case SyntaxKind.OutKeyword: 12611case SyntaxKind.InKeyword: 12620var nameColon = this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.ColonToken 12623this.EatToken(SyntaxKind.ColonToken)) 12629!(this.CurrentToken.Kind == SyntaxKind.RefKeyword && 12637if (isIndexer && this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseBracketToken) 12641else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12653expression = refKindKeyword?.Kind == SyntaxKind.OutKeyword 12665this.EatToken(SyntaxKind.OpenParenToken), 12667this.EatToken(SyntaxKind.CloseParenToken)); 12673if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 12677this.EatToken(SyntaxKind.OpenParenToken), 12679this.EatToken(SyntaxKind.CloseParenToken)); 12683return _syntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression, keyword); 12691this.EatToken(SyntaxKind.OpenParenToken), 12693this.EatToken(SyntaxKind.CloseParenToken)); 12700this.EatToken(SyntaxKind.OpenParenToken), 12702this.EatToken(SyntaxKind.CloseParenToken)); 12709this.EatToken(SyntaxKind.OpenParenToken), 12711this.EatToken(SyntaxKind.CloseParenToken)); 12717Debug.Assert(checkedOrUnchecked.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 12718var kind = checkedOrUnchecked.Kind == SyntaxKind.CheckedKeyword ? SyntaxKind.CheckedExpression : SyntaxKind.UncheckedExpression; 12723this.EatToken(SyntaxKind.OpenParenToken), 12725this.EatToken(SyntaxKind.CloseParenToken)); 12731this.EatToken(SyntaxKind.RefValueKeyword), 12732this.EatToken(SyntaxKind.OpenParenToken), 12734this.EatToken(SyntaxKind.CommaToken), 12736this.EatToken(SyntaxKind.CloseParenToken)); 12751Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12769token.Kind is SyntaxKind.CommaToken || 12775return token.Kind == SyntaxKind.CloseParenToken && 12776this.PeekToken(index).Kind == SyntaxKind.EqualsGreaterThanToken; 12782Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12824var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 12834if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 12844case SyntaxKind.CommaToken: 12847case SyntaxKind.CloseParenToken: 12848return this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken; 12858Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 12873this.EatToken(SyntaxKind.OpenParenToken), 12875this.EatToken(SyntaxKind.CloseParenToken), 12882var openParen = this.EatToken(SyntaxKind.OpenParenToken); 12886if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12894if (expression.Kind == SyntaxKind.IdentifierName && this.CurrentToken.Kind == SyntaxKind.ColonToken) 12907this.EatToken(SyntaxKind.CloseParenToken)); 12915while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12917list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 12920var argument = expression.Kind != SyntaxKind.IdentifierName || this.CurrentToken.Kind != SyntaxKind.ColonToken 12932list.AddSeparator(SyntaxFactory.MissingToken(SyntaxKind.CommaToken)); 12941this.EatToken(SyntaxKind.CloseParenToken)); 12948if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 12961if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 12968if (forPattern && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 12980if (inSwitchArmPattern && this.CurrentToken.ContextualKind == SyntaxKind.WhenKeyword) 13004SyntaxKind.PlusToken or 13005SyntaxKind.MinusToken or 13006SyntaxKind.AmpersandToken or 13007SyntaxKind.AsteriskToken 13011SyntaxKind.DotToken when IsAtDotDotToken() 13027return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken || CanFollowCast(this.CurrentToken.Kind); 13033if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && 13034this.PeekToken(1).Kind == SyntaxKind.CloseBracketToken) 13073return this.CurrentToken.ContextualKind is SyntaxKind.OrKeyword or SyntaxKind.AndKeyword; 13094if (token1.Kind == SyntaxKind.EqualsGreaterThanToken) 13102if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 13118if (this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 13123else if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13124this.PeekToken(1).Kind == SyntaxKind.StaticKeyword) 13137if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 13147if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13155if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 13156this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13166if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13175if (st == ScanTypeFlags.NotType || this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13192if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 13193this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13200if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13209private static bool CanFollowCast(SyntaxKind kind) 13213case SyntaxKind.AsKeyword: 13214case SyntaxKind.IsKeyword: 13215case SyntaxKind.SemicolonToken: 13216case SyntaxKind.CloseParenToken: 13217case SyntaxKind.CloseBracketToken: 13218case SyntaxKind.OpenBraceToken: 13219case SyntaxKind.CloseBraceToken: 13220case SyntaxKind.CommaToken: 13221case SyntaxKind.EqualsToken: 13222case SyntaxKind.PlusEqualsToken: 13223case SyntaxKind.MinusEqualsToken: 13224case SyntaxKind.AsteriskEqualsToken: 13225case SyntaxKind.SlashEqualsToken: 13226case SyntaxKind.PercentEqualsToken: 13227case SyntaxKind.AmpersandEqualsToken: 13228case SyntaxKind.CaretEqualsToken: 13229case SyntaxKind.BarEqualsToken: 13230case SyntaxKind.LessThanLessThanEqualsToken: 13231case SyntaxKind.GreaterThanGreaterThanEqualsToken: 13232case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 13233case SyntaxKind.QuestionToken: 13234case SyntaxKind.ColonToken: 13235case SyntaxKind.BarBarToken: 13236case SyntaxKind.AmpersandAmpersandToken: 13237case SyntaxKind.BarToken: 13238case SyntaxKind.CaretToken: 13239case SyntaxKind.AmpersandToken: 13240case SyntaxKind.EqualsEqualsToken: 13241case SyntaxKind.ExclamationEqualsToken: 13242case SyntaxKind.LessThanToken: 13243case SyntaxKind.LessThanEqualsToken: 13244case SyntaxKind.GreaterThanToken: 13245case SyntaxKind.GreaterThanEqualsToken: 13246case SyntaxKind.QuestionQuestionEqualsToken: 13247case SyntaxKind.LessThanLessThanToken: 13248case SyntaxKind.GreaterThanGreaterThanToken: 13249case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 13250case SyntaxKind.PlusToken: 13251case SyntaxKind.MinusToken: 13252case SyntaxKind.AsteriskToken: 13253case SyntaxKind.SlashToken: 13254case SyntaxKind.PercentToken: 13255case SyntaxKind.PlusPlusToken: 13256case SyntaxKind.MinusMinusToken: 13257case SyntaxKind.OpenBracketToken: 13258case SyntaxKind.DotToken: 13259case SyntaxKind.MinusGreaterThanToken: 13260case SyntaxKind.QuestionQuestionToken: 13261case SyntaxKind.EndOfFileToken: 13262case SyntaxKind.SwitchKeyword: 13263case SyntaxKind.EqualsGreaterThanToken: 13272Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 13291Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 13292var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13295SyntaxKind.CloseBracketToken, 13306this.EatToken(SyntaxKind.CloseBracketToken)); 13309LanguageParser @this, ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<CollectionElementSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13312static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleCollectionElement(), 13327if (this.CurrentToken.ContextualKind == SyntaxKind.WithKeyword && 13328this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 13330return _syntaxFactory.WithElement(this.EatContextualToken(SyntaxKind.WithKeyword), this.ParseParenthesizedArgumentList()); 13345return this.CurrentToken.Kind == SyntaxKind.NewKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 13351var @new = this.EatToken(SyntaxKind.NewKeyword); 13353Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBraceToken); 13355var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13358SyntaxKind.CloseBraceToken, 13370this.EatToken(SyntaxKind.CloseBraceToken)); 13390return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken; 13395return IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 13400return IsTrueIdentifier() && this.PeekToken(1).Kind is SyntaxKind.EqualsToken or SyntaxKind.ColonToken; 13405return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken; 13410SyntaxToken @new = this.EatToken(SyntaxKind.NewKeyword); 13418if (type.Kind == SyntaxKind.ArrayType) 13421if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 13431if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13436if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 13445this.EatToken(SyntaxKind.OpenParenToken, ErrorCode.ERR_BadNewExpr, reportError: type?.ContainsDiagnostics == false), 13447SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken)); 13458if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13471case SyntaxKind.QuestionToken: // e.g. `new(a, b)?()` 13472case SyntaxKind.OpenBracketToken: // e.g. `new(a, b)[]` 13473case SyntaxKind.OpenParenToken: // e.g. `new(a, b)()` for better error recovery 13485var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13488SyntaxKind.CloseBraceToken, 13500SyntaxKind.WithInitializerExpression, 13503this.EatToken(SyntaxKind.CloseBraceToken))); 13510var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13514SyntaxKind.CloseBraceToken, 13522var kind = isObjectInitializer(initializers) ? SyntaxKind.ObjectInitializerExpression : SyntaxKind.CollectionInitializerExpression; 13528this.EatToken(SyntaxKind.CloseBraceToken)); 13542Kind: SyntaxKind.SimpleAssignmentExpression, 13543Left.Kind: SyntaxKind.IdentifierName or SyntaxKind.ImplicitElementAccess, 13584LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13588static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 13596SyntaxKind.SimpleAssignmentExpression, 13598this.CurrentToken.Kind == SyntaxKind.ColonToken 13599? this.EatTokenAsKind(SyntaxKind.EqualsToken) 13600: this.EatToken(SyntaxKind.EqualsToken), 13601this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 13609SyntaxKind.SimpleAssignmentExpression, 13611this.EatToken(SyntaxKind.EqualsToken), 13612this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 13619var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13623SyntaxKind.CloseBraceToken, 13632SyntaxKind.ComplexElementInitializerExpression, 13635this.EatToken(SyntaxKind.CloseBraceToken)); 13640Debug.Assert(this.CurrentToken.Kind is SyntaxKind.NewKeyword or SyntaxKind.StackAllocKeyword); 13641return this.PeekToken(1).Kind == SyntaxKind.OpenBracketToken; 13646var @new = this.EatToken(SyntaxKind.NewKeyword); 13647var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13667if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 13680this.EatToken(SyntaxKind.CloseBracketToken), 13686var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13689SyntaxKind.CloseBraceToken, 13698SyntaxKind.ArrayInitializerExpression, 13701this.EatToken(SyntaxKind.CloseBraceToken)); 13704LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13707static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleVariableInitializer(), 13722var @stackalloc = this.EatToken(SyntaxKind.StackAllocKeyword); 13723var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13734if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 13747this.EatToken(SyntaxKind.CloseBracketToken), 13754this.EatToken(SyntaxKind.StackAllocKeyword), 13756this.CurrentToken.Kind == SyntaxKind.OpenBraceToken ? this.ParseArrayInitializer() : null); 13763isInAsyncContext: this.IsInAsync || modifiers.Any((int)SyntaxKind.AsyncKeyword), 13770var @delegate = this.EatToken(SyntaxKind.DelegateKeyword); 13773if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13786if (this.CurrentToken.Kind != SyntaxKind.OpenBraceToken) 13789var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13798SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)), 13817if (this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 13819modifiers.Add(this.EatToken(SyntaxKind.StaticKeyword)); 13823if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13826modifiers.Add(this.EatContextualToken(SyntaxKind.AsyncKeyword)); 13838Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword); 13842case SyntaxKind.OpenParenToken: 13843case SyntaxKind.IdentifierToken: 13844case SyntaxKind.StaticKeyword: 13845case SyntaxKind.RefKeyword: 13846case SyntaxKind.DelegateKeyword: 13863if (this.CurrentToken.Kind == SyntaxKind.ColonToken && 13880isInAsyncContext: this.IsInAsync || modifiers.Any((int)SyntaxKind.AsyncKeyword), 13891if (CurrentToken.Kind != SyntaxKind.OpenParenToken) 13898if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13901var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13911var identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13912? this.EatTokenAsKind(SyntaxKind.IdentifierToken) 13916var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13928=> CurrentToken.Kind == SyntaxKind.OpenBraceToken 13934var openParen = this.EatToken(SyntaxKind.OpenParenToken); 13940SyntaxKind.CloseParenToken, 13953this.EatToken(SyntaxKind.CloseParenToken)); 13956LanguageParser @this, ref SyntaxToken openParen, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13959static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleLambdaParameter(), 13969case SyntaxKind.ParamsKeyword: 13970case SyntaxKind.ReadOnlyKeyword: 13971case SyntaxKind.RefKeyword: 13972case SyntaxKind.OutKeyword: 13973case SyntaxKind.InKeyword: 13974case SyntaxKind.OpenParenToken: // tuple 13975case SyntaxKind.OpenBracketToken: // attribute 13978case SyntaxKind.IdentifierToken: 13981case SyntaxKind.DelegateKeyword: 14008var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 14029if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 14052is not SyntaxKind.CommaToken 14053and not SyntaxKind.CloseParenToken 14054and not SyntaxKind.EqualsGreaterThanToken 14055and not SyntaxKind.OpenBraceToken 14056and not SyntaxKind.EqualsToken) 14077case SyntaxKind.OnKeyword: 14078case SyntaxKind.EqualsKeyword: 14079case SyntaxKind.AscendingKeyword: 14080case SyntaxKind.DescendingKeyword: 14081case SyntaxKind.ByKeyword: 14092case SyntaxKind.FromKeyword: 14093case SyntaxKind.JoinKeyword: 14094case SyntaxKind.IntoKeyword: 14095case SyntaxKind.WhereKeyword: 14096case SyntaxKind.OrderByKeyword: 14097case SyntaxKind.GroupKeyword: 14098case SyntaxKind.SelectKeyword: 14099case SyntaxKind.LetKeyword: 14108return this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword && 14116var pk1 = this.PeekToken(1).Kind; 14122if (pk1 == SyntaxKind.IdentifierToken) 14124var pk2 = this.PeekToken(2).Kind; 14125if (pk2 == SyntaxKind.InKeyword) 14132if (pk2 is SyntaxKind.SemicolonToken or // from x; 14133SyntaxKind.CommaToken or // from x, y; 14134SyntaxKind.EqualsToken) // from x = null; 14144if (pk2 is SyntaxKind.OpenParenToken or SyntaxKind.OpenBraceToken) 14161return this.ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind is SyntaxKind.IdentifierToken or SyntaxKind.InKeyword; 14172: this.AddError(fromClause, ErrorCode.WRN_PrecedenceInversion, SyntaxFacts.GetText(SyntaxKind.FromKeyword)), 14185case SyntaxKind.FromKeyword: 14188case SyntaxKind.JoinKeyword: 14191case SyntaxKind.LetKeyword: 14194case SyntaxKind.WhereKeyword: 14197case SyntaxKind.OrderByKeyword: 14208SyntaxKind.SelectKeyword => this.ParseSelectClause(), 14209SyntaxKind.GroupKeyword => this.ParseGroupClause(), 14211this.EatToken(SyntaxKind.SelectKeyword, ErrorCode.ERR_ExpectedSelectOrGroup), 14218this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword 14225Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword); 14226var @from = this.EatContextualToken(SyntaxKind.FromKeyword); 14228var type = this.PeekToken(1).Kind != SyntaxKind.InKeyword 14233if (this.PeekToken(1).ContextualKind == SyntaxKind.InKeyword && 14234(this.CurrentToken.Kind != SyntaxKind.IdentifierToken || SyntaxFacts.IsQueryContextualKeyword(this.CurrentToken.ContextualKind))) 14240name = WithAdditionalDiagnostics(name, this.GetExpectedTokenError(SyntaxKind.IdentifierToken, name.ContextualKind, name.GetLeadingTriviaWidth(), name.Width)); 14241name = this.ConvertToMissingWithTrailingTrivia(name, SyntaxKind.IdentifierToken); 14252this.EatToken(SyntaxKind.InKeyword), 14258Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.JoinKeyword); 14260joinKeyword: this.EatContextualToken(SyntaxKind.JoinKeyword), 14261type: this.PeekToken(1).Kind != SyntaxKind.InKeyword 14265inKeyword: this.EatToken(SyntaxKind.InKeyword), 14267onKeyword: this.EatContextualToken(SyntaxKind.OnKeyword, ErrorCode.ERR_ExpectedContextualKeywordOn), 14269equalsKeyword: this.EatContextualToken(SyntaxKind.EqualsKeyword, ErrorCode.ERR_ExpectedContextualKeywordEquals), 14271into: this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword 14278Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.LetKeyword); 14280this.EatContextualToken(SyntaxKind.LetKeyword), 14282SyntaxFacts.IsReservedKeyword(this.CurrentToken.Kind) && this.PeekToken(1).Kind == SyntaxKind.EqualsToken 14283? this.EatTokenAsKind(SyntaxKind.IdentifierToken) 14285this.EatToken(SyntaxKind.EqualsToken), 14291Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword); 14293this.EatContextualToken(SyntaxKind.WhereKeyword), 14299Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.OrderByKeyword); 14300var @orderby = this.EatContextualToken(SyntaxKind.OrderByKeyword); 14307while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 14309if (this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken) 14313else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 14315list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 14319else if (skipBadOrderingListTokens(list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 14329PostSkipAction skipBadOrderingListTokens(SeparatedSyntaxListBuilder<OrderingSyntax> list, SyntaxKind expected) 14334static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 14335static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseParenToken 14336|| p.CurrentToken.Kind == SyntaxKind.SemicolonToken 14346SyntaxKind kind = SyntaxKind.AscendingOrdering; 14348if (this.CurrentToken.ContextualKind is SyntaxKind.AscendingKeyword or SyntaxKind.DescendingKeyword) 14351if (direction.Kind == SyntaxKind.DescendingKeyword) 14353kind = SyntaxKind.DescendingOrdering; 14362Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.SelectKeyword); 14364this.EatContextualToken(SyntaxKind.SelectKeyword), 14370Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.GroupKeyword); 14372this.EatContextualToken(SyntaxKind.GroupKeyword), 14374this.EatContextualToken(SyntaxKind.ByKeyword, ErrorCode.ERR_ExpectedContextualKeywordBy), 14380Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword); 14382this.EatContextualToken(SyntaxKind.IntoKeyword), 14441LanguageParser parser, ref SyntaxToken openToken, SeparatedSyntaxListBuilder<TNode> builder, SyntaxKind expectedKind, SyntaxKind closeTokenKind) where TNode : GreenNode; 14474SyntaxKind closeTokenKind, 14496SyntaxKind closeTokenKind, 14507var separatorTokenKind = SyntaxKind.CommaToken; 14539nodes.AddSeparator(this.CurrentToken.Kind == SyntaxKind.SemicolonToken 14566else if (skipBadTokens(this, ref openToken, nodes, SyntaxKind.IdentifierToken, closeTokenKind) == PostSkipAction.Continue) 14586if (allowSemicolonAsSeparator && this.CurrentToken.Kind is SyntaxKind.SemicolonToken) 14675if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) return node; 14677while (this.CurrentToken.Kind != SyntaxKind.EndOfFileToken)
Parser\LanguageParser_InterpolatedString.cs (24)
20var expressionKind = SyntaxFacts.GetLiteralExpression(originalToken.Kind); 21Debug.Assert(expressionKind != SyntaxKind.None); 34Debug.Assert(interpolatedString.StringStartToken.Kind is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken); 112Debug.Assert(this.CurrentToken.Kind == SyntaxKind.InterpolatedStringToken); 181Lexer.InterpolatedStringKind.Normal => SyntaxKind.InterpolatedStringStartToken, 182Lexer.InterpolatedStringKind.Verbatim => SyntaxKind.InterpolatedVerbatimStringStartToken, 183Lexer.InterpolatedStringKind.SingleLineRaw => SyntaxKind.InterpolatedSingleLineRawStringStartToken, 184Lexer.InterpolatedStringKind.MultiLineRaw => SyntaxKind.InterpolatedMultiLineRawStringStartToken, 259SyntaxFactory.Literal(leading: null, "", SyntaxKind.InterpolatedStringTextToken, "", trailing: null)); 339SyntaxFactory.Literal(leading: null, textString, SyntaxKind.InterpolatedStringTextToken, valueString, trailing: null)); 353Lexer.InterpolatedStringKind.Normal => SyntaxKind.InterpolatedStringEndToken, 354Lexer.InterpolatedStringKind.Verbatim => SyntaxKind.InterpolatedStringEndToken, 355Lexer.InterpolatedStringKind.SingleLineRaw => SyntaxKind.InterpolatedRawStringEndToken, 356Lexer.InterpolatedStringKind.MultiLineRaw => SyntaxKind.InterpolatedRawStringEndToken, 445private static SyntaxToken TokenOrMissingToken(GreenNode? leading, SyntaxKind kind, string text, GreenNode? trailing) 512SyntaxFactory.Token(leading: null, SyntaxKind.OpenBraceToken, text[interpolation.OpenBraceRange], openTokenTrailingTrivia)); 537if (this.CurrentToken.Kind != SyntaxKind.CommaToken) 543this.EatToken(SyntaxKind.CommaToken), 554SyntaxFactory.Token(leading, SyntaxKind.ColonToken, text[interpolation.ColonRange], trailing: null), 568SyntaxKind.CloseBraceToken, 584return SyntaxFactory.Literal(leading: null, text, SyntaxKind.InterpolatedStringTextToken, text, trailing: null); 595Debug.Assert(token.Kind == SyntaxKind.StringLiteralToken); 596var result = SyntaxFactory.Literal(leading: null, text, SyntaxKind.InterpolatedStringTextToken, token.ValueText, trailing: null);
Parser\LanguageParser_Patterns.cs (115)
23var pattern = ParsePattern(GetPrecedence(SyntaxKind.IsPatternExpression), afterIs: true); 40case MemberAccessExpressionSyntax { Expression: var expr, OperatorToken: { Kind: SyntaxKind.DotToken } dotToken, Name: var simpleName } 61while (this.CurrentToken.ContextualKind == SyntaxKind.OrKeyword) 64SyntaxKind.OrPattern, 78var tk = CurrentToken.Kind; 84if (tk == SyntaxKind.IdentifierToken && this.CurrentToken.ContextualKind != SyntaxKind.UnderscoreToken && 85(this.CurrentToken.ContextualKind != SyntaxKind.NameOfKeyword || this.PeekToken(1).Kind != SyntaxKind.OpenParenToken)) 107while (this.CurrentToken.ContextualKind == SyntaxKind.AndKeyword) 110SyntaxKind.AndPattern, 125case SyntaxKind.IdentifierToken: 129case SyntaxKind.OpenParenToken: 145case SyntaxKind.CloseParenToken: 148case SyntaxKind.CommaToken: 160if (this.CurrentToken.ContextualKind == SyntaxKind.NotKeyword) 166else if (this.CurrentToken.Kind == SyntaxKind.EqualsEqualsToken) 172else if (this.CurrentToken.Kind == SyntaxKind.ExclamationEqualsToken) 177SyntaxFactory.MissingToken(SyntaxKind.NotKeyword), 190var tk = this.CurrentToken.Kind; 193case SyntaxKind.CommaToken: 194case SyntaxKind.SemicolonToken: 195case SyntaxKind.CloseBraceToken: 196case SyntaxKind.CloseParenToken: 197case SyntaxKind.CloseBracketToken: 198case SyntaxKind.EqualsGreaterThanToken: 202if (CurrentToken.ContextualKind == SyntaxKind.UnderscoreToken) 204return _syntaxFactory.DiscardPattern(this.EatContextualToken(SyntaxKind.UnderscoreToken)); 209case SyntaxKind.OpenBracketToken: 211case SyntaxKind.DotToken when IsAtDotDotToken(): 217case SyntaxKind.LessThanToken: 218case SyntaxKind.LessThanEqualsToken: 219case SyntaxKind.GreaterThanToken: 220case SyntaxKind.GreaterThanEqualsToken: 221case SyntaxKind.EqualsEqualsToken: 222case SyntaxKind.ExclamationEqualsToken: 261case SyntaxKind.OpenParenToken: 262case SyntaxKind.OpenBraceToken: 263case SyntaxKind.IdentifierToken: 264case SyntaxKind.CloseBraceToken: // for efficiency, test some tokens that can follow a type pattern 265case SyntaxKind.CloseBracketToken: 266case SyntaxKind.CloseParenToken: 267case SyntaxKind.CommaToken: 268case SyntaxKind.SemicolonToken: 270case SyntaxKind.DotToken: 273case SyntaxKind.MinusGreaterThanToken: 274case SyntaxKind.ExclamationToken: 286if (type?.Kind == SyntaxKind.IdentifierName) 290if (typeIdentifierToken.ContextualKind == SyntaxKind.VarKeyword && 291(this.CurrentToken.Kind == SyntaxKind.OpenParenToken || this.IsValidPatternDesignation(inSwitchArmPattern))) 300if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken && (type != null || !looksLikeCast())) 304var openParenToken = this.EatToken(SyntaxKind.OpenParenToken); 307SyntaxKind.CloseParenToken, 314var closeParenToken = this.EatToken(SyntaxKind.CloseParenToken); 379this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken 383if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 409if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 413case SyntaxKind.WhenKeyword: 417case SyntaxKind.AndKeyword: 418case SyntaxKind.OrKeyword: 419var tk = PeekToken(1).Kind; 422case SyntaxKind.CloseBraceToken: 423case SyntaxKind.CloseBracketToken: 424case SyntaxKind.CloseParenToken: 425case SyntaxKind.CommaToken: 426case SyntaxKind.SemicolonToken: 427case SyntaxKind.QuestionToken: 428case SyntaxKind.ColonToken: 430case SyntaxKind.LessThanEqualsToken: 431case SyntaxKind.LessThanToken: 432case SyntaxKind.GreaterThanEqualsToken: 433case SyntaxKind.GreaterThanToken: 434case SyntaxKind.IdentifierToken: 435case SyntaxKind.OpenBraceToken: 436case SyntaxKind.OpenParenToken: 437case SyntaxKind.OpenBracketToken: 450case SyntaxKind.UnderscoreToken: // discard is a valid pattern designation 492expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, newLeft, dotToken, right); 502if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 511var openBraceToken = this.EatToken(SyntaxKind.OpenBraceToken); 514SyntaxKind.CloseBraceToken, 525this.EatToken(SyntaxKind.CloseBraceToken)); 534if (this.CurrentToken.Kind == SyntaxKind.ColonToken && ConvertPatternToExpressionIfPossible(pattern, permitTypeArguments: true) is ExpressionSyntax expr) 556SyntaxKind.OpenBraceToken or 557SyntaxKind.OpenBracketToken or 558SyntaxKind.LessThanToken or 559SyntaxKind.LessThanEqualsToken or 560SyntaxKind.GreaterThanToken or 561SyntaxKind.GreaterThanEqualsToken; 565LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind) 568if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBraceToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken) 575if (@this._termState.HasFlag(TerminatorState.IsExpressionOrPatternInCaseLabelOfSwitchStatement) && @this.CurrentToken.Kind is SyntaxKind.ColonToken) 584if (@this._termState.HasFlag(TerminatorState.IsPatternInSwitchExpressionArm) && @this.CurrentToken.Kind is SyntaxKind.EqualsGreaterThanToken or SyntaxKind.ColonToken) 588static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleSubpatternElement(), 589static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 601this.EatToken(SyntaxKind.OpenBraceToken), 603this.EatToken(SyntaxKind.CloseBraceToken)); 609while (this.CurrentToken.Kind != SyntaxKind.CloseBraceToken) 615var errantCase = this.CurrentToken.Kind == SyntaxKind.CaseKeyword 634this.CurrentToken.Kind == SyntaxKind.ColonToken 635? this.EatTokenAsKind(SyntaxKind.EqualsGreaterThanToken) 636: this.EatToken(SyntaxKind.EqualsGreaterThanToken), 640if (errantCase is null && switchExpressionCase.FullWidth == 0 && this.CurrentToken.Kind != SyntaxKind.CommaToken) 647if (this.CurrentToken.Kind != SyntaxKind.CloseBraceToken) 649var commaToken = this.CurrentToken.Kind == SyntaxKind.SemicolonToken 650? this.EatTokenAsKind(SyntaxKind.CommaToken) 651: this.EatToken(SyntaxKind.CommaToken); 662var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 665SyntaxKind.CloseBracketToken, 676this.EatToken(SyntaxKind.CloseBracketToken),
Parser\Lexer.cs (204)
99internal SyntaxKind Kind; 100internal SyntaxKind ContextualKind; 329Debug.Assert(info.Kind != SyntaxKind.IdentifierToken || info.StringValue != null); 343case SyntaxKind.IdentifierToken: 346case SyntaxKind.NumericLiteralToken: 375case SyntaxKind.InterpolatedStringToken: 379case SyntaxKind.StringLiteralToken: 380case SyntaxKind.Utf8StringLiteralToken: 381case SyntaxKind.SingleLineRawStringLiteralToken: 382case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 383case SyntaxKind.MultiLineRawStringLiteralToken: 384case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 387case SyntaxKind.CharacterLiteralToken: 390case SyntaxKind.XmlTextLiteralNewLineToken: 393case SyntaxKind.XmlTextLiteralToken: 396case SyntaxKind.XmlEntityLiteralToken: 399case SyntaxKind.EndOfDocumentationCommentToken: 400case SyntaxKind.EndOfFileToken: 403case SyntaxKind.RazorContentToken: 406case SyntaxKind.None: 428info.Kind = SyntaxKind.None; 429info.ContextualKind = SyntaxKind.None; 447info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.SlashEqualsToken : SyntaxKind.SlashToken; 467info.Kind = SyntaxKind.DotToken; 478info.Kind = SyntaxKind.DotToken; 485info.Kind = SyntaxKind.CommaToken; 490info.Kind = TextWindow.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken; 495info.Kind = SyntaxKind.SemicolonToken; 500info.Kind = SyntaxKind.TildeToken; 505info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken; 511TextWindow.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken : 512TextWindow.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken; 517info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken; 522info.Kind = SyntaxKind.OpenParenToken; 527info.Kind = SyntaxKind.CloseParenToken; 532info.Kind = SyntaxKind.OpenBraceToken; 537info.Kind = SyntaxKind.CloseBraceToken; 542info.Kind = SyntaxKind.OpenBracketToken; 547info.Kind = SyntaxKind.CloseBracketToken; 553? TextWindow.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken 554: SyntaxKind.QuestionToken; 560TextWindow.TryAdvance('=') ? SyntaxKind.PlusEqualsToken : 561TextWindow.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken; 567TextWindow.TryAdvance('=') ? SyntaxKind.MinusEqualsToken : 568TextWindow.TryAdvance('-') ? SyntaxKind.MinusMinusToken : 569TextWindow.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken; 574info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken; 580TextWindow.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken : 581TextWindow.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken; 586info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken; 592TextWindow.TryAdvance('=') ? SyntaxKind.BarEqualsToken : 593TextWindow.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken; 599TextWindow.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken : 601? TextWindow.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken 602: SyntaxKind.LessThanToken; 607info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken; 620info.Kind = SyntaxKind.RazorContentToken; 685info.Kind = SyntaxKind.EndOfFileToken; 914info.Kind = SyntaxKind.IdentifierToken; 1035info.Kind = SyntaxKind.NumericLiteralToken; 1817info.ContextualKind = SyntaxKind.None; 1828SyntaxKind keywordKind = SyntaxFacts.GetPreprocessorKeywordKind(info.Text); 1832info.Kind = SyntaxKind.IdentifierToken; 1844info.ContextualKind = info.Kind = SyntaxKind.IdentifierToken; 1849info.Kind = SyntaxKind.IdentifierToken; 1853if (info.Kind == SyntaxKind.None) 1855info.Kind = SyntaxKind.IdentifierToken; 1860info.ContextualKind = info.Kind = SyntaxKind.IdentifierToken; 1867info.Kind = SyntaxKind.None; 2368if (directive.Kind == SyntaxKind.EndIfDirectiveTrivia || (branching != null && branching.BranchTaken)) 2372else if (directive.Kind == SyntaxKind.IfDirectiveTrivia) 2477this.LexDirectiveTrailingTrivia(info.Kind == SyntaxKind.EndOfDirectiveToken, ref directiveTriviaCache); 2523var endOfDirective = SyntaxFactory.Token(leading, SyntaxKind.EndOfDirectiveToken, trailing); 2559info.Kind = SyntaxKind.EndOfDirectiveToken; 2565info.Kind = SyntaxKind.EndOfDirectiveToken; 2570info.Kind = SyntaxKind.HashToken; 2575info.Kind = SyntaxKind.OpenParenToken; 2580info.Kind = SyntaxKind.CloseParenToken; 2585info.Kind = SyntaxKind.CommaToken; 2590info.Kind = SyntaxKind.MinusToken; 2595info.Kind = SyntaxKind.ColonToken; 2603info.Kind = SyntaxKind.ExclamationEqualsToken; 2607info.Kind = SyntaxKind.ExclamationToken; 2617info.Kind = SyntaxKind.EqualsEqualsToken; 2621info.Kind = SyntaxKind.EqualsToken; 2630info.Kind = SyntaxKind.AmpersandAmpersandToken; 2640info.Kind = SyntaxKind.BarBarToken; 2657info.Kind = SyntaxKind.NumericLiteralToken; 2705info.Kind = SyntaxKind.None; 2712Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2713return info.Kind != SyntaxKind.None; 2727else if (tr.Kind == SyntaxKind.EndOfLineTrivia) 2848info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 2856info.Kind = SyntaxKind.XmlEntityLiteralToken; 2874info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 2884info.Kind = SyntaxKind.XmlTextLiteralToken; 2888Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2889return info.Kind != SyntaxKind.None; 2896info.Kind = SyntaxKind.XmlTextLiteralNewLineToken; 2910info.Kind = SyntaxKind.XmlCommentStartToken; 2921info.Kind = SyntaxKind.XmlCDataStartToken; 2927info.Kind = SyntaxKind.LessThanToken; 2933info.Kind = SyntaxKind.LessThanSlashToken; 2938info.Kind = SyntaxKind.XmlProcessingInstructionStartToken; 2943info.Kind = SyntaxKind.LessThanToken; 3193if (errors == null && tagInfo.ContextualKind == SyntaxKind.None && tagInfo.Kind == SyntaxKind.IdentifierToken) 3215info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3227info.Kind = SyntaxKind.GreaterThanToken; 3234info.Kind = SyntaxKind.SlashGreaterThanToken; 3242info.Kind = SyntaxKind.DoubleQuoteToken; 3247info.Kind = SyntaxKind.SingleQuoteToken; 3252info.Kind = SyntaxKind.EqualsToken; 3257info.Kind = SyntaxKind.ColonToken; 3271info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3289info.Kind = SyntaxKind.IdentifierToken; 3299info.Kind = SyntaxKind.None; 3306Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3307return info.Kind != SyntaxKind.None; 3388info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3399info.Kind = SyntaxKind.DoubleQuoteToken; 3409info.Kind = SyntaxKind.SingleQuoteToken; 3417info.Kind = SyntaxKind.XmlEntityLiteralToken; 3422info.Kind = SyntaxKind.LessThanToken; 3436info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3446info.Kind = SyntaxKind.XmlTextLiteralToken; 3450Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3451return info.Kind != SyntaxKind.None; 3546info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3554info.Kind = SyntaxKind.XmlEntityLiteralToken; 3561info.Kind = SyntaxKind.EndOfFileToken; 3564info.Kind = SyntaxKind.XmlTextLiteralToken; 3606info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3621info.Kind = SyntaxKind.DoubleQuoteToken; 3630info.Kind = SyntaxKind.SingleQuoteToken; 3647info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3662info.Kind = SyntaxKind.XmlEntityLiteralToken; 3699info.Kind = SyntaxKind.OpenParenToken; 3702info.Kind = SyntaxKind.CloseParenToken; 3705info.Kind = SyntaxKind.OpenBracketToken; 3708info.Kind = SyntaxKind.CloseBracketToken; 3711info.Kind = SyntaxKind.CommaToken; 3722info.Kind = SyntaxKind.DotDotToken; 3726info.Kind = SyntaxKind.DotToken; 3730info.Kind = SyntaxKind.QuestionToken; 3733info.Kind = SyntaxKind.AmpersandToken; 3736info.Kind = SyntaxKind.AsteriskToken; 3739info.Kind = SyntaxKind.BarToken; 3742info.Kind = SyntaxKind.CaretToken; 3745info.Kind = SyntaxKind.PercentToken; 3748info.Kind = SyntaxKind.SlashToken; 3751info.Kind = SyntaxKind.TildeToken; 3756info.Kind = SyntaxKind.LessThanToken; 3759info.Kind = SyntaxKind.GreaterThanToken; 3764if (AdvanceIfMatches(':')) info.Kind = SyntaxKind.ColonColonToken; 3765else info.Kind = SyntaxKind.ColonToken; 3768if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.EqualsEqualsToken; 3769else info.Kind = SyntaxKind.EqualsToken; 3772if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.ExclamationEqualsToken; 3773else info.Kind = SyntaxKind.ExclamationToken; 3776if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.GreaterThanEqualsToken; 3778else info.Kind = SyntaxKind.GreaterThanToken; 3781if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.LessThanEqualsToken; 3782else if (AdvanceIfMatches('<')) info.Kind = SyntaxKind.LessThanLessThanToken; 3783else info.Kind = SyntaxKind.LessThanToken; 3786if (AdvanceIfMatches('+')) info.Kind = SyntaxKind.PlusPlusToken; 3787else info.Kind = SyntaxKind.PlusToken; 3790if (AdvanceIfMatches('-')) info.Kind = SyntaxKind.MinusMinusToken; 3791else info.Kind = SyntaxKind.MinusToken; 3795if (info.Kind != SyntaxKind.None) 3822SyntaxKind keywordKind; 3827info.Kind = SyntaxKind.IdentifierToken; 3839info.ContextualKind = info.Kind = SyntaxKind.IdentifierToken; 3857info.Kind = SyntaxKind.IdentifierToken; 3864info.Kind = SyntaxKind.XmlEntityLiteralToken; 3886Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3887return info.Kind != SyntaxKind.None; 4012info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4022info.Kind = SyntaxKind.XmlCDataEndToken; 4039info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4049info.Kind = SyntaxKind.XmlTextLiteralToken; 4134info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4146info.Kind = SyntaxKind.XmlCommentEndToken; 4152info.Kind = SyntaxKind.MinusMinusToken; 4169info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4179info.Kind = SyntaxKind.XmlTextLiteralToken; 4265info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4275info.Kind = SyntaxKind.XmlProcessingInstructionEndToken; 4292info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4302info.Kind = SyntaxKind.XmlTextLiteralToken;
Parser\Lexer_RawStringLiteral.cs (8)
73Debug.Assert(info.Kind is (SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)); 79case SyntaxKind.SingleLineRawStringLiteralToken: 80info.Kind = SyntaxKind.Utf8SingleLineRawStringLiteralToken; 83case SyntaxKind.MultiLineRawStringLiteralToken: 84info.Kind = SyntaxKind.Utf8MultiLineRawStringLiteralToken; 103info.Kind = SyntaxKind.SingleLineRawStringLiteralToken; 135info.Kind = SyntaxKind.MultiLineRawStringLiteralToken;
Parser\Lexer_StringLiteral.cs (9)
28info.Kind = SyntaxKind.StringLiteralToken; 77info.Kind = SyntaxKind.CharacterLiteralToken; 98info.Kind = SyntaxKind.Utf8StringLiteralToken; 102info.Kind = SyntaxKind.StringLiteralToken; 243info.Kind = SyntaxKind.Utf8StringLiteralToken; 247info.Kind = SyntaxKind.StringLiteralToken; 294info.Kind = SyntaxKind.InterpolatedStringToken; 305var kind = SyntaxKind.InterpolatedStringToken;
Parser\LexerCache.cs (9)
20private static readonly ObjectPool<CachingIdentityFactory<string, SyntaxKind>> s_keywordKindPool = 21CachingIdentityFactory<string, SyntaxKind>.CreatePool( 25var kind = SyntaxFacts.GetKeywordKind(key); 26if (kind == SyntaxKind.None) 36private CachingIdentityFactory<string, SyntaxKind>? _keywordKindMap; 134private CachingIdentityFactory<string, SyntaxKind> KeywordKindMap 174internal bool TryGetKeywordKind(string key, out SyntaxKind kind) 178kind = SyntaxKind.None; 183return kind != SyntaxKind.None;
Parser\SyntaxParser.cs (30)
151if (token.Kind == SyntaxKind.EndOfFileToken) 271protected SyntaxKind CurrentNodeKind 276return cn != null ? cn.Kind() : SyntaxKind.None; 497protected SyntaxToken TryEatToken(SyntaxKind kind) 516_currentToken = SyntaxFactory.Token(SyntaxKind.EndOfFileToken); 521protected SyntaxToken EatToken(SyntaxKind kind) 537protected SyntaxToken EatTokenAsKind(SyntaxKind expected) 552protected SyntaxToken CreateMissingToken(SyntaxKind expected, SyntaxKind actual) 558private SyntaxToken CreateMissingToken(SyntaxKind expected, ErrorCode code, bool reportError) 570protected SyntaxToken EatToken(SyntaxKind kind, bool reportError) 589protected SyntaxToken EatToken(SyntaxKind kind, ErrorCode code, bool reportError = true) 609protected SyntaxToken EatTokenEvenWithIncorrectKind(SyntaxKind kind) 631if (triviaList.Any((int)SyntaxKind.EndOfLineTrivia)) 645protected SyntaxToken EatContextualToken(SyntaxKind kind, ErrorCode code) 659protected SyntaxToken EatContextualToken(SyntaxKind kind) 663var contextualKind = this.CurrentToken.ContextualKind; 674protected virtual SyntaxDiagnosticInfo GetExpectedTokenError(SyntaxKind expected, SyntaxKind actual, int offset, int width) 692GreenNode missingNodeOrToken, SyntaxKind expected, SyntaxKind actual) 700private static ErrorCode GetExpectedTokenErrorCode(SyntaxKind expected, SyntaxKind actual) 704case SyntaxKind.IdentifierToken: 714case SyntaxKind.SemicolonToken: 719case SyntaxKind.CloseParenToken: 721case SyntaxKind.OpenBraceToken: 723case SyntaxKind.CloseBraceToken: 767Debug.Assert(nodeOrToken.Width > 0 || nodeOrToken.RawKind is (int)SyntaxKind.EndOfFileToken); 819if (triviaList.Any((int)SyntaxKind.EndOfLineTrivia))
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (38)
74case SyntaxKind.NamespaceDeclaration: 75case SyntaxKind.FileScopedNamespaceDeclaration: 88while (name.Kind() == SyntaxKind.QualifiedName) 98case SyntaxKind.ClassDeclaration: 99case SyntaxKind.StructDeclaration: 100case SyntaxKind.RecordDeclaration: 101case SyntaxKind.RecordStructDeclaration: 121goto case SyntaxKind.InterfaceDeclaration; 123case SyntaxKind.InterfaceDeclaration: 124case SyntaxKind.ExtensionBlockDeclaration: 142case SyntaxKind.EnumDeclaration: 158case SyntaxKind.EnumMemberDeclaration: 170case SyntaxKind.DelegateDeclaration: 184case SyntaxKind.EventDeclaration: 202case SyntaxKind.EventFieldDeclaration: 203case SyntaxKind.FieldDeclaration: 222case SyntaxKind.ArrowExpressionClause: 233case SyntaxKind.PropertyDeclaration: 258case SyntaxKind.IndexerDeclaration: 284case SyntaxKind.AddAccessorDeclaration: 285case SyntaxKind.RemoveAccessorDeclaration: 286case SyntaxKind.GetAccessorDeclaration: 287case SyntaxKind.SetAccessorDeclaration: 288case SyntaxKind.InitAccessorDeclaration: 301case SyntaxKind.ConstructorDeclaration: 302case SyntaxKind.ConversionOperatorDeclaration: 303case SyntaxKind.DestructorDeclaration: 304case SyntaxKind.MethodDeclaration: 305case SyntaxKind.OperatorDeclaration: 336case SyntaxKind.CompilationUnit: 438case SyntaxKind.ArrowExpressionClause: 441case SyntaxKind.MethodDeclaration: 444case SyntaxKind.OperatorDeclaration: 447case SyntaxKind.ConversionOperatorDeclaration: 450case SyntaxKind.PropertyDeclaration: 453case SyntaxKind.IndexerDeclaration: 456case SyntaxKind.ConstructorDeclaration: 459case SyntaxKind.DestructorDeclaration:
SymbolDisplay\SymbolDisplayVisitor.cs (24)
141SyntaxKind kind = SyntaxFacts.GetKeywordKind(identifier); 143if (kind is SyntaxKind.None && isNamedTypeOrAliasName && StringComparer.Ordinal.Equals(identifier, "record")) 145kind = SyntaxKind.RecordKeyword; 148return kind == SyntaxKind.None ? identifier : $"@{identifier}"; 180AddKeyword(SyntaxKind.NamespaceKeyword); 190AddPunctuation(containingNamespace.IsGlobalNamespace ? SyntaxKind.ColonColonToken : SyntaxKind.DotToken); 224SyntaxFacts.GetText(SyntaxKind.GlobalKeyword))); 247AddKeyword(SyntaxKind.ScopedKeyword); 251AddKeyword(SyntaxKind.RefKeyword); 256AddKeyword(SyntaxKind.ReadOnlyKeyword); 262AddKeyword(SyntaxKind.ScopedKeyword); 288AddPunctuation(SyntaxKind.EqualsToken); 339AddPunctuation(SyntaxKind.EqualsToken); 356private void AddPunctuation(SyntaxKind punctuationKind) 361private void AddKeyword(SyntaxKind keywordKind) 396AddKeyword(SyntaxKind.PrivateKeyword); 399AddKeyword(SyntaxKind.InternalKeyword); 402AddKeyword(SyntaxKind.PrivateKeyword); 404AddKeyword(SyntaxKind.ProtectedKeyword); 407AddKeyword(SyntaxKind.ProtectedKeyword); 410AddKeyword(SyntaxKind.ProtectedKeyword); 412AddKeyword(SyntaxKind.InternalKeyword); 415AddKeyword(SyntaxKind.PublicKeyword);
SymbolDisplay\SymbolDisplayVisitor.Members.cs (95)
59AddPunctuation(SyntaxKind.DotToken); 67AddPunctuation(SyntaxKind.DotToken); 68AddKeyword(SyntaxKind.FieldKeyword); 90AddPunctuation(SyntaxKind.EqualsToken); 175AddPunctuation(SyntaxKind.DotToken); 183AddPunctuation(SyntaxKind.OpenBraceToken); 185AddAccessor(symbol, symbol.GetMethod, SyntaxKind.GetKeyword); 186var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; 190AddPunctuation(SyntaxKind.CloseBraceToken); 210AddKeyword(SyntaxKind.ThisKeyword); 224AddPunctuation(SyntaxKind.OpenBracketToken); 226AddPunctuation(SyntaxKind.CloseBracketToken); 243AddKeyword(SyntaxKind.EventKeyword); 257AddPunctuation(SyntaxKind.DotToken); 344tryGetUserDefinedOperatorTokenKind(symbol.MetadataName) == SyntaxKind.None) 368AddKeyword(SyntaxKind.VoidKeyword); 415AddPunctuation(SyntaxKind.DotToken); 448AddPunctuation(SyntaxKind.DotToken); 449AddKeyword(symbol.MethodKind == MethodKind.PropertyGet ? SyntaxKind.GetKeyword : 450IsInitOnly(symbol) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword); 463AddPunctuation(SyntaxKind.DotToken); 464AddKeyword(symbol.MethodKind == MethodKind.EventAdd ? SyntaxKind.AddKeyword : SyntaxKind.RemoveKeyword); 494AddPunctuation(SyntaxKind.TildeToken); 538SyntaxKind operatorKind = tryGetUserDefinedOperatorTokenKind(symbol.MetadataName); 540if (operatorKind == SyntaxKind.None) 559SyntaxKind conversionKind = tryGetUserDefinedConversionTokenKind(symbol.MetadataName); 561if (conversionKind == SyntaxKind.None) 585AddKeyword(SyntaxKind.DelegateKeyword); 586AddPunctuation(SyntaxKind.AsteriskToken); 591AddKeyword(SyntaxKind.UnmanagedKeyword); 597AddPunctuation(SyntaxKind.OpenBracketToken); 621AddPunctuation(SyntaxKind.CommaToken); 634AddPunctuation(SyntaxKind.CloseBracketToken); 638AddPunctuation(SyntaxKind.LessThanToken); 650AddPunctuation(SyntaxKind.CommaToken); 669AddPunctuation(SyntaxKind.GreaterThanToken); 672static SyntaxKind tryGetUserDefinedOperatorTokenKind(string operatorName) 676return SyntaxKind.TrueKeyword; 680return SyntaxKind.FalseKeyword; 688void addUserDefinedOperatorName(IMethodSymbol symbol, SyntaxKind operatorKind, string operatorName) 690Debug.Assert(operatorKind != SyntaxKind.None); 692AddKeyword(SyntaxKind.OperatorKeyword); 695if (operatorKind == SyntaxKind.TrueKeyword) 697AddKeyword(SyntaxKind.TrueKeyword); 699else if (operatorKind == SyntaxKind.FalseKeyword) 701AddKeyword(SyntaxKind.FalseKeyword); 707AddKeyword(SyntaxKind.CheckedKeyword); 716static SyntaxKind tryGetUserDefinedConversionTokenKind(string operatorName) 720return SyntaxKind.ExplicitKeyword; 724return SyntaxKind.ImplicitKeyword; 728return SyntaxKind.None; 732void addUserDefinedConversionName(IMethodSymbol symbol, SyntaxKind conversionKind, string operatorName) 736Debug.Assert(conversionKind != SyntaxKind.None); 740AddKeyword(SyntaxKind.OperatorKeyword); 745AddKeyword(SyntaxKind.CheckedKeyword); 781AddPunctuation(SyntaxKind.OpenParenToken); 786AddPunctuation(SyntaxKind.CloseParenToken); 809AddPunctuation(SyntaxKind.OpenBracketToken); 833AddPunctuation(SyntaxKind.EqualsToken); 841AddPunctuation(SyntaxKind.CloseBracketToken); 855AddKeyword(SyntaxKind.ScopedKeyword); 868AddKeyword(SyntaxKind.ParamsKeyword); 876AddKeyword(SyntaxKind.ScopedKeyword); 907AddKeyword(SyntaxKind.ConstKeyword); 913AddKeyword(SyntaxKind.ReadOnlyKeyword); 919AddKeyword(SyntaxKind.VolatileKeyword); 942AddKeyword(SyntaxKind.StaticKeyword); 948AddKeyword(SyntaxKind.OverrideKeyword); 954AddKeyword(SyntaxKind.AbstractKeyword); 960AddKeyword(SyntaxKind.SealedKeyword); 966AddKeyword(SyntaxKind.ExternKeyword); 972AddKeyword(SyntaxKind.VirtualKeyword); 978AddKeyword(SyntaxKind.RequiredKeyword); 1003AddPunctuation(SyntaxKind.CommaToken); 1010AddKeyword(SyntaxKind.ThisKeyword); 1024AddPunctuation(SyntaxKind.CommaToken); 1028AddKeyword(SyntaxKind.ArgListKeyword); 1032private void AddAccessor(IPropertySymbol property, IMethodSymbol? method, SyntaxKind keyword) 1048AddPunctuation(SyntaxKind.SemicolonToken); 1063AddPunctuation(SyntaxKind.DotToken); 1082AddPunctuation(SyntaxKind.OpenParenToken); 1084AddPunctuation(SyntaxKind.CloseParenToken); 1103AddKeyword(SyntaxKind.RefKeyword); 1117AddKeyword(SyntaxKind.RefKeyword); 1119AddKeyword(SyntaxKind.ReadOnlyKeyword); 1129AddKeyword(SyntaxKind.ReadOnlyKeyword); 1139AddKeyword(SyntaxKind.OutKeyword); 1143AddKeyword(SyntaxKind.RefKeyword); 1147AddKeyword(SyntaxKind.InKeyword); 1151AddKeyword(SyntaxKind.RefKeyword); 1153AddKeyword(SyntaxKind.ReadOnlyKeyword);
SymbolDisplay\SymbolDisplayVisitor.Types.cs (61)
73AddPunctuation(type.NullableAnnotation == CodeAnalysis.NullableAnnotation.Annotated ? SyntaxKind.QuestionToken : SyntaxKind.ExclamationToken); 106AddPunctuation(SyntaxKind.OpenBracketToken); 112AddPunctuation(SyntaxKind.AsteriskToken); 120AddPunctuation(SyntaxKind.AsteriskToken); 126AddPunctuation(SyntaxKind.CommaToken); 130AddPunctuation(SyntaxKind.AsteriskToken); 134AddPunctuation(SyntaxKind.CloseBracketToken); 147AddPunctuation(SyntaxKind.AsteriskToken); 236AddPunctuation(SyntaxKind.QuestionToken); 270AddKeyword(SyntaxKind.VoidKeyword); 291AddPunctuation(namespaceSymbol.IsGlobalNamespace ? SyntaxKind.ColonColonToken : SyntaxKind.DotToken); 312AddPunctuation(Format.CompilerInternalOptions.HasFlag(SymbolDisplayCompilerInternalOptions.UsePlusForNestedTypes) ? SyntaxKind.PlusToken : SyntaxKind.DotToken); 349AddKeyword(SyntaxKind.ExtensionKeyword); 423AddPunctuation(SyntaxKind.LessThanToken); 426AddPunctuation(SyntaxKind.CommaToken); 429AddPunctuation(SyntaxKind.GreaterThanToken); 459AddPunctuation(SyntaxKind.OpenBracketToken); 461AddPunctuation(SyntaxKind.CloseBracketToken); 471AddPunctuation(SyntaxKind.OpenParenToken); 473AddPunctuation(SyntaxKind.CloseParenToken); 500AddPunctuation(SyntaxKind.OpenParenToken); 502AddPunctuation(SyntaxKind.CloseParenToken); 594AddPunctuation(SyntaxKind.OpenParenToken); 601AddPunctuation(SyntaxKind.CommaToken); 613AddPunctuation(SyntaxKind.CloseParenToken); 619AddPunctuation(SyntaxKind.OpenBracketToken); 621AddPunctuation(SyntaxKind.CloseBracketToken); 744AddKeyword(SyntaxKind.RecordKeyword); 754AddKeyword(SyntaxKind.ReadOnlyKeyword); 758AddKeyword(SyntaxKind.RecordKeyword); 760AddKeyword(SyntaxKind.StructKeyword); 766AddKeyword(SyntaxKind.ClassKeyword); 771AddKeyword(SyntaxKind.EnumKeyword); 776AddKeyword(SyntaxKind.DelegateKeyword); 781AddKeyword(SyntaxKind.InterfaceKeyword); 788AddKeyword(SyntaxKind.ReadOnlyKeyword); 794AddKeyword(SyntaxKind.RefKeyword); 798AddKeyword(SyntaxKind.StructKeyword); 813AddKeyword(SyntaxKind.InKeyword); 817AddKeyword(SyntaxKind.OutKeyword); 840AddPunctuation(SyntaxKind.LessThanToken); 849AddPunctuation(SyntaxKind.CommaToken); 877AddPunctuation(SyntaxKind.GreaterThanToken); 901AddKeyword(SyntaxKind.WhereKeyword); 907AddPunctuation(SyntaxKind.ColonToken); 915AddKeyword(SyntaxKind.ClassKeyword); 922AddPunctuation(SyntaxKind.QuestionToken); 929AddPunctuation(SyntaxKind.ExclamationToken); 943AddKeyword(SyntaxKind.StructKeyword); 957AddPunctuation(SyntaxKind.CommaToken); 970AddPunctuation(SyntaxKind.CommaToken); 974AddKeyword(SyntaxKind.NewKeyword); 975AddPunctuation(SyntaxKind.OpenParenToken); 976AddPunctuation(SyntaxKind.CloseParenToken); 984AddPunctuation(SyntaxKind.CommaToken); 988AddKeyword(SyntaxKind.AllowsKeyword); 990AddKeyword(SyntaxKind.RefKeyword); 992AddKeyword(SyntaxKind.StructKeyword);
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (7)
20AddKeyword(SyntaxKind.NullKeyword); 24AddKeyword(SyntaxKind.DefaultKeyword); 27AddPunctuation(SyntaxKind.OpenParenToken); 29AddPunctuation(SyntaxKind.CloseParenToken); 36AddPunctuation(SyntaxKind.OpenParenToken); 38AddPunctuation(SyntaxKind.CloseParenToken); 66AddPunctuation(SyntaxKind.BarToken);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (8)
56return SyntaxFacts.IsInNamespaceOrTypeContext(startNode as ExpressionSyntax) || token.IsKind(SyntaxKind.NewKeyword) || this.InNamespaceOrType; 102AddPunctuation(SyntaxKind.ColonColonToken); 108AddPunctuation(SyntaxKind.DotToken); 140AddPunctuation(SyntaxKind.DotToken); 155AddKeyword(SyntaxKind.GlobalKeyword); 156AddPunctuation(SyntaxKind.ColonColonToken); 162AddPunctuation(SyntaxKind.DotToken); 295if (token.IsKind(SyntaxKind.IdentifierToken))
Symbols\FieldOrPropertyInitializer.cs (2)
31Debug.Assert(((syntax.IsKind(SyntaxKind.EqualsValueClause) || syntax.IsKind(SyntaxKind.Parameter)) && fieldOpt != null) || syntax is StatementSyntax);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (5)
44case SyntaxKind.RefKeyword when refKind == RefKind.None: 45if (modifiers.Count > i + 1 && modifiers[i + 1].Kind() == SyntaxKind.ReadOnlyKeyword) 58case SyntaxKind.RefKeyword: 115case SyntaxKind.ManagedKeyword: 123case SyntaxKind.UnmanagedKeyword:
Symbols\MemberSymbolExtensions.cs (1)
627if (constructorSyntax?.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer)
Symbols\NamespaceOrTypeSymbol.cs (1)
210SyntaxKind kind,
Symbols\NamespaceSymbol.cs (4)
294case SyntaxKind.GenericName: // DeclarationTreeBuilder.VisitNamespace uses the PlainName, even for generic names 295case SyntaxKind.IdentifierName: 298case SyntaxKind.QualifiedName: 308case SyntaxKind.AliasQualifiedName:
Symbols\RangeVariableSymbol.cs (1)
63Debug.Assert(token.Kind() == SyntaxKind.IdentifierToken);
Symbols\RefKindExtensions.cs (5)
21public static RefKind GetRefKind(this SyntaxKind syntaxKind) 25case SyntaxKind.RefKeyword: 27case SyntaxKind.OutKeyword: 29case SyntaxKind.InKeyword: 31case SyntaxKind.None:
Symbols\Source\AttributeLocation.cs (2)
113var kind = SyntaxFacts.GetKeywordKind(token.ValueText); 114if (kind == SyntaxKind.None)
Symbols\Source\GlobalExpressionVariable.cs (4)
52Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); 179Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); 189if ((object)_containingFieldOpt != null && nodeToBind.Kind() != SyntaxKind.VariableDeclarator) 200case SyntaxKind.VariableDeclarator:
Symbols\Source\LambdaSymbol.cs (1)
382var isParams = paramSyntax?.Modifiers.Any(static m => m.IsKind(SyntaxKind.ParamsKeyword)) ?? false;
Symbols\Source\LocalFunctionSymbol.cs (7)
63var safeToken = syntax.Modifiers.FirstOrDefault(SyntaxKind.SafeKeyword); 139Syntax.Modifiers.GetModifierLocation(SyntaxKind.ExternKeyword, Syntax.Identifier.GetLocation())); 145Syntax.Modifiers.GetModifierLocation(SyntaxKind.UnsafeKeyword, Syntax.Identifier.GetLocation()), 152Syntax.Modifiers.GetModifierLocation(SyntaxKind.SafeKeyword, Syntax.Identifier.GetLocation())); 239var isVararg = arglistToken.Kind() == SyntaxKind.ArgListKeyword; 356firstParam.Modifiers.Any(SyntaxKind.ThisKeyword); 465if (parameter.VarianceKeyword.Kind() != SyntaxKind.None)
Symbols\Source\ModifierUtils.cs (61)
29var readonlyToken = modifiers.FirstOrDefault(SyntaxKind.ReadOnlyKeyword); 117var safeToken = modifierTokens?.FirstOrDefault(SyntaxKind.SafeKeyword) ?? default; 129Debug.Assert(modifier.Kind() == SyntaxKind.ScopedKeyword); 142var partialToken = modifierTokens.Value.FirstOrDefault(SyntaxKind.PartialKeyword); 313return SyntaxFacts.GetText(SyntaxKind.AbstractKeyword); 315return SyntaxFacts.GetText(SyntaxKind.SealedKeyword); 317return SyntaxFacts.GetText(SyntaxKind.StaticKeyword); 319return SyntaxFacts.GetText(SyntaxKind.NewKeyword); 321return SyntaxFacts.GetText(SyntaxKind.PublicKeyword); 323return SyntaxFacts.GetText(SyntaxKind.ProtectedKeyword); 325return SyntaxFacts.GetText(SyntaxKind.InternalKeyword); 327return SyntaxFacts.GetText(SyntaxKind.ProtectedKeyword) + " " + SyntaxFacts.GetText(SyntaxKind.InternalKeyword); 329return SyntaxFacts.GetText(SyntaxKind.PrivateKeyword); 331return SyntaxFacts.GetText(SyntaxKind.PrivateKeyword) + " " + SyntaxFacts.GetText(SyntaxKind.ProtectedKeyword); 333return SyntaxFacts.GetText(SyntaxKind.ReadOnlyKeyword); 335return SyntaxFacts.GetText(SyntaxKind.ConstKeyword); 337return SyntaxFacts.GetText(SyntaxKind.VolatileKeyword); 339return SyntaxFacts.GetText(SyntaxKind.ExternKeyword); 341return SyntaxFacts.GetText(SyntaxKind.PartialKeyword); 343return SyntaxFacts.GetText(SyntaxKind.UnsafeKeyword); 345return SyntaxFacts.GetText(SyntaxKind.SafeKeyword); 347return SyntaxFacts.GetText(SyntaxKind.FixedKeyword); 349return SyntaxFacts.GetText(SyntaxKind.VirtualKeyword); 351return SyntaxFacts.GetText(SyntaxKind.OverrideKeyword); 353return SyntaxFacts.GetText(SyntaxKind.AsyncKeyword); 355return SyntaxFacts.GetText(SyntaxKind.RefKeyword); 357return SyntaxFacts.GetText(SyntaxKind.RequiredKeyword); 359return SyntaxFacts.GetText(SyntaxKind.ScopedKeyword); 361return SyntaxFacts.GetText(SyntaxKind.FileKeyword); 363return SyntaxFacts.GetText(SyntaxKind.ClosedKeyword); 369private static DeclarationModifiers ToDeclarationModifier(SyntaxKind kind) 373case SyntaxKind.AbstractKeyword: 375case SyntaxKind.AsyncKeyword: 377case SyntaxKind.SealedKeyword: 379case SyntaxKind.StaticKeyword: 381case SyntaxKind.NewKeyword: 383case SyntaxKind.PublicKeyword: 385case SyntaxKind.ProtectedKeyword: 387case SyntaxKind.InternalKeyword: 389case SyntaxKind.PrivateKeyword: 391case SyntaxKind.ExternKeyword: 393case SyntaxKind.ReadOnlyKeyword: 395case SyntaxKind.PartialKeyword: 397case SyntaxKind.UnsafeKeyword: 399case SyntaxKind.SafeKeyword: 401case SyntaxKind.VirtualKeyword: 403case SyntaxKind.OverrideKeyword: 405case SyntaxKind.ConstKeyword: 407case SyntaxKind.FixedKeyword: 409case SyntaxKind.VolatileKeyword: 411case SyntaxKind.RefKeyword: 413case SyntaxKind.RequiredKeyword: 415case SyntaxKind.ScopedKeyword: 417case SyntaxKind.FileKeyword: 419case SyntaxKind.ClosedKeyword: 462var i = modifiers.IndexOf(SyntaxKind.PartialKeyword); 472var isPartialAsyncMethod = isOrdinaryMethod && i == modifiers.Count - 2 && modifiers[i + 1].ContextualKind() is SyntaxKind.AsyncKeyword; 624internal static Location GetModifierLocation(this SyntaxTokenList modifiers, SyntaxKind kind, Location fallback) 627internal static Location GetModifierLocation(this SyntaxTokenList? modifiers, SyntaxKind kind, Location fallback)
Symbols\Source\ParameterHelpers.cs (50)
55hasParamsModifier: paramsKeyword.Kind() != SyntaxKind.None, 56isExtensionMethodThis: ordinal == 0 && thisKeyword.Kind() != SyntaxKind.None, 77Debug.Assert(paramsKeyword.Kind() == SyntaxKind.None); 271if (thisKeyword.Kind() != SyntaxKind.None && !allowThis) 283if (paramsKeyword.Kind() != SyntaxKind.None 284|| refnessKeyword.Kind() != SyntaxKind.None 285|| thisKeyword.Kind() != SyntaxKind.None 312Debug.Assert(refnessKeyword.Kind() != SyntaxKind.None); 606case SyntaxKind.ThisKeyword: 625addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.OutKeyword); 637case SyntaxKind.RefKeyword: 649addERR_ParamsCantBeWithModifier(diagnostics, modifier, SyntaxKind.RefKeyword); 653addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.OutKeyword); 657addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.InKeyword); 665case SyntaxKind.OutKeyword: 672addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.ThisKeyword); 676addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.ExtensionKeyword); 680addERR_ParamsCantBeWithModifier(diagnostics, modifier, SyntaxKind.OutKeyword); 684addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.RefKeyword); 688addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.InKeyword); 696case SyntaxKind.ParamsKeyword when parameterContext is not ParameterContext.FunctionPointer: 711addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.RefKeyword); 715addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.InKeyword); 719addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.OutKeyword); 737case SyntaxKind.InKeyword: 751addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.OutKeyword); 755addERR_BadParameterModifiers(diagnostics, modifier, SyntaxKind.RefKeyword); 759addERR_ParamsCantBeWithModifier(diagnostics, modifier, SyntaxKind.InKeyword); 767case SyntaxKind.ScopedKeyword when parameterContext is not ParameterContext.FunctionPointer: 787if (nextModifier.Kind() is not (SyntaxKind.RefKeyword or SyntaxKind.OutKeyword or SyntaxKind.InKeyword or SyntaxKind.ScopedKeyword)) 794case SyntaxKind.ReadOnlyKeyword: 799else if (previousModifier?.Kind() != SyntaxKind.RefKeyword) 810case SyntaxKind.ParamsKeyword when parameterContext is ParameterContext.FunctionPointer: 811case SyntaxKind.ScopedKeyword when parameterContext is ParameterContext.FunctionPointer: 827static void addERR_BadParameterModifiers(BindingDiagnosticBag diagnostics, SyntaxToken modifier, SyntaxKind otherModifierKind) 832static void addERR_ParamsCantBeWithModifier(BindingDiagnosticBag diagnostics, SyntaxToken modifier, SyntaxKind otherModifierKind) 857if (thisKeyword.Kind() == SyntaxKind.ThisKeyword && parameterIndex != 0 && owner?.IsExtensionBlockMember() != true) 873bool isNamed = syntax is ParameterSyntax parameterSyntax && parameterSyntax.Identifier.Kind() != SyntaxKind.None; 963else if (paramsKeyword.Kind() == SyntaxKind.ParamsKeyword) 969else if (thisKeyword.Kind() == SyntaxKind.ThisKeyword) 1146case SyntaxKind.OutKeyword: 1153case SyntaxKind.RefKeyword: 1160case SyntaxKind.InKeyword: 1167case SyntaxKind.ParamsKeyword: 1173case SyntaxKind.ThisKeyword: 1176case SyntaxKind.ScopedKeyword: 1179case SyntaxKind.ReadOnlyKeyword:
Symbols\Source\QuickAttributeChecker.cs (1)
99(!onlyGlobalAliases || usingDirective.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword)))
Symbols\Source\SourceComplexParameterSymbol.cs (3)
56Debug.Assert((syntaxRef == null) || (syntaxRef.GetSyntax().IsKind(SyntaxKind.Parameter))); 1591if (IsParams && ParameterSyntax?.Modifiers.Any(SyntaxKind.ParamsKeyword) == true) 1747diagnostics.Add(ErrorCode.ERR_ParamsMustBeCollection, ParameterSyntax.Modifiers.First(static m => m.IsKind(SyntaxKind.ParamsKeyword)).GetLocation());
Symbols\Source\SourceConstructorSymbol.cs (2)
26var methodKind = syntax.Modifiers.Any(SyntaxKind.StaticKeyword) ? MethodKind.StaticConstructor : MethodKind.Constructor; 39containingType, syntax, methodKind, isNullableAnalysisEnabled, syntax.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer, location, diagnostics, out bool modifierErrors, out bool report_ERR_StaticConstructorWithAccessModifiers))
Symbols\Source\SourceConstructorSymbolBase.cs (6)
31Debug.Assert(syntax.Kind() is SyntaxKind.ConstructorDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.UnionDeclaration);
Symbols\Source\SourceCustomEventAccessorSymbol.cs (3)
33isAdder: syntax.Kind() == SyntaxKind.AddAccessorDeclaration, 39Debug.Assert(syntax.Kind() == SyntaxKind.AddAccessorDeclaration || syntax.Kind() == SyntaxKind.RemoveAccessorDeclaration);
Symbols\Source\SourceCustomEventSymbol.cs (7)
87case SyntaxKind.AddAccessorDeclaration: 98case SyntaxKind.RemoveAccessorDeclaration: 109case SyntaxKind.GetAccessorDeclaration: 110case SyntaxKind.SetAccessorDeclaration: 111case SyntaxKind.InitAccessorDeclaration: 115case SyntaxKind.UnknownAccessorDeclaration: 124if (checkBody && !IsAbstract && accessor.Body == null && accessor.ExpressionBody == null && accessor.SemicolonToken.Kind() == SyntaxKind.SemicolonToken)
Symbols\Source\SourceDelegateMethodSymbol.cs (1)
279if (arglistToken.Kind() == SyntaxKind.ArgListKeyword)
Symbols\Source\SourceEventSymbol.cs (7)
162case SyntaxKind.EventDeclaration: 164case SyntaxKind.VariableDeclarator: 672diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 677diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword)); 893(MemberSyntax?.Modifiers).GetModifierLocation(SyntaxKind.ExternKeyword, location)); 899(MemberSyntax?.Modifiers).GetModifierLocation(SyntaxKind.UnsafeKeyword, location), 906(MemberSyntax?.Modifiers).GetModifierLocation(SyntaxKind.SafeKeyword, location));
Symbols\Source\SourceFixedFieldSymbol.cs (1)
73if (arguments.Count == 0 || arguments[0].Expression.Kind() == SyntaxKind.OmittedArraySizeExpression)
Symbols\Source\SourceLabelSymbol.cs (3)
51if (node.Kind() == SyntaxKind.DefaultSwitchLabel) 60if (tk.Kind() != SyntaxKind.None) 155&& symbol._identifierNodeOrToken.Kind() != SyntaxKind.None
Symbols\Source\SourceLocalSymbol.cs (33)
81Debug.Assert(identifierToken.Kind() != SyntaxKind.None); 198nodeToBind.Kind() == SyntaxKind.CasePatternSwitchLabel || 199nodeToBind.Kind() == SyntaxKind.ThisConstructorInitializer || 200nodeToBind.Kind() == SyntaxKind.BaseConstructorInitializer || 201nodeToBind.Kind() == SyntaxKind.PrimaryConstructorBaseType || // initializer for a record constructor 202nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm || 203nodeToBind.Kind() == SyntaxKind.ArgumentList && (nodeToBind.Parent is ConstructorInitializerSyntax || nodeToBind.Parent is PrimaryConstructorBaseTypeSyntax) || 204nodeToBind.Kind() == SyntaxKind.GotoCaseStatement || // for error recovery 205nodeToBind.Kind() == SyntaxKind.VariableDeclarator && 206new[] { SyntaxKind.LocalDeclarationStatement, SyntaxKind.ForStatement, SyntaxKind.UsingStatement, SyntaxKind.FixedStatement }. 209Debug.Assert(!(nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm) || nodeBinder is SwitchExpressionArmBinder); 776case SyntaxKind.SimpleAssignmentExpression: 784case SyntaxKind.ForEachVariableStatement: 814nodeToBind.Kind() == SyntaxKind.CasePatternSwitchLabel || 815nodeToBind.Kind() == SyntaxKind.ThisConstructorInitializer || 816nodeToBind.Kind() == SyntaxKind.BaseConstructorInitializer || 817nodeToBind.Kind() == SyntaxKind.PrimaryConstructorBaseType || // initializer for a record constructor 818nodeToBind.Kind() == SyntaxKind.ArgumentList && (nodeToBind.Parent is ConstructorInitializerSyntax || nodeToBind.Parent is PrimaryConstructorBaseTypeSyntax) || 819nodeToBind.Kind() == SyntaxKind.VariableDeclarator || 820nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm || 821nodeToBind.Kind() == SyntaxKind.GotoCaseStatement || 823Debug.Assert(!(nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm) || nodeBinder is SwitchExpressionArmBinder); 837case SyntaxKind.ThisConstructorInitializer: 838case SyntaxKind.BaseConstructorInitializer: 842case SyntaxKind.PrimaryConstructorBaseType: 845case SyntaxKind.ArgumentList: 858case SyntaxKind.CasePatternSwitchLabel: 861case SyntaxKind.VariableDeclarator: 867case SyntaxKind.SwitchExpressionArm: 872case SyntaxKind.GotoCaseStatement:
Symbols\Source\SourceMemberContainerSymbol.cs (62)
532if (reportIfContextual(SyntaxKind.RecordKeyword, MessageID.IDS_FeatureRecords, ErrorCode.WRN_RecordNamedDisallowed) 533|| reportIfContextual(SyntaxKind.RequiredKeyword, MessageID.IDS_FeatureRequiredMembers, ErrorCode.ERR_RequiredNameDisallowed) 534|| reportIfContextual(SyntaxKind.FileKeyword, MessageID.IDS_FeatureFileTypes, ErrorCode.ERR_FileTypeNameDisallowed) 535|| reportIfContextual(SyntaxKind.ClosedKeyword, MessageID.IDS_FeatureClosedClasses, ErrorCode.ERR_ClosedTypeNameDisallowed) 536|| reportIfContextual(SyntaxKind.ScopedKeyword, MessageID.IDS_FeatureRefFields, ErrorCode.ERR_ScopedTypeNameDisallowed) 537|| reportIfContextual(SyntaxKind.ExtensionKeyword, MessageID.IDS_FeatureExtensions, ErrorCode.ERR_ExtensionTypeNameDisallowed)) 546bool reportIfContextual(SyntaxKind contextualKind, MessageID featureId, ErrorCode error) 2513diagnostics.Add(ErrorCode.ERR_MemberAlreadyExists, indexer.GetFirstLocation(), SyntaxFacts.GetText(SyntaxKind.ThisKeyword), containerForDiagnostics); 3222case SyntaxKind.FieldDeclaration: 3225!ContainsModifier(fieldDecl.Modifiers, SyntaxKind.StaticKeyword) && 3226!ContainsModifier(fieldDecl.Modifiers, SyntaxKind.ConstKeyword); 3227case SyntaxKind.PropertyDeclaration: 3231!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.StaticKeyword) && 3232!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.AbstractKeyword) && 3233!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.ExternKeyword) && 3234!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.PartialKeyword) && 3237case SyntaxKind.EventFieldDeclaration: 3241!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.StaticKeyword) && 3242!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.AbstractKeyword) && 3243!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.ExternKeyword); 3256private static bool ContainsModifier(SyntaxTokenList modifiers, SyntaxKind modifier) 4044case SyntaxKind.EnumDeclaration: 4048case SyntaxKind.DelegateDeclaration: 4052case SyntaxKind.NamespaceDeclaration: 4053case SyntaxKind.FileScopedNamespaceDeclaration: 4058case SyntaxKind.CompilationUnit: 4062case SyntaxKind.InterfaceDeclaration: 4066case SyntaxKind.ClassDeclaration: 4067case SyntaxKind.StructDeclaration: 4068case SyntaxKind.UnionDeclaration: 4069case SyntaxKind.RecordDeclaration: 4070case SyntaxKind.RecordStructDeclaration: 4071case SyntaxKind.ExtensionBlockDeclaration: 4097if (syntax.Kind() is SyntaxKind.UnionDeclaration) 4885&& type.Kind() is (SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.UnionDeclaration)); 5773case SyntaxKind.FieldDeclaration: 5819case SyntaxKind.MethodDeclaration: 5832case SyntaxKind.ConstructorDeclaration: 5843if (constructorSyntax.Initializer?.Kind() != SyntaxKind.ThisConstructorInitializer) 5850case SyntaxKind.DestructorDeclaration: 5867case SyntaxKind.PropertyDeclaration: 5917case SyntaxKind.EventFieldDeclaration: 5969case SyntaxKind.EventDeclaration: 5988case SyntaxKind.IndexerDeclaration: 6004case SyntaxKind.ConversionOperatorDeclaration: 6018case SyntaxKind.OperatorDeclaration: 6032case SyntaxKind.GlobalStatement: 6041while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 6048case SyntaxKind.LocalDeclarationStatement: 6060case SyntaxKind.ExpressionStatement: 6061case SyntaxKind.IfStatement: 6062case SyntaxKind.YieldReturnStatement: 6063case SyntaxKind.ReturnStatement: 6064case SyntaxKind.ThrowStatement: 6065case SyntaxKind.SwitchStatement: 6066case SyntaxKind.LockStatement: 6091m.Kind() is SyntaxKind.NamespaceDeclaration or 6092SyntaxKind.FileScopedNamespaceDeclaration or 6093SyntaxKind.IncompleteMember); 6106var errorCode = parentSyntax.IsKind(SyntaxKind.CompilationUnit)
Symbols\Source\SourceMemberFieldSymbol.cs (6)
81if (modifier.Kind() == SyntaxKind.ConstKeyword) 87Debug.Assert(constToken.Kind() == SyntaxKind.ConstKeyword); 152ModifiersTokenList.GetModifierLocation(SyntaxKind.UnsafeKeyword, ErrorLocation), 244if (modifier.IsKind(SyntaxKind.FixedKeyword)) 282diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, SyntaxFacts.GetText(SyntaxKind.RequiredKeyword)); 502diagnostics.Add(ErrorCode.ERR_BadMemberFlag, ErrorLocation, SyntaxFacts.GetText(SyntaxKind.ScopedKeyword));
Symbols\Source\SourceMemberMethodSymbol.cs (5)
763Debug.Assert(arrowExpression.Parent.Kind() == SyntaxKind.PropertyDeclaration || 764arrowExpression.Parent.Kind() == SyntaxKind.IndexerDeclaration || 1001Modifiers.GetModifierLocation(SyntaxKind.ExternKeyword, _location)); 1007Modifiers.GetModifierLocation(SyntaxKind.UnsafeKeyword, _location), 1016Modifiers.GetModifierLocation(SyntaxKind.SafeKeyword, _location));
Symbols\Source\SourceMethodSymbol.cs (3)
306SyntaxKind syntaxKind = SyntaxFacts.GetOperatorKind(target.Name); 308return syntaxKind is (SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken) ||
Symbols\Source\SourceMethodSymbolWithAttributes.cs (3)
53Debug.Assert(arrowExpression.Parent!.Kind() == SyntaxKind.PropertyDeclaration || 54arrowExpression.Parent.Kind() == SyntaxKind.IndexerDeclaration); 61Debug.Assert(recordDecl.IsKind(SyntaxKind.RecordDeclaration));
Symbols\Source\SourceNamedTypeSymbol.cs (29)
118case SyntaxKind.EnumDeclaration: 120case SyntaxKind.DelegateDeclaration: 122case SyntaxKind.ClassDeclaration: 123case SyntaxKind.InterfaceDeclaration: 124case SyntaxKind.StructDeclaration: 125case SyntaxKind.UnionDeclaration: 126case SyntaxKind.RecordDeclaration: 127case SyntaxKind.RecordStructDeclaration: 162SyntaxKind typeKind = typeDecl.Kind(); 165case SyntaxKind.ClassDeclaration: 166case SyntaxKind.StructDeclaration: 167case SyntaxKind.UnionDeclaration: 168case SyntaxKind.InterfaceDeclaration: 169case SyntaxKind.RecordDeclaration: 170case SyntaxKind.RecordStructDeclaration: 171case SyntaxKind.ExtensionBlockDeclaration: 175case SyntaxKind.DelegateDeclaration: 179case SyntaxKind.EnumDeclaration: 187bool isInterfaceOrDelegate = typeKind == SyntaxKind.InterfaceDeclaration || typeKind == SyntaxKind.DelegateDeclaration; 193if (tp.VarianceKeyword.Kind() != SyntaxKind.None) 476case SyntaxKind.ClassDeclaration: 477case SyntaxKind.StructDeclaration: 478case SyntaxKind.UnionDeclaration: 479case SyntaxKind.InterfaceDeclaration: 480case SyntaxKind.RecordDeclaration: 481case SyntaxKind.RecordStructDeclaration: 482case SyntaxKind.ExtensionBlockDeclaration: 486case SyntaxKind.DelegateDeclaration:
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (1)
515if (typeSyntax.Kind() != SyntaxKind.PredefinedType && !SyntaxFacts.IsName(typeSyntax.Kind()))
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (2)
542if (SyntaxFacts.GetKeywordKind(name) != SyntaxKind.None 543|| SyntaxFacts.GetContextualKeywordKind(name) != SyntaxKind.None
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (3)
497if (aliasSyntax.Identifier.ContextualKind() == SyntaxKind.GlobalKeyword) 654if (applyIsGlobalFilter.HasValue && usingDirective.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword) != applyIsGlobalFilter.GetValueOrDefault()) 666if (identifier.ContextualKind() == SyntaxKind.GlobalKeyword)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (8)
43return explicitInterfaceType is null && !syntax.Modifiers.Any(SyntaxKind.PartialKeyword) && syntax.Arity == 0 102firstParam.Modifiers.Any(SyntaxKind.ThisKeyword) && 250CheckExtensionAttributeAvailability(DeclaringCompilation, syntax.ParameterList.Parameters[0].Modifiers.FirstOrDefault(SyntaxKind.ThisKeyword).GetLocation(), diagnostics); 742if (this.ReturnType?.IsErrorType() == true && GetSyntax().ReturnType is IdentifierNameSyntax { Identifier.RawContextualKind: (int)SyntaxKind.PartialKeyword }) 911diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.SealedKeyword)); 933diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 938diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword)); 1189if (parameter.VarianceKeyword.Kind() != SyntaxKind.None)
Symbols\Source\SourcePropertyAccessorSymbol.cs (13)
37Debug.Assert(syntax.Kind() == SyntaxKind.GetAccessorDeclaration || 38syntax.Kind() == SyntaxKind.SetAccessorDeclaration || 39syntax.Kind() == SyntaxKind.InitAccessorDeclaration); 41bool isGetMethod = (syntax.Kind() == SyntaxKind.GetAccessorDeclaration); 60syntax.Keyword.IsKind(SyntaxKind.InitKeyword), 553var syntax = modifiers.FirstOrDefault(SyntaxKind.UnsafeKeyword); 706case SyntaxKind.GetAccessorDeclaration: 707case SyntaxKind.SetAccessorDeclaration: 708case SyntaxKind.InitAccessorDeclaration: 779case SyntaxKind.GetAccessorDeclaration: 780case SyntaxKind.SetAccessorDeclaration: 781case SyntaxKind.InitAccessorDeclaration: 782case SyntaxKind.ArrowExpressionClause:
Symbols\Source\SourcePropertySymbol.cs (13)
64isIndexer: syntax.Kind() == SyntaxKind.IndexerDeclaration, 254case SyntaxKind.GetAccessorDeclaration: 266case SyntaxKind.SetAccessorDeclaration: 267case SyntaxKind.InitAccessorDeclaration: 279case SyntaxKind.AddAccessorDeclaration: 280case SyntaxKind.RemoveAccessorDeclaration: 283case SyntaxKind.UnknownAccessorDeclaration: 332if (node.RawKind == (int)SyntaxKind.FieldExpression) 348case SyntaxKind.GetAccessorDeclaration: 362case SyntaxKind.SetAccessorDeclaration: 363case SyntaxKind.InitAccessorDeclaration: 493diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.RequiredKeyword)); 639if (arglistToken.Kind() != SyntaxKind.None)
Symbols\Source\SourcePropertySymbolBase.cs (9)
348{ MethodKind: MethodKind.PropertyGet, IsInitOnly: false } => SyntaxFacts.GetText(SyntaxKind.GetKeyword), 349{ MethodKind: MethodKind.PropertySet, IsInitOnly: false } => SyntaxFacts.GetText(SyntaxKind.SetKeyword), 350{ MethodKind: MethodKind.PropertySet, IsInitOnly: true } => SyntaxFacts.GetText(SyntaxKind.InitKeyword), 506if (node.ArgumentList?.Arguments is not [{ NameColon: null, NameEquals: null, Expression: LiteralExpressionSyntax { RawKind: (int)SyntaxKind.StringLiteralExpression } }]) 1056(Syntax?.Modifiers).GetModifierLocation(SyntaxKind.ExternKeyword, GetFirstLocation())); 1062(Syntax?.Modifiers).GetModifierLocation(SyntaxKind.UnsafeKeyword, GetFirstLocation()), 1069(Syntax?.Modifiers).GetModifierLocation(SyntaxKind.SafeKeyword, GetFirstLocation())); 1146diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 1151diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
33else if (syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword))
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
34else if (!syntax.OperatorToken.IsMissing && syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword))
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (7)
65!(syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken))) 197if (syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken)) 270if (syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken)) 332if (arglistToken.Kind() == SyntaxKind.ArgListKeyword)
Symbols\Source\TypeParameterBuilder.cs (1)
29Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter));
Symbols\Symbol.cs (1)
512if (token.Kind() != SyntaxKind.None)
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (4)
26Debug.Assert(syntax.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration);
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
297public SyntaxNode ReturnTypeSyntax => CompilationUnit.Members.First(m => m.Kind() == SyntaxKind.GlobalStatement); 303if (member.Kind() == SyntaxKind.GlobalStatement && compilation.IsNullableAnalysisEnabledIn(member))
Syntax\AnonymousFunctionExpressionSyntax.cs (2)
38if (Modifiers.Any(SyntaxKind.AsyncKeyword)) 40return new SyntaxTokenList(Modifiers.Where(m => !m.IsKind(SyntaxKind.AsyncKeyword)));
Syntax\AnonymousMethodExpressionSyntax.cs (2)
25=> this.Modifiers.FirstOrDefault(SyntaxKind.AsyncKeyword); 44Token(SyntaxKind.DelegateKeyword),
Syntax\CheckedStatementSyntax.cs (1)
20public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxToken keyword, BlockSyntax block)
Syntax\CSharpLineDirectiveMap.cs (9)
24return directive.IsActive && (directive.Kind() is SyntaxKind.LineDirectiveTrivia or SyntaxKind.LineSpanDirectiveTrivia); 56case SyntaxKind.HiddenKeyword: 60case SyntaxKind.DefaultKeyword: 66case SyntaxKind.NumericLiteralToken: 77if (directive.File.Kind() == SyntaxKind.StringLiteralToken) 111token.Kind() == SyntaxKind.NumericLiteralToken && 130if (token.Kind() == SyntaxKind.StringLiteralToken) 144if (token.Kind() == SyntaxKind.None)
Syntax\CSharpPragmaWarningStateMap.cs (6)
62if (!d.IsActive || d.Kind() != SyntaxKind.PragmaWarningDirectiveTrivia) 102SyntaxKind.DisableKeyword => PragmaWarningState.Disabled, 103SyntaxKind.RestoreKeyword => PragmaWarningState.Default, 104SyntaxKind.EnableKeyword => PragmaWarningState.Enabled, 125if (currentErrorCode.Kind() == SyntaxKind.NumericLiteralExpression) 130else if (currentErrorCode.Kind() == SyntaxKind.IdentifierName)
Syntax\CSharpSyntaxNode.cs (6)
146/// Returns the <see cref="SyntaxKind"/> of the node. 148public SyntaxKind Kind() 150return (SyntaxKind)this.Green.RawKind; 398if (curr.Kind() == SyntaxKind.XmlCrefAttribute || curr.Kind() == SyntaxKind.XmlNameAttribute) 520if (this.Kind() == SyntaxKind.Block)
Syntax\CSharpSyntaxRewriter.cs (3)
152if (!alternate.IsNull && visited != null && !visited.IsKind(SyntaxKind.None)) 267if (alternate != null && visited.Kind() != SyntaxKind.None) //skip the null check since SyntaxToken is a value type 301if (alternate != null && visited.Kind() != SyntaxKind.None)
Syntax\CSharpSyntaxTree.cs (14)
239case SyntaxKind.IfDirectiveTrivia: 240case SyntaxKind.ElifDirectiveTrivia: 241case SyntaxKind.ElseDirectiveTrivia: 242case SyntaxKind.EndIfDirectiveTrivia: 243case SyntaxKind.DefineDirectiveTrivia: 244case SyntaxKind.UndefDirectiveTrivia: 255case SyntaxKind.IfDirectiveTrivia: 259case SyntaxKind.ElifDirectiveTrivia: 264case SyntaxKind.ElseDirectiveTrivia: 269case SyntaxKind.EndIfDirectiveTrivia: 274case SyntaxKind.DefineDirectiveTrivia: 279case SyntaxKind.UndefDirectiveTrivia: 738isComment: trivia => trivia.Kind() == SyntaxKind.SingleLineCommentTrivia || trivia.Kind() == SyntaxKind.MultiLineCommentTrivia,
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (1)
53_hasCompilationUnitRoot = root.Kind() == SyntaxKind.CompilationUnit;
Syntax\DeclarationStatementSyntax.cs (1)
13return this.Modifiers.Any(SyntaxKind.ConstKeyword);
Syntax\DestructorDeclarationSyntax.cs (2)
46SyntaxFactory.Token(SyntaxKind.TildeToken), 80SyntaxFactory.Token(SyntaxKind.TildeToken),
Syntax\DirectiveTriviaSyntax.cs (54)
23case SyntaxKind.IfDirectiveTrivia: 25case SyntaxKind.ElifDirectiveTrivia: 27case SyntaxKind.ElseDirectiveTrivia: 29case SyntaxKind.EndIfDirectiveTrivia: 31case SyntaxKind.RegionDirectiveTrivia: 33case SyntaxKind.EndRegionDirectiveTrivia: 35case SyntaxKind.ErrorDirectiveTrivia: 37case SyntaxKind.WarningDirectiveTrivia: 39case SyntaxKind.BadDirectiveTrivia: 41case SyntaxKind.DefineDirectiveTrivia: 43case SyntaxKind.UndefDirectiveTrivia: 45case SyntaxKind.LineDirectiveTrivia: 47case SyntaxKind.LineSpanDirectiveTrivia: 49case SyntaxKind.PragmaWarningDirectiveTrivia: 51case SyntaxKind.PragmaChecksumDirectiveTrivia: 53case SyntaxKind.ReferenceDirectiveTrivia: 55case SyntaxKind.LoadDirectiveTrivia: 57case SyntaxKind.ShebangDirectiveTrivia: 59case SyntaxKind.IgnoredDirectiveTrivia: 61case SyntaxKind.NullableDirectiveTrivia: 73while (token.Kind() != SyntaxKind.None) 104while (token.Kind() != SyntaxKind.None) 163case SyntaxKind.IfDirectiveTrivia: 168case SyntaxKind.ElifDirectiveTrivia: 169case SyntaxKind.ElseDirectiveTrivia: 170case SyntaxKind.EndIfDirectiveTrivia: 178case SyntaxKind.ElifDirectiveTrivia: 185case SyntaxKind.ElifDirectiveTrivia: 186case SyntaxKind.ElseDirectiveTrivia: 187case SyntaxKind.EndIfDirectiveTrivia: 195case SyntaxKind.ElseDirectiveTrivia: 198if (d.Kind() == SyntaxKind.EndIfDirectiveTrivia) 207case SyntaxKind.RegionDirectiveTrivia: 210if (d.Kind() == SyntaxKind.EndRegionDirectiveTrivia) 235case SyntaxKind.IfDirectiveTrivia: 236while (d != null && d.Kind() != SyntaxKind.EndIfDirectiveTrivia) 242case SyntaxKind.RegionDirectiveTrivia: 243while (d != null && d.Kind() != SyntaxKind.EndRegionDirectiveTrivia) 263case SyntaxKind.EndIfDirectiveTrivia: 268case SyntaxKind.IfDirectiveTrivia: 269case SyntaxKind.ElifDirectiveTrivia: 270case SyntaxKind.ElseDirectiveTrivia: 278case SyntaxKind.ElifDirectiveTrivia: 285case SyntaxKind.IfDirectiveTrivia: 286case SyntaxKind.ElifDirectiveTrivia: 294case SyntaxKind.ElseDirectiveTrivia: 299case SyntaxKind.IfDirectiveTrivia: 300case SyntaxKind.ElifDirectiveTrivia: 308case SyntaxKind.EndRegionDirectiveTrivia: 311if (d.Kind() == SyntaxKind.RegionDirectiveTrivia) 336case SyntaxKind.EndIfDirectiveTrivia: 337while (d != null && d.Kind() != SyntaxKind.IfDirectiveTrivia) 343case SyntaxKind.EndRegionDirectiveTrivia: 344while (d != null && d.Kind() != SyntaxKind.RegionDirectiveTrivia)
Syntax\GenericNameSyntax.cs (1)
19return this.TypeArgumentList.Arguments.Any(SyntaxKind.OmittedTypeArgument);
Syntax\GotoStatementSyntax.cs (2)
20public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression) 23public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
Syntax\InternalSyntax\CSharpSyntaxNode.cs (12)
21internal CSharpSyntaxNode(SyntaxKind kind) 27internal CSharpSyntaxNode(SyntaxKind kind, int fullWidth) 33internal CSharpSyntaxNode(SyntaxKind kind, DiagnosticInfo[] diagnostics) 39internal CSharpSyntaxNode(SyntaxKind kind, DiagnosticInfo[] diagnostics, int fullWidth) 45internal CSharpSyntaxNode(SyntaxKind kind, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) 51internal CSharpSyntaxNode(SyntaxKind kind, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations, int fullWidth) 62public SyntaxKind Kind 64get { return (SyntaxKind)this.RawKind; } 77public override bool IsSkippedTokensTrivia => this.Kind == SyntaxKind.SkippedTokensTrivia; 243return CSharp.SyntaxFactory.Token(SyntaxKind.CommaToken); 248return this.Kind == SyntaxKind.EndOfLineTrivia 249|| this.Kind == SyntaxKind.SingleLineCommentTrivia;
Syntax\InternalSyntax\CSharpSyntaxRewriter.cs (1)
57Debug.Assert(visited != null && visited.Kind != SyntaxKind.None, "Cannot remove node using Syntax.InternalSyntax.SyntaxRewriter.");
Syntax\InternalSyntax\StructuredTriviaSyntax.cs (2)
13internal StructuredTriviaSyntax(SyntaxKind kind, DiagnosticInfo[] diagnostics = null, SyntaxAnnotation[] annotations = null) 18if (this.Kind == SyntaxKind.SkippedTokensTrivia)
Syntax\InternalSyntax\SyntaxFactory.cs (35)
71trivia = SyntaxTrivia.Create(SyntaxKind.EndOfLineTrivia, text); 82var trivia = SyntaxTrivia.Create(SyntaxKind.WhitespaceTrivia, text); 95return SyntaxTrivia.Create(SyntaxKind.MultiLineCommentTrivia, text); 99return SyntaxTrivia.Create(SyntaxKind.SingleLineCommentTrivia, text); 104=> SyntaxTrivia.Create(SyntaxKind.ConflictMarkerTrivia, text); 108return SyntaxTrivia.Create(SyntaxKind.DisabledTextTrivia, text); 113return SyntaxTrivia.Create(SyntaxKind.PreprocessingMessageTrivia, text); 116public static SyntaxToken Token(SyntaxKind kind) 121internal static SyntaxToken Token(GreenNode leading, SyntaxKind kind, GreenNode trailing) 129internal static SyntaxToken Token(GreenNode leading, SyntaxKind kind, string text, GreenNode trailing) 134internal static SyntaxToken Token(GreenNode leading, SyntaxKind kind, string text, string valueText, GreenNode trailing) 137Debug.Assert(kind != SyntaxKind.IdentifierToken); 138Debug.Assert(kind != SyntaxKind.CharacterLiteralToken); 139Debug.Assert(kind != SyntaxKind.NumericLiteralToken); 147internal static SyntaxToken MissingToken(SyntaxKind kind) 152internal static SyntaxToken MissingToken(GreenNode leading, SyntaxKind kind, GreenNode trailing) 159return Identifier(SyntaxKind.IdentifierToken, null, text, text, null); 164return Identifier(SyntaxKind.IdentifierToken, leading, text, text, trailing); 167internal static SyntaxToken Identifier(SyntaxKind contextualKind, GreenNode leading, string text, string valueText, GreenNode trailing) 174return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 179return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 184return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 189return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 194return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 199return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 204return SyntaxToken.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing); 209return SyntaxToken.WithValue(SyntaxKind.StringLiteralToken, leading, text, value, trailing); 212internal static SyntaxToken Literal(GreenNode leading, string text, SyntaxKind kind, string value, GreenNode trailing) 219return SyntaxToken.WithValue(SyntaxKind.CharacterLiteralToken, leading, text, value, trailing); 224return SyntaxToken.WithValue(SyntaxKind.BadToken, leading, text, text, trailing); 229return SyntaxToken.WithValue(SyntaxKind.XmlTextLiteralToken, leading, text, value, trailing); 239return SyntaxToken.WithValue(SyntaxKind.XmlTextLiteralNewLineToken, leading, text, value, trailing); 244return SyntaxToken.WithValue(SyntaxKind.XmlTextLiteralNewLineToken, null, text, text, null); 249return SyntaxToken.WithValue(SyntaxKind.XmlEntityLiteralToken, leading, text, value, trailing); 254return SyntaxTrivia.Create(SyntaxKind.DocumentationCommentExteriorTrivia, text);
Syntax\InternalSyntax\SyntaxToken.cs (28)
22internal SyntaxToken(SyntaxKind kind) 29internal SyntaxToken(SyntaxKind kind, DiagnosticInfo[] diagnostics) 36internal SyntaxToken(SyntaxKind kind, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) 43internal SyntaxToken(SyntaxKind kind, int fullWidth) 49internal SyntaxToken(SyntaxKind kind, int fullWidth, DiagnosticInfo[] diagnostics) 55internal SyntaxToken(SyntaxKind kind, int fullWidth, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) 70internal static SyntaxToken Create(SyntaxKind kind) 85internal static SyntaxToken Create(SyntaxKind kind, GreenNode leading, GreenNode trailing) 121internal static SyntaxToken CreateMissing(SyntaxKind kind) 127else if (kind == SyntaxKind.IdentifierToken) 135internal static SyntaxToken CreateMissing(SyntaxKind kind, GreenNode leading, GreenNode trailing) 140internal const SyntaxKind FirstTokenWithWellKnownText = SyntaxKind.TildeToken; 141internal const SyntaxKind LastTokenWithWellKnownText = SyntaxKind.EndOfFileToken; 150private static readonly SyntaxToken s_missingIdentifierTokenWithNoTrivia = new MissingTokenWithTrivia(SyntaxKind.IdentifierToken, leading: null, trailing: null); 154for (var kind = FirstTokenWithWellKnownText; kind <= LastTokenWithWellKnownText; kind++) 218return new SyntaxIdentifierWithTrivia(SyntaxKind.IdentifierToken, text, text, leading, trailing); 221internal static SyntaxToken Identifier(SyntaxKind contextualKind, GreenNode leading, string text, string valueText, GreenNode trailing) 223if (contextualKind == SyntaxKind.IdentifierToken && valueText == text) 231internal static SyntaxToken WithValue<T>(SyntaxKind kind, string text, T value) 236internal static SyntaxToken WithValue<T>(SyntaxKind kind, GreenNode leading, string text, T value, GreenNode trailing) 243return new SyntaxTokenWithValue<string>(SyntaxKind.StringLiteralToken, text, text); 248return new SyntaxTokenWithValueAndTrivia<string>(SyntaxKind.StringLiteralToken, text, text, leading, trailing); 251public virtual SyntaxKind ContextualKind 288case SyntaxKind.TrueKeyword: 290case SyntaxKind.FalseKeyword: 292case SyntaxKind.NullKeyword:
Syntax\InternalSyntax\SyntaxToken.MissingTokenWithTrivia.cs (3)
16internal MissingTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing) 22internal MissingTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) 39case SyntaxKind.IdentifierToken:
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifier.cs (2)
18: base(SyntaxKind.IdentifierToken, text.Length) 24: base(SyntaxKind.IdentifierToken, text.Length, diagnostics, annotations)
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifierExtended.cs (4)
15protected readonly SyntaxKind contextualKind; 18internal SyntaxIdentifierExtended(SyntaxKind contextualKind, string text, string valueText) 25internal SyntaxIdentifierExtended(SyntaxKind contextualKind, string text, string valueText, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) 32public override SyntaxKind ContextualKind
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifierWithTrivia.cs (2)
17SyntaxKind contextualKind, 37SyntaxKind contextualKind,
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteral.cs (2)
19internal SyntaxTokenWithValue(SyntaxKind kind, string text, T value) 26internal SyntaxTokenWithValue(SyntaxKind kind, string text, T value, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteralWithTrivia.cs (2)
16internal SyntaxTokenWithValueAndTrivia(SyntaxKind kind, string text, T value, GreenNode leading, GreenNode trailing) 32SyntaxKind kind,
Syntax\InternalSyntax\SyntaxToken.SyntaxTokenWithTrivia.cs (2)
16internal SyntaxTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing) 31internal SyntaxTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
Syntax\InternalSyntax\SyntaxTrivia.cs (3)
14internal SyntaxTrivia(SyntaxKind kind, string text, DiagnosticInfo[]? diagnostics = null, SyntaxAnnotation[]? annotations = null) 18if (kind == SyntaxKind.PreprocessingMessageTrivia) 26internal static SyntaxTrivia Create(SyntaxKind kind, string text)
Syntax\InternalSyntax\TypeSyntax.cs (1)
19public bool IsRef => Kind == SyntaxKind.RefType;
Syntax\InterpolatedStringExpressionSyntax.cs (2)
12=> InterpolatedStringExpression(stringStartToken, Token(SyntaxKind.InterpolatedStringEndToken)); 15=> InterpolatedStringExpression(stringStartToken, contents, Token(SyntaxKind.InterpolatedStringEndToken));
Syntax\LambdaUtilities.cs (90)
24case SyntaxKind.ParenthesizedLambdaExpression: 25case SyntaxKind.SimpleLambdaExpression: 26case SyntaxKind.AnonymousMethodExpression: 27case SyntaxKind.LetClause: 28case SyntaxKind.WhereClause: 29case SyntaxKind.AscendingOrdering: 30case SyntaxKind.DescendingOrdering: 31case SyntaxKind.JoinClause: 32case SyntaxKind.GroupClause: 33case SyntaxKind.LocalFunctionStatement: 36case SyntaxKind.SelectClause: 40case SyntaxKind.FromClause: 42return !node.Parent.IsKind(SyntaxKind.QueryExpression); 57if (lambda.IsKind(SyntaxKind.ArrowExpressionClause)) 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 79case SyntaxKind.ParenthesizedLambdaExpression: 80case SyntaxKind.SimpleLambdaExpression: 81case SyntaxKind.AnonymousMethodExpression: 84case SyntaxKind.FromClause: 87case SyntaxKind.LetClause: 90case SyntaxKind.WhereClause: 93case SyntaxKind.AscendingOrdering: 94case SyntaxKind.DescendingOrdering: 97case SyntaxKind.SelectClause: 104case SyntaxKind.JoinClause: 110case SyntaxKind.GroupClause: 117case SyntaxKind.LocalFunctionStatement: 151case SyntaxKind.ParenthesizedLambdaExpression: 152case SyntaxKind.SimpleLambdaExpression: 153case SyntaxKind.AnonymousMethodExpression: 157case SyntaxKind.LocalFunctionStatement: 161case SyntaxKind.ArrowExpressionClause: 165case SyntaxKind.FromClause: 169case SyntaxKind.JoinClause: 173case SyntaxKind.LetClause: 177case SyntaxKind.WhereClause: 181case SyntaxKind.AscendingOrdering: 182case SyntaxKind.DescendingOrdering: 186case SyntaxKind.SelectClause: 190case SyntaxKind.GroupClause: 220if (!selectOrGroupExpression.IsKind(SyntaxKind.IdentifierName)) 232if (containingQueryOrContinuation.IsKind(SyntaxKind.QueryExpression)) 250if (selectOrGroupClause.IsKind(SyntaxKind.SelectClause) && containingBody.Clauses.Count == 0) 257if (!clause.IsKind(SyntaxKind.WhereClause) && !clause.IsKind(SyntaxKind.OrderByClause)) 292case SyntaxKind.ParenthesizedLambdaExpression: 293case SyntaxKind.SimpleLambdaExpression: 294case SyntaxKind.AnonymousMethodExpression: 298case SyntaxKind.FromClause: 300if (node.Parent.IsKind(SyntaxKind.QueryExpression)) 308case SyntaxKind.JoinClause: 314case SyntaxKind.LetClause: 318case SyntaxKind.WhereClause: 322case SyntaxKind.AscendingOrdering: 323case SyntaxKind.DescendingOrdering: 327case SyntaxKind.SelectClause: 337case SyntaxKind.GroupClause: 351case SyntaxKind.LocalFunctionStatement: 378return syntax.IsKind(SyntaxKind.GroupClause) || 379syntax.IsKind(SyntaxKind.JoinClause) || 380syntax.IsKind(SyntaxKind.FromClause); 392case SyntaxKind.CompilationUnit: 393case SyntaxKind.Block: 394case SyntaxKind.SwitchStatement: 395case SyntaxKind.ArrowExpressionClause: // expression-bodied member 396case SyntaxKind.CatchClause: 397case SyntaxKind.ForStatement: 398case SyntaxKind.ForEachStatement: 399case SyntaxKind.ForEachVariableStatement: 400case SyntaxKind.UsingStatement: 401case SyntaxKind.TryStatement: 404case SyntaxKind.ConstructorDeclaration: 408case SyntaxKind.DoStatement: 409case SyntaxKind.ExpressionStatement: 410case SyntaxKind.FixedStatement: 411case SyntaxKind.GotoCaseStatement: 412case SyntaxKind.IfStatement: 413case SyntaxKind.LockStatement: 414case SyntaxKind.ReturnStatement: 415case SyntaxKind.ThrowStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.YieldReturnStatement: 420case SyntaxKind.ClassDeclaration: 421case SyntaxKind.StructDeclaration: 422case SyntaxKind.RecordDeclaration: 423case SyntaxKind.RecordStructDeclaration: 432case SyntaxKind.SwitchExpression: 433case SyntaxKind.AwaitExpression: 446case SyntaxKind.EqualsValueClause: 449case SyntaxKind.ForStatement:
Syntax\LiteralExpressionSyntax.cs (21)
13public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind) 16private static SyntaxKind GetLiteralExpressionTokenKind(SyntaxKind kind) 19SyntaxKind.ArgListExpression => SyntaxKind.ArgListKeyword, 20SyntaxKind.NumericLiteralExpression => SyntaxKind.NumericLiteralToken, 21SyntaxKind.StringLiteralExpression => SyntaxKind.StringLiteralToken, 22SyntaxKind.Utf8StringLiteralExpression => SyntaxKind.Utf8StringLiteralToken, 23SyntaxKind.CharacterLiteralExpression => SyntaxKind.CharacterLiteralToken, 24SyntaxKind.TrueLiteralExpression => SyntaxKind.TrueKeyword, 25SyntaxKind.FalseLiteralExpression => SyntaxKind.FalseKeyword, 26SyntaxKind.NullLiteralExpression => SyntaxKind.NullKeyword, 27SyntaxKind.DefaultLiteralExpression => SyntaxKind.DefaultKeyword,
Syntax\LookupPosition.cs (64)
95return firstExcluded.Kind() == SyntaxKind.None || position < firstExcluded.SpanStart; 195constructorDecl.SemicolonToken.Kind() == SyntaxKind.None ? constructorDecl.Body!.CloseBraceToken : constructorDecl.SemicolonToken); 266if (statement.Kind() == SyntaxKind.EmptyStatement) 315case SyntaxKind.Block: 317case SyntaxKind.BreakStatement: 319case SyntaxKind.CheckedStatement: 320case SyntaxKind.UncheckedStatement: 322case SyntaxKind.ContinueStatement: 324case SyntaxKind.ExpressionStatement: 325case SyntaxKind.LocalDeclarationStatement: 327case SyntaxKind.DoStatement: 329case SyntaxKind.EmptyStatement: 331case SyntaxKind.FixedStatement: 333case SyntaxKind.ForEachStatement: 334case SyntaxKind.ForEachVariableStatement: 336case SyntaxKind.ForStatement: 338case SyntaxKind.GotoDefaultStatement: 339case SyntaxKind.GotoCaseStatement: 340case SyntaxKind.GotoStatement: 342case SyntaxKind.IfStatement: 344case SyntaxKind.LabeledStatement: 346case SyntaxKind.LockStatement: 348case SyntaxKind.ReturnStatement: 350case SyntaxKind.SwitchStatement: 352case SyntaxKind.ThrowStatement: 354case SyntaxKind.TryStatement: 356case SyntaxKind.UnsafeStatement: 358case SyntaxKind.UsingStatement: 360case SyntaxKind.WhileStatement: 362case SyntaxKind.YieldReturnStatement: 363case SyntaxKind.YieldBreakStatement: 365case SyntaxKind.LocalFunctionStatement: 377case SyntaxKind.Block: 379case SyntaxKind.BreakStatement: 381case SyntaxKind.CheckedStatement: 382case SyntaxKind.UncheckedStatement: 384case SyntaxKind.ContinueStatement: 386case SyntaxKind.LocalDeclarationStatement: 388case SyntaxKind.DoStatement: 390case SyntaxKind.EmptyStatement: 392case SyntaxKind.ExpressionStatement: 394case SyntaxKind.FixedStatement: 396case SyntaxKind.ForEachStatement: 397case SyntaxKind.ForEachVariableStatement: 399case SyntaxKind.ForStatement: 401case SyntaxKind.GotoDefaultStatement: 402case SyntaxKind.GotoCaseStatement: 403case SyntaxKind.GotoStatement: 405case SyntaxKind.IfStatement: 407case SyntaxKind.LabeledStatement: 409case SyntaxKind.LockStatement: 411case SyntaxKind.ReturnStatement: 413case SyntaxKind.SwitchStatement: 415case SyntaxKind.ThrowStatement: 417case SyntaxKind.TryStatement: 432case SyntaxKind.UnsafeStatement: 434case SyntaxKind.UsingStatement: 436case SyntaxKind.WhileStatement: 438case SyntaxKind.YieldReturnStatement: 439case SyntaxKind.YieldBreakStatement: 441case SyntaxKind.LocalFunctionStatement: 482case SyntaxKind.SimpleLambdaExpression: 488case SyntaxKind.ParenthesizedLambdaExpression: 494case SyntaxKind.AnonymousMethodExpression:
Syntax\NameColonSyntax.cs (1)
27=> NameColon(name, Token(SyntaxKind.ColonToken));
Syntax\NameSyntax.cs (2)
48case SyntaxKind.QualifiedName: 51case SyntaxKind.AliasQualifiedName:
Syntax\NullableContextStateMap.cs (7)
143if (d.Kind() != SyntaxKind.NullableDirectiveTrivia) 156SyntaxKind.EnableKeyword => NullableContextState.State.Enabled, 157SyntaxKind.DisableKeyword => NullableContextState.State.Disabled, 158SyntaxKind.RestoreKeyword => NullableContextState.State.ExplicitlyRestored, 164SyntaxKind.None => new NullableContextState(position, setting, setting), 165SyntaxKind.WarningsKeyword => new NullableContextState(position, warningsState: setting, annotationsState: previousContext.AnnotationsState), 166SyntaxKind.AnnotationsKeyword => new NullableContextState(position, warningsState: previousContext.WarningsState, annotationsState: setting),
Syntax\ParameterSyntax.cs (2)
13return this.Type == null && this.Identifier.ContextualKind() == SyntaxKind.ArgListKeyword; 19if (Type is null && Identifier.IsKind(SyntaxKind.None))
Syntax\ParenthesizedLambdaExpressionSyntax.cs (1)
22=> this.Modifiers.FirstOrDefault(SyntaxKind.AsyncKeyword);
Syntax\PropertyDeclarationSyntax.cs (1)
44public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, BlockSyntax? body)
Syntax\RecordDeclarationSyntax.cs (6)
31return RecordDeclaration(SyntaxKind.RecordDeclaration, attributeLists, modifiers, keyword, classOrStructKeyword: default, identifier, 38var semicolonToken = members.Count == 0 ? Token(SyntaxKind.SemicolonToken) : default; 39var openBraceToken = members.Count == 0 ? default : Token(SyntaxKind.OpenBraceToken); 40var closeBraceToken = members.Count == 0 ? default : Token(SyntaxKind.CloseBraceToken); 42return RecordDeclaration(SyntaxKind.RecordDeclaration, attributeLists, modifiers, keyword, classOrStructKeyword: default, identifier, 53return RecordDeclaration(SyntaxKind.RecordDeclaration, attributeLists: default, modifiers: default, keyword, classOrStructKeyword: default, identifier,
Syntax\ShebangDirectiveTriviaSyntax.cs (2)
41if (content.Kind is SyntaxKind.StringLiteralToken) 45else if (content.Kind is not SyntaxKind.None)
Syntax\SimpleLambdaExpressionSyntax.cs (3)
22=> this.Modifiers.FirstOrDefault(SyntaxKind.AsyncKeyword); 44=> SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); 48=> SyntaxFactory.SimpleLambdaExpression(default, default(SyntaxTokenList), parameter, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), null, null);
Syntax\SyntaxBindingUtilities.cs (2)
14=> node.IsKind(SyntaxKind.YieldReturnStatement) || 15node.IsKind(SyntaxKind.AwaitExpression) ||
Syntax\SyntaxEquivalence.cs (28)
19internal static bool AreEquivalent(SyntaxTree? before, SyntaxTree? after, Func<SyntaxKind, bool>? ignoreChildNode, bool topLevel) 34public static bool AreEquivalent(SyntaxNode? before, SyntaxNode? after, Func<SyntaxKind, bool>? ignoreChildNode, bool topLevel) 56private static bool AreTokensEquivalent(GreenNode? before, GreenNode? after, Func<SyntaxKind, bool>? ignoreChildNode) 77switch ((SyntaxKind)before.RawKind) 79case SyntaxKind.IdentifierToken: 86case SyntaxKind.NumericLiteralToken: 87case SyntaxKind.CharacterLiteralToken: 88case SyntaxKind.StringLiteralToken: 89case SyntaxKind.Utf8StringLiteralToken: 90case SyntaxKind.SingleLineRawStringLiteralToken: 91case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 92case SyntaxKind.MultiLineRawStringLiteralToken: 93case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 94case SyntaxKind.InterpolatedStringTextToken: 105private static bool AreEquivalentRecursive(GreenNode? before, GreenNode? after, Func<SyntaxKind, bool>? ignoreChildNode, bool topLevel) 155switch ((SyntaxKind)before.RawKind) 157case SyntaxKind.Block: 158case SyntaxKind.ArrowExpressionClause: 166if ((SyntaxKind)before.RawKind == SyntaxKind.FieldDeclaration) 171var isConstBefore = fieldBefore.Modifiers.Any((int)SyntaxKind.ConstKeyword); 172var isConstAfter = fieldAfter.Modifiers.Any((int)SyntaxKind.ConstKeyword); 176ignoreChildNode = static childKind => childKind == SyntaxKind.EqualsValueClause; 204if (c != null && (c.IsToken || !ignoreChildNode((SyntaxKind)c.RawKind))) 214if (c != null && (c.IsToken || !ignoreChildNode((SyntaxKind)c.RawKind))) 254private static bool AreNullableDirectivesEquivalent(GreenNode before, GreenNode after, Func<SyntaxKind, bool>? ignoreChildNode) 257if (ignoreChildNode is object && ignoreChildNode(SyntaxKind.NullableDirectiveTrivia)) 284if (current.Kind == SyntaxKind.NullableDirectiveTrivia)
Syntax\SyntaxExtensions.cs (67)
28case SyntaxKind.ArrowExpressionClause: 31case SyntaxKind.MethodDeclaration: 32case SyntaxKind.OperatorDeclaration: 33case SyntaxKind.ConversionOperatorDeclaration: 34case SyntaxKind.ConstructorDeclaration: 35case SyntaxKind.DestructorDeclaration: 38case SyntaxKind.GetAccessorDeclaration: 39case SyntaxKind.SetAccessorDeclaration: 40case SyntaxKind.InitAccessorDeclaration: 41case SyntaxKind.AddAccessorDeclaration: 42case SyntaxKind.RemoveAccessorDeclaration: 43case SyntaxKind.UnknownAccessorDeclaration: 46case SyntaxKind.PropertyDeclaration: 49case SyntaxKind.IndexerDeclaration: 135SyntaxKind parentKind = parentSyntax.Kind(); 138if (parentKind == SyntaxKind.XmlEmptyElement) 144else if (parentKind == SyntaxKind.XmlElementStartTag) 191return simpleName.Kind() == SyntaxKind.IdentifierName 204while (expression.Kind() == SyntaxKind.ParenthesizedExpression) 219case SyntaxKind.TupleExpression: 221case SyntaxKind.DeclarationExpression: 222return ((DeclarationExpressionSyntax)node).Designation.Kind() == SyntaxKind.ParenthesizedVariableDesignation; 239case SyntaxKind.Parameter: 240case SyntaxKind.FieldDeclaration: 241case SyntaxKind.MethodDeclaration: 242case SyntaxKind.IndexerDeclaration: 243case SyntaxKind.OperatorDeclaration: 244case SyntaxKind.ConversionOperatorDeclaration: 245case SyntaxKind.PropertyDeclaration: 246case SyntaxKind.DelegateDeclaration: 247case SyntaxKind.EventDeclaration: 248case SyntaxKind.EventFieldDeclaration: 249case SyntaxKind.BaseList: 250case SyntaxKind.SimpleBaseType: 251case SyntaxKind.PrimaryConstructorBaseType: 254case SyntaxKind.Block: 255case SyntaxKind.VariableDeclarator: 256case SyntaxKind.TypeParameterConstraintClause: 257case SyntaxKind.Attribute: 258case SyntaxKind.EqualsValueClause: 345var kind = expr.Kind(); 346if (kind != SyntaxKind.TupleExpression && kind != SyntaxKind.DeclarationExpression && kind != SyntaxKind.IdentifierName) 353Debug.Assert(expr.Kind() == SyntaxKind.TupleExpression || expr.Kind() == SyntaxKind.DeclarationExpression || expr.Kind() == SyntaxKind.IdentifierName); 359case SyntaxKind.Argument: 360if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 366case SyntaxKind.SimpleAssignmentExpression: 372case SyntaxKind.ForEachVariableStatement: 386return p.Parent?.Kind() == SyntaxKind.Argument 387&& ((ArgumentSyntax)p.Parent).RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword; 392return p.Designation.Kind() == SyntaxKind.SingleVariableDesignation && p.IsOutDeclaration(); 422case SyntaxKind.ArrayType: 430case SyntaxKind.NullableType: 434case SyntaxKind.PointerType: 438case SyntaxKind.FunctionPointerType: 447case SyntaxKind.TupleType: 454case SyntaxKind.RefType: 458case SyntaxKind.ScopedType: 462case SyntaxKind.GenericName: 469case SyntaxKind.QualifiedName: 474case SyntaxKind.AliasQualifiedName: 478case SyntaxKind.IdentifierName: 479case SyntaxKind.OmittedTypeArgument: 480case SyntaxKind.PredefinedType:
Syntax\SyntaxFactory.cs (140)
182/// A <see cref="SyntaxKind"/> representing the specific kind of <see cref="SyntaxTrivia"/>. One of 183/// <see cref="SyntaxKind.WhitespaceTrivia"/>, <see cref="SyntaxKind.EndOfLineTrivia"/>, 184/// <see cref="SyntaxKind.SingleLineCommentTrivia"/>, <see cref="SyntaxKind.MultiLineCommentTrivia"/>, 185/// <see cref="SyntaxKind.DocumentationCommentExteriorTrivia"/>, <see cref="SyntaxKind.DisabledTextTrivia"/> 190public static SyntaxTrivia SyntaxTrivia(SyntaxKind kind, string text) 199case SyntaxKind.DisabledTextTrivia: 200case SyntaxKind.DocumentationCommentExteriorTrivia: 201case SyntaxKind.EndOfLineTrivia: 202case SyntaxKind.MultiLineCommentTrivia: 203case SyntaxKind.SingleLineCommentTrivia: 204case SyntaxKind.WhitespaceTrivia: 217public static SyntaxToken Token(SyntaxKind kind) 229public static SyntaxToken Token(SyntaxTriviaList leading, SyntaxKind kind, SyntaxTriviaList trailing) 246public static SyntaxToken Token(SyntaxTriviaList leading, SyntaxKind kind, string text, string valueText, SyntaxTriviaList trailing) 250case SyntaxKind.IdentifierToken: 253case SyntaxKind.CharacterLiteralToken: 256case SyntaxKind.NumericLiteralToken: 274public static SyntaxToken MissingToken(SyntaxKind kind) 286public static SyntaxToken MissingToken(SyntaxTriviaList leading, SyntaxKind kind, SyntaxTriviaList trailing) 347return new SyntaxToken(Syntax.InternalSyntax.SyntaxFactory.Identifier(SyntaxKind.IdentifierName, leading.Node, "@" + text, valueText, trailing.Node)); 361public static SyntaxToken Identifier(SyntaxTriviaList leading, SyntaxKind contextualKind, string text, string valueText, SyntaxTriviaList trailing) 699return DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, List(content)) 779Token(SyntaxKind.DoubleQuoteToken), 781Token(SyntaxKind.DoubleQuoteToken)) 799return XmlCrefAttribute(cref, SyntaxKind.DoubleQuoteToken); 807public static XmlCrefAttributeSyntax XmlCrefAttribute(CrefSyntax cref, SyntaxKind quoteKind) 1073return XmlTextAttribute(XmlName(name), SyntaxKind.DoubleQuoteToken, TokenList(textTokens)); 1082public static XmlTextAttributeSyntax XmlTextAttribute(string name, SyntaxKind quoteKind, SyntaxTokenList textTokens) 1093public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxKind quoteKind, SyntaxTokenList textTokens) 1235if (rewrittenToken.IsKind(SyntaxKind.LessThanToken) && string.Equals("<", rewrittenToken.Text, StringComparison.Ordinal)) 1236return Token(rewrittenToken.LeadingTrivia, SyntaxKind.LessThanToken, "{", rewrittenToken.ValueText, rewrittenToken.TrailingTrivia); 1238if (rewrittenToken.IsKind(SyntaxKind.GreaterThanToken) && string.Equals(">", rewrittenToken.Text, StringComparison.Ordinal)) 1239return Token(rewrittenToken.LeadingTrivia, SyntaxKind.GreaterThanToken, "}", rewrittenToken.ValueText, rewrittenToken.TrailingTrivia); 1414var commaToken = Token(SyntaxKind.CommaToken); 1659return attributeSyntax.Kind() == SyntaxKind.XmlCrefAttribute ? ((XmlCrefAttributeSyntax)attributeSyntax).Cref : null; 1697if (token.Kind == SyntaxKind.EndOfFileToken) 1925SyntaxKind.AttributeArgumentList, 1926InternalSyntax.SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken), 1928InternalSyntax.SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken), 2016public static bool AreEquivalent(SyntaxNode? oldNode, SyntaxNode? newNode, Func<SyntaxKind, bool>? ignoreChildNode = null) 2066public static bool AreEquivalent<TNode>(SyntaxList<TNode> oldList, SyntaxList<TNode> newList, Func<SyntaxKind, bool>? ignoreChildNode = null) 2097public static bool AreEquivalent<TNode>(SeparatedSyntaxList<TNode> oldList, SeparatedSyntaxList<TNode> newList, Func<SyntaxKind, bool>? ignoreChildNode = null) 2108if (parent != null && (node.Kind() == SyntaxKind.IdentifierName || node.Kind() == SyntaxKind.GenericName)) 2112case SyntaxKind.QualifiedName: 2120case SyntaxKind.AliasQualifiedName: 2166case SyntaxKind.IdentifierName: 2167case SyntaxKind.GenericName: 2168case SyntaxKind.NameMemberCref: 2169case SyntaxKind.IndexerMemberCref: 2170case SyntaxKind.OperatorMemberCref: 2171case SyntaxKind.ConversionOperatorMemberCref: 2172case SyntaxKind.ExtensionMemberCref: 2173case SyntaxKind.ArrayType: 2174case SyntaxKind.NullableType: 2190case SyntaxKind.QualifiedName: 2197case SyntaxKind.AliasQualifiedName: 2204case SyntaxKind.SimpleMemberAccessExpression: 2205case SyntaxKind.PointerMemberAccessExpression: 2213case SyntaxKind.MemberBindingExpression: 2225case SyntaxKind.NameMemberCref: 2236case SyntaxKind.QualifiedCref: 2244case SyntaxKind.ExtensionMemberCref: 2252case SyntaxKind.ArrayCreationExpression: 2260case SyntaxKind.ObjectCreationExpression: 2261if (node.Kind() == SyntaxKind.NullableType && ((ObjectCreationExpressionSyntax)parent).Type == node) 2268case SyntaxKind.StackAllocArrayCreationExpression: 2276case SyntaxKind.NameColon: 2277if (parent.Parent.IsKind(SyntaxKind.Subpattern)) 2295Debug.Assert(currentNode.Kind() == SyntaxKind.MemberBindingExpression || 2296currentNode.Kind() == SyntaxKind.ElementBindingExpression); 2305if (currentNode.Kind() == SyntaxKind.ConditionalAccessExpression) 2329case SyntaxKind.SimpleMemberAccessExpression: 2330case SyntaxKind.PointerMemberAccessExpression: 2332if (max.Name.Kind() == SyntaxKind.GenericName) 2338case SyntaxKind.QualifiedName: 2340if (qn.Right.Kind() == SyntaxKind.GenericName) 2346case SyntaxKind.AliasQualifiedName: 2348if (an.Name.Kind() == SyntaxKind.GenericName) 2408if (lastNode.IsKind(SyntaxKind.IncompleteMember)) 2415if (!lastNode.IsKind(SyntaxKind.GlobalStatement)) 2428!globalStatement.Statement.IsKind(SyntaxKind.ExpressionStatement) || 2429!token.IsKind(SyntaxKind.SemicolonToken)) 2465if (trivia.ContainsDiagnostics && trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 2477return SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, SyntaxFactory.Token(SyntaxKind.ColonToken)); 2483return SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.ColonToken)); 2709usingKeyword: Token(SyntaxKind.UsingKeyword), 2713semicolonToken: Token(SyntaxKind.SemicolonToken)); 2729public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword) 2735public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, BlockSyntax body) 2737public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax body, SyntaxToken semicolonToken) 2739public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, ArrowExpressionClauseSyntax expressionBody) 2741public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) 2772var openParen = needsParens ? SyntaxFactory.Token(SyntaxKind.OpenParenToken) : default; 2773var closeParen = needsParens ? SyntaxFactory.Token(SyntaxKind.CloseParenToken) : default; 2776SyntaxFactory.Token(SyntaxKind.SwitchKeyword), 2780SyntaxFactory.Token(SyntaxKind.OpenBraceToken), 2782SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 2819? AnonymousMethodExpression(default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), parameterList, block, null) 2921=> SyntaxFactory.ClassDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.ClassKeyword), identifier, typeParameterList, parameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2925=> SyntaxFactory.ClassDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ClassKeyword), identifier, null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2929=> SyntaxFactory.ClassDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ClassKeyword), SyntaxFactory.Identifier(identifier), null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2948=> SyntaxFactory.StructDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, typeParameterList, parameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2952=> SyntaxFactory.StructDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2956=> SyntaxFactory.StructDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.StructKeyword), SyntaxFactory.Identifier(identifier), null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2966=> SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), identifier, typeParameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2970=> SyntaxFactory.InterfaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), identifier, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2974=> SyntaxFactory.InterfaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), SyntaxFactory.Identifier(identifier), null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2978=> SyntaxFactory.EnumDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EnumKeyword), identifier, baseList, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2982=> SyntaxFactory.EnumDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EnumKeyword), identifier, null, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 2986=> SyntaxFactory.EnumDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EnumKeyword), SyntaxFactory.Identifier(identifier), null, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default);
Syntax\SyntaxFacts.cs (21)
13using static Microsoft.CodeAnalysis.CSharp.SyntaxKind; 290if (parent2.IsKind(SyntaxKind.Subpattern)) 306if (parent3.IsKind(SyntaxKind.TupleExpression)) 445return node.ContextualKind == SyntaxKind.VarKeyword; 468case SyntaxKind.SingleVariableDesignation: 472case SyntaxKind.DeclarationExpression: 474var designationKind = declaration.Designation.Kind(); 475if (designationKind == SyntaxKind.ParenthesizedVariableDesignation || 476designationKind == SyntaxKind.DiscardDesignation) 484case SyntaxKind.ParenthesizedVariableDesignation: 485case SyntaxKind.DiscardDesignation: 535return syntax?.Parent?.IsKind(SyntaxKind.CompilationUnit) == true; 552case LocalDeclarationStatementSyntax local when local.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword): 553case CommonForEachStatementSyntax @foreach when @foreach.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword): 554case UsingStatementSyntax @using when @using.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword): 565private static bool IsNestedFunction(SyntaxKind kind) 566=> kind is SyntaxKind.LocalFunctionStatement 567or SyntaxKind.AnonymousMethodExpression 568or SyntaxKind.SimpleLambdaExpression 569or SyntaxKind.ParenthesizedLambdaExpression; 589if (IsNestedFunction((SyntaxKind)current.RawKind) ||
Syntax\SyntaxKindEqualityComparer.cs (6)
11private sealed class SyntaxKindEqualityComparer : IEqualityComparer<SyntaxKind> 13public bool Equals(SyntaxKind x, SyntaxKind y) 18public int GetHashCode(SyntaxKind obj) 25/// A custom equality comparer for <see cref="SyntaxKind"/> 31public static IEqualityComparer<SyntaxKind> EqualityComparer { get; } = new SyntaxKindEqualityComparer();
Syntax\SyntaxKindExtensions.cs (17)
11internal static SpecialType GetSpecialType(this SyntaxKind kind) 15case SyntaxKind.VoidKeyword: 17case SyntaxKind.BoolKeyword: 19case SyntaxKind.ByteKeyword: 21case SyntaxKind.SByteKeyword: 23case SyntaxKind.ShortKeyword: 25case SyntaxKind.UShortKeyword: 27case SyntaxKind.IntKeyword: 29case SyntaxKind.UIntKeyword: 31case SyntaxKind.LongKeyword: 33case SyntaxKind.ULongKeyword: 35case SyntaxKind.DoubleKeyword: 37case SyntaxKind.FloatKeyword: 39case SyntaxKind.DecimalKeyword: 41case SyntaxKind.StringKeyword: 43case SyntaxKind.CharKeyword: 45case SyntaxKind.ObjectKeyword:
Syntax\SyntaxKindFacts.cs (1026)
13public static bool IsKeywordKind(SyntaxKind kind) 18public static IEnumerable<SyntaxKind> GetReservedKeywordKinds() 20for (int i = (int)SyntaxKind.BoolKeyword; i <= (int)SyntaxKind.ImplicitKeyword; i++) 22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 23yield return (SyntaxKind)i; 27public static IEnumerable<SyntaxKind> GetKeywordKinds() 29foreach (var reserved in GetReservedKeywordKinds()) 34foreach (var contextual in GetContextualKeywordKinds()) 40public static bool IsReservedKeyword(SyntaxKind kind) 42return kind >= SyntaxKind.BoolKeyword && kind <= SyntaxKind.ImplicitKeyword; 45public static bool IsAttributeTargetSpecifier(SyntaxKind kind) 49case SyntaxKind.AssemblyKeyword: 50case SyntaxKind.ModuleKeyword: 51case SyntaxKind.EventKeyword: 52case SyntaxKind.FieldKeyword: 53case SyntaxKind.MethodKeyword: 54case SyntaxKind.ParamKeyword: 55case SyntaxKind.PropertyKeyword: 56case SyntaxKind.ReturnKeyword: 57case SyntaxKind.TypeKeyword: 58case SyntaxKind.TypeVarKeyword: 65public static bool IsAccessibilityModifier(SyntaxKind kind) 69case SyntaxKind.PrivateKeyword: 70case SyntaxKind.ProtectedKeyword: 71case SyntaxKind.InternalKeyword: 72case SyntaxKind.PublicKeyword: 79public static bool IsPreprocessorKeyword(SyntaxKind kind) 83case SyntaxKind.TrueKeyword: 84case SyntaxKind.FalseKeyword: 85case SyntaxKind.DefaultKeyword: 86case SyntaxKind.IfKeyword: 87case SyntaxKind.ElseKeyword: 88case SyntaxKind.ElifKeyword: 89case SyntaxKind.EndIfKeyword: 90case SyntaxKind.RegionKeyword: 91case SyntaxKind.EndRegionKeyword: 92case SyntaxKind.DefineKeyword: 93case SyntaxKind.UndefKeyword: 94case SyntaxKind.WarningKeyword: 95case SyntaxKind.ErrorKeyword: 96case SyntaxKind.LineKeyword: 97case SyntaxKind.PragmaKeyword: 98case SyntaxKind.HiddenKeyword: 99case SyntaxKind.ChecksumKeyword: 100case SyntaxKind.DisableKeyword: 101case SyntaxKind.RestoreKeyword: 102case SyntaxKind.ReferenceKeyword: 103case SyntaxKind.LoadKeyword: 104case SyntaxKind.NullableKeyword: 105case SyntaxKind.EnableKeyword: 106case SyntaxKind.WarningsKeyword: 107case SyntaxKind.AnnotationsKeyword: 123internal static bool IsPreprocessorContextualKeyword(SyntaxKind kind) 127case SyntaxKind.TrueKeyword: 128case SyntaxKind.FalseKeyword: 129case SyntaxKind.DefaultKeyword: 130case SyntaxKind.HiddenKeyword: 131case SyntaxKind.ChecksumKeyword: 132case SyntaxKind.DisableKeyword: 133case SyntaxKind.RestoreKeyword: 134case SyntaxKind.EnableKeyword: 135case SyntaxKind.WarningsKeyword: 136case SyntaxKind.AnnotationsKeyword: 143public static IEnumerable<SyntaxKind> GetPreprocessorKeywordKinds() 145yield return SyntaxKind.TrueKeyword; 146yield return SyntaxKind.FalseKeyword; 147yield return SyntaxKind.DefaultKeyword; 149for (int i = (int)SyntaxKind.ElifKeyword; i <= (int)SyntaxKind.RestoreKeyword; i++) 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 152yield return (SyntaxKind)i; 156public static bool IsPunctuation(SyntaxKind kind) 158return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 161public static bool IsLanguagePunctuation(SyntaxKind kind) 166public static bool IsPreprocessorPunctuation(SyntaxKind kind) 168return kind == SyntaxKind.HashToken; 171private static bool IsDebuggerSpecialPunctuation(SyntaxKind kind) 174return kind == SyntaxKind.DollarToken; 177public static IEnumerable<SyntaxKind> GetPunctuationKinds() 179for (int i = (int)SyntaxKind.TildeToken; i <= (int)SyntaxKind.DotDotToken; i++) 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 182yield return (SyntaxKind)i; 185for (int i = (int)SyntaxKind.SlashGreaterThanToken; i <= (int)SyntaxKind.XmlProcessingInstructionEndToken; i++) 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 188yield return (SyntaxKind)i; 191for (int i = (int)SyntaxKind.BarBarToken; i <= (int)SyntaxKind.QuestionQuestionEqualsToken; i++) 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 194yield return (SyntaxKind)i; 197yield return SyntaxKind.GreaterThanGreaterThanGreaterThanToken; 198yield return SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 201public static bool IsPunctuationOrKeyword(SyntaxKind kind) 203return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.EndOfFileToken; 206internal static bool IsLiteral(SyntaxKind kind) 210case SyntaxKind.IdentifierToken: 211case SyntaxKind.StringLiteralToken: 212case SyntaxKind.Utf8StringLiteralToken: 213case SyntaxKind.SingleLineRawStringLiteralToken: 214case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 215case SyntaxKind.MultiLineRawStringLiteralToken: 216case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 217case SyntaxKind.CharacterLiteralToken: 218case SyntaxKind.NumericLiteralToken: 219case SyntaxKind.XmlTextLiteralToken: 220case SyntaxKind.XmlTextLiteralNewLineToken: 221case SyntaxKind.XmlEntityLiteralToken: 228public static bool IsAnyToken(SyntaxKind kind) 230if (kind >= SyntaxKind.TildeToken && kind < SyntaxKind.EndOfLineTrivia) return true; 233case SyntaxKind.InterpolatedStringToken: 234case SyntaxKind.InterpolatedStringStartToken: 235case SyntaxKind.InterpolatedVerbatimStringStartToken: 236case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 237case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 238case SyntaxKind.InterpolatedStringTextToken: 239case SyntaxKind.InterpolatedStringEndToken: 240case SyntaxKind.InterpolatedRawStringEndToken: 241case SyntaxKind.LoadKeyword: 242case SyntaxKind.NullableKeyword: 243case SyntaxKind.EnableKeyword: 244case SyntaxKind.UnderscoreToken: 245case SyntaxKind.MultiLineRawStringLiteralToken: 246case SyntaxKind.SingleLineRawStringLiteralToken: 253public static bool IsTrivia(SyntaxKind kind) 257case SyntaxKind.EndOfLineTrivia: 258case SyntaxKind.WhitespaceTrivia: 259case SyntaxKind.SingleLineCommentTrivia: 260case SyntaxKind.MultiLineCommentTrivia: 261case SyntaxKind.SingleLineDocumentationCommentTrivia: 262case SyntaxKind.MultiLineDocumentationCommentTrivia: 263case SyntaxKind.DisabledTextTrivia: 264case SyntaxKind.DocumentationCommentExteriorTrivia: 265case SyntaxKind.ConflictMarkerTrivia: 272public static bool IsPreprocessorDirective(SyntaxKind kind) 276case SyntaxKind.IfDirectiveTrivia: 277case SyntaxKind.ElifDirectiveTrivia: 278case SyntaxKind.ElseDirectiveTrivia: 279case SyntaxKind.EndIfDirectiveTrivia: 280case SyntaxKind.RegionDirectiveTrivia: 281case SyntaxKind.EndRegionDirectiveTrivia: 282case SyntaxKind.DefineDirectiveTrivia: 283case SyntaxKind.UndefDirectiveTrivia: 284case SyntaxKind.ErrorDirectiveTrivia: 285case SyntaxKind.WarningDirectiveTrivia: 286case SyntaxKind.LineDirectiveTrivia: 287case SyntaxKind.LineSpanDirectiveTrivia: 288case SyntaxKind.PragmaWarningDirectiveTrivia: 289case SyntaxKind.PragmaChecksumDirectiveTrivia: 290case SyntaxKind.ReferenceDirectiveTrivia: 291case SyntaxKind.LoadDirectiveTrivia: 292case SyntaxKind.BadDirectiveTrivia: 293case SyntaxKind.ShebangDirectiveTrivia: 294case SyntaxKind.IgnoredDirectiveTrivia: 295case SyntaxKind.NullableDirectiveTrivia: 302public static bool IsName(SyntaxKind kind) 306case SyntaxKind.IdentifierName: 307case SyntaxKind.GenericName: 308case SyntaxKind.QualifiedName: 309case SyntaxKind.AliasQualifiedName: 316public static bool IsPredefinedType(SyntaxKind kind) 320case SyntaxKind.BoolKeyword: 321case SyntaxKind.ByteKeyword: 322case SyntaxKind.SByteKeyword: 323case SyntaxKind.IntKeyword: 324case SyntaxKind.UIntKeyword: 325case SyntaxKind.ShortKeyword: 326case SyntaxKind.UShortKeyword: 327case SyntaxKind.LongKeyword: 328case SyntaxKind.ULongKeyword: 329case SyntaxKind.FloatKeyword: 330case SyntaxKind.DoubleKeyword: 331case SyntaxKind.DecimalKeyword: 332case SyntaxKind.StringKeyword: 333case SyntaxKind.CharKeyword: 334case SyntaxKind.ObjectKeyword: 335case SyntaxKind.VoidKeyword: 342public static bool IsTypeSyntax(SyntaxKind kind) 346case SyntaxKind.ArrayType: 347case SyntaxKind.PointerType: 348case SyntaxKind.NullableType: 349case SyntaxKind.PredefinedType: 350case SyntaxKind.TupleType: 351case SyntaxKind.FunctionPointerType: 361public static bool IsGlobalMemberDeclaration(SyntaxKind kind) 365case SyntaxKind.GlobalStatement: 366case SyntaxKind.FieldDeclaration: 367case SyntaxKind.MethodDeclaration: 368case SyntaxKind.PropertyDeclaration: 369case SyntaxKind.EventDeclaration: 370case SyntaxKind.EventFieldDeclaration: 376public static bool IsTypeDeclaration(SyntaxKind kind) 380case SyntaxKind.ClassDeclaration: 381case SyntaxKind.StructDeclaration: 382case SyntaxKind.UnionDeclaration: 383case SyntaxKind.InterfaceDeclaration: 384case SyntaxKind.DelegateDeclaration: 385case SyntaxKind.EnumDeclaration: 386case SyntaxKind.RecordDeclaration: 387case SyntaxKind.RecordStructDeclaration: 388case SyntaxKind.ExtensionBlockDeclaration: 396public static bool IsNamespaceMemberDeclaration(SyntaxKind kind) 398kind == SyntaxKind.NamespaceDeclaration || 399kind == SyntaxKind.FileScopedNamespaceDeclaration; 401public static bool IsAnyUnaryExpression(SyntaxKind token) 406public static bool IsPrefixUnaryExpression(SyntaxKind token) 408return GetPrefixUnaryExpression(token) != SyntaxKind.None; 411public static bool IsPrefixUnaryExpressionOperatorToken(SyntaxKind token) 413return GetPrefixUnaryExpression(token) != SyntaxKind.None; 416public static SyntaxKind GetPrefixUnaryExpression(SyntaxKind token) 420case SyntaxKind.PlusToken: 421return SyntaxKind.UnaryPlusExpression; 422case SyntaxKind.MinusToken: 423return SyntaxKind.UnaryMinusExpression; 424case SyntaxKind.TildeToken: 425return SyntaxKind.BitwiseNotExpression; 426case SyntaxKind.ExclamationToken: 427return SyntaxKind.LogicalNotExpression; 428case SyntaxKind.PlusPlusToken: 429return SyntaxKind.PreIncrementExpression; 430case SyntaxKind.MinusMinusToken: 431return SyntaxKind.PreDecrementExpression; 432case SyntaxKind.AmpersandToken: 433return SyntaxKind.AddressOfExpression; 434case SyntaxKind.AsteriskToken: 435return SyntaxKind.PointerIndirectionExpression; 436case SyntaxKind.CaretToken: 437return SyntaxKind.IndexExpression; 439return SyntaxKind.None; 443public static bool IsPostfixUnaryExpression(SyntaxKind token) 445return GetPostfixUnaryExpression(token) != SyntaxKind.None; 448public static bool IsPostfixUnaryExpressionToken(SyntaxKind token) 450return GetPostfixUnaryExpression(token) != SyntaxKind.None; 453public static SyntaxKind GetPostfixUnaryExpression(SyntaxKind token) 457case SyntaxKind.PlusPlusToken: 458return SyntaxKind.PostIncrementExpression; 459case SyntaxKind.MinusMinusToken: 460return SyntaxKind.PostDecrementExpression; 461case SyntaxKind.ExclamationToken: 462return SyntaxKind.SuppressNullableWarningExpression; 464return SyntaxKind.None; 468internal static bool IsIncrementOrDecrementOperator(SyntaxKind token) 472case SyntaxKind.PlusPlusToken: 473case SyntaxKind.MinusMinusToken: 480public static bool IsUnaryOperatorDeclarationToken(SyntaxKind token) 483token == SyntaxKind.TrueKeyword || 484token == SyntaxKind.FalseKeyword; 487public static bool IsAnyOverloadableOperator(SyntaxKind kind) 494public static bool IsOverloadableBinaryOperator(SyntaxKind kind) 498case SyntaxKind.PlusToken: 499case SyntaxKind.MinusToken: 500case SyntaxKind.AsteriskToken: 501case SyntaxKind.SlashToken: 502case SyntaxKind.PercentToken: 503case SyntaxKind.CaretToken: 504case SyntaxKind.AmpersandToken: 505case SyntaxKind.BarToken: 506case SyntaxKind.EqualsEqualsToken: 507case SyntaxKind.LessThanToken: 508case SyntaxKind.LessThanEqualsToken: 509case SyntaxKind.LessThanLessThanToken: 510case SyntaxKind.GreaterThanToken: 511case SyntaxKind.GreaterThanEqualsToken: 512case SyntaxKind.GreaterThanGreaterThanToken: 513case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 514case SyntaxKind.ExclamationEqualsToken: 521public static bool IsOverloadableUnaryOperator(SyntaxKind kind) 525case SyntaxKind.PlusToken: 526case SyntaxKind.MinusToken: 527case SyntaxKind.TildeToken: 528case SyntaxKind.ExclamationToken: 529case SyntaxKind.PlusPlusToken: 530case SyntaxKind.MinusMinusToken: 531case SyntaxKind.TrueKeyword: 532case SyntaxKind.FalseKeyword: 539public static bool IsOverloadableCompoundAssignmentOperator(SyntaxKind kind) 543case SyntaxKind.PlusEqualsToken: 544case SyntaxKind.MinusEqualsToken: 545case SyntaxKind.AsteriskEqualsToken: 546case SyntaxKind.SlashEqualsToken: 547case SyntaxKind.PercentEqualsToken: 548case SyntaxKind.AmpersandEqualsToken: 549case SyntaxKind.BarEqualsToken: 550case SyntaxKind.CaretEqualsToken: 551case SyntaxKind.LessThanLessThanEqualsToken: 552case SyntaxKind.GreaterThanGreaterThanEqualsToken: 553case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 560public static bool IsPrimaryFunction(SyntaxKind keyword) 562return GetPrimaryFunction(keyword) != SyntaxKind.None; 565public static SyntaxKind GetPrimaryFunction(SyntaxKind keyword) 569case SyntaxKind.MakeRefKeyword: 570return SyntaxKind.MakeRefExpression; 571case SyntaxKind.RefTypeKeyword: 572return SyntaxKind.RefTypeExpression; 573case SyntaxKind.RefValueKeyword: 574return SyntaxKind.RefValueExpression; 575case SyntaxKind.CheckedKeyword: 576return SyntaxKind.CheckedExpression; 577case SyntaxKind.UncheckedKeyword: 578return SyntaxKind.UncheckedExpression; 579case SyntaxKind.DefaultKeyword: 580return SyntaxKind.DefaultExpression; 581case SyntaxKind.TypeOfKeyword: 582return SyntaxKind.TypeOfExpression; 583case SyntaxKind.SizeOfKeyword: 584return SyntaxKind.SizeOfExpression; 586return SyntaxKind.None; 590public static bool IsLiteralExpression(SyntaxKind token) 592return GetLiteralExpression(token) != SyntaxKind.None; 595public static SyntaxKind GetLiteralExpression(SyntaxKind token) 599SyntaxKind.StringLiteralToken => SyntaxKind.StringLiteralExpression, 600SyntaxKind.Utf8StringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 601SyntaxKind.SingleLineRawStringLiteralToken => SyntaxKind.StringLiteralExpression, 602SyntaxKind.Utf8SingleLineRawStringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 603SyntaxKind.MultiLineRawStringLiteralToken => SyntaxKind.StringLiteralExpression, 604SyntaxKind.Utf8MultiLineRawStringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 605SyntaxKind.CharacterLiteralToken => SyntaxKind.CharacterLiteralExpression, 606SyntaxKind.NumericLiteralToken => SyntaxKind.NumericLiteralExpression, 607SyntaxKind.NullKeyword => SyntaxKind.NullLiteralExpression, 608SyntaxKind.TrueKeyword => SyntaxKind.TrueLiteralExpression, 609SyntaxKind.FalseKeyword => SyntaxKind.FalseLiteralExpression, 610SyntaxKind.ArgListKeyword => SyntaxKind.ArgListExpression, 611_ => SyntaxKind.None, 615public static bool IsInstanceExpression(SyntaxKind token) 617return GetInstanceExpression(token) != SyntaxKind.None; 620public static SyntaxKind GetInstanceExpression(SyntaxKind token) 624case SyntaxKind.ThisKeyword: 625return SyntaxKind.ThisExpression; 626case SyntaxKind.BaseKeyword: 627return SyntaxKind.BaseExpression; 629return SyntaxKind.None; 633public static bool IsBinaryExpression(SyntaxKind token) 635return GetBinaryExpression(token) != SyntaxKind.None; 638public static bool IsBinaryExpressionOperatorToken(SyntaxKind token) 640return GetBinaryExpression(token) != SyntaxKind.None; 643public static SyntaxKind GetBinaryExpression(SyntaxKind token) 647case SyntaxKind.QuestionQuestionToken: 648return SyntaxKind.CoalesceExpression; 649case SyntaxKind.IsKeyword: 650return SyntaxKind.IsExpression; 651case SyntaxKind.AsKeyword: 652return SyntaxKind.AsExpression; 653case SyntaxKind.BarToken: 654return SyntaxKind.BitwiseOrExpression; 655case SyntaxKind.CaretToken: 656return SyntaxKind.ExclusiveOrExpression; 657case SyntaxKind.AmpersandToken: 658return SyntaxKind.BitwiseAndExpression; 659case SyntaxKind.EqualsEqualsToken: 660return SyntaxKind.EqualsExpression; 661case SyntaxKind.ExclamationEqualsToken: 662return SyntaxKind.NotEqualsExpression; 663case SyntaxKind.LessThanToken: 664return SyntaxKind.LessThanExpression; 665case SyntaxKind.LessThanEqualsToken: 666return SyntaxKind.LessThanOrEqualExpression; 667case SyntaxKind.GreaterThanToken: 668return SyntaxKind.GreaterThanExpression; 669case SyntaxKind.GreaterThanEqualsToken: 670return SyntaxKind.GreaterThanOrEqualExpression; 671case SyntaxKind.LessThanLessThanToken: 672return SyntaxKind.LeftShiftExpression; 673case SyntaxKind.GreaterThanGreaterThanToken: 674return SyntaxKind.RightShiftExpression; 675case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 676return SyntaxKind.UnsignedRightShiftExpression; 677case SyntaxKind.PlusToken: 678return SyntaxKind.AddExpression; 679case SyntaxKind.MinusToken: 680return SyntaxKind.SubtractExpression; 681case SyntaxKind.AsteriskToken: 682return SyntaxKind.MultiplyExpression; 683case SyntaxKind.SlashToken: 684return SyntaxKind.DivideExpression; 685case SyntaxKind.PercentToken: 686return SyntaxKind.ModuloExpression; 687case SyntaxKind.AmpersandAmpersandToken: 688return SyntaxKind.LogicalAndExpression; 689case SyntaxKind.BarBarToken: 690return SyntaxKind.LogicalOrExpression; 692return SyntaxKind.None; 696public static bool IsAssignmentExpression(SyntaxKind kind) 700case SyntaxKind.CoalesceAssignmentExpression: 701case SyntaxKind.OrAssignmentExpression: 702case SyntaxKind.AndAssignmentExpression: 703case SyntaxKind.ExclusiveOrAssignmentExpression: 704case SyntaxKind.LeftShiftAssignmentExpression: 705case SyntaxKind.RightShiftAssignmentExpression: 706case SyntaxKind.UnsignedRightShiftAssignmentExpression: 707case SyntaxKind.AddAssignmentExpression: 708case SyntaxKind.SubtractAssignmentExpression: 709case SyntaxKind.MultiplyAssignmentExpression: 710case SyntaxKind.DivideAssignmentExpression: 711case SyntaxKind.ModuloAssignmentExpression: 712case SyntaxKind.SimpleAssignmentExpression: 719public static bool IsAssignmentExpressionOperatorToken(SyntaxKind token) 723case SyntaxKind.QuestionQuestionEqualsToken: 724case SyntaxKind.BarEqualsToken: 725case SyntaxKind.AmpersandEqualsToken: 726case SyntaxKind.CaretEqualsToken: 727case SyntaxKind.LessThanLessThanEqualsToken: 728case SyntaxKind.GreaterThanGreaterThanEqualsToken: 729case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 730case SyntaxKind.PlusEqualsToken: 731case SyntaxKind.MinusEqualsToken: 732case SyntaxKind.AsteriskEqualsToken: 733case SyntaxKind.SlashEqualsToken: 734case SyntaxKind.PercentEqualsToken: 735case SyntaxKind.EqualsToken: 742public static SyntaxKind GetAssignmentExpression(SyntaxKind token) 746case SyntaxKind.BarEqualsToken: 747return SyntaxKind.OrAssignmentExpression; 748case SyntaxKind.AmpersandEqualsToken: 749return SyntaxKind.AndAssignmentExpression; 750case SyntaxKind.CaretEqualsToken: 751return SyntaxKind.ExclusiveOrAssignmentExpression; 752case SyntaxKind.LessThanLessThanEqualsToken: 753return SyntaxKind.LeftShiftAssignmentExpression; 754case SyntaxKind.GreaterThanGreaterThanEqualsToken: 755return SyntaxKind.RightShiftAssignmentExpression; 756case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 757return SyntaxKind.UnsignedRightShiftAssignmentExpression; 758case SyntaxKind.PlusEqualsToken: 759return SyntaxKind.AddAssignmentExpression; 760case SyntaxKind.MinusEqualsToken: 761return SyntaxKind.SubtractAssignmentExpression; 762case SyntaxKind.AsteriskEqualsToken: 763return SyntaxKind.MultiplyAssignmentExpression; 764case SyntaxKind.SlashEqualsToken: 765return SyntaxKind.DivideAssignmentExpression; 766case SyntaxKind.PercentEqualsToken: 767return SyntaxKind.ModuloAssignmentExpression; 768case SyntaxKind.EqualsToken: 769return SyntaxKind.SimpleAssignmentExpression; 770case SyntaxKind.QuestionQuestionEqualsToken: 771return SyntaxKind.CoalesceAssignmentExpression; 773return SyntaxKind.None; 777public static SyntaxKind GetCheckStatement(SyntaxKind keyword) 781case SyntaxKind.CheckedKeyword: 782return SyntaxKind.CheckedStatement; 783case SyntaxKind.UncheckedKeyword: 784return SyntaxKind.UncheckedStatement; 786return SyntaxKind.None; 790public static SyntaxKind GetAccessorDeclarationKind(SyntaxKind keyword) 794case SyntaxKind.GetKeyword: 795return SyntaxKind.GetAccessorDeclaration; 796case SyntaxKind.SetKeyword: 797return SyntaxKind.SetAccessorDeclaration; 798case SyntaxKind.InitKeyword: 799return SyntaxKind.InitAccessorDeclaration; 800case SyntaxKind.AddKeyword: 801return SyntaxKind.AddAccessorDeclaration; 802case SyntaxKind.RemoveKeyword: 803return SyntaxKind.RemoveAccessorDeclaration; 805return SyntaxKind.None; 809public static bool IsAccessorDeclaration(SyntaxKind kind) 813case SyntaxKind.GetAccessorDeclaration: 814case SyntaxKind.SetAccessorDeclaration: 815case SyntaxKind.InitAccessorDeclaration: 816case SyntaxKind.AddAccessorDeclaration: 817case SyntaxKind.RemoveAccessorDeclaration: 824public static bool IsAccessorDeclarationKeyword(SyntaxKind keyword) 828case SyntaxKind.GetKeyword: 829case SyntaxKind.SetKeyword: 830case SyntaxKind.InitKeyword: 831case SyntaxKind.AddKeyword: 832case SyntaxKind.RemoveKeyword: 839public static SyntaxKind GetSwitchLabelKind(SyntaxKind keyword) 843case SyntaxKind.CaseKeyword: 844return SyntaxKind.CaseSwitchLabel; 845case SyntaxKind.DefaultKeyword: 846return SyntaxKind.DefaultSwitchLabel; 848return SyntaxKind.None; 852public static SyntaxKind GetBaseTypeDeclarationKind(SyntaxKind kind) 854return kind == SyntaxKind.EnumKeyword ? SyntaxKind.EnumDeclaration : GetTypeDeclarationKind(kind); 857public static SyntaxKind GetTypeDeclarationKind(SyntaxKind kind) 861case SyntaxKind.ClassKeyword: 862return SyntaxKind.ClassDeclaration; 863case SyntaxKind.StructKeyword: 864return SyntaxKind.StructDeclaration; 865case SyntaxKind.UnionKeyword: 866return SyntaxKind.UnionDeclaration; 867case SyntaxKind.InterfaceKeyword: 868return SyntaxKind.InterfaceDeclaration; 869case SyntaxKind.RecordKeyword: 870return SyntaxKind.RecordDeclaration; 871case SyntaxKind.ExtensionKeyword: 872return SyntaxKind.ExtensionBlockDeclaration; 874return SyntaxKind.None; 878public static SyntaxKind GetKeywordKind(string text) 883return SyntaxKind.BoolKeyword; 885return SyntaxKind.ByteKeyword; 887return SyntaxKind.SByteKeyword; 889return SyntaxKind.ShortKeyword; 891return SyntaxKind.UShortKeyword; 893return SyntaxKind.IntKeyword; 895return SyntaxKind.UIntKeyword; 897return SyntaxKind.LongKeyword; 899return SyntaxKind.ULongKeyword; 901return SyntaxKind.DoubleKeyword; 903return SyntaxKind.FloatKeyword; 905return SyntaxKind.DecimalKeyword; 907return SyntaxKind.StringKeyword; 909return SyntaxKind.CharKeyword; 911return SyntaxKind.VoidKeyword; 913return SyntaxKind.ObjectKeyword; 915return SyntaxKind.TypeOfKeyword; 917return SyntaxKind.SizeOfKeyword; 919return SyntaxKind.NullKeyword; 921return SyntaxKind.TrueKeyword; 923return SyntaxKind.FalseKeyword; 925return SyntaxKind.IfKeyword; 927return SyntaxKind.ElseKeyword; 929return SyntaxKind.WhileKeyword; 931return SyntaxKind.ForKeyword; 933return SyntaxKind.ForEachKeyword; 935return SyntaxKind.DoKeyword; 937return SyntaxKind.SwitchKeyword; 939return SyntaxKind.CaseKeyword; 941return SyntaxKind.DefaultKeyword; 943return SyntaxKind.LockKeyword; 945return SyntaxKind.TryKeyword; 947return SyntaxKind.ThrowKeyword; 949return SyntaxKind.CatchKeyword; 951return SyntaxKind.FinallyKeyword; 953return SyntaxKind.GotoKeyword; 955return SyntaxKind.BreakKeyword; 957return SyntaxKind.ContinueKeyword; 959return SyntaxKind.ReturnKeyword; 961return SyntaxKind.PublicKeyword; 963return SyntaxKind.PrivateKeyword; 965return SyntaxKind.InternalKeyword; 967return SyntaxKind.ProtectedKeyword; 969return SyntaxKind.StaticKeyword; 971return SyntaxKind.ReadOnlyKeyword; 973return SyntaxKind.SealedKeyword; 975return SyntaxKind.ConstKeyword; 977return SyntaxKind.FixedKeyword; 979return SyntaxKind.StackAllocKeyword; 981return SyntaxKind.VolatileKeyword; 983return SyntaxKind.NewKeyword; 985return SyntaxKind.OverrideKeyword; 987return SyntaxKind.AbstractKeyword; 989return SyntaxKind.VirtualKeyword; 991return SyntaxKind.EventKeyword; 993return SyntaxKind.ExternKeyword; 995return SyntaxKind.RefKeyword; 997return SyntaxKind.OutKeyword; 999return SyntaxKind.InKeyword; 1001return SyntaxKind.IsKeyword; 1003return SyntaxKind.AsKeyword; 1005return SyntaxKind.ParamsKeyword; 1007return SyntaxKind.ArgListKeyword; 1009return SyntaxKind.MakeRefKeyword; 1011return SyntaxKind.RefTypeKeyword; 1013return SyntaxKind.RefValueKeyword; 1015return SyntaxKind.ThisKeyword; 1017return SyntaxKind.BaseKeyword; 1019return SyntaxKind.NamespaceKeyword; 1021return SyntaxKind.UsingKeyword; 1023return SyntaxKind.ClassKeyword; 1025return SyntaxKind.StructKeyword; 1027return SyntaxKind.InterfaceKeyword; 1029return SyntaxKind.EnumKeyword; 1031return SyntaxKind.DelegateKeyword; 1033return SyntaxKind.CheckedKeyword; 1035return SyntaxKind.UncheckedKeyword; 1037return SyntaxKind.UnsafeKeyword; 1039return SyntaxKind.OperatorKeyword; 1041return SyntaxKind.ImplicitKeyword; 1043return SyntaxKind.ExplicitKeyword; 1045return SyntaxKind.None; 1049public static SyntaxKind GetOperatorKind(string operatorMetadataName) 1055return SyntaxKind.PlusToken; 1057case WellKnownMemberNames.BitwiseAndOperatorName: return SyntaxKind.AmpersandToken; 1058case WellKnownMemberNames.BitwiseOrOperatorName: return SyntaxKind.BarToken; 1065return SyntaxKind.MinusMinusToken; 1069return SyntaxKind.SlashToken; 1071case WellKnownMemberNames.EqualityOperatorName: return SyntaxKind.EqualsEqualsToken; 1072case WellKnownMemberNames.ExclusiveOrOperatorName: return SyntaxKind.CaretToken; 1076return SyntaxKind.ExplicitKeyword; 1079case WellKnownMemberNames.FalseOperatorName: return SyntaxKind.FalseKeyword; 1080case WellKnownMemberNames.GreaterThanOperatorName: return SyntaxKind.GreaterThanToken; 1081case WellKnownMemberNames.GreaterThanOrEqualOperatorName: return SyntaxKind.GreaterThanEqualsToken; 1082case WellKnownMemberNames.ImplicitConversionName: return SyntaxKind.ImplicitKeyword; 1088return SyntaxKind.PlusPlusToken; 1090case WellKnownMemberNames.InequalityOperatorName: return SyntaxKind.ExclamationEqualsToken; 1092case WellKnownMemberNames.LeftShiftOperatorName: return SyntaxKind.LessThanLessThanToken; 1093case WellKnownMemberNames.LessThanOperatorName: return SyntaxKind.LessThanToken; 1094case WellKnownMemberNames.LessThanOrEqualOperatorName: return SyntaxKind.LessThanEqualsToken; 1096case WellKnownMemberNames.LogicalNotOperatorName: return SyntaxKind.ExclamationToken; 1097case WellKnownMemberNames.ModulusOperatorName: return SyntaxKind.PercentToken; 1101return SyntaxKind.AsteriskToken; 1103case WellKnownMemberNames.OnesComplementOperatorName: return SyntaxKind.TildeToken; 1104case WellKnownMemberNames.RightShiftOperatorName: return SyntaxKind.GreaterThanGreaterThanToken; 1105case WellKnownMemberNames.UnsignedRightShiftOperatorName: return SyntaxKind.GreaterThanGreaterThanGreaterThanToken; 1109return SyntaxKind.MinusToken; 1111case WellKnownMemberNames.TrueOperatorName: return SyntaxKind.TrueKeyword; 1115return SyntaxKind.MinusToken; 1117case WellKnownMemberNames.UnaryPlusOperatorName: return SyntaxKind.PlusToken; 1121return SyntaxKind.PlusEqualsToken; 1125return SyntaxKind.SlashEqualsToken; 1129return SyntaxKind.AsteriskEqualsToken; 1133return SyntaxKind.MinusEqualsToken; 1135case WellKnownMemberNames.ModulusAssignmentOperatorName: return SyntaxKind.PercentEqualsToken; 1137case WellKnownMemberNames.BitwiseAndAssignmentOperatorName: return SyntaxKind.AmpersandEqualsToken; 1139case WellKnownMemberNames.BitwiseOrAssignmentOperatorName: return SyntaxKind.BarEqualsToken; 1141case WellKnownMemberNames.ExclusiveOrAssignmentOperatorName: return SyntaxKind.CaretEqualsToken; 1143case WellKnownMemberNames.LeftShiftAssignmentOperatorName: return SyntaxKind.LessThanLessThanEqualsToken; 1145case WellKnownMemberNames.RightShiftAssignmentOperatorName: return SyntaxKind.GreaterThanGreaterThanEqualsToken; 1147case WellKnownMemberNames.UnsignedRightShiftAssignmentOperatorName: return SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 1150return SyntaxKind.None; 1179public static SyntaxKind GetPreprocessorKeywordKind(string text) 1184return SyntaxKind.TrueKeyword; 1186return SyntaxKind.FalseKeyword; 1188return SyntaxKind.DefaultKeyword; 1190return SyntaxKind.IfKeyword; 1192return SyntaxKind.ElseKeyword; 1194return SyntaxKind.ElifKeyword; 1196return SyntaxKind.EndIfKeyword; 1198return SyntaxKind.RegionKeyword; 1200return SyntaxKind.EndRegionKeyword; 1202return SyntaxKind.DefineKeyword; 1204return SyntaxKind.UndefKeyword; 1206return SyntaxKind.WarningKeyword; 1208return SyntaxKind.ErrorKeyword; 1210return SyntaxKind.LineKeyword; 1212return SyntaxKind.PragmaKeyword; 1214return SyntaxKind.HiddenKeyword; 1216return SyntaxKind.ChecksumKeyword; 1218return SyntaxKind.DisableKeyword; 1220return SyntaxKind.RestoreKeyword; 1222return SyntaxKind.ReferenceKeyword; 1224return SyntaxKind.LoadKeyword; 1226return SyntaxKind.NullableKeyword; 1228return SyntaxKind.EnableKeyword; 1230return SyntaxKind.WarningsKeyword; 1232return SyntaxKind.AnnotationsKeyword; 1234return SyntaxKind.None; 1238public static IEnumerable<SyntaxKind> GetContextualKeywordKinds() 1240for (int i = (int)SyntaxKind.YieldKeyword; i <= (int)SyntaxKind.SafeKeyword; i++) 1245Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1246yield return (SyntaxKind)i; 1251public static bool IsContextualKeyword(SyntaxKind kind) 1255case SyntaxKind.YieldKeyword: 1256case SyntaxKind.PartialKeyword: 1257case SyntaxKind.FromKeyword: 1258case SyntaxKind.GroupKeyword: 1259case SyntaxKind.JoinKeyword: 1260case SyntaxKind.IntoKeyword: 1261case SyntaxKind.LetKeyword: 1262case SyntaxKind.ByKeyword: 1263case SyntaxKind.WhereKeyword: 1264case SyntaxKind.SelectKeyword: 1265case SyntaxKind.GetKeyword: 1266case SyntaxKind.SetKeyword: 1267case SyntaxKind.AddKeyword: 1268case SyntaxKind.RemoveKeyword: 1269case SyntaxKind.OrderByKeyword: 1270case SyntaxKind.AliasKeyword: 1271case SyntaxKind.OnKeyword: 1272case SyntaxKind.EqualsKeyword: 1273case SyntaxKind.AscendingKeyword: 1274case SyntaxKind.DescendingKeyword: 1275case SyntaxKind.AssemblyKeyword: 1276case SyntaxKind.ModuleKeyword: 1277case SyntaxKind.TypeKeyword: 1278case SyntaxKind.GlobalKeyword: 1279case SyntaxKind.FieldKeyword: 1280case SyntaxKind.MethodKeyword: 1281case SyntaxKind.ParamKeyword: 1282case SyntaxKind.PropertyKeyword: 1283case SyntaxKind.TypeVarKeyword: 1284case SyntaxKind.NameOfKeyword: 1285case SyntaxKind.AsyncKeyword: 1286case SyntaxKind.AwaitKeyword: 1287case SyntaxKind.WhenKeyword: 1288case SyntaxKind.UnderscoreToken: 1289case SyntaxKind.VarKeyword: 1290case SyntaxKind.OrKeyword: 1291case SyntaxKind.AndKeyword: 1292case SyntaxKind.NotKeyword: 1293case SyntaxKind.WithKeyword: 1294case SyntaxKind.InitKeyword: 1295case SyntaxKind.RecordKeyword: 1296case SyntaxKind.ManagedKeyword: 1297case SyntaxKind.UnmanagedKeyword: 1298case SyntaxKind.RequiredKeyword: 1299case SyntaxKind.ScopedKeyword: 1300case SyntaxKind.FileKeyword: 1301case SyntaxKind.AllowsKeyword: 1302case SyntaxKind.ExtensionKeyword: 1303case SyntaxKind.UnionKeyword: 1304case SyntaxKind.ClosedKeyword: 1305case SyntaxKind.SafeKeyword: 1312public static bool IsQueryContextualKeyword(SyntaxKind kind) 1316case SyntaxKind.FromKeyword: 1317case SyntaxKind.WhereKeyword: 1318case SyntaxKind.SelectKeyword: 1319case SyntaxKind.GroupKeyword: 1320case SyntaxKind.IntoKeyword: 1321case SyntaxKind.OrderByKeyword: 1322case SyntaxKind.JoinKeyword: 1323case SyntaxKind.LetKeyword: 1324case SyntaxKind.OnKeyword: 1325case SyntaxKind.EqualsKeyword: 1326case SyntaxKind.ByKeyword: 1327case SyntaxKind.AscendingKeyword: 1328case SyntaxKind.DescendingKeyword: 1335public static SyntaxKind GetContextualKeywordKind(string text) 1340return SyntaxKind.YieldKeyword; 1342return SyntaxKind.PartialKeyword; 1344return SyntaxKind.FromKeyword; 1346return SyntaxKind.GroupKeyword; 1348return SyntaxKind.JoinKeyword; 1350return SyntaxKind.IntoKeyword; 1352return SyntaxKind.LetKeyword; 1354return SyntaxKind.ByKeyword; 1356return SyntaxKind.WhereKeyword; 1358return SyntaxKind.SelectKeyword; 1360return SyntaxKind.GetKeyword; 1362return SyntaxKind.SetKeyword; 1364return SyntaxKind.AddKeyword; 1366return SyntaxKind.RemoveKeyword; 1368return SyntaxKind.OrderByKeyword; 1370return SyntaxKind.AliasKeyword; 1372return SyntaxKind.OnKeyword; 1374return SyntaxKind.EqualsKeyword; 1376return SyntaxKind.AscendingKeyword; 1378return SyntaxKind.DescendingKeyword; 1380return SyntaxKind.AssemblyKeyword; 1382return SyntaxKind.ModuleKeyword; 1384return SyntaxKind.TypeKeyword; 1386return SyntaxKind.FieldKeyword; 1388return SyntaxKind.MethodKeyword; 1390return SyntaxKind.ParamKeyword; 1392return SyntaxKind.PropertyKeyword; 1394return SyntaxKind.TypeVarKeyword; 1396return SyntaxKind.GlobalKeyword; 1398return SyntaxKind.AsyncKeyword; 1400return SyntaxKind.AwaitKeyword; 1402return SyntaxKind.WhenKeyword; 1404return SyntaxKind.NameOfKeyword; 1406return SyntaxKind.UnderscoreToken; 1408return SyntaxKind.VarKeyword; 1410return SyntaxKind.AndKeyword; 1412return SyntaxKind.OrKeyword; 1414return SyntaxKind.NotKeyword; 1416return SyntaxKind.WithKeyword; 1418return SyntaxKind.InitKeyword; 1420return SyntaxKind.RecordKeyword; 1422return SyntaxKind.ManagedKeyword; 1424return SyntaxKind.UnmanagedKeyword; 1426return SyntaxKind.RequiredKeyword; 1428return SyntaxKind.ScopedKeyword; 1430return SyntaxKind.FileKeyword; 1432return SyntaxKind.AllowsKeyword; 1434return SyntaxKind.ExtensionKeyword; 1436return SyntaxKind.UnionKeyword; 1438return SyntaxKind.ClosedKeyword; 1440return SyntaxKind.SafeKeyword; 1442return SyntaxKind.None; 1446public static string GetText(SyntaxKind kind) 1450case SyntaxKind.TildeToken: 1452case SyntaxKind.ExclamationToken: 1454case SyntaxKind.DollarToken: 1456case SyntaxKind.PercentToken: 1458case SyntaxKind.CaretToken: 1460case SyntaxKind.AmpersandToken: 1462case SyntaxKind.AsteriskToken: 1464case SyntaxKind.OpenParenToken: 1466case SyntaxKind.CloseParenToken: 1468case SyntaxKind.MinusToken: 1470case SyntaxKind.PlusToken: 1472case SyntaxKind.EqualsToken: 1474case SyntaxKind.OpenBraceToken: 1476case SyntaxKind.CloseBraceToken: 1478case SyntaxKind.OpenBracketToken: 1480case SyntaxKind.CloseBracketToken: 1482case SyntaxKind.BarToken: 1484case SyntaxKind.BackslashToken: 1486case SyntaxKind.ColonToken: 1488case SyntaxKind.SemicolonToken: 1490case SyntaxKind.DoubleQuoteToken: 1492case SyntaxKind.SingleQuoteToken: 1494case SyntaxKind.LessThanToken: 1496case SyntaxKind.CommaToken: 1498case SyntaxKind.GreaterThanToken: 1500case SyntaxKind.DotToken: 1502case SyntaxKind.QuestionToken: 1504case SyntaxKind.HashToken: 1506case SyntaxKind.SlashToken: 1508case SyntaxKind.SlashGreaterThanToken: 1510case SyntaxKind.LessThanSlashToken: 1512case SyntaxKind.XmlCommentStartToken: 1514case SyntaxKind.XmlCommentEndToken: 1516case SyntaxKind.XmlCDataStartToken: 1518case SyntaxKind.XmlCDataEndToken: 1520case SyntaxKind.XmlProcessingInstructionStartToken: 1522case SyntaxKind.XmlProcessingInstructionEndToken: 1526case SyntaxKind.BarBarToken: 1528case SyntaxKind.AmpersandAmpersandToken: 1530case SyntaxKind.MinusMinusToken: 1532case SyntaxKind.PlusPlusToken: 1534case SyntaxKind.ColonColonToken: 1536case SyntaxKind.QuestionQuestionToken: 1538case SyntaxKind.MinusGreaterThanToken: 1540case SyntaxKind.ExclamationEqualsToken: 1542case SyntaxKind.EqualsEqualsToken: 1544case SyntaxKind.EqualsGreaterThanToken: 1546case SyntaxKind.LessThanEqualsToken: 1548case SyntaxKind.LessThanLessThanToken: 1550case SyntaxKind.LessThanLessThanEqualsToken: 1552case SyntaxKind.GreaterThanEqualsToken: 1554case SyntaxKind.GreaterThanGreaterThanToken: 1556case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1558case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1560case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1562case SyntaxKind.SlashEqualsToken: 1564case SyntaxKind.AsteriskEqualsToken: 1566case SyntaxKind.BarEqualsToken: 1568case SyntaxKind.AmpersandEqualsToken: 1570case SyntaxKind.PlusEqualsToken: 1572case SyntaxKind.MinusEqualsToken: 1574case SyntaxKind.CaretEqualsToken: 1576case SyntaxKind.PercentEqualsToken: 1578case SyntaxKind.QuestionQuestionEqualsToken: 1580case SyntaxKind.DotDotToken: 1584case SyntaxKind.BoolKeyword: 1586case SyntaxKind.ByteKeyword: 1588case SyntaxKind.SByteKeyword: 1590case SyntaxKind.ShortKeyword: 1592case SyntaxKind.UShortKeyword: 1594case SyntaxKind.IntKeyword: 1596case SyntaxKind.UIntKeyword: 1598case SyntaxKind.LongKeyword: 1600case SyntaxKind.ULongKeyword: 1602case SyntaxKind.DoubleKeyword: 1604case SyntaxKind.FloatKeyword: 1606case SyntaxKind.DecimalKeyword: 1608case SyntaxKind.StringKeyword: 1610case SyntaxKind.CharKeyword: 1612case SyntaxKind.VoidKeyword: 1614case SyntaxKind.ObjectKeyword: 1616case SyntaxKind.TypeOfKeyword: 1618case SyntaxKind.SizeOfKeyword: 1620case SyntaxKind.NullKeyword: 1622case SyntaxKind.TrueKeyword: 1624case SyntaxKind.FalseKeyword: 1626case SyntaxKind.IfKeyword: 1628case SyntaxKind.ElseKeyword: 1630case SyntaxKind.WhileKeyword: 1632case SyntaxKind.ForKeyword: 1634case SyntaxKind.ForEachKeyword: 1636case SyntaxKind.DoKeyword: 1638case SyntaxKind.SwitchKeyword: 1640case SyntaxKind.CaseKeyword: 1642case SyntaxKind.DefaultKeyword: 1644case SyntaxKind.TryKeyword: 1646case SyntaxKind.CatchKeyword: 1648case SyntaxKind.FinallyKeyword: 1650case SyntaxKind.LockKeyword: 1652case SyntaxKind.GotoKeyword: 1654case SyntaxKind.BreakKeyword: 1656case SyntaxKind.ContinueKeyword: 1658case SyntaxKind.ReturnKeyword: 1660case SyntaxKind.ThrowKeyword: 1662case SyntaxKind.PublicKeyword: 1664case SyntaxKind.PrivateKeyword: 1666case SyntaxKind.InternalKeyword: 1668case SyntaxKind.ProtectedKeyword: 1670case SyntaxKind.StaticKeyword: 1672case SyntaxKind.ReadOnlyKeyword: 1674case SyntaxKind.SealedKeyword: 1676case SyntaxKind.ConstKeyword: 1678case SyntaxKind.FixedKeyword: 1680case SyntaxKind.StackAllocKeyword: 1682case SyntaxKind.VolatileKeyword: 1684case SyntaxKind.NewKeyword: 1686case SyntaxKind.OverrideKeyword: 1688case SyntaxKind.AbstractKeyword: 1690case SyntaxKind.VirtualKeyword: 1692case SyntaxKind.EventKeyword: 1694case SyntaxKind.ExternKeyword: 1696case SyntaxKind.RefKeyword: 1698case SyntaxKind.OutKeyword: 1700case SyntaxKind.InKeyword: 1702case SyntaxKind.IsKeyword: 1704case SyntaxKind.AsKeyword: 1706case SyntaxKind.ParamsKeyword: 1708case SyntaxKind.ArgListKeyword: 1710case SyntaxKind.MakeRefKeyword: 1712case SyntaxKind.RefTypeKeyword: 1714case SyntaxKind.RefValueKeyword: 1716case SyntaxKind.ThisKeyword: 1718case SyntaxKind.BaseKeyword: 1720case SyntaxKind.NamespaceKeyword: 1722case SyntaxKind.UsingKeyword: 1724case SyntaxKind.ClassKeyword: 1726case SyntaxKind.StructKeyword: 1728case SyntaxKind.InterfaceKeyword: 1730case SyntaxKind.EnumKeyword: 1732case SyntaxKind.DelegateKeyword: 1734case SyntaxKind.CheckedKeyword: 1736case SyntaxKind.UncheckedKeyword: 1738case SyntaxKind.UnsafeKeyword: 1740case SyntaxKind.OperatorKeyword: 1742case SyntaxKind.ImplicitKeyword: 1744case SyntaxKind.ExplicitKeyword: 1746case SyntaxKind.ElifKeyword: 1748case SyntaxKind.EndIfKeyword: 1750case SyntaxKind.RegionKeyword: 1752case SyntaxKind.EndRegionKeyword: 1754case SyntaxKind.DefineKeyword: 1756case SyntaxKind.UndefKeyword: 1758case SyntaxKind.WarningKeyword: 1760case SyntaxKind.ErrorKeyword: 1762case SyntaxKind.LineKeyword: 1764case SyntaxKind.PragmaKeyword: 1766case SyntaxKind.HiddenKeyword: 1768case SyntaxKind.ChecksumKeyword: 1770case SyntaxKind.DisableKeyword: 1772case SyntaxKind.RestoreKeyword: 1774case SyntaxKind.ReferenceKeyword: 1776case SyntaxKind.LoadKeyword: 1778case SyntaxKind.NullableKeyword: 1780case SyntaxKind.EnableKeyword: 1782case SyntaxKind.WarningsKeyword: 1784case SyntaxKind.AnnotationsKeyword: 1788case SyntaxKind.YieldKeyword: 1790case SyntaxKind.PartialKeyword: 1792case SyntaxKind.FromKeyword: 1794case SyntaxKind.GroupKeyword: 1796case SyntaxKind.JoinKeyword: 1798case SyntaxKind.IntoKeyword: 1800case SyntaxKind.LetKeyword: 1802case SyntaxKind.ByKeyword: 1804case SyntaxKind.WhereKeyword: 1806case SyntaxKind.SelectKeyword: 1808case SyntaxKind.GetKeyword: 1810case SyntaxKind.SetKeyword: 1812case SyntaxKind.AddKeyword: 1814case SyntaxKind.RemoveKeyword: 1816case SyntaxKind.OrderByKeyword: 1818case SyntaxKind.AliasKeyword: 1820case SyntaxKind.OnKeyword: 1822case SyntaxKind.EqualsKeyword: 1824case SyntaxKind.AscendingKeyword: 1826case SyntaxKind.DescendingKeyword: 1828case SyntaxKind.AssemblyKeyword: 1830case SyntaxKind.ModuleKeyword: 1832case SyntaxKind.TypeKeyword: 1834case SyntaxKind.FieldKeyword: 1836case SyntaxKind.MethodKeyword: 1838case SyntaxKind.ParamKeyword: 1840case SyntaxKind.PropertyKeyword: 1842case SyntaxKind.TypeVarKeyword: 1844case SyntaxKind.GlobalKeyword: 1846case SyntaxKind.NameOfKeyword: 1848case SyntaxKind.AsyncKeyword: 1850case SyntaxKind.AwaitKeyword: 1852case SyntaxKind.WhenKeyword: 1854case SyntaxKind.InterpolatedStringStartToken: 1856case SyntaxKind.InterpolatedStringEndToken: 1858case SyntaxKind.InterpolatedVerbatimStringStartToken: 1860case SyntaxKind.UnderscoreToken: 1862case SyntaxKind.VarKeyword: 1864case SyntaxKind.AndKeyword: 1866case SyntaxKind.OrKeyword: 1868case SyntaxKind.NotKeyword: 1870case SyntaxKind.WithKeyword: 1872case SyntaxKind.InitKeyword: 1874case SyntaxKind.RecordKeyword: 1876case SyntaxKind.ManagedKeyword: 1878case SyntaxKind.UnmanagedKeyword: 1880case SyntaxKind.RequiredKeyword: 1882case SyntaxKind.ScopedKeyword: 1884case SyntaxKind.FileKeyword: 1886case SyntaxKind.AllowsKeyword: 1888case SyntaxKind.ExtensionKeyword: 1890case SyntaxKind.UnionKeyword: 1892case SyntaxKind.ClosedKeyword: 1894case SyntaxKind.SafeKeyword: 1901public static bool IsTypeParameterVarianceKeyword(SyntaxKind kind) 1903return kind == SyntaxKind.OutKeyword || kind == SyntaxKind.InKeyword; 1906public static bool IsDocumentationCommentTrivia(SyntaxKind kind) 1908return kind == SyntaxKind.SingleLineDocumentationCommentTrivia || 1909kind == SyntaxKind.MultiLineDocumentationCommentTrivia;
Syntax\SyntaxNodeExtensions.cs (57)
23case SyntaxKind.ParenthesizedLambdaExpression: 24case SyntaxKind.SimpleLambdaExpression: 25case SyntaxKind.AnonymousMethodExpression: 37case SyntaxKind.FromClause: 38case SyntaxKind.GroupClause: 39case SyntaxKind.JoinClause: 40case SyntaxKind.JoinIntoClause: 41case SyntaxKind.LetClause: 42case SyntaxKind.OrderByClause: 43case SyntaxKind.QueryContinuation: 44case SyntaxKind.QueryExpression: 45case SyntaxKind.SelectClause: 46case SyntaxKind.WhereClause: 55if (node.Expression.Kind() == SyntaxKind.IdentifierName && 56((IdentifierNameSyntax)node.Expression).Identifier.ContextualKind() == SyntaxKind.NameOfKeyword && 80SyntaxKind kind = syntax.Kind(); 83case SyntaxKind.InvocationExpression when ((InvocationExpressionSyntax)syntax).MayBeNameofOperator(): 85case SyntaxKind.CatchClause: 86case SyntaxKind.ParenthesizedLambdaExpression: 87case SyntaxKind.SimpleLambdaExpression: 88case SyntaxKind.AnonymousMethodExpression: 89case SyntaxKind.CatchFilterClause: 90case SyntaxKind.SwitchSection: 91case SyntaxKind.EqualsValueClause: 92case SyntaxKind.Attribute: 93case SyntaxKind.ArgumentList: 94case SyntaxKind.ArrowExpressionClause: 95case SyntaxKind.SwitchExpression: 96case SyntaxKind.SwitchExpressionArm: 97case SyntaxKind.BaseConstructorInitializer: 98case SyntaxKind.ThisConstructorInitializer: 99case SyntaxKind.ConstructorDeclaration: 100case SyntaxKind.PrimaryConstructorBaseType: 101case SyntaxKind.CheckedExpression: 102case SyntaxKind.UncheckedExpression: 105case SyntaxKind.RecordStructDeclaration: 119case SyntaxKind.SimpleLambdaExpression: 120case SyntaxKind.ParenthesizedLambdaExpression: 123case SyntaxKind.SwitchStatement: 126case SyntaxKind.ForStatement: 130case SyntaxKind.ForEachStatement: 131case SyntaxKind.ForEachVariableStatement: 150if (node.Parent.IsKind(SyntaxKind.CastExpression)) 155while (node.Parent.IsKind(SyntaxKind.ConditionalExpression)) 170case SyntaxKind.EqualsValueClause: 174return variableDeclarator.IsKind(SyntaxKind.VariableDeclarator) && 175variableDeclarator.Parent.IsKind(SyntaxKind.VariableDeclaration); 178case SyntaxKind.SimpleAssignmentExpression: 180return parentNode.Parent.IsKind(SyntaxKind.ExpressionStatement); 200case SyntaxKind.IdentifierName: 203case SyntaxKind.SimpleMemberAccessExpression: 207case SyntaxKind.ConditionalAccessExpression: 209if (input.Kind() == SyntaxKind.MemberBindingExpression) 250if (syntax.Kind() == SyntaxKind.RefType) 253refKind = refType.ReadOnlyKeyword.Kind() == SyntaxKind.ReadOnlyKeyword 353if (expression.Kind() == SyntaxKind.InvocationExpression) 358return invocationTarget.Kind() == SyntaxKind.IdentifierName &&
Syntax\SyntaxNodeRemover.cs (17)
123/// be true for <see cref="SyntaxKind.EndOfLineTrivia"/>, <see cref="SyntaxKind.SingleLineCommentTrivia"/>, 128return trivia.Kind() == SyntaxKind.EndOfLineTrivia 129|| trivia.Kind() == SyntaxKind.SingleLineCommentTrivia 140if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 196if (result.Kind() != SyntaxKind.None && _residualTrivia != null && _residualTrivia.Count > 0) 243withSeps, i, (int)SyntaxKind.EndOfLineTrivia, 279if (alternate != null && visited.Kind() != SyntaxKind.None) 444else if (directive.Kind() == SyntaxKind.DefineDirectiveTrivia || 445directive.Kind() == SyntaxKind.UndefDirectiveTrivia) 473if (directiveTriviaListIndex >= 1 && triviaList[directiveTriviaListIndex - 1] is { RawKind: (int)SyntaxKind.WhitespaceTrivia } indentationTrivia) 500case SyntaxKind.IfDirectiveTrivia: 501case SyntaxKind.ElseDirectiveTrivia: 502case SyntaxKind.ElifDirectiveTrivia: 503case SyntaxKind.EndIfDirectiveTrivia: 504case SyntaxKind.RegionDirectiveTrivia: 505case SyntaxKind.EndRegionDirectiveTrivia:
Syntax\SyntaxNormalizer.cs (234)
86if (token.Kind() == SyntaxKind.None || (token.IsMissing && token.FullWidth == 0)) 129if (syntaxToken.LeadingTrivia[^2].IsKind(SyntaxKind.MultiLineDocumentationCommentTrivia) && 130syntaxToken.LeadingTrivia[^1].IsKind(SyntaxKind.EndOfLineTrivia)) 149t => SyntaxToken.NonZeroWidth(t) || t.Kind() == SyntaxKind.EndOfDirectiveToken, 150t => t.Kind() == SyntaxKind.SkippedTokensTrivia); 190return !token.IsKind(SyntaxKind.EndOfFileToken); 200if (currentToken.IsKind(SyntaxKind.EndOfDirectiveToken)) 205if (nextToken.Kind() == SyntaxKind.None) 216if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 232case SyntaxKind.None: 235case SyntaxKind.OpenBraceToken: 238case SyntaxKind.FinallyKeyword: 241case SyntaxKind.CloseBraceToken: 244case SyntaxKind.CloseParenToken: 251if (nextToken.IsKind(SyntaxKind.OpenBraceToken) && 263|| nextToken.Kind() == SyntaxKind.OpenBraceToken 264|| nextToken.Kind() == SyntaxKind.WhereKeyword) ? 1 : 0; 266case SyntaxKind.CloseBracketToken: 273case SyntaxKind.SemicolonToken: 276case SyntaxKind.CommaToken: 283case SyntaxKind.ElseKeyword: 284return nextToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 285case SyntaxKind.ColonToken: 291case SyntaxKind.SwitchKeyword when currentToken.Parent is SwitchExpressionSyntax: 295if ((nextToken.IsKind(SyntaxKind.FromKeyword) && nextToken.Parent.IsKind(SyntaxKind.FromClause)) || 296(nextToken.IsKind(SyntaxKind.LetKeyword) && nextToken.Parent.IsKind(SyntaxKind.LetClause)) || 297(nextToken.IsKind(SyntaxKind.WhereKeyword) && nextToken.Parent.IsKind(SyntaxKind.WhereClause)) || 298(nextToken.IsKind(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinClause)) || 299(nextToken.IsKind(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 300(nextToken.IsKind(SyntaxKind.OrderByKeyword) && nextToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 301(nextToken.IsKind(SyntaxKind.SelectKeyword) && nextToken.Parent.IsKind(SyntaxKind.SelectClause)) || 302(nextToken.IsKind(SyntaxKind.GroupKeyword) && nextToken.Parent.IsKind(SyntaxKind.GroupClause))) 309case SyntaxKind.OpenBraceToken: 311case SyntaxKind.CloseBraceToken: 313case SyntaxKind.ElseKeyword: 314case SyntaxKind.FinallyKeyword: 316case SyntaxKind.OpenBracketToken: 318case SyntaxKind.WhereKeyword: 334Debug.Assert(openBraceToken.IsKind(SyntaxKind.OpenBraceToken)); 336if (parent.IsKind(SyntaxKind.Interpolation) || 351Debug.Assert(closeBraceToken.IsKind(SyntaxKind.CloseBraceToken)); 353if (parent.IsKind(SyntaxKind.Interpolation) || 369parent.IsKind(SyntaxKind.Interpolation) || 385currentTokenParent.IsKind(SyntaxKind.Interpolation) || 405var kind = nextToken.Kind(); 408case SyntaxKind.EndOfFileToken: 409case SyntaxKind.CloseBraceToken: 410case SyntaxKind.CatchKeyword: 411case SyntaxKind.FinallyKeyword: 412case SyntaxKind.ElseKeyword: 415if (kind == SyntaxKind.WhileKeyword && 416nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 427=> currentToken.IsKind(SyntaxKind.CloseBraceToken) && 428nextToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.SemicolonToken; 433if (currentToken.Parent.IsKind(SyntaxKind.ForStatement)) 437else if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 441else if (currentToken.Parent.IsKind(SyntaxKind.UsingDirective)) 443return nextToken.Parent.IsKind(SyntaxKind.UsingDirective) ? 1 : 2; 445else if (currentToken.Parent.IsKind(SyntaxKind.ExternAliasDirective)) 447return nextToken.Parent.IsKind(SyntaxKind.ExternAliasDirective) ? 1 : 2; 486if (token.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 490else if (next.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 499var tokenIsOpenBrace = token.IsKind(SyntaxKind.OpenBraceToken); 500var nextIsOpenBrace = next.IsKind(SyntaxKind.OpenBraceToken); 501var tokenIsCloseBrace = token.IsKind(SyntaxKind.CloseBraceToken); 502var nextIsCloseBrace = next.IsKind(SyntaxKind.CloseBraceToken); 546if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 550else if (next.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 559var tokenIsOpenParen = token.IsKind(SyntaxKind.OpenParenToken); 560var nextIsOpenParen = next.IsKind(SyntaxKind.OpenParenToken); 561var tokenIsCloseParen = token.IsKind(SyntaxKind.CloseParenToken); 562var nextIsCloseParen = next.IsKind(SyntaxKind.CloseParenToken); 616if (next.IsKind(SyntaxKind.OpenBracketToken)) 622if (token.IsKind(SyntaxKind.OpenBracketToken)) 642return !next.IsKind(SyntaxKind.SemicolonToken); 650if (next.Kind() == SyntaxKind.EndOfDirectiveToken) 665if (token.IsKind(SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeArgumentList)) 673if (token.IsKind(SyntaxKind.GreaterThanToken) && 674token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && 680if (token.IsKind(SyntaxKind.CommaToken) && 681!next.IsKind(SyntaxKind.CommaToken) && 682!token.Parent.IsKind(SyntaxKind.EnumDeclaration)) 687if (token.Kind() == SyntaxKind.SemicolonToken 688&& !(next.Kind() == SyntaxKind.SemicolonToken || next.Kind() == SyntaxKind.CloseParenToken)) 693if (next.IsKind(SyntaxKind.SwitchKeyword) && next.Parent is SwitchExpressionSyntax) 698if (token.IsKind(SyntaxKind.QuestionToken)) 700if (token.Parent.IsKind(SyntaxKind.ConditionalExpression) || token.Parent is TypeSyntax) 702if (token.Parent.Parent?.Kind() is not SyntaxKind.TypeArgumentList and not SyntaxKind.UsingDirective) 709if (token.IsKind(SyntaxKind.ColonToken)) 711return !token.Parent.IsKind(SyntaxKind.InterpolationFormatClause) && 712!token.Parent.IsKind(SyntaxKind.XmlPrefix) && 713!token.Parent.IsKind(SyntaxKind.IgnoredDirectiveTrivia); 716if (next.IsKind(SyntaxKind.ColonToken)) 718if (next.Parent.IsKind(SyntaxKind.BaseList) || 719next.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) || 726if (token.IsKind(SyntaxKind.CloseBracketToken) && IsWord(next.Kind())) 732if (token.IsKind(SyntaxKind.CloseParenToken) && IsWord(next.Kind()) && token.Parent.IsKind(SyntaxKind.TupleType) == true) 737if ((next.IsKind(SyntaxKind.QuestionToken) || next.IsKind(SyntaxKind.ColonToken)) 738&& (next.Parent.IsKind(SyntaxKind.ConditionalExpression))) 743if (token.IsKind(SyntaxKind.EqualsToken)) 745return !token.Parent.IsKind(SyntaxKind.XmlTextAttribute); 748if (next.IsKind(SyntaxKind.EqualsToken)) 750return !next.Parent.IsKind(SyntaxKind.XmlTextAttribute); 755if (token.Parent.IsKind(SyntaxKind.FunctionPointerType)) 758if (next.IsKind(SyntaxKind.AsteriskToken) && token.IsKind(SyntaxKind.DelegateKeyword)) 764if (token.IsKind(SyntaxKind.AsteriskToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention)) 768case SyntaxKind.IdentifierToken: 769case SyntaxKind.ManagedKeyword: 770case SyntaxKind.UnmanagedKeyword: 776if (next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && next.IsKind(SyntaxKind.LessThanToken)) 781case SyntaxKind.AsteriskToken: 784case SyntaxKind.ManagedKeyword: 785case SyntaxKind.UnmanagedKeyword: 788case SyntaxKind.CloseBracketToken when token.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList): 795if (token.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention) && next.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList) && 796next.IsKind(SyntaxKind.OpenBracketToken)) 802if (next.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList) && token.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList)) 804if (next.IsKind(SyntaxKind.IdentifierToken)) 806if (token.IsKind(SyntaxKind.OpenBracketToken)) 812else if (token.IsKind(SyntaxKind.CommaToken)) 820if (next.IsKind(SyntaxKind.CommaToken)) 827if (next.IsKind(SyntaxKind.CloseBracketToken)) 835if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 842if (next.IsKind(SyntaxKind.GreaterThanToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 847if (token.IsKind(SyntaxKind.EqualsGreaterThanToken) || next.IsKind(SyntaxKind.EqualsGreaterThanToken)) 859if (next.IsKind(SyntaxKind.AsteriskToken) && next.Parent is PointerTypeSyntax) 865if (token.IsKind(SyntaxKind.AsteriskToken) && token.Parent is PointerTypeSyntax && 866(next.IsKind(SyntaxKind.IdentifierToken) || next.Parent.IsKind(SyntaxKind.IndexerDeclaration))) 881next.IsKind(SyntaxKind.OpenBraceToken)) 887token.IsKind(SyntaxKind.OpenBraceToken)) 893next.IsKind(SyntaxKind.CloseBraceToken)) 900if (next is { RawKind: (int)SyntaxKind.OpenParenToken, Parent.Parent: ParenthesizedLambdaExpressionSyntax lambda } && 906if (token.Parent.Parent?.Kind() == SyntaxKind.SuppressNullableWarningExpression) 911if (IsKeyword(token.Kind()) && !token.IsKind(SyntaxKind.ExtensionKeyword)) 913if (!next.IsKind(SyntaxKind.ColonToken) && 914!next.IsKind(SyntaxKind.DotToken) && 915!next.IsKind(SyntaxKind.QuestionToken) && 916!next.IsKind(SyntaxKind.SemicolonToken) && 917!next.IsKind(SyntaxKind.OpenBracketToken) && 918(!next.IsKind(SyntaxKind.OpenParenToken) || KeywordNeedsSeparatorBeforeOpenParen(token.Kind()) || next.Parent.IsKind(SyntaxKind.TupleType)) && 919!next.IsKind(SyntaxKind.CloseParenToken) && 920!next.IsKind(SyntaxKind.CloseBraceToken) && 921!next.IsKind(SyntaxKind.ColonColonToken) && 922!next.IsKind(SyntaxKind.GreaterThanToken) && 923!next.IsKind(SyntaxKind.CommaToken)) 951case SyntaxKind.AndKeyword: 952case SyntaxKind.OrKeyword: 958case SyntaxKind.AndKeyword: 959case SyntaxKind.OrKeyword: 960case SyntaxKind.NotKeyword: 981case (SyntaxKind.LineSpanDirectiveTrivia, SyntaxKind.LineDirectivePosition): 982case (SyntaxKind.LineDirectivePosition, SyntaxKind.LineSpanDirectiveTrivia): 989private static bool KeywordNeedsSeparatorBeforeOpenParen(SyntaxKind kind) 993case SyntaxKind.TypeOfKeyword: 994case SyntaxKind.DefaultKeyword: 995case SyntaxKind.NewKeyword: 996case SyntaxKind.BaseKeyword: 997case SyntaxKind.ThisKeyword: 998case SyntaxKind.CheckedKeyword: 999case SyntaxKind.UncheckedKeyword: 1000case SyntaxKind.SizeOfKeyword: 1001case SyntaxKind.ArgListKeyword: 1008private static bool IsXmlTextToken(SyntaxKind kind) 1012case SyntaxKind.XmlTextLiteralNewLineToken: 1013case SyntaxKind.XmlTextLiteralToken: 1020private static bool BinaryTokenNeedsSeparator(SyntaxKind kind) 1024case SyntaxKind.DotToken: 1025case SyntaxKind.MinusGreaterThanToken: 1028return SyntaxFacts.GetBinaryExpression(kind) != SyntaxKind.None; 1032private static bool AssignmentTokenNeedsSeparator(SyntaxKind kind) 1034return SyntaxFacts.GetAssignmentExpression(kind) != SyntaxKind.None; 1050if (trivia.IsKind(SyntaxKind.WhitespaceTrivia) || 1051trivia.IsKind(SyntaxKind.EndOfLineTrivia) || 1091else if (trivia.IsKind(SyntaxKind.DocumentationCommentExteriorTrivia)) 1188case SyntaxKind.None: 1189case SyntaxKind.WhitespaceTrivia: 1190case SyntaxKind.DocumentationCommentExteriorTrivia: 1205var kind = trivia.Kind(); 1208case SyntaxKind.DocumentationCommentExteriorTrivia: 1217var kind = trivia.Kind(); 1220case SyntaxKind.SingleLineCommentTrivia: 1222case SyntaxKind.MultiLineCommentTrivia: 1233case SyntaxKind.SingleLineCommentTrivia: 1234case SyntaxKind.MultiLineCommentTrivia: 1235case SyntaxKind.DocumentationCommentExteriorTrivia: 1236case SyntaxKind.SingleLineDocumentationCommentTrivia: 1237case SyntaxKind.MultiLineDocumentationCommentTrivia: 1246return token.Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 1251if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 1256if (trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia || trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1272return !node.IsKind(SyntaxKind.MultiLineDocumentationCommentTrivia) && IsLineBreak(node.GetLastToken()); 1279private static bool IsWord(SyntaxKind kind) 1281return kind == SyntaxKind.IdentifierToken || IsKeyword(kind); 1284private static bool IsWordOrLiteral(SyntaxKind kind) 1288|| kind == SyntaxKind.InterpolatedStringEndToken 1289|| kind == SyntaxKind.InterpolatedRawStringEndToken; 1292private static bool IsKeyword(SyntaxKind kind) 1343if (node.Parent.IsKind(SyntaxKind.CompilationUnit)) 1350if (node.Parent.Kind() is SyntaxKind.GlobalStatement or SyntaxKind.FileScopedNamespaceDeclaration) 1355if (node.IsKind(SyntaxKind.IfStatement) && node.Parent.IsKind(SyntaxKind.ElseClause)) 1478if (node.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken) 1509SyntaxKind nextTokenKind = GetNextRelevantToken(node.EndQuoteToken).Kind(); 1510return nextTokenKind != SyntaxKind.GreaterThanToken && nextTokenKind != SyntaxKind.SlashGreaterThanToken
Syntax\SyntaxTokenParser.cs (8)
60/// of <see cref="SyntaxKind.None"/>, <see cref="SyntaxToken.IsMissing"/> set to <see langword="true"/>, and a parent of <see langword="null"/>. The 68var containingToken = InternalSyntax.SyntaxFactory.MissingToken(leading: leadingTrivia.Node, SyntaxKind.None, trailing: null); 75/// of <see cref="SyntaxKind.None"/>, <see cref="SyntaxToken.IsMissing"/> set to <see langword="true"/>, and a parent of <see langword="null"/>. The 83var containingToken = InternalSyntax.SyntaxFactory.MissingToken(leading: null, SyntaxKind.None, trailing: trailingTrivia.Node); 125/// will return <see cref="SyntaxKind.None"/>. 127public readonly SyntaxKind ContextualKind 131var contextualKind = Token.ContextualKind(); 132return contextualKind == Token.Kind() ? SyntaxKind.None : contextualKind;
Syntax\TypeDeclarationSyntax.cs (34)
37if (Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration)) 52internal static SyntaxKind GetTypeDeclarationKeywordKind(DeclarationKind kind) 57return SyntaxKind.ClassKeyword; 59return SyntaxKind.StructKeyword; 61return SyntaxKind.UnionKeyword; 63return SyntaxKind.InterfaceKeyword; 69private static SyntaxKind GetTypeDeclarationKeywordKind(SyntaxKind kind) 73case SyntaxKind.ClassDeclaration: 74return SyntaxKind.ClassKeyword; 75case SyntaxKind.StructDeclaration: 76return SyntaxKind.StructKeyword; 77case SyntaxKind.UnionDeclaration: 78return SyntaxKind.UnionKeyword; 79case SyntaxKind.InterfaceDeclaration: 80return SyntaxKind.InterfaceKeyword; 81case SyntaxKind.RecordDeclaration: 82case SyntaxKind.RecordStructDeclaration: 83return SyntaxKind.RecordKeyword; 89public static TypeDeclarationSyntax TypeDeclaration(SyntaxKind kind, SyntaxToken identifier) 100SyntaxFactory.Token(SyntaxKind.OpenBraceToken), 102SyntaxFactory.Token(SyntaxKind.CloseBraceToken), 106public static TypeDeclarationSyntax TypeDeclaration(SyntaxKind kind, string identifier) 112SyntaxKind kind, 127case SyntaxKind.ClassDeclaration: 129case SyntaxKind.StructDeclaration: 131case SyntaxKind.UnionDeclaration: 133case SyntaxKind.InterfaceDeclaration: 135case SyntaxKind.RecordDeclaration: 136return SyntaxFactory.RecordDeclaration(SyntaxKind.RecordDeclaration, attributes, modifiers, keyword, classOrStructKeyword: default, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 137case SyntaxKind.RecordStructDeclaration: 138return SyntaxFactory.RecordDeclaration(SyntaxKind.RecordStructDeclaration, attributes, modifiers, keyword, classOrStructKeyword: SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
Syntax\UsingDirectiveSyntax.cs (2)
38=> UsingDirective(globalKeyword: default, usingKeyword: Token(SyntaxKind.UsingKeyword), staticKeyword, unsafeKeyword: default, alias, namespaceOrType: name, semicolonToken: Token(SyntaxKind.SemicolonToken));
Syntax\YieldStatementSyntax.cs (1)
20public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
Microsoft.CodeAnalysis.CSharp.Analyzers (27)
CSharpUpgradeMSBuildWorkspaceAnalyzer.cs (1)
17context.RegisterSyntaxNodeAction(AnalyzeIdentifier, SyntaxKind.IdentifierName);
MetaAnalyzers\CSharpDiagnosticAnalyzerAPIUsageAnalyzer.cs (5)
18SyntaxKind.ClassDeclaration 19or SyntaxKind.StructDeclaration 20or SyntaxKind.EnumDeclaration 21or SyntaxKind.RecordDeclaration 22or SyntaxKind.InterfaceDeclaration => true,
MetaAnalyzers\CSharpRegisterActionAnalyzer.cs (7)
15public class CSharpRegisterActionAnalyzer : RegisterActionAnalyzer<InvocationExpressionSyntax, ArgumentSyntax, SyntaxKind> 52protected override SyntaxKind InvocationExpressionKind => SyntaxKind.InvocationExpression; 53protected override SyntaxKind ArgumentSyntaxKind => SyntaxKind.Argument; 54protected override SyntaxKind ParameterSyntaxKind => SyntaxKind.Parameter;
MetaAnalyzers\CSharpSymbolIsBannedInAnalyzersAnalyzer.cs (7)
15public sealed class CSharpSymbolIsBannedInAnalyzersAnalyzer : SymbolIsBannedInAnalyzersAnalyzer<SyntaxKind> 17protected override SyntaxKind XmlCrefSyntaxKind => SyntaxKind.XmlCrefAttribute; 19protected override ImmutableArray<SyntaxKind> BaseTypeSyntaxKinds => ImmutableArray.Create(SyntaxKind.BaseList); 28=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia;
MetaAnalyzers\Fixers\CSharpPreferIsKindFix.cs (7)
28if (binaryExpression.Left.IsKind(SyntaxKind.InvocationExpression) || 29binaryExpression.Left.IsKind(SyntaxKind.ConditionalAccessExpression)) 45if (binaryExpression.Left.IsKind(SyntaxKind.ConditionalAccessExpression)) 50SyntaxKind.SimpleMemberAccessExpression, 54else if (binaryExpression.Left.IsKind(SyntaxKind.InvocationExpression)) 68var negate = binaryExpression.OperatorToken.IsKind(SyntaxKind.ExclamationEqualsToken); 71return SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, newInvocation.WithoutLeadingTrivia()).WithLeadingTrivia(newInvocation.GetLeadingTrivia());
Microsoft.CodeAnalysis.CSharp.CodeStyle (2436)
src\roslyn\src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiers.cs (9)
33if (name.Kind() == SyntaxKind.None) 86case SyntaxKind.CompilationUnit: 87case SyntaxKind.FileScopedNamespaceDeclaration: 88case SyntaxKind.NamespaceDeclaration: 92case SyntaxKind.ClassDeclaration: 93case SyntaxKind.RecordDeclaration: 94case SyntaxKind.StructDeclaration: 95case SyntaxKind.RecordStructDeclaration: 99case SyntaxKind.InterfaceDeclaration:
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (23)
33SyntaxKind.IfStatement, 34SyntaxKind.ElseClause, 35SyntaxKind.ForStatement, 36SyntaxKind.ForEachStatement, 37SyntaxKind.ForEachVariableStatement, 38SyntaxKind.WhileStatement, 39SyntaxKind.DoStatement, 40SyntaxKind.UsingStatement, 41SyntaxKind.LockStatement, 42SyntaxKind.FixedStatement); 62case SyntaxKind.Block: 66case SyntaxKind.IfStatement when statement.Kind() == SyntaxKind.ElseClause: 77case SyntaxKind.LockStatement: 78case SyntaxKind.UsingStatement: 79case SyntaxKind.FixedStatement: 238if (statement.Kind() is not (SyntaxKind.IfStatement or SyntaxKind.ElseClause)) 267if (ifStatementOrElseClause.IsKind(SyntaxKind.ElseClause)) 273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement)); 277while (result.IsParentKind(SyntaxKind.ElseClause)) 292if (statement.Statement.IsKind(SyntaxKind.Block)) 296if (elseStatement.IsKind(SyntaxKind.Block))
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (26)
18ExpressionSyntax, ExpressionSyntax, SyntaxKind>(CSharpExpressionPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = 22SyntaxKind.AddExpression, 23SyntaxKind.SubtractExpression, 24SyntaxKind.MultiplyExpression, 25SyntaxKind.DivideExpression, 26SyntaxKind.ModuloExpression, 27SyntaxKind.LeftShiftExpression, 28SyntaxKind.RightShiftExpression, 29SyntaxKind.LogicalOrExpression, 30SyntaxKind.LogicalAndExpression, 31SyntaxKind.BitwiseOrExpression, 32SyntaxKind.BitwiseAndExpression, 33SyntaxKind.ExclusiveOrExpression, 34SyntaxKind.EqualsExpression, 35SyntaxKind.NotEqualsExpression, 36SyntaxKind.LessThanExpression, 37SyntaxKind.LessThanOrEqualExpression, 38SyntaxKind.GreaterThanExpression, 39SyntaxKind.GreaterThanOrEqualExpression, 40SyntaxKind.IsExpression, 41SyntaxKind.AsExpression, 42SyntaxKind.CoalesceExpression, 43SyntaxKind.IsPatternExpression, 46protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds() 81=> node.Kind() == SyntaxKind.AsExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (5)
18PatternSyntax, BinaryPatternSyntax, SyntaxKind>(CSharpPatternPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = [SyntaxKind.AndPattern, SyntaxKind.OrPattern]; 22protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds()
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.FileScopedNamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.NamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
66var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (5)
58if (!methodDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword) || 132if (member.Modifiers.Any(m => m.Kind() is SyntaxKind.PublicKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.InternalKeyword)) 135if (!member.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
38context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
44context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (33)
20private sealed class Analyzer : CSharpSyntaxVisitor<SyntaxKind> 31public static (SyntaxKind nodeToGenerate, VariableDeclaratorSyntax? declaratorToRemoveOpt) Analyze( 37var nodeToGenerate = analyzer.AnalyzeSwitchStatement(node, out shouldRemoveNextStatement); 39if (nodeToGenerate == SyntaxKind.SimpleAssignmentExpression && 84if (!_assignmentTargetOpt.IsKind(SyntaxKind.IdentifierName)) 104public override SyntaxKind VisitSwitchStatement(SwitchStatementSyntax node) 107private SyntaxKind AnalyzeSwitchStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 126var nextStatement = AnalyzeNextStatement(switchStatement, out shouldRemoveNextStatement); 175private SyntaxKind AnalyzeNextStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 182return SyntaxKind.ThrowStatement; 190private static SyntaxKind Intersect(SyntaxKind left, SyntaxKind right) 192if (left == SyntaxKind.ThrowStatement) 197if (right == SyntaxKind.ThrowStatement) 210private SyntaxKind AnalyzeNextStatement(StatementSyntax? nextStatement) 213return nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement) 218private SyntaxKind AnalyzeSwitchSection(SwitchSectionSyntax section) 223case 2 when section.Statements[1].IsKind(SyntaxKind.BreakStatement) || section.Statements[0].IsKind(SyntaxKind.SwitchStatement): 230private static SyntaxKind Aggregate<T>(SyntaxKind seed, SyntaxList<T> nodes, Func<SyntaxKind, T, SyntaxKind> func) 233var result = seed; 248public override SyntaxKind VisitAssignmentExpression(AssignmentExpressionSyntax node) 268public override SyntaxKind VisitExpressionStatement(ExpressionStatementSyntax node) 271public override SyntaxKind VisitReturnStatement(ReturnStatementSyntax node) 279: SyntaxKind.ReturnStatement; 282public override SyntaxKind VisitThrowStatement(ThrowStatementSyntax node) 286return node.Expression is null ? default : SyntaxKind.ThrowStatement; 289public override SyntaxKind DefaultVisit(SyntaxNode node)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
34context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SwitchStatement);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionHelpers.cs (4)
14if (node.IsKind(SyntaxKind.DefaultSwitchLabel)) 22if (@case.Pattern.IsKind(SyntaxKind.DiscardPattern)) 30varPattern.Designation.Kind() is SyntaxKind.DiscardDesignation or SyntaxKind.SingleVariableDesignation)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
36and not { Type: PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword } };
src\roslyn\src\Analyzers\CSharp\Analyzers\FileHeaders\CSharpFileHeaderHelper.cs (2)
22if (commentTrivia.IsKind(SyntaxKind.SingleLineCommentTrivia)) 26else if (commentTrivia.IsKind(SyntaxKind.MultiLineCommentTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\ForEachCast\CSharpForEachCastDiagnosticAnalyzer.cs (4)
17SyntaxKind, 23protected override ImmutableArray<SyntaxKind> GetSyntaxKinds() 24=> [SyntaxKind.ForEachStatement, SyntaxKind.ForEachVariableStatement];
src\roslyn\src\Analyzers\CSharp\Analyzers\HiddenExplicitCast\CSharpHiddenExplicitCastDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.CastExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (13)
57compilationContext.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 59syntaxContext => AnalyzeSyntaxNode(syntaxContext, expressionType), SyntaxKind.Argument)); 81if (argumentNode.RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) 102if (invocationOrCreation?.Kind() is not SyntaxKind.InvocationExpression and not SyntaxKind.ObjectCreationExpression) 293case SyntaxKind.WhileStatement: 294case SyntaxKind.DoStatement: 295case SyntaxKind.ForStatement: 296case SyntaxKind.ForEachStatement: 297case SyntaxKind.UsingStatement: 298case SyntaxKind.FixedStatement: 299case SyntaxKind.TryStatement: 318return current.IsParentKind(SyntaxKind.Block)
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (7)
35=> context.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IfStatement); 56if (!ifStatement.Condition.IsKind(SyntaxKind.NotEqualsExpression)) 119if (condition.Left.IsKind(SyntaxKind.NullLiteralExpression) || 120condition.Right.IsKind(SyntaxKind.NullLiteralExpression)) 122var expr = condition.Left.IsKind(SyntaxKind.NullLiteralExpression) 309=> left.IsKind(SyntaxKind.IdentifierName) && right.IsKind(SyntaxKind.NullLiteralExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (4)
35context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 46if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeFieldReadonly\CSharpMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
15: AbstractMakeFieldReadonlyDiagnosticAnalyzer<SyntaxKind, ThisExpressionSyntax>
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (2)
32context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.LocalFunctionStatement); 38if (localFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
186property.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
51}, SyntaxKind.ThisExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceDiagnosticAnalyzer.cs (4)
24: AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<SyntaxKind, BaseNamespaceDeclarationSyntax> 36protected override ImmutableArray<SyntaxKind> GetSyntaxKindsToAnalyze() 37=> [SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration];
src\roslyn\src\Analyzers\CSharp\Analyzers\MisplacedUsingDirectives\MisplacedUsingDirectivesDiagnosticAnalyzer.cs (6)
53context.RegisterSyntaxNodeAction(AnalyzeNamespaceNode, SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration); 54context.RegisterSyntaxNodeAction(AnalyzeCompilationUnitNode, SyntaxKind.CompilationUnit); 103t => t.Kind() is not (SyntaxKind.UsingDirective or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration));
src\roslyn\src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (9)
15internal sealed class CSharpNamingStyleDiagnosticAnalyzer : NamingStyleDiagnosticAnalyzerBase<SyntaxKind> 17protected override ImmutableArray<SyntaxKind> SupportedSyntaxKinds { get; } = 19SyntaxKind.VariableDeclarator, 20SyntaxKind.ForEachStatement, 21SyntaxKind.CatchDeclaration, 22SyntaxKind.SingleVariableDesignation, 23SyntaxKind.LocalFunctionStatement, 24SyntaxKind.Parameter, 25SyntaxKind.TypeParameter,
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (5)
101if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 111SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (6)
33=> context.RegisterSyntaxNodeAction(ProcessConditionalExpression, SyntaxKind.ConditionalExpression); 77if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 87SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (3)
98if (!token.IsKind(SyntaxKind.CloseBraceToken)) 102if (!nextToken.IsKind(SyntaxKind.CloseBraceToken)) 127endOfLineTrivia = secondBrace.LeadingTrivia.Last(t => t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
86if (colonToken.TrailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (4)
93var parentIsElseClause = parent.IsKind(SyntaxKind.ElseClause); 99if (statement.IsKind(SyntaxKind.IfStatement) && parentIsElseClause) 111if (parent.IsKind(SyntaxKind.Block)) 133if (trivia.IsKind(SyntaxKind.EndOfLineTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersHelper.cs (3)
21var kind = SyntaxFacts.GetKeywordKind(trimmed); 22return (int)(kind == SyntaxKind.None ? SyntaxFacts.GetContextualKeywordKind(trimmed) : kind); 31parsed[(int)SyntaxKind.PartialKeyword] = int.MaxValue;
src\roslyn\src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (6)
18: AbstractQualifyMemberAccessDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax, SimpleNameSyntax> 24=> node.IsKind(SyntaxKind.ThisExpression); 38if (node.IsKind(SyntaxKind.BaseExpression)) 44if (node.Parent is AssignmentExpressionSyntax { Parent: InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression), Left: var left } && 62=> declarationSyntax.IsKind(SyntaxKind.PropertyDeclaration) && declarationSyntax.Contains(node); 65=> declarationSyntax.GetAncestorsOrThis(n => n.IsKind(SyntaxKind.FieldDeclaration) && n.Contains(node)).Any();
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (3)
26=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.IsExpression, SyntaxKind.IsPatternExpression); 38if (left.Kind() != SyntaxKind.SuppressNullableWarningExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
90if (modifier.Kind() == SyntaxKind.AsyncKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (4)
20: AbstractRemoveUnnecessaryCastDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax> 22protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; } = 23[SyntaxKind.CastExpression, SyntaxKind.AsExpression];
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
40context.RegisterSyntaxNodeAction(AnalyzeDiscardDesignation, SyntaxKind.DiscardDesignation);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (5)
50SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 75if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 83if (wasAwaited != anonymousFunction.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (14)
55if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 96case SyntaxKind.NullableDirectiveTrivia: 107case SyntaxKind.IfDirectiveTrivia or 108SyntaxKind.ElifDirectiveTrivia or 109SyntaxKind.ElseDirectiveTrivia or 110SyntaxKind.EndIfDirectiveTrivia: 120if (!directive.TargetToken.IsKind(SyntaxKind.None)) 128if (directive.TargetToken.IsKind(SyntaxKind.AnnotationsKeyword)) 132else if (directive.TargetToken.IsKind(SyntaxKind.WarningsKeyword)) 141if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 145else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 155if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 159else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 163else if (directive.SettingToken.IsKind(SyntaxKind.RestoreKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (13)
56SyntaxKind.CompilationUnit or 57SyntaxKind.ClassDeclaration or 58SyntaxKind.RecordDeclaration or 59SyntaxKind.StructDeclaration or 60SyntaxKind.RecordStructDeclaration or 61SyntaxKind.InterfaceDeclaration or 62SyntaxKind.DelegateDeclaration or 63SyntaxKind.EnumDeclaration; 135SyntaxKind.IfDirectiveTrivia or 136SyntaxKind.ElifDirectiveTrivia or 137SyntaxKind.ElseDirectiveTrivia) 272if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 293if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (5)
73if (node.IsParentKind(SyntaxKind.UsingDirective)) 79if (node.IsParentKind(SyntaxKind.SimpleBaseType)) 91if (node.IsParentKind(SyntaxKind.NameEquals) && node.Parent.IsParentKind(SyntaxKind.UsingDirective)) 101if (node.IsParentKind(SyntaxKind.Attribute))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedExpressionSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedPatternSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedPattern;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (3)
22case SyntaxKind.AssemblyKeyword: 23case SyntaxKind.ModuleKeyword: 31}, SyntaxKind.AttributeList);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
24=> (typeof(SyntaxKind).Assembly, CompilerDiagnosticAnalyzerNames.CSharpCompilerAnalyzerTypeName); 26=> root.ContainsDirective(SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (1)
26if (node is not PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixUnary)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\UnnecessaryUnsafeModifierUtilities.cs (1)
145if (modifier.Kind() == SyntaxKind.UnsafeKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (2)
64if (currentStatement.IsKind(SyntaxKind.LabeledStatement)) 74if (currentStatement.IsKind(SyntaxKind.LocalFunctionStatement))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
79!blockOperation.Syntax.IsKind(SyntaxKind.Block);
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyBooleanExpression\CSharpSimplifyConditionalDiagnosticAnalyzer.cs (1)
18SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
35context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, enumerableType), SyntaxKind.InvocationExpression); 72if (whereLambda.Body is not BinaryExpressionSyntax(kind: SyntaxKind.IsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (12)
30=> context.RegisterSyntaxNodeAction(AnalyzePropertyDeclaration, SyntaxKind.PropertyDeclaration); 50if (accessor is (SyntaxKind.GetAccessorDeclaration) { Body.Statements: [ReturnStatementSyntax { Expression.RawKind: (int)SyntaxKind.FieldExpression }] } 51or (SyntaxKind.GetAccessorDeclaration) { ExpressionBody.Expression.RawKind: (int)SyntaxKind.FieldExpression }) 57if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { Body.Statements: [ExpressionStatementSyntax { Expression: var innerBlockBodyExpression }] } && 64if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { ExpressionBody.Expression: var innerExpressionBodyExpression } && 73return expression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 75Left.RawKind: (int)SyntaxKind.FieldExpression, 86containingPropertyDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
47context.RegisterSyntaxNodeAction(AnalyzeSubpattern, SyntaxKind.Subpattern);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (10)
21SyntaxKind, 29protected override SyntaxKind PropertyDeclarationKind 30=> SyntaxKind.PropertyDeclaration; 59if (argument.RefKindKeyword.Kind() != SyntaxKind.None) 75if (addressOfExpression.Kind() == SyntaxKind.AddressOfExpression) 155if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) 157Expression: (kind: SyntaxKind.ThisExpression), 158Name: (kind: SyntaxKind.IdentifierName), 163else if (expression.IsKind(SyntaxKind.IdentifierName)) 215if (setExpression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (6)
19SyntaxKind, 25protected override SyntaxKind IfStatementKind 26=> SyntaxKind.IfStatement; 42if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binary) 47else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs (2)
43protected abstract void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType); 67context.RegisterCodeBlockStartAction<SyntaxKind>(context => InitializeWorker(context, expressionType));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (3)
29protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 31context.RegisterSyntaxNodeAction(context => AnalyzeArrayInitializerExpression(context, expressionType), SyntaxKind.ArrayInitializerExpression); 32context.RegisterSyntaxNodeAction(context => AnalyzeArrayCreationExpression(context, expressionType), SyntaxKind.ArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (5)
32protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 33=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression); 110if (invocationExpression.Expression is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccessExpression || 149argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword, Expression: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } } 216identifierName.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (2)
22protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 23=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (2)
23protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 24=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (4)
65protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 66=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression); 221Initializer: null or { RawKind: (int)SyntaxKind.CollectionInitializerExpression } 403if (memberAccess.Kind() != SyntaxKind.SimpleMemberAccessExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (3)
26protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 28context.RegisterSyntaxNodeAction(context => AnalyzeObjectCreationExpression(context, expressionType), SyntaxKind.ObjectCreationExpression); 29context.RegisterSyntaxNodeAction(context => AnalyzeImplicitObjectCreationExpression(context, expressionType), SyntaxKind.ImplicitObjectCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (3)
35protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 37context.RegisterSyntaxNodeAction(context => AnalyzeExplicitStackAllocExpression(context, expressionType), SyntaxKind.StackAllocArrayCreationExpression); 38context.RegisterSyntaxNodeAction(context => AnalyzeImplicitStackAllocExpression(context, expressionType), SyntaxKind.ImplicitStackAllocArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (5)
580siblingArgument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 614if (openBracket.TrailingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), ..]) 617if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia)] trailingTrivia) 886RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, 1041if (objectCreation.Initializer.IsKind(SyntaxKind.ObjectCreationExpression) && objectCreation.Initializer.Expressions.Count > 0)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (4)
37if (expression is InitializerExpressionSyntax(SyntaxKind.ComplexElementInitializerExpression) initializer) 54if (_objectCreationExpression.Initializer is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) 201if (binaryExpression.Kind() != SyntaxKind.AddExpression) 250if (current is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) { Name.Identifier.ValueText: "Length" or "Count" } memberAccess)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
27SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs (10)
15: AbstractUseCompoundAssignmentDiagnosticAnalyzer<SyntaxKind, AssignmentExpressionSyntax, BinaryExpressionSyntax>( 18protected override SyntaxKind GetAnalysisKind() 19=> SyntaxKind.SimpleAssignmentExpression; 21protected override bool IsSupported(SyntaxKind assignmentKind, ParseOptions options) 22=> assignmentKind != SyntaxKind.CoalesceExpression || 25protected override int TryGetIncrementOrDecrement(SyntaxKind opKind, object constantValue) 34SyntaxKind.AddExpression => 1, 35SyntaxKind.SubtractExpression => -1, 45SyntaxKind.AddExpression => -1, 46SyntaxKind.SubtractExpression => 1,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (10)
44context.RegisterSyntaxNodeAction(AnalyzeCoalesceExpression, SyntaxKind.CoalesceExpression); 45context.RegisterSyntaxNodeAction(AnalyzeIfStatement, SyntaxKind.IfStatement); 71if (assignment.Kind() != SyntaxKind.SimpleAssignmentExpression) 108assignment = whenTrue is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignmentTemp } 179if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binaryExpression) 188else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern) 198if (arg0.Kind() == SyntaxKind.NullLiteralExpression || 199arg1.Kind() == SyntaxKind.NullLiteralExpression) 204testedExpression = arg0.Kind() == SyntaxKind.NullLiteralExpression ? arg1 : arg0;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\Utilities.cs (30)
11public static readonly ImmutableArray<(SyntaxKind, SyntaxKind, SyntaxKind)> Kinds = 13(SyntaxKind.AddExpression, SyntaxKind.AddAssignmentExpression), 14(SyntaxKind.SubtractExpression, SyntaxKind.SubtractAssignmentExpression), 15(SyntaxKind.MultiplyExpression, SyntaxKind.MultiplyAssignmentExpression), 16(SyntaxKind.DivideExpression, SyntaxKind.DivideAssignmentExpression), 17(SyntaxKind.ModuloExpression, SyntaxKind.ModuloAssignmentExpression), 18(SyntaxKind.BitwiseAndExpression, SyntaxKind.AndAssignmentExpression), 19(SyntaxKind.ExclusiveOrExpression, SyntaxKind.ExclusiveOrAssignmentExpression), 20(SyntaxKind.BitwiseOrExpression, SyntaxKind.OrAssignmentExpression), 21(SyntaxKind.LeftShiftExpression, SyntaxKind.LeftShiftAssignmentExpression), 22(SyntaxKind.RightShiftExpression, SyntaxKind.RightShiftAssignmentExpression), 23(SyntaxKind.CoalesceExpression, SyntaxKind.CoalesceAssignmentExpression)).SelectAsArray( 26private static SyntaxKind FindOperatorToken(SyntaxKind assignmentExpressionKind) 28for (var current = SyntaxKind.None; current <= SyntaxKind.ThrowExpression; current++)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (3)
39SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement); 233if (element.Identifier.IsKind(SyntaxKind.None))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.DefaultExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (7)
30SyntaxKind.GetAccessorDeclaration, 31SyntaxKind.SetAccessorDeclaration, 32SyntaxKind.InitAccessorDeclaration, 33SyntaxKind.AddAccessorDeclaration, 34SyntaxKind.RemoveAccessorDeclaration, 63return !declaration.GetLeadingTrivia().Any(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 69=> declaration.IsKind(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConstructorsHelper.cs (1)
25[SyntaxKind.ConstructorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConversionOperatorsHelper.cs (1)
25[SyntaxKind.ConversionOperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForIndexersHelper.cs (1)
28[SyntaxKind.IndexerDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (2)
28[SyntaxKind.LocalFunctionStatement]) 56if (statement.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (2)
26[SyntaxKind.MethodDeclaration]) 54if (declaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForOperatorsHelper.cs (1)
27[SyntaxKind.OperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (1)
31[SyntaxKind.PropertyDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper.cs (1)
22public abstract ImmutableArray<SyntaxKind> SyntaxKinds { get; }
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (8)
34ImmutableArray<SyntaxKind> syntaxKinds) : UseExpressionBodyHelper 42public override ImmutableArray<SyntaxKind> SyntaxKinds { get; } = syntaxKinds; 46return accessorList is { Accessors: [{ AttributeLists.Count: 0, RawKind: (int)SyntaxKind.GetAccessorDeclaration } accessor] } 174getAccessor?.GetLeadingTrivia() is not [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace]) 208if (startOfLine && trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 247if (expressionBody.Expression.IsKind(SyntaxKind.ThrowExpression)) 290.Where(t => t.Kind() != SyntaxKind.EndOfLineTrivia) 384var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (4)
20private readonly ImmutableArray<SyntaxKind> _syntaxKinds; 53var nodeKind = context.Node.Kind(); 60if (grandparent.Kind() == SyntaxKind.PropertyDeclaration && 66if (grandparent.Kind() == SyntaxKind.IndexerDeclaration &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (2)
35SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
57if (expressionBodyOpt.IsKind(SyntaxKind.ThrowExpression) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitlyTypedLambdaExpressionDiagnosticAnalyzer.cs (2)
34SyntaxKind.ParenthesizedLambdaExpression); 124var paramsModifierIndex = parameter.Modifiers.IndexOf(SyntaxKind.ParamsKeyword);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (6)
32=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.ObjectCreationExpression); 102else if (objectCreation.Parent.IsKind(SyntaxKind.ArrowExpressionClause)) 106LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)), 107MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 111AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } => (baseProperty.Type, false), 124else if (objectCreation.Parent is InitializerExpressionSyntax(kind: SyntaxKind.ArrayInitializerExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (3)
43HandleVariableDeclaration, SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement, SyntaxKind.DeclarationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
17=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.NameColon, SyntaxKind.NameEquals); 23case SyntaxKind.NameColon: 26case SyntaxKind.NameEquals:
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (4)
41context.RegisterSyntaxNodeAction(n => AnalyzeSyntax(n), SyntaxKind.EqualsExpression, SyntaxKind.NotEqualsExpression); 61var properties = binaryExpression.Kind() == SyntaxKind.EqualsExpression 73right.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer.cs (1)
14internal sealed class CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer : AbstractUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (10)
71context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 73SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression)); 330if (containingStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclaration) && 357if (anonymousFunction?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Parent: ExpressionStatementSyntax expressionStatement } assignment) 359if (assignment.Left.IsKind(SyntaxKind.IdentifierName)) 383SyntaxKind.NullLiteralExpression or 384SyntaxKind.DefaultLiteralExpression or 385SyntaxKind.DefaultExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (2)
42context.RegisterSyntaxNodeAction(AnalyzeAttribute, SyntaxKind.Attribute); 78if (argument.Expression is not LiteralExpressionSyntax(SyntaxKind.StringLiteralExpression) and not InterpolatedStringExpressionSyntax)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (4)
19SyntaxKind, 33protected override SyntaxKind IfStatementSyntaxKind 34=> SyntaxKind.IfStatement; 53if (pattern is UnaryPatternSyntax(SyntaxKind.NotPattern) notPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (2)
54SyntaxKind.SimpleAssignmentExpression, 167if (target.Syntax.DescendantNodesAndSelf().OfType<ArgumentSyntax>().Any(a => a.RefKindKeyword.Kind() is SyntaxKind.RefKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (3)
43SyntaxKind.LogicalAndExpression, 44SyntaxKind.LogicalOrExpression, 45SyntaxKind.LogicalNotExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
48context.RegisterSyntaxNodeAction(context => AnalyzeAsExpression(context), SyntaxKind.AsExpression); 99if (binaryExpression.Kind() is SyntaxKind.EqualsExpression) 109else if (binaryExpression.Kind() is SyntaxKind.NotEqualsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (20)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection); 106var defAssignedWhenTrue = _comparison.Kind() is SyntaxKind.NotEqualsExpression or SyntaxKind.IsExpression; 114case SyntaxKind.LogicalAndExpression when !defAssignedWhenTrue: 115case SyntaxKind.LogicalOrExpression when defAssignedWhenTrue: 126case SyntaxKind.LogicalAndExpression: 127case SyntaxKind.LogicalOrExpression: 130case SyntaxKind.ParenthesizedExpression: 131case SyntaxKind.CastExpression: 135case SyntaxKind.EqualsValueClause: 136case SyntaxKind.VariableDeclarator: 137case SyntaxKind.VariableDeclaration: 140case SyntaxKind.LogicalNotExpression: 145case SyntaxKind.ConditionalExpression: 158case SyntaxKind.ForStatement: 169case SyntaxKind.WhileStatement: 173case SyntaxKind.IfStatement: 282if (_operand.Kind() == SyntaxKind.IdentifierName)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (16)
47=> context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 49SyntaxKind.EqualsExpression, 50SyntaxKind.NotEqualsExpression, 51SyntaxKind.IsExpression, 52SyntaxKind.IsPatternExpression)); 286case SyntaxKind.IdentifierName: 295if (!initializerValue.IsKind(SyntaxKind.AsExpression, out asExpression)) 301case SyntaxKind.SimpleAssignmentExpression: 306if (!assignment.Right.IsKind(SyntaxKind.AsExpression, out asExpression) || 336private static ExpressionSyntax? GetNullCheckOperand(ExpressionSyntax left, SyntaxKind comparisonKind, SyntaxNode right) 338if (left.IsKind(SyntaxKind.NullLiteralExpression)) 345if (right.IsKind(SyntaxKind.NullLiteralExpression)) 353&& predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword) 354&& comparisonKind == SyntaxKind.IsExpression) 361&& constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression) 362&& comparisonKind == SyntaxKind.IsPatternExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (6)
59context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 60blockStartContext.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IsExpression)); 95var ifStatementScope = ifStatement.Parent.IsKind(SyntaxKind.Block) 173if (!isExpression.Parent.IsKind(SyntaxKind.IfStatement, out ifStatement)) 186if (!firstStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclarationStatement)) 197if (!declaratorValue.IsKind(SyntaxKind.CastExpression, out castExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (3)
46context.RegisterSyntaxNodeAction(n => SyntaxNodeAction(n, expressionOfTType), SyntaxKind.LogicalNotExpression); 63if (node is not PrefixUnaryExpressionSyntax(SyntaxKind.LogicalNotExpression) 81BinaryExpressionSyntax(SyntaxKind.IsExpression) { Right: TypeSyntax type } isExpression
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\UsePatternMatchingHelpers.cs (7)
26if (asExpression.Kind() == SyntaxKind.AsExpression) 54if (conditionalAccessExpression.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) parentBinaryExpression1 && 65SyntaxKind.NotEqualsExpression or 66SyntaxKind.GreaterThanExpression or 67SyntaxKind.GreaterThanOrEqualExpression or 68SyntaxKind.LessThanExpression or 69SyntaxKind.LessThanOrEqualExpression) parentBinaryExpression2 &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (5)
363if (constructorDeclaration.Initializer is null or (kind: SyntaxKind.BaseConstructorInitializer)) 377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer); 472if (assignmentExpression.Kind() != SyntaxKind.SimpleAssignmentExpression) 482MemberAccessExpressionSyntax(kind: SyntaxKind.SimpleMemberAccessExpression) { Expression: (kind: SyntaxKind.ThisExpression), Name: IdentifierNameSyntax identifierName } => identifierName,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (3)
74context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.UsingStatement); 222=> priorStatement.Kind() is SyntaxKind.GotoStatement or 223SyntaxKind.LabeledStatement;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
58SyntaxKind.LocalDeclarationStatement); 139if (assignmentStatement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (2)
53SyntaxKind.InvocationExpression); 72if (argument.Kind() != SyntaxKind.OmittedTypeArgument)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
109else if (elements is [{ Syntax.Parent: (kind: SyntaxKind.CollectionInitializerExpression) }, ..])
src\roslyn\src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
16AbstractValidateFormatStringDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (97)
11public static readonly SyntaxToken AbstractKeyword = Token(SyntaxKind.AbstractKeyword); 12public static readonly SyntaxToken AsKeyword = Token(SyntaxKind.AsKeyword); 13public static readonly SyntaxToken AssemblyKeyword = Token(SyntaxKind.AssemblyKeyword); 14public static readonly SyntaxToken AsyncKeyword = Token(SyntaxKind.AsyncKeyword); 15public static readonly SyntaxToken AwaitKeyword = Token(SyntaxKind.AwaitKeyword); 16public static readonly SyntaxToken BoolKeyword = Token(SyntaxKind.BoolKeyword); 17public static readonly SyntaxToken BreakKeyword = Token(SyntaxKind.BreakKeyword); 18public static readonly SyntaxToken ByteKeyword = Token(SyntaxKind.ByteKeyword); 19public static readonly SyntaxToken CaseKeyword = Token(SyntaxKind.CaseKeyword); 20public static readonly SyntaxToken CharKeyword = Token(SyntaxKind.CharKeyword); 21public static readonly SyntaxToken CheckedKeyword = Token(SyntaxKind.CheckedKeyword); 22public static readonly SyntaxToken CloseBraceToken = Token(SyntaxKind.CloseBraceToken); 23public static readonly SyntaxToken CloseBracketToken = Token(SyntaxKind.CloseBracketToken); 25public static readonly SyntaxToken ClosedKeyword = Token(SyntaxKind.ClosedKeyword); 27public static readonly SyntaxToken CloseParenToken = Token(SyntaxKind.CloseParenToken); 28public static readonly SyntaxToken ColonToken = Token(SyntaxKind.ColonToken); 29public static readonly SyntaxToken CommaToken = Token(SyntaxKind.CommaToken); 30public static readonly SyntaxToken ConstKeyword = Token(SyntaxKind.ConstKeyword); 31public static readonly SyntaxToken ContinueKeyword = Token(SyntaxKind.ContinueKeyword); 32public static readonly SyntaxToken DecimalKeyword = Token(SyntaxKind.DecimalKeyword); 33public static readonly SyntaxToken DisableKeyword = Token(SyntaxKind.DisableKeyword); 34public static readonly SyntaxToken DotDotToken = Token(SyntaxKind.DotDotToken); 35public static readonly SyntaxToken DoubleKeyword = Token(SyntaxKind.DoubleKeyword); 36public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken); 37public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken); 38public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword); 40public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword); 42public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword); 43public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword); 44public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword); 45public static readonly SyntaxToken FloatKeyword = Token(SyntaxKind.FloatKeyword); 46public static readonly SyntaxToken ForEachKeyword = Token(SyntaxKind.ForEachKeyword); 47public static readonly SyntaxToken FromKeyword = Token(SyntaxKind.FromKeyword); 48public static readonly SyntaxToken GlobalKeyword = Token(SyntaxKind.GlobalKeyword); 49public static readonly SyntaxToken GreaterThanEqualsToken = Token(SyntaxKind.GreaterThanEqualsToken); 50public static readonly SyntaxToken GreaterThanToken = Token(SyntaxKind.GreaterThanToken); 51public static readonly SyntaxToken IfKeyword = Token(SyntaxKind.IfKeyword); 52public static readonly SyntaxToken ImplicitKeyword = Token(SyntaxKind.ImplicitKeyword); 53public static readonly SyntaxToken InKeyword = Token(SyntaxKind.InKeyword); 54public static readonly SyntaxToken InterfaceKeyword = Token(SyntaxKind.InterfaceKeyword); 55public static readonly SyntaxToken InternalKeyword = Token(SyntaxKind.InternalKeyword); 56public static readonly SyntaxToken InterpolatedStringEndToken = Token(SyntaxKind.InterpolatedStringEndToken); 57public static readonly SyntaxToken InterpolatedStringStartToken = Token(SyntaxKind.InterpolatedStringStartToken); 58public static readonly SyntaxToken IntKeyword = Token(SyntaxKind.IntKeyword); 59public static readonly SyntaxToken IsKeyword = Token(SyntaxKind.IsKeyword); 60public static readonly SyntaxToken LessThanEqualsToken = Token(SyntaxKind.LessThanEqualsToken); 61public static readonly SyntaxToken LessThanToken = Token(SyntaxKind.LessThanToken); 62public static readonly SyntaxToken LetKeyword = Token(SyntaxKind.LetKeyword); 63public static readonly SyntaxToken LongKeyword = Token(SyntaxKind.LongKeyword); 64public static readonly SyntaxToken MethodKeyword = Token(SyntaxKind.MethodKeyword); 65public static readonly SyntaxToken NewKeyword = Token(SyntaxKind.NewKeyword); 66public static readonly SyntaxToken NotKeyword = Token(SyntaxKind.NotKeyword); 67public static readonly SyntaxToken NullKeyword = Token(SyntaxKind.NullKeyword); 68public static readonly SyntaxToken ObjectKeyword = Token(SyntaxKind.ObjectKeyword); 69public static readonly SyntaxToken OpenBraceToken = Token(SyntaxKind.OpenBraceToken); 70public static readonly SyntaxToken OpenBracketToken = Token(SyntaxKind.OpenBracketToken); 71public static readonly SyntaxToken OpenParenToken = Token(SyntaxKind.OpenParenToken); 72public static readonly SyntaxToken OperatorKeyword = Token(SyntaxKind.OperatorKeyword); 73public static readonly SyntaxToken OutKeyword = Token(SyntaxKind.OutKeyword); 74public static readonly SyntaxToken OverrideKeyword = Token(SyntaxKind.OverrideKeyword); 75public static readonly SyntaxToken ParamsKeyword = Token(SyntaxKind.ParamsKeyword); 76public static readonly SyntaxToken PartialKeyword = Token(SyntaxKind.PartialKeyword); 77public static readonly SyntaxToken PlusToken = Token(SyntaxKind.PlusToken); 78public static readonly SyntaxToken PrivateKeyword = Token(SyntaxKind.PrivateKeyword); 79public static readonly SyntaxToken PropertyKeyword = Token(SyntaxKind.PropertyKeyword); 80public static readonly SyntaxToken ProtectedKeyword = Token(SyntaxKind.ProtectedKeyword); 81public static readonly SyntaxToken PublicKeyword = Token(SyntaxKind.PublicKeyword); 82public static readonly SyntaxToken QuestionQuestionEqualsToken = Token(SyntaxKind.QuestionQuestionEqualsToken); 83public static readonly SyntaxToken QuestionToken = Token(SyntaxKind.QuestionToken); 84public static readonly SyntaxToken ReadOnlyKeyword = Token(SyntaxKind.ReadOnlyKeyword); 85public static readonly SyntaxToken RecordKeyword = Token(SyntaxKind.RecordKeyword); 86public static readonly SyntaxToken RefKeyword = Token(SyntaxKind.RefKeyword); 87public static readonly SyntaxToken RequiredKeyword = Token(SyntaxKind.RequiredKeyword); 88public static readonly SyntaxToken RestoreKeyword = Token(SyntaxKind.RestoreKeyword); 89public static readonly SyntaxToken ReturnKeyword = Token(SyntaxKind.ReturnKeyword); 90public static readonly SyntaxToken SByteKeyword = Token(SyntaxKind.SByteKeyword); 91public static readonly SyntaxToken ScopedKeyword = Token(SyntaxKind.ScopedKeyword); 92public static readonly SyntaxToken SealedKeyword = Token(SyntaxKind.SealedKeyword); 93public static readonly SyntaxToken SemicolonToken = Token(SyntaxKind.SemicolonToken); 94public static readonly SyntaxToken ShortKeyword = Token(SyntaxKind.ShortKeyword); 95public static readonly SyntaxToken SlashGreaterThanToken = Token(SyntaxKind.SlashGreaterThanToken); 96public static readonly SyntaxToken StaticKeyword = Token(SyntaxKind.StaticKeyword); 97public static readonly SyntaxToken StringKeyword = Token(SyntaxKind.StringKeyword); 98public static readonly SyntaxToken StructKeyword = Token(SyntaxKind.StructKeyword); 99public static readonly SyntaxToken SwitchKeyword = Token(SyntaxKind.SwitchKeyword); 100public static readonly SyntaxToken ThisKeyword = Token(SyntaxKind.ThisKeyword); 101public static readonly SyntaxToken TildeToken = Token(SyntaxKind.TildeToken); 102public static readonly SyntaxToken UIntKeyword = Token(SyntaxKind.UIntKeyword); 103public static readonly SyntaxToken ULongKeyword = Token(SyntaxKind.ULongKeyword); 104public static readonly SyntaxToken UnmanagedKeyword = Token(SyntaxKind.UnmanagedKeyword); 105public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.UnsafeKeyword); 106public static readonly SyntaxToken UShortKeyword = Token(SyntaxKind.UShortKeyword); 107public static readonly SyntaxToken UsingKeyword = Token(SyntaxKind.UsingKeyword); 108public static readonly SyntaxToken VirtualKeyword = Token(SyntaxKind.VirtualKeyword); 109public static readonly SyntaxToken VoidKeyword = Token(SyntaxKind.VoidKeyword); 110public static readonly SyntaxToken VolatileKeyword = Token(SyntaxKind.VolatileKeyword); 111public static readonly SyntaxToken WhereKeyword = Token(SyntaxKind.WhereKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (19)
157private static readonly ImmutableArray<SyntaxKind> s_preferredModifierOrderDefault = 159SyntaxKind.PublicKeyword, 160SyntaxKind.PrivateKeyword, 161SyntaxKind.ProtectedKeyword, 162SyntaxKind.InternalKeyword, 163SyntaxKind.FileKeyword, 164SyntaxKind.StaticKeyword, 165SyntaxKind.ExternKeyword, 166SyntaxKind.NewKeyword, 167SyntaxKind.VirtualKeyword, 168SyntaxKind.AbstractKeyword, 170SyntaxKind.ClosedKeyword, 172SyntaxKind.SealedKeyword, 173SyntaxKind.OverrideKeyword, 174SyntaxKind.ReadOnlyKeyword, 175SyntaxKind.UnsafeKeyword, 176SyntaxKind.RequiredKeyword, 177SyntaxKind.VolatileKeyword, 178SyntaxKind.AsyncKeyword,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (7)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 79if (initializerExpression.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ArrayCreationExpression && 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 87if (initializerExpression.Kind() is SyntaxKind.CastExpression or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (18)
35if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 38if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 63case SyntaxKind.CharacterLiteralToken: 66case SyntaxKind.StringLiteralToken: 71case SyntaxKind.Utf8StringLiteralToken: 76case SyntaxKind.SingleLineRawStringLiteralToken: 77case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 80case SyntaxKind.MultiLineRawStringLiteralToken: 81case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 86case SyntaxKind.InterpolatedStringTextToken: 97SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 98SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 100SyntaxKind.InterpolatedMultiLineRawStringStartToken 138if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 144if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (5)
27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 81if (argument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 87if (argument.RefOrOutKeyword.Kind() == SyntaxKind.RefKeyword &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\AssignmentExpressionSyntaxExtensions.cs (4)
16return assignment.Kind() == SyntaxKind.SimpleAssignmentExpression && 17assignment.OperatorToken.Kind() == SyntaxKind.EqualsToken && 18(left.Kind() == SyntaxKind.TupleExpression || left.Kind() == SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (15)
27Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.IfDirectiveTrivia), nameof(IfDirectiveTriviaSyntax)), 29Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElifDirectiveTrivia), nameof(ElifDirectiveTriviaSyntax))), 30Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElseDirectiveTrivia), nameof(ElseDirectiveTriviaSyntax)), 31Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.EndIfDirectiveTrivia), nameof(EndIfDirectiveTriviaSyntax))); 78if (leadingDirectives.Any(t => t.Kind() == SyntaxKind.EndIfDirectiveTrivia)) 113if (nextTrivia.Kind() == SyntaxKind.DisabledTextTrivia) 137SyntaxKind declarationKind, 157if (parent.Kind() == SyntaxKind.GetAccessorDeclaration) 175private static bool IsSupportedInCSharp6(SyntaxKind declarationKind) 179case SyntaxKind.ConstructorDeclaration: 180case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.AddAccessorDeclaration: 182case SyntaxKind.RemoveAccessorDeclaration: 183case SyntaxKind.GetAccessorDeclaration: 184case SyntaxKind.SetAccessorDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression); 69if (equalsValueClause.IsParentKind(SyntaxKind.VariableDeclarator) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DirectiveSyntaxExtensions.cs (6)
63=> directive?.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia; 67is SyntaxKind.IfDirectiveTrivia 68or SyntaxKind.ElifDirectiveTrivia 69or SyntaxKind.ElseDirectiveTrivia 70or SyntaxKind.EndIfDirectiveTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (138)
38while (expression is PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixExpression) 48=> expression?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == expression; 84return firstToken.Kind() != SyntaxKind.None 85&& firstToken.GetPreviousToken().Kind() == SyntaxKind.CloseParenToken; 98=> (expression?.Parent) is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && 109=> name.IsParentKind(SyntaxKind.ExplicitInterfaceSpecifier); 130if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 187if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 197=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 209while (expression?.Parent is ParenthesizedExpressionSyntax or PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression)) 213ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 224=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 275if (!expr.IsParentKind(SyntaxKind.Argument)) 290case SyntaxKind.Argument: 291if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 298case SyntaxKind.SimpleAssignmentExpression: 305case SyntaxKind.ForEachVariableStatement: 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 400return nameEquals.IsParentKind(SyntaxKind.AttributeArgument); 409case SyntaxKind.PostIncrementExpression: 410case SyntaxKind.PreIncrementExpression: 411case SyntaxKind.PostDecrementExpression: 412case SyntaxKind.PreDecrementExpression: 428name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 476is SyntaxKind.BaseExpression 477or SyntaxKind.CollectionInitializerExpression 478or SyntaxKind.ObjectInitializerExpression 479or SyntaxKind.ComplexElementInitializerExpression) 485if (expression is LiteralExpressionSyntax && !expression.IsParentKind(SyntaxKind.UnaryMinusExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 517return expression is { Parent.RawKind: not (int)SyntaxKind.ConditionalAccessExpression }; 525case SyntaxKind.InvocationExpression: 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 552case SyntaxKind.ConditionalAccessExpression: 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression); 557case SyntaxKind.IsExpression: 558case SyntaxKind.AsExpression: 562case SyntaxKind.EqualsValueClause: 563case SyntaxKind.ExpressionStatement: 564case SyntaxKind.ArrayInitializerExpression: 565case SyntaxKind.CollectionInitializerExpression: 566case SyntaxKind.Argument: 567case SyntaxKind.AttributeArgument: 568case SyntaxKind.AnonymousObjectMemberDeclarator: 569case SyntaxKind.ArrowExpressionClause: 570case SyntaxKind.AwaitExpression: 571case SyntaxKind.ReturnStatement: 572case SyntaxKind.YieldReturnStatement: 573case SyntaxKind.ParenthesizedLambdaExpression: 574case SyntaxKind.SimpleLambdaExpression: 575case SyntaxKind.ParenthesizedExpression: 576case SyntaxKind.ArrayRankSpecifier: 577case SyntaxKind.ConditionalExpression: 578case SyntaxKind.IfStatement: 579case SyntaxKind.CatchFilterClause: 580case SyntaxKind.WhileStatement: 581case SyntaxKind.DoStatement: 582case SyntaxKind.ThrowStatement: 583case SyntaxKind.SwitchStatement: 584case SyntaxKind.InterpolatedStringExpression: 585case SyntaxKind.ComplexElementInitializerExpression: 586case SyntaxKind.Interpolation: 587case SyntaxKind.RefExpression: 588case SyntaxKind.LockStatement: 589case SyntaxKind.ElementAccessExpression: 590case SyntaxKind.SwitchExpressionArm: 591case SyntaxKind.WhenClause: 598if (!(expression is LiteralExpressionSyntax && expression.IsParentKind(SyntaxKind.UnaryMinusExpression))) 639if ((expression.IsParentKind(SyntaxKind.NameEquals) && expression.Parent.IsParentKind(SyntaxKind.AttributeArgument)) || 655identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.NameOfKeyword); 697case SyntaxKind.SimpleMemberAccessExpression: 698case SyntaxKind.ConditionalAccessExpression: 699case SyntaxKind.InvocationExpression: 700case SyntaxKind.ElementAccessExpression: 701case SyntaxKind.PostIncrementExpression: 702case SyntaxKind.PostDecrementExpression: 703case SyntaxKind.ObjectCreationExpression: 704case SyntaxKind.ImplicitObjectCreationExpression: 705case SyntaxKind.TypeOfExpression: 706case SyntaxKind.DefaultExpression: 707case SyntaxKind.CheckedExpression: 708case SyntaxKind.UncheckedExpression: 709case SyntaxKind.AnonymousMethodExpression: 710case SyntaxKind.SuppressNullableWarningExpression: 712case SyntaxKind.SizeOfExpression: 713case SyntaxKind.PointerMemberAccessExpression: 719case SyntaxKind.UnaryPlusExpression: 720case SyntaxKind.UnaryMinusExpression: 721case SyntaxKind.LogicalNotExpression: 722case SyntaxKind.BitwiseNotExpression: 723case SyntaxKind.PreIncrementExpression: 724case SyntaxKind.PreDecrementExpression: 725case SyntaxKind.CastExpression: 726case SyntaxKind.AwaitExpression: 728case SyntaxKind.PointerIndirectionExpression: 729case SyntaxKind.AddressOfExpression: 736case SyntaxKind.RangeExpression: 742case SyntaxKind.MultiplyExpression: 743case SyntaxKind.DivideExpression: 744case SyntaxKind.ModuloExpression: 750case SyntaxKind.AddExpression: 751case SyntaxKind.SubtractExpression: 757case SyntaxKind.LeftShiftExpression: 758case SyntaxKind.RightShiftExpression: 764case SyntaxKind.LessThanExpression: 765case SyntaxKind.GreaterThanExpression: 766case SyntaxKind.LessThanOrEqualExpression: 767case SyntaxKind.GreaterThanOrEqualExpression: 768case SyntaxKind.IsExpression: 769case SyntaxKind.AsExpression: 770case SyntaxKind.IsPatternExpression: 776case SyntaxKind.EqualsExpression: 777case SyntaxKind.NotEqualsExpression: 783case SyntaxKind.BitwiseAndExpression: 789case SyntaxKind.ExclusiveOrExpression: 795case SyntaxKind.BitwiseOrExpression: 801case SyntaxKind.LogicalAndExpression: 807case SyntaxKind.LogicalOrExpression: 813case SyntaxKind.CoalesceExpression: 819case SyntaxKind.ConditionalExpression: 825case SyntaxKind.SimpleAssignmentExpression: 826case SyntaxKind.MultiplyAssignmentExpression: 827case SyntaxKind.DivideAssignmentExpression: 828case SyntaxKind.ModuloAssignmentExpression: 829case SyntaxKind.AddAssignmentExpression: 830case SyntaxKind.SubtractAssignmentExpression: 831case SyntaxKind.LeftShiftAssignmentExpression: 832case SyntaxKind.RightShiftAssignmentExpression: 833case SyntaxKind.AndAssignmentExpression: 834case SyntaxKind.ExclusiveOrAssignmentExpression: 835case SyntaxKind.OrAssignmentExpression: 836case SyntaxKind.SimpleLambdaExpression: 837case SyntaxKind.ParenthesizedLambdaExpression: 843case SyntaxKind.SwitchExpression: 1091return binaryExpression.Kind() == SyntaxKind.CoalesceExpression && binaryExpression.Right == expression && HasType(binaryExpression.Left, out var leftType) ? leftType : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (50)
32case SyntaxKind.EnumDeclaration: 34case SyntaxKind.ClassDeclaration: 36case SyntaxKind.ExtensionBlockDeclaration: 37case SyntaxKind.UnionDeclaration: 39case SyntaxKind.InterfaceDeclaration: 40case SyntaxKind.RecordDeclaration: 41case SyntaxKind.RecordStructDeclaration: 42case SyntaxKind.StructDeclaration: 44case SyntaxKind.DelegateDeclaration: 46case SyntaxKind.FieldDeclaration: 48case SyntaxKind.EventFieldDeclaration: 50case SyntaxKind.PropertyDeclaration: 52case SyntaxKind.EventDeclaration: 54case SyntaxKind.MethodDeclaration: 56case SyntaxKind.ConstructorDeclaration: 58case SyntaxKind.DestructorDeclaration: 60case SyntaxKind.IndexerDeclaration: 62case SyntaxKind.OperatorDeclaration: 77case SyntaxKind.ClassDeclaration: 79case SyntaxKind.ExtensionBlockDeclaration: 80case SyntaxKind.UnionDeclaration: 82case SyntaxKind.InterfaceDeclaration: 83case SyntaxKind.RecordDeclaration: 84case SyntaxKind.RecordStructDeclaration: 85case SyntaxKind.StructDeclaration: 87case SyntaxKind.DelegateDeclaration: 89case SyntaxKind.MethodDeclaration: 105case SyntaxKind.ClassDeclaration: 107case SyntaxKind.ExtensionBlockDeclaration: 108case SyntaxKind.UnionDeclaration: 110case SyntaxKind.InterfaceDeclaration: 111case SyntaxKind.RecordDeclaration: 112case SyntaxKind.RecordStructDeclaration: 113case SyntaxKind.StructDeclaration: 115case SyntaxKind.DelegateDeclaration: 117case SyntaxKind.MethodDeclaration: 135case SyntaxKind.DelegateDeclaration: 137case SyntaxKind.MethodDeclaration: 139case SyntaxKind.ConstructorDeclaration: 141case SyntaxKind.IndexerDeclaration: 143case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.DelegateDeclaration: 161case SyntaxKind.MethodDeclaration: 163case SyntaxKind.OperatorDeclaration: 165case SyntaxKind.PropertyDeclaration: 167case SyntaxKind.IndexerDeclaration: 169case SyntaxKind.EventDeclaration: 171case SyntaxKind.EventFieldDeclaration: 173case SyntaxKind.FieldDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.DeclarationFinder.cs (1)
32if (syntaxToken.Kind() == SyntaxKind.IdentifierToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (75)
38var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 57if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 58parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 84if (expression.Kind() is SyntaxKind.GreaterThanExpression or SyntaxKind.LessThanExpression && 87var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 93if (expression.IsKind(SyntaxKind.ThrowExpression)) 97if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 101if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 105if (nodeParent.Kind() is SyntaxKind.CheckedExpression or SyntaxKind.UncheckedExpression) 109if (expression.IsKind(SyntaxKind.TupleExpression)) 117if (tokenAfterParen.Kind() == SyntaxKind.OpenBracketToken) 170(nodeParent is YieldStatementSyntax(SyntaxKind.YieldReturnStatement) yieldStatement && yieldStatement.Expression == node) || 195if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 205if (nodeParent.IsKind(SyntaxKind.Interpolation)) 210if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 257if (expression.IsKind(SyntaxKind.ThisExpression)) 271if (expression.IsKind(SyntaxKind.ThrowExpression) && 272nodeParent is BinaryExpressionSyntax(SyntaxKind.CoalesceExpression) binary && 279if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 283if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 284nodeParent.IsParentKind(SyntaxKind.CasePatternSwitchLabel)) 290if (nodeParent.IsKind(SyntaxKind.WhenClause)) 318if (parentExpression.IsKind(SyntaxKind.CastExpression) && 319expression.Kind() is SyntaxKind.PreIncrementExpression or SyntaxKind.PreDecrementExpression) 326if (expression.IsKind(SyntaxKind.ConditionalExpression) && 337if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 389if (ancestor.IsKind(SyntaxKind.ParenthesizedExpression)) 392if (ancestor.IsKind(SyntaxKind.Interpolation, out interpolation)) 414if (!childNode.IsKind(SyntaxKind.ParenthesizedExpression)) 419if (nodeOrToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.ColonColonToken) 488if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 510private static bool IsAssociative(SyntaxKind kind) 514case SyntaxKind.AddExpression: 515case SyntaxKind.MultiplyExpression: 516case SyntaxKind.BitwiseOrExpression: 517case SyntaxKind.ExclusiveOrExpression: 518case SyntaxKind.LogicalOrExpression: 519case SyntaxKind.BitwiseAndExpression: 520case SyntaxKind.LogicalAndExpression: 551SyntaxKind.PredefinedType or 552SyntaxKind.ArrayType or 553SyntaxKind.PointerType or 554SyntaxKind.NullableType) 567SyntaxKind.UnaryMinusExpression or 568SyntaxKind.UnaryPlusExpression or 569SyntaxKind.PointerIndirectionExpression or 570SyntaxKind.AddressOfExpression) 581if (name.IsKind(SyntaxKind.AliasQualifiedName)) 607binaryExpression.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.GreaterThanExpression && 608(binaryExpression.IsParentKind(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax)) 610if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 623else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 626binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 638else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 645else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 681previousExpression is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) lessThanExpression) 687|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 716nextExpression is not BinaryExpressionSyntax(SyntaxKind.GreaterThanExpression) greaterThanExpression) 722&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression; 726=> expression.Kind() is SyntaxKind.IdentifierName or SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression; 818if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 821if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (31)
63case SyntaxKind.SimpleMemberAccessExpression: 64case SyntaxKind.PointerMemberAccessExpression: 70case SyntaxKind.QualifiedName: 76case SyntaxKind.AliasQualifiedName: 82case SyntaxKind.GenericName: 88case SyntaxKind.IdentifierName: 153case SyntaxKind.CommaToken: 154case SyntaxKind.DelegateKeyword: 225variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 232if (type.IsParentKind(SyntaxKind.ObjectCreationExpression) && 233type.Parent.IsParentKind(SyntaxKind.EqualsValueClause) && 234type.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclarator) && 235type.Parent.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 236variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 252is SyntaxKind.DelegateDeclaration 253or SyntaxKind.MethodDeclaration 254or SyntaxKind.PropertyDeclaration 255or SyntaxKind.EventDeclaration 256or SyntaxKind.IndexerDeclaration 257or SyntaxKind.OperatorDeclaration) 273if (type.IsParentKind(SyntaxKind.Parameter) && type.Parent.IsParentKind(SyntaxKind.ParameterList)) 276is SyntaxKind.DelegateDeclaration 277or SyntaxKind.MethodDeclaration 278or SyntaxKind.IndexerDeclaration 279or SyntaxKind.OperatorDeclaration) 285if (type.Parent.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration)) 296if (type.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 297variableDeclaration.IsParentKind(SyntaxKind.EventFieldDeclaration)) 307if (type.IsParentKind(SyntaxKind.TypeConstraint)) 447if (SyntaxFacts.GetContextualKeywordKind(parameter.Name) is not SyntaxKind.UnderscoreToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SymbolDisplayPartExtensions.cs (1)
21if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (29)
14/// Determine if the given <see cref="SyntaxKind"/> array contains the given kind. 22public static bool Contains(this SyntaxKind[] kinds, SyntaxKind kind) 24foreach (var k in kinds) 35public static SyntaxKind MapCompoundAssignmentKindToBinaryExpressionKind(this SyntaxKind syntaxKind) 39case SyntaxKind.AddAssignmentExpression: 40return SyntaxKind.AddExpression; 42case SyntaxKind.SubtractAssignmentExpression: 43return SyntaxKind.SubtractExpression; 45case SyntaxKind.MultiplyAssignmentExpression: 46return SyntaxKind.MultiplyExpression; 48case SyntaxKind.DivideAssignmentExpression: 49return SyntaxKind.DivideExpression; 51case SyntaxKind.ModuloAssignmentExpression: 52return SyntaxKind.ModuloExpression; 54case SyntaxKind.AndAssignmentExpression: 55return SyntaxKind.BitwiseAndExpression; 57case SyntaxKind.ExclusiveOrAssignmentExpression: 58return SyntaxKind.ExclusiveOrExpression; 60case SyntaxKind.OrAssignmentExpression: 61return SyntaxKind.BitwiseOrExpression; 63case SyntaxKind.LeftShiftAssignmentExpression: 64return SyntaxKind.LeftShiftExpression; 66case SyntaxKind.RightShiftAssignmentExpression: 67return SyntaxKind.RightShiftExpression; 69case SyntaxKind.CoalesceAssignmentExpression: 70return SyntaxKind.CoalesceExpression; 74return SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (57)
28public static void Deconstruct(this SyntaxNode node, out SyntaxKind kind) 31public static bool IsKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 44public static bool IsParentKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 47public static bool IsParentKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 75if (prevToken.Kind() == SyntaxKind.None) 93is SyntaxKind.ArgumentList 94or SyntaxKind.AttributeArgumentList 95or SyntaxKind.BracketedArgumentList 96or SyntaxKind.TypeArgumentList; 186if ((current?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == current) || 196SyntaxKind.InvocationExpression or 197SyntaxKind.ElementAccessExpression or 198SyntaxKind.SimpleMemberAccessExpression or 199SyntaxKind.MemberBindingExpression or 200SyntaxKind.ElementBindingExpression or 202SyntaxKind.SuppressNullableWarningExpression) && 285=> node is AssignmentExpressionSyntax(kind: not SyntaxKind.SimpleAssignmentExpression); 288=> node?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment && 332m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword)); 345case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 348case AnonymousFunctionExpressionSyntax anonymousFunction when anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 352return current.GetModifiers().Any(SyntaxKind.StaticKeyword); 355return property.Modifiers.Any(SyntaxKind.StaticKeyword) || 360return !current.Parent.IsKind(SyntaxKind.CompilationUnit); 399case SyntaxKind.DoStatement: 400case SyntaxKind.WhileStatement: 401case SyntaxKind.SwitchStatement: 402case SyntaxKind.ForStatement: 403case SyntaxKind.ForEachStatement: 404case SyntaxKind.ForEachVariableStatement: 415case SyntaxKind.DoStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.ForStatement: 418case SyntaxKind.ForEachStatement: 419case SyntaxKind.ForEachVariableStatement: 430case SyntaxKind.AnonymousMethodExpression: 431case SyntaxKind.SimpleLambdaExpression: 432case SyntaxKind.ParenthesizedLambdaExpression: 433case SyntaxKind.LocalFunctionStatement: 434case SyntaxKind.MethodDeclaration: 435case SyntaxKind.ConstructorDeclaration: 436case SyntaxKind.DestructorDeclaration: 437case SyntaxKind.GetAccessorDeclaration: 438case SyntaxKind.SetAccessorDeclaration: 439case SyntaxKind.InitAccessorDeclaration: 440case SyntaxKind.OperatorDeclaration: 441case SyntaxKind.ConversionOperatorDeclaration: 442case SyntaxKind.AddAccessorDeclaration: 443case SyntaxKind.RemoveAccessorDeclaration: 454=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 556if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 570else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 898while (finalTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
60if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (88)
20public static void Deconstruct(this SyntaxToken token, out SyntaxKind kind) 39public static bool IsKindOrHasMatchingText(this SyntaxToken token, SyntaxKind kind) 42public static bool HasMatchingText(this SyntaxToken token, SyntaxKind kind) 46=> token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList); 64if (token.Kind() == SyntaxKind.IdentifierToken) 69SyntaxFacts.GetContextualKeywordKind(simpleNameText) != SyntaxKind.None; 75public static bool IsPotentialModifier(this SyntaxToken token, out SyntaxKind modifierKind) 77var tokenKind = token.Kind(); 78modifierKind = SyntaxKind.None; 82case SyntaxKind.PublicKeyword: 83case SyntaxKind.InternalKeyword: 84case SyntaxKind.ProtectedKeyword: 85case SyntaxKind.PrivateKeyword: 86case SyntaxKind.SealedKeyword: 87case SyntaxKind.AbstractKeyword: 89case SyntaxKind.ClosedKeyword: 91case SyntaxKind.StaticKeyword: 92case SyntaxKind.VirtualKeyword: 93case SyntaxKind.ExternKeyword: 94case SyntaxKind.NewKeyword: 95case SyntaxKind.OverrideKeyword: 96case SyntaxKind.ReadOnlyKeyword: 97case SyntaxKind.VolatileKeyword: 98case SyntaxKind.UnsafeKeyword: 99case SyntaxKind.AsyncKeyword: 100case SyntaxKind.RefKeyword: 101case SyntaxKind.OutKeyword: 102case SyntaxKind.InKeyword: 103case SyntaxKind.RequiredKeyword: 104case SyntaxKind.FileKeyword: 105case SyntaxKind.PartialKeyword: 108case SyntaxKind.IdentifierToken: 109if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 111modifierKind = SyntaxKind.AsyncKeyword; 113if (token.HasMatchingText(SyntaxKind.FileKeyword)) 115modifierKind = SyntaxKind.FileKeyword; 118if (token.HasMatchingText(SyntaxKind.ClosedKeyword)) 120modifierKind = SyntaxKind.ClosedKeyword; 123if (token.HasMatchingText(SyntaxKind.PartialKeyword)) 125modifierKind = SyntaxKind.PartialKeyword; 127return modifierKind != SyntaxKind.None; 137case SyntaxKind.CharacterLiteralToken: 138case SyntaxKind.FalseKeyword: 139case SyntaxKind.NumericLiteralToken: 140case SyntaxKind.StringLiteralToken: 141case SyntaxKind.TrueKeyword: 171if (previousToken.Kind() == SyntaxKind.None) 204=> token.Kind() == SyntaxKind.StringLiteralToken && !token.IsVerbatimStringLiteral(); 210case SyntaxKind.AssemblyKeyword: 211case SyntaxKind.ModuleKeyword: 212case SyntaxKind.FieldKeyword: 213case SyntaxKind.EventKeyword: 214case SyntaxKind.MethodKeyword: 215case SyntaxKind.ParamKeyword: 216case SyntaxKind.PropertyKeyword: 217case SyntaxKind.ReturnKeyword: 218case SyntaxKind.TypeKeyword: 242if (genericIdentifier.GetNextToken(includeSkipped: true).Kind() == SyntaxKind.LessThanToken) 266Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 270Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken); 279if (next.Kind() == SyntaxKind.None) 287if (token.Kind() == SyntaxKind.GreaterThanToken) 302case SyntaxKind.LessThanLessThanToken: 304goto case SyntaxKind.LessThanToken; 307case SyntaxKind.LessThanToken: 311case SyntaxKind.AsteriskToken: // for int* 312case SyntaxKind.QuestionToken: // for int? 313case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 314case SyntaxKind.ColonColonToken: // for global:: 315case SyntaxKind.CloseBracketToken: 316case SyntaxKind.OpenBracketToken: 317case SyntaxKind.DotToken: 318case SyntaxKind.IdentifierToken: 319case SyntaxKind.CommaToken: 323case SyntaxKind.ClassKeyword: 324case SyntaxKind.StructKeyword: 325case SyntaxKind.InterfaceKeyword: 326case SyntaxKind.DelegateKeyword: 327case SyntaxKind.EnumKeyword: 328case SyntaxKind.PrivateKeyword: 329case SyntaxKind.PublicKeyword: 330case SyntaxKind.InternalKeyword: 331case SyntaxKind.ProtectedKeyword: 332case SyntaxKind.VoidKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (54)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 20public static ISet<SyntaxKind> GetPrecedingModifiers( 30var result = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 31while (token.IsPotentialModifier(out var modifierKind)) 87private static readonly Func<SyntaxKind, bool> s_isDot = k => k is SyntaxKind.DotToken; 88private static readonly Func<SyntaxKind, bool> s_isDotOrArrow = k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken; 89private static readonly Func<SyntaxKind, bool> s_isDotOrArrowOrColonColon = 90k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken or SyntaxKind.ColonColonToken; 95(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken) 111if (token.Kind() == SyntaxKind.None) 122return token.Kind() == SyntaxKind.NumericLiteralToken; 125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken) 202var endsWithNewLine = trivia.GetStructure()!.GetLastToken(includeSkipped: true).Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 263if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 269return trivia.Kind() == SyntaxKind.ConflictMarkerTrivia; 277if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 303if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 324var kind = token.Kind(); 326SyntaxKind.StringLiteralToken or 327SyntaxKind.CharacterLiteralToken or 328SyntaxKind.SingleLineRawStringLiteralToken or 329SyntaxKind.MultiLineRawStringLiteralToken or 330SyntaxKind.Utf8StringLiteralToken or 331SyntaxKind.Utf8SingleLineRawStringLiteralToken or 332SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 339SyntaxKind.Utf8StringLiteralToken or 340SyntaxKind.Utf8SingleLineRawStringLiteralToken or 341SyntaxKind.Utf8MultiLineRawStringLiteralToken) 349if (kind is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 399if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 404SyntaxKind.StringLiteralToken or 405SyntaxKind.SingleLineRawStringLiteralToken or 406SyntaxKind.MultiLineRawStringLiteralToken or 407SyntaxKind.Utf8StringLiteralToken or 408SyntaxKind.Utf8SingleLineRawStringLiteralToken or 409SyntaxKind.Utf8MultiLineRawStringLiteralToken) 421SyntaxKind.InterpolatedStringStartToken or 422SyntaxKind.InterpolatedStringEndToken or 423SyntaxKind.InterpolatedRawStringEndToken or 424SyntaxKind.InterpolatedSingleLineRawStringStartToken or 425SyntaxKind.InterpolatedMultiLineRawStringStartToken) 430if (token.Kind() is SyntaxKind.InterpolatedStringTextToken) 455if (token.Kind() == SyntaxKind.CharacterLiteralToken) 497if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 503if (token.Kind() == SyntaxKind.EndOfFileToken) 553if (token.IsKind(SyntaxKind.HashToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (15)
21public static void Deconstruct(this SyntaxTrivia trivia, out SyntaxKind kind) 25=> trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia; 37=> trivia.Kind() == SyntaxKind.SingleLineCommentTrivia; 40=> trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 43=> trivia.Kind() == SyntaxKind.ShebangDirectiveTrivia; 47if (trivia.Kind() != SyntaxKind.MultiLineCommentTrivia) 58=> trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia; 61=> trivia.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia; 66if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 75else if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 148=> trivia.Kind() == SyntaxKind.EndOfLineTrivia; 151=> trivia.Kind() == SyntaxKind.WhitespaceTrivia; 203if (trivia.IsKind(SyntaxKind.PragmaWarningDirectiveTrivia)) 206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (8)
21.Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 38.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.WhitespaceTrivia)) 43=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia); 52if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 55t.Kind() is SyntaxKind.EndOfLineTrivia or 56SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\DefaultOperationProvider.cs (1)
45var space = currentToken.Kind() == SyntaxKind.EndOfFileToken ? 0 : 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (16)
37=> trivia.RawKind == (int)SyntaxKind.WhitespaceTrivia; 40=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 69if (trivia2.IsKind(SyntaxKind.None)) 90if (trivia2.IsKind(SyntaxKind.BadDirectiveTrivia) && existingWhitespaceBetween.Lines == 0 && !implicitLineBreak) 97var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 99if (trivia2.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia) 110if (previous.IsKind(SyntaxKind.DisabledTextTrivia)) 114else if (previous.IsKind(SyntaxKind.EndIfDirectiveTrivia)) 178if (trivia2.IsKind(SyntaxKind.SkippedTokensTrivia)) 198structuredTrivia.GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia); 210var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0); 220if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 334if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 363if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (9)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);) 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 101if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 105else if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 113else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 117else if (trivia.Kind() is SyntaxKind.DisabledTextTrivia or 118SyntaxKind.PreprocessingMessageTrivia) 122else if (trivia.Kind() == SyntaxKind.ConflictMarkerTrivia) 155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (18)
36Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 37Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia); 46if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 63if (trivia.Kind() == SyntaxKind.RegionDirectiveTrivia || 64trivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia || 78if (trivia.Kind() is SyntaxKind.SkippedTokensTrivia or 79SyntaxKind.PreprocessingMessageTrivia) 125if (trivia.Kind() != SyntaxKind.WhitespaceTrivia) 154if (trivia.Kind() != SyntaxKind.EndOfLineTrivia) 213if (trivia.Kind() is not SyntaxKind.SkippedTokensTrivia and 214not SyntaxKind.PreprocessingMessageTrivia) 224if (trivia.Kind() is not SyntaxKind.RegionDirectiveTrivia and 225not SyntaxKind.EndRegionDirectiveTrivia) 269trivia.Kind() == SyntaxKind.WhitespaceTrivia || 270trivia.Kind() == SyntaxKind.EndOfLineTrivia) 309if (trivia.IsKind(SyntaxKind.DisabledTextTrivia)) 332if (xmlTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (2)
53var formatSpanEnd = commonToken2.Kind() == SyntaxKind.None ? commonToken1.Span.End : commonToken2.Span.Start; 81var firstTriviaInTree = this.Token1.Kind() == SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
119if (trivia.Kind() == SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (95)
57if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 59bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 64if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 66return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 69if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 71return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 78=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.ConversionOperatorDeclaration); 81=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.OperatorDeclaration); 84=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 87=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 91return token.Kind() == SyntaxKind.OpenParenToken && 97return token.Kind() == SyntaxKind.CloseParenToken && 104if (token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList)) 110if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 120=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 123=> token.Kind() == SyntaxKind.CommaToken && (token.Parent.IsAnyArgumentList() || token.Parent?.Kind() is SyntaxKind.ParameterList or SyntaxKind.FunctionPointerParameterList); 126=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 130if (node.Kind() != SyntaxKind.Block) 135return node.Parent?.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression; 140if (node.Kind() != SyntaxKind.Block) 145return node.IsParentKind(SyntaxKind.AnonymousMethodExpression); 151token.Kind() == SyntaxKind.SemicolonToken && 158if (token.Kind() != SyntaxKind.SemicolonToken) 174if (token.Kind() != SyntaxKind.CloseBraceToken) 179return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 184if (token.Kind() != SyntaxKind.CloseBraceToken) 210return token.Kind() == SyntaxKind.CommaToken && 211token.Parent.IsKind(SyntaxKind.EnumDeclaration); 216return token.Kind() == SyntaxKind.CommaToken && 222return token.Kind() == SyntaxKind.CommaToken && 223token.Parent.IsKind(SyntaxKind.VariableDeclaration); 237case SyntaxKind.SizeOfExpression: 241case SyntaxKind.TypeOfExpression: 245case SyntaxKind.CheckedExpression: 246case SyntaxKind.UncheckedExpression: 250case SyntaxKind.DefaultExpression: 254case SyntaxKind.MakeRefExpression: 258case SyntaxKind.RefTypeExpression: 262case SyntaxKind.RefValueExpression: 266case SyntaxKind.ArgumentList: 270case SyntaxKind.AttributeArgumentList: 280return token.IsKind(SyntaxKind.EqualsToken) && 281token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 282token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 308=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 317return token.Kind() == SyntaxKind.DotToken 323if (token.Kind() == SyntaxKind.GreaterThanToken) 324return token.Parent is (kind: SyntaxKind.TypeParameterList or SyntaxKind.TypeArgumentList); 331return token.Kind() == SyntaxKind.CommaToken && 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent is CasePatternSwitchLabelSyntax; 340=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 346=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 350return token.Kind() == SyntaxKind.IdentifierToken && 360return token.Kind() == SyntaxKind.ColonToken && 377=> token.Kind() == SyntaxKind.InKeyword && token.Parent is FromClauseSyntax { Expression: QueryExpressionSyntax }; 381return token.Kind() == SyntaxKind.FromKeyword && 404if (expression.Kind() == SyntaxKind.SimpleAssignmentExpression) 432parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 451parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 466return (token1.Kind() == SyntaxKind.OpenParenToken && token2.Kind() == SyntaxKind.CloseParenToken) || 467(token1.Kind() == SyntaxKind.OpenBracketToken && token2.Kind() == SyntaxKind.CloseBracketToken); 472if (token.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 511if (token.Kind() is not SyntaxKind.PlusToken and not SyntaxKind.MinusToken) 520=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 527return currentToken.Kind() == SyntaxKind.OpenParenToken && currentToken is { Parent: ParenthesizedVariableDesignationSyntax, Parent.Parent: DeclarationExpressionSyntax }; 535return currentToken.IsKind(SyntaxKind.CommaToken) && 536currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 541return currentToken.IsKind(SyntaxKind.CommaToken) && 542currentToken.Parent.IsKind(SyntaxKind.TupleType); 547return currentToken.IsKind(SyntaxKind.CommaToken) && 548currentToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation); 552=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression); 559return !previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && !currentToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (3)
20if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression) 26if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (15)
24if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 37if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 51if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 65if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 80if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 116if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 126if (anchorToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 172else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (62)
115currentToken.IsKind(SyntaxKind.WhereKeyword) && 116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 130firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 142currentToken.IsKind(SyntaxKind.OpenBraceToken) && 143currentToken.Parent.IsParentKind(SyntaxKind.IfStatement)) 176if (previousToken.Kind() != SyntaxKind.SemicolonToken) 179if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 182if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 216if (previousMember.Kind() is SyntaxKind.FieldDeclaration or 217SyntaxKind.EventFieldDeclaration) 293if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 310if (currentToken.Kind() == SyntaxKind.None) 317case SyntaxKind.None: 320case SyntaxKind.OpenBraceToken: 321case SyntaxKind.FinallyKeyword: 324case SyntaxKind.CloseBraceToken: 327case SyntaxKind.CloseParenToken: 329|| currentToken.Kind() == SyntaxKind.OpenBraceToken) ? 1 : 0; 331case SyntaxKind.CloseBracketToken: 337(parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.AssemblyKeyword) || 338parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.ModuleKeyword))) 340if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax)) 355case SyntaxKind.SemicolonToken: 358case SyntaxKind.CommaToken: 361case SyntaxKind.ElseKeyword: 362return currentToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 364case SyntaxKind.ColonToken: 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))) 387case SyntaxKind.OpenBraceToken: 388case SyntaxKind.CloseBraceToken: 389case SyntaxKind.ElseKeyword: 390case SyntaxKind.FinallyKeyword: 393case SyntaxKind.OpenBracketToken: 399parent.Target.Identifier.Kind() is SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword && 416case SyntaxKind.WhereKeyword: 425if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 430nextToken.Kind() is SyntaxKind.CatchKeyword or 431SyntaxKind.FinallyKeyword or 432SyntaxKind.ElseKeyword) 437nextToken.Kind() == SyntaxKind.WhileKeyword && 438nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 442else if (nextToken.Kind() == SyntaxKind.EndOfFileToken) 458else if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 482return trivia.Kind() is SyntaxKind.WhitespaceTrivia 483or SyntaxKind.EndOfLineTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\EndOfFileTokenFormattingRule.cs (2)
17if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 29if (currentToken.Kind() == SyntaxKind.EndOfFileToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (7)
95var firstStatementIsBlock = section.Statements is [(kind: SyntaxKind.Block), ..]; 222if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock() || node.Kind() is SyntaxKind.PropertyPatternClause or SyntaxKind.SwitchExpression) 228if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression)) 262if (node.Parent != null && node.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (79)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 53case SyntaxKind.IfStatement: 54case SyntaxKind.ElseClause: 55case SyntaxKind.WhileStatement: 56case SyntaxKind.DoStatement: 57case SyntaxKind.ForEachStatement: 58case SyntaxKind.ForEachVariableStatement: 59case SyntaxKind.UsingStatement: 60case SyntaxKind.ForStatement: 61case SyntaxKind.TryStatement: 62case SyntaxKind.CatchClause: 63case SyntaxKind.FinallyClause: 64case SyntaxKind.LockStatement: 65case SyntaxKind.CheckedStatement: 66case SyntaxKind.UncheckedStatement: 67case SyntaxKind.SwitchSection: 68case SyntaxKind.FixedStatement: 69case SyntaxKind.UnsafeStatement: 83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken)) 132if (currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression 133or SyntaxKind.CollectionInitializerExpression 134or SyntaxKind.ArrayInitializerExpression 135or SyntaxKind.ImplicitArrayCreationExpression 136or SyntaxKind.WithInitializerExpression) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 153var isFirstTokenOfSwitchArm = currentToken.Parent.IsParentKind(SyntaxKind.RecursivePattern, out RecursivePatternSyntax? recursivePattern) 154&& recursivePattern.IsParentKind(SyntaxKind.SwitchExpressionArm, out SwitchExpressionArmSyntax? switchExpressionArm) 170if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 183if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 192if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 201if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 210if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 211currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 220if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 229if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 249if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 263if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 277if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 291if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 304if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 317if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 330if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 346if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 347currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression or SyntaxKind.WithInitializerExpression or SyntaxKind.PropertyPatternClause) 363if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 364currentToken.Parent.Kind() is SyntaxKind.ArrayInitializerExpression or SyntaxKind.ImplicitArrayCreationExpression) 374if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 418if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 431if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 432currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 445if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 458if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 473if (previousToken.IsKind(SyntaxKind.SemicolonToken) 474&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\QueryExpressionFormattingRule.cs (7)
169case SyntaxKind.FromKeyword: 170case SyntaxKind.WhereKeyword: 171case SyntaxKind.LetKeyword: 172case SyntaxKind.JoinKeyword: 173case SyntaxKind.OrderByKeyword: 174case SyntaxKind.GroupKeyword: 175case SyntaxKind.SelectKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (165)
47var previousKind = previousToken.Kind(); 48var currentKind = currentToken.Kind(); 49var previousParentKind = previousToken.Parent.Kind(); 50var currentParentKind = currentToken.Parent.Kind(); 53if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.IdentifierToken) 65if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.GreaterThanToken) 68if (currentToken.IsOpenParenInParameterListOfParenthesizedLambdaExpression() && previousParentKind == SyntaxKind.TypeArgumentList) 73if (previousParentKind == SyntaxKind.TypeParameterList) 85if ((previousToken.IsKeyword() || previousToken.Kind() is SyntaxKind.QuestionToken or SyntaxKind.AsteriskToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseParenToken or SyntaxKind.GreaterThanToken) 92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 137if (currentKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 142if (previousKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(previousParentKind)) 147if (currentKind == SyntaxKind.CloseParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 153if (currentKind == SyntaxKind.OpenParenToken && 154(previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || 155previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || 156previousKind == SyntaxKind.UsingKeyword || previousKind == SyntaxKind.WhenKeyword || previousKind == SyntaxKind.LockKeyword || 157previousKind == SyntaxKind.FixedKeyword)) 163if ((previousToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && previousKind == SyntaxKind.OpenParenToken) || 164(currentToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && currentKind == SyntaxKind.CloseParenToken)) 170if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || 171(currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) 177if (previousParentKind == SyntaxKind.ForStatement 180if (currentKind == SyntaxKind.SemicolonToken 181&& (previousKind != SyntaxKind.SemicolonToken 191if (previousKind == SyntaxKind.OpenParenToken && IsControlFlowLikeKeywordStatementKind(previousParentKind)) 196if (currentKind == SyntaxKind.CloseParenToken && IsControlFlowLikeKeywordStatementKind(currentParentKind)) 202if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) 208if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression) 211if (previousKind == SyntaxKind.CommaToken) 217if (previousKind is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken)) 224if (currentKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(currentToken) && !previousToken.IsOpenBraceOrCommaOfObjectInitializer()) 230if (((currentKind == SyntaxKind.CloseBracketToken && previousKind == SyntaxKind.OpenBracketToken) 231|| currentKind == SyntaxKind.OmittedArraySizeExpressionToken) 238if (previousKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(previousToken)) 243if (currentKind == SyntaxKind.CloseBracketToken && previousKind != SyntaxKind.OmittedArraySizeExpressionToken && HasFormattableBracketParent(currentToken)) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 252if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 259if (currentToken.IsKind(SyntaxKind.EndOfFileToken)) 292bool IsCommaWithCustomSpacing(SyntaxToken previousToken, SyntaxToken currentToken, SyntaxKind currentKind, SyntaxKind previousKind, bool checkPreviousToken) 295var tokenKind = checkPreviousToken ? previousKind : currentKind; 296var otherKind = checkPreviousToken ? currentKind : previousKind; 298return (token.IsCommaInArgumentOrParameterList() && otherKind != SyntaxKind.OmittedTypeArgumentToken) 304|| (tokenKind == SyntaxKind.CommaToken 305&& otherKind != SyntaxKind.OmittedArraySizeExpressionToken 322if (previousToken.IsSemicolonInForStatement() && currentKind != SyntaxKind.CloseParenToken) 338currentToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern || 339previousToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern) 346if (currentKind == SyntaxKind.IsKeyword || 347currentKind == SyntaxKind.AsKeyword || 348currentKind == SyntaxKind.AndKeyword || 349currentKind == SyntaxKind.OrKeyword || 350previousKind == SyntaxKind.IsKeyword || 351previousKind == SyntaxKind.AsKeyword || 352previousKind == SyntaxKind.AndKeyword || 353previousKind == SyntaxKind.OrKeyword) 371if (previousParentKind == SyntaxKind.FunctionPointerType) 374if (currentKind == SyntaxKind.AsteriskToken && previousKind == SyntaxKind.DelegateKeyword) 380if (previousKind == SyntaxKind.AsteriskToken && currentParentKind == SyntaxKind.FunctionPointerCallingConvention) 384case SyntaxKind.IdentifierToken: 385case SyntaxKind.ManagedKeyword: 386case SyntaxKind.UnmanagedKeyword: 392if (currentParentKind == SyntaxKind.FunctionPointerParameterList && currentKind == SyntaxKind.LessThanToken) 397case SyntaxKind.AsteriskToken: 400case SyntaxKind.ManagedKeyword: 401case SyntaxKind.UnmanagedKeyword: 404case SyntaxKind.CloseBracketToken when previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList: 411if (previousParentKind == SyntaxKind.FunctionPointerCallingConvention && currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && currentKind == SyntaxKind.OpenBracketToken) 417if (currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList) 419if (currentKind == SyntaxKind.IdentifierToken) 423if (previousKind == SyntaxKind.OpenBracketToken) 429else if (previousKind == SyntaxKind.CommaToken) 437if (currentKind == SyntaxKind.CommaToken) 444if (currentKind == SyntaxKind.CloseBracketToken) 452if (previousKind == SyntaxKind.LessThanToken && previousParentKind == SyntaxKind.FunctionPointerParameterList) 459if (currentKind == SyntaxKind.GreaterThanToken && currentParentKind == SyntaxKind.FunctionPointerParameterList) 465if (previousToken.Parent.IsKind(SyntaxKind.NotPattern)) 472if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.SlicePattern) 478if (previousKind is SyntaxKind.InterpolatedStringStartToken or 479SyntaxKind.InterpolatedVerbatimStringStartToken or 480SyntaxKind.InterpolatedSingleLineRawStringStartToken or 481SyntaxKind.InterpolatedMultiLineRawStringStartToken) 487if (currentKind is SyntaxKind.InterpolatedStringEndToken or 488SyntaxKind.InterpolatedRawStringEndToken) 494if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || 495(previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) 501if (previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) 507if (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax interpolation) 518if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is InterpolationAlignmentClauseSyntax) || 519(currentKind == SyntaxKind.CommaToken && currentToken.Parent is InterpolationAlignmentClauseSyntax)) 525if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is InterpolationFormatClauseSyntax) || 526(currentKind == SyntaxKind.ColonToken && currentToken.Parent is InterpolationFormatClauseSyntax)) 538if (previousKind == SyntaxKind.CaretToken && previousParentKind == SyntaxKind.IndexExpression) 544if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.RangeExpression) 555if (currentKind == SyntaxKind.DotDotToken && currentParentKind == SyntaxKind.RangeExpression) 581is SyntaxKind.FieldDeclaration 582or SyntaxKind.EventDeclaration 583or SyntaxKind.EventFieldDeclaration 584or SyntaxKind.LocalDeclarationStatement 585or SyntaxKind.EnumMemberDeclaration) 610=> token.Parent is (kind: SyntaxKind.ArrayRankSpecifier or SyntaxKind.BracketedArgumentList or SyntaxKind.BracketedParameterList or SyntaxKind.ImplicitArrayCreationExpression or SyntaxKind.ListPattern or SyntaxKind.CollectionExpression); 612private static bool IsFunctionLikeKeywordExpressionKind(SyntaxKind syntaxKind) 613=> (syntaxKind is SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression); 615private static bool IsControlFlowLikeKeywordStatementKind(SyntaxKind syntaxKind) 617return syntaxKind is SyntaxKind.IfStatement or SyntaxKind.WhileStatement or SyntaxKind.SwitchStatement or 618SyntaxKind.ForStatement or SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement or 619SyntaxKind.DoStatement or 620SyntaxKind.CatchDeclaration or SyntaxKind.UsingStatement or SyntaxKind.LockStatement or 621SyntaxKind.FixedStatement or SyntaxKind.CatchFilterClause;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\StructuredTriviaFormattingRule.cs (8)
31((previousToken.Kind() == SyntaxKind.HashToken && currentToken.Kind() == SyntaxKind.ColonToken) || 32(previousToken.Kind() == SyntaxKind.ColonToken && currentToken.Kind() == SyntaxKind.StringLiteralToken))) 38if (previousToken.Kind() == SyntaxKind.HashToken && SyntaxFacts.IsPreprocessorKeyword(currentToken.Kind())) 43if (previousToken.Kind() == SyntaxKind.RegionKeyword && currentToken.Kind() == SyntaxKind.EndOfDirectiveToken) 48if (currentToken.Kind() == SyntaxKind.EndOfDirectiveToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (8)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression)) 257if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 314if (!IsFormatDirective(pragmaWarningDirectiveTrivia, SyntaxKind.DisableKeyword)) 321var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword)); 326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 332private static bool IsFormatDirective(DirectiveTriviaSyntax? trivia, SyntaxKind disableOrRestoreKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (101)
52case SyntaxKind.OpenBraceToken: 61case SyntaxKind.CloseBraceToken: 69if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword) 77case SyntaxKind.CloseBraceToken: 83if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 103case SyntaxKind.OpenBraceToken: 144if (previousToken.Kind() == SyntaxKind.ElseKeyword) 146var isElseIfOnSameLine = currentToken.Kind() == SyntaxKind.IfKeyword && FormattingHelpers.AreOnSameLine(previousToken, currentToken); 165if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 170if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 182if (previousToken.Kind() == SyntaxKind.SemicolonToken && 183(currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword)) 189if (previousToken.Kind() == SyntaxKind.SemicolonToken) 194if (currentToken.Kind() == SyntaxKind.SemicolonToken && 203if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 301if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) 315if (currentToken.Kind() == SyntaxKind.SemicolonToken) 318if (previousToken.Kind() == SyntaxKind.SemicolonToken) 322if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 330if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 331previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken || 332currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 333currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken) 338if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 339previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 340previousToken.Parent.IsParentKind(SyntaxKind.Parameter)) 342if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 358if (currentToken.Kind() == SyntaxKind.OpenParenToken && 359previousToken.Kind() == SyntaxKind.ThisKeyword) 364if (previousToken.Kind() == SyntaxKind.NewKeyword) 369SyntaxKind.ConstructorConstraint or 370SyntaxKind.ImplicitObjectCreationExpression or 371SyntaxKind.ImplicitArrayCreationExpression) ? 0 : 1; 376if (currentToken.Kind() == SyntaxKind.OpenParenToken) 379is SyntaxKind.IdentifierToken 380or SyntaxKind.DefaultKeyword 381or SyntaxKind.BaseKeyword 382or SyntaxKind.ThisKeyword 384or SyntaxKind.ExtensionKeyword 401if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax) 407if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 420case SyntaxKind.CloseParenToken: 421case SyntaxKind.CloseBracketToken: 422case SyntaxKind.CommaToken: 423case SyntaxKind.DotToken: 424case SyntaxKind.MinusGreaterThanToken: 429if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 430currentToken.Parent?.Kind() is not SyntaxKind.CollectionExpression and not SyntaxKind.AttributeList && 448if (currentToken.IsKind(SyntaxKind.ColonToken) && 450SyntaxKind.AttributeTargetSpecifier or 451SyntaxKind.CaseSwitchLabel or 452SyntaxKind.CasePatternSwitchLabel or 453SyntaxKind.DefaultSwitchLabel or 454SyntaxKind.ExpressionColon or 458SyntaxKind.LabeledStatement or 459SyntaxKind.NameColon or 460SyntaxKind.SwitchExpressionArm)) 467previousToken.Kind() == SyntaxKind.CloseParenToken) 473if (previousToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList or SyntaxKind.FunctionPointerType)) 476if (previousToken.Kind() == SyntaxKind.LessThanToken) 482if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken) 489if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) && 490currentToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList)) 496if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) && 503if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) && 510if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 516if (currentToken.Kind() == SyntaxKind.QuestionToken && 517currentToken.Parent is (kind: SyntaxKind.NullableType or SyntaxKind.ClassConstraint)) 523if (currentToken.IsKind(SyntaxKind.QuestionToken) && 524previousToken.Parent?.IsParentKind(SyntaxKind.ArrayType) == true) 530if (currentToken.Kind() == SyntaxKind.ExclamationToken && 531currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 537if (currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) 543if (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax) 551case SyntaxKind.OpenParenToken: 552case SyntaxKind.OpenBracketToken: 553case SyntaxKind.DotToken: 554case SyntaxKind.MinusGreaterThanToken: 557case SyntaxKind.CloseParenToken: 558case SyntaxKind.CloseBracketToken: 577if (previousToken.Kind() == SyntaxKind.ExclamationToken 578&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 584if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax or DestructorDeclarationSyntax)) 590if (previousToken.Kind() == SyntaxKind.AmpersandToken && 597if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (9)
70if (embeddedStatement.IsKind(SyntaxKind.Block)) 91if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 99if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 112if (!(node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block)) 121if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None)) 179if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (14)
47Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 48Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 71return endToken.IsKind(SyntaxKind.CloseBraceToken) && 72endToken.Parent.IsKind(SyntaxKind.Block) && 73endToken.Parent.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.DoStatement; 78Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 82if (previousToken.Kind() == SyntaxKind.None) 93if (token.IsKind(SyntaxKind.OpenBraceToken) && 98if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 107if (token.IsKind(SyntaxKind.OpenBraceToken) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (12)
245modifiers.Any(SyntaxKind.PartialKeyword)) 286AssignmentExpressionSyntax _ when token.Kind() == SyntaxKind.EqualsToken => GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(), 287ForEachVariableStatementSyntax _ when token.Kind() == SyntaxKind.InKeyword => GetDeconstructionForEachMethods(semanticModel, node).As<ISymbol>(), 310if (token.Kind() == SyntaxKind.CommaToken) 320if (ordering.AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 324else if (orderByClauseSyntax.Orderings[0].AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 343return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 369if (token.IsKind(SyntaxKind.CommaToken)) 479SyntaxKind.IfDirectiveTrivia or 480SyntaxKind.ElifDirectiveTrivia or 481SyntaxKind.DefineDirectiveTrivia or 482SyntaxKind.UndefDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (53)
24case SyntaxKind.ClassDeclaration: 25case SyntaxKind.RecordDeclaration: 26case SyntaxKind.StructDeclaration: 27case SyntaxKind.RecordStructDeclaration: 28case SyntaxKind.InterfaceDeclaration: 29case SyntaxKind.EnumDeclaration: 30case SyntaxKind.DelegateDeclaration: 31return ignoreDeclarationModifiers || !((MemberDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.FileKeyword); 33case SyntaxKind.FieldDeclaration: 34case SyntaxKind.EventFieldDeclaration: 35case SyntaxKind.GetAccessorDeclaration: 36case SyntaxKind.SetAccessorDeclaration: 37case SyntaxKind.InitAccessorDeclaration: 38case SyntaxKind.AddAccessorDeclaration: 39case SyntaxKind.RemoveAccessorDeclaration: 42case SyntaxKind.VariableDeclaration: 45case SyntaxKind.VariableDeclarator: 48case SyntaxKind.ConstructorDeclaration: 50return ignoreDeclarationModifiers || !((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword); 52case SyntaxKind.PropertyDeclaration: 55case SyntaxKind.IndexerDeclaration: 58case SyntaxKind.OperatorDeclaration: 61case SyntaxKind.ConversionOperatorDeclaration: 64case SyntaxKind.MethodDeclaration: 72if (method.Modifiers.Any(SyntaxKind.PartialKeyword)) 80case SyntaxKind.EventDeclaration: 108(SyntaxKind.PublicKeyword, _) => Accessibility.Public, 110(SyntaxKind.PrivateKeyword, Accessibility.Protected) => Accessibility.ProtectedAndInternal, 111(SyntaxKind.PrivateKeyword, _) => Accessibility.Private, 113(SyntaxKind.InternalKeyword, Accessibility.Protected) => Accessibility.ProtectedOrInternal, 114(SyntaxKind.InternalKeyword, _) => Accessibility.Internal, 116(SyntaxKind.ProtectedKeyword, Accessibility.Private) => Accessibility.ProtectedAndInternal, 117(SyntaxKind.ProtectedKeyword, Accessibility.Internal) => Accessibility.ProtectedOrInternal, 118(SyntaxKind.ProtectedKeyword, _) => Accessibility.Protected, 125SyntaxKind.AbstractKeyword => Modifiers.Abstract, 126SyntaxKind.NewKeyword => Modifiers.New, 127SyntaxKind.OverrideKeyword => Modifiers.Override, 128SyntaxKind.VirtualKeyword => Modifiers.Virtual, 129SyntaxKind.StaticKeyword => Modifiers.Static, 130SyntaxKind.AsyncKeyword => Modifiers.Async, 131SyntaxKind.ConstKeyword => Modifiers.Const, 132SyntaxKind.ReadOnlyKeyword => Modifiers.ReadOnly, 133SyntaxKind.SealedKeyword => Modifiers.Sealed, 134SyntaxKind.UnsafeKeyword => Modifiers.Unsafe, 135SyntaxKind.PartialKeyword => Modifiers.Partial, 136SyntaxKind.RefKeyword => Modifiers.Ref, 137SyntaxKind.VolatileKeyword => Modifiers.Volatile, 138SyntaxKind.ExternKeyword => Modifiers.Extern, 139SyntaxKind.FileKeyword => Modifiers.File, 141SyntaxKind.ClosedKeyword => Modifiers.Closed, 143SyntaxKind.RequiredKeyword => Modifiers.Required, 144SyntaxKind.FixedKeyword => Modifiers.Fixed, 148isDefault |= token.Kind() == SyntaxKind.DefaultKeyword;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (4)
22=> node.IsKind(SyntaxKind.Block); 25=> node is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.CompilationUnit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (4)
22=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (175)
101var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 110var kind = token.Kind(); 149if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword) 154else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken && 201=> node is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList); 222=> node is LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not (int)SyntaxKind.None }; 268=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.ThisConstructorInitializer) constructorInit && 272=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.BaseConstructorInitializer) constructorInit && 282case SyntaxKind.FromKeyword: 283case SyntaxKind.JoinKeyword: 284case SyntaxKind.LetKeyword: 285case SyntaxKind.OrderByKeyword: 286case SyntaxKind.WhereKeyword: 287case SyntaxKind.OnKeyword: 288case SyntaxKind.EqualsKeyword: 289case SyntaxKind.InKeyword: 291case SyntaxKind.ByKeyword: 292case SyntaxKind.GroupKeyword: 293case SyntaxKind.SelectKeyword: 295case SyntaxKind.AscendingKeyword: 296case SyntaxKind.DescendingKeyword: 298case SyntaxKind.IntoKeyword: 299return token.Parent is (kind: SyntaxKind.JoinIntoClause or SyntaxKind.QueryContinuation); 326SyntaxKind.BoolKeyword => PredefinedType.Boolean, 327SyntaxKind.ByteKeyword => PredefinedType.Byte, 328SyntaxKind.SByteKeyword => PredefinedType.SByte, 329SyntaxKind.IntKeyword => PredefinedType.Int32, 330SyntaxKind.UIntKeyword => PredefinedType.UInt32, 331SyntaxKind.ShortKeyword => PredefinedType.Int16, 332SyntaxKind.UShortKeyword => PredefinedType.UInt16, 333SyntaxKind.LongKeyword => PredefinedType.Int64, 334SyntaxKind.ULongKeyword => PredefinedType.UInt64, 335SyntaxKind.FloatKeyword => PredefinedType.Single, 336SyntaxKind.DoubleKeyword => PredefinedType.Double, 337SyntaxKind.DecimalKeyword => PredefinedType.Decimal, 338SyntaxKind.StringKeyword => PredefinedType.String, 339SyntaxKind.CharKeyword => PredefinedType.Char, 340SyntaxKind.ObjectKeyword => PredefinedType.Object, 341SyntaxKind.VoidKeyword => PredefinedType.Void, 342SyntaxKind.IdentifierToken => token.Text switch 365switch ((SyntaxKind)token.RawKind) 367case SyntaxKind.PlusToken: 368case SyntaxKind.PlusEqualsToken: 371case SyntaxKind.MinusToken: 372case SyntaxKind.MinusEqualsToken: 375case SyntaxKind.AmpersandAmpersandToken: // overridden bitwise & can be accessed through && 376case SyntaxKind.AmpersandToken: 377case SyntaxKind.AmpersandEqualsToken: 380case SyntaxKind.BarBarToken: // overridden bitwise | can be accessed through || 381case SyntaxKind.BarToken: 382case SyntaxKind.BarEqualsToken: 385case SyntaxKind.MinusMinusToken: 388case SyntaxKind.PlusPlusToken: 391case SyntaxKind.SlashToken: 392case SyntaxKind.SlashEqualsToken: 395case SyntaxKind.EqualsEqualsToken: 398case SyntaxKind.CaretToken: 399case SyntaxKind.CaretEqualsToken: 402case SyntaxKind.GreaterThanToken: 405case SyntaxKind.GreaterThanEqualsToken: 408case SyntaxKind.ExclamationEqualsToken: 411case SyntaxKind.LessThanLessThanToken: 412case SyntaxKind.LessThanLessThanEqualsToken: 415case SyntaxKind.LessThanToken: 418case SyntaxKind.LessThanEqualsToken: 421case SyntaxKind.AsteriskToken: 422case SyntaxKind.AsteriskEqualsToken: 425case SyntaxKind.PercentToken: 426case SyntaxKind.PercentEqualsToken: 429case SyntaxKind.ExclamationToken: 430case SyntaxKind.TildeToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanEqualsToken: 437case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 438case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 446=> SyntaxFacts.GetText((SyntaxKind)kind); 478case SyntaxKind.NumericLiteralToken: 479case SyntaxKind.CharacterLiteralToken: 480case SyntaxKind.StringLiteralToken: 481case SyntaxKind.Utf8StringLiteralToken: 482case SyntaxKind.SingleLineRawStringLiteralToken: 483case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 484case SyntaxKind.MultiLineRawStringLiteralToken: 485case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 486case SyntaxKind.NullKeyword: 487case SyntaxKind.TrueKeyword: 488case SyntaxKind.FalseKeyword: 489case SyntaxKind.InterpolatedStringStartToken: 490case SyntaxKind.InterpolatedStringEndToken: 491case SyntaxKind.InterpolatedRawStringEndToken: 492case SyntaxKind.InterpolatedVerbatimStringStartToken: 493case SyntaxKind.InterpolatedStringTextToken: 494case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 495case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 503=> token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken; 511case SyntaxKind.DelegateKeyword: 512case SyntaxKind.VoidKeyword: 520if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 523if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken) 525if (token.Parent.IsKind(SyntaxKind.CollectionExpression)) 545=> (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression; 555=> simpleName.IsKind(SyntaxKind.GenericName) || 556simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken; 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 607argument.RefOrOutKeyword.Kind() == SyntaxKind.None && 635=> node.IsKind(SyntaxKind.IdentifierName) && 636node.IsParentKind(SyntaxKind.NameColon) && 637node.Parent.IsParentKind(SyntaxKind.Subpattern); 640=> node.Kind() == SyntaxKind.PropertyPatternClause; 649if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression)) 655else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression)) 663else if (objectInitializer?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 694=> node.IsKind(SyntaxKind.ElementAccessExpression); 724var kind = node.Kind(); 725if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is TMemberDeclarationSyntax)) 816case SyntaxKind.CompilationUnit: 818case SyntaxKind.IdentifierName: 821case SyntaxKind.IncompleteMember: 823case SyntaxKind.NamespaceDeclaration: 824case SyntaxKind.FileScopedNamespaceDeclaration: 826case SyntaxKind.QualifiedName: 840if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration) 865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 1016if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1022if (token.Kind() == SyntaxKind.EndOfFileToken) 1091=> node?.Parent?.Kind() is SyntaxKind.PostIncrementExpression or SyntaxKind.PreIncrementExpression; 1094=> node?.Parent?.Kind() is SyntaxKind.PostDecrementExpression or SyntaxKind.PreDecrementExpression; 1107SyntaxKind.SingleLineRawStringLiteralToken or 1108SyntaxKind.MultiLineRawStringLiteralToken or 1109SyntaxKind.Utf8SingleLineRawStringLiteralToken or 1110SyntaxKind.Utf8MultiLineRawStringLiteralToken; 1113=> token.Kind() == SyntaxKind.NumericLiteralToken; 1139=> trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia; 1145=> node?.Kind() is SyntaxKind.UsingDirective or SyntaxKind.ExternAliasDirective; 1148=> IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword); 1151=> IsGlobalAttribute(node, SyntaxKind.ModuleKeyword); 1153private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget) 1154=> node.IsKind(SyntaxKind.Attribute) && 1183case SyntaxKind.VariableDeclarator: 1184return node.Parent?.Parent?.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration; 1186case SyntaxKind.FieldDeclaration: 1187case SyntaxKind.MethodDeclaration: 1188case SyntaxKind.PropertyDeclaration: 1189case SyntaxKind.GetAccessorDeclaration: 1190case SyntaxKind.SetAccessorDeclaration: 1191case SyntaxKind.EventDeclaration: 1192case SyntaxKind.EventFieldDeclaration: 1193case SyntaxKind.AddAccessorDeclaration: 1194case SyntaxKind.RemoveAccessorDeclaration: 1195case SyntaxKind.IndexerDeclaration: 1196case SyntaxKind.OperatorDeclaration: 1197case SyntaxKind.ConversionOperatorDeclaration: 1198case SyntaxKind.ConstructorDeclaration: 1199case SyntaxKind.DestructorDeclaration: 1211=> node is ExpressionStatementSyntax { Expression: (kind: SyntaxKind.SimpleAssignmentExpression) }; 1332if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member) 1440=> node is InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedVerbatimStringStartToken) }; 1482=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: IdentifierNameSyntax }; 1485=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: ImplicitElementAccessSyntax }; 1488=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression); 1491=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression); 1687=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) initExpr ? initExpr.Expressions : default; 1690=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression) initExpr ? initExpr.Expressions : default;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (151)
19=> (TSyntaxKind)(object)(SyntaxKind)kind; 23=> (int)(SyntaxKind)(object)kind; 25public int ConflictMarkerTrivia => (int)SyntaxKind.ConflictMarkerTrivia; 26public int DisabledTextTrivia => (int)SyntaxKind.DisabledTextTrivia; 27public int EndOfLineTrivia => (int)SyntaxKind.EndOfLineTrivia; 28public int SkippedTokensTrivia => (int)SyntaxKind.SkippedTokensTrivia; 29public int WhitespaceTrivia => (int)SyntaxKind.WhitespaceTrivia; 30public int SingleLineCommentTrivia => (int)SyntaxKind.SingleLineCommentTrivia; 31public int? MultiLineCommentTrivia => (int)SyntaxKind.MultiLineCommentTrivia; 32public int SingleLineDocCommentTrivia => (int)SyntaxKind.SingleLineDocumentationCommentTrivia; 33public int? MultiLineDocCommentTrivia => (int)SyntaxKind.MultiLineDocumentationCommentTrivia; 35public int IfDirectiveTrivia => (int)SyntaxKind.IfDirectiveTrivia; 36public int ElifDirectiveTrivia => (int)SyntaxKind.ElifDirectiveTrivia; 37public int ElseDirectiveTrivia => (int)SyntaxKind.ElseDirectiveTrivia; 38public int EndIfDirectiveTrivia => (int)SyntaxKind.EndIfDirectiveTrivia; 39public int RegionDirectiveTrivia => (int)SyntaxKind.RegionDirectiveTrivia; 40public int EndRegionDirectiveTrivia => (int)SyntaxKind.EndRegionDirectiveTrivia; 41public int? ShebangDirectiveTrivia => (int)SyntaxKind.ShebangDirectiveTrivia; 42public int DefineDirectiveTrivia => (int)SyntaxKind.DefineDirectiveTrivia; 43public int? UndefDirectiveTrivia => (int)SyntaxKind.UndefDirectiveTrivia; 45public int CloseBraceToken => (int)SyntaxKind.CloseBraceToken; 46public int? CloseBracketToken => (int)SyntaxKind.CloseBracketToken; 47public int CloseParenToken => (int)SyntaxKind.CloseParenToken; 48public int CommaToken => (int)SyntaxKind.CommaToken; 49public int ColonToken => (int)SyntaxKind.ColonToken; 50public int CharacterLiteralToken => (int)SyntaxKind.CharacterLiteralToken; 51public int DotToken => (int)SyntaxKind.DotToken; 52public int GreaterThanToken => (int)SyntaxKind.GreaterThanToken; 53public int InterpolatedStringTextToken => (int)SyntaxKind.InterpolatedStringTextToken; 54public int LessThanToken => (int)SyntaxKind.LessThanToken; 55public int LessThanSlashToken => (int)SyntaxKind.LessThanSlashToken; 56public int OpenBraceToken => (int)SyntaxKind.OpenBraceToken; 57public int? OpenBracketToken => (int)SyntaxKind.OpenBracketToken; 58public int OpenParenToken => (int)SyntaxKind.OpenParenToken; 59public int QuestionToken => (int)SyntaxKind.QuestionToken; 60public int StringLiteralToken => (int)SyntaxKind.StringLiteralToken; 61public int? SingleLineRawStringLiteralToken => (int)SyntaxKind.SingleLineRawStringLiteralToken; 62public int? MultiLineRawStringLiteralToken => (int)SyntaxKind.MultiLineRawStringLiteralToken; 63public int? Utf8StringLiteralToken => (int)SyntaxKind.Utf8StringLiteralToken; 64public int? Utf8SingleLineRawStringLiteralToken => (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken; 65public int? Utf8MultiLineRawStringLiteralToken => (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 67public int XmlCrefAttribute => (int)SyntaxKind.XmlCrefAttribute; 68public int XmlTextLiteralToken => (int)SyntaxKind.XmlTextLiteralToken; 70public int DelegateKeyword => (int)SyntaxKind.DelegateKeyword; 71public int FalseKeyword => (int)SyntaxKind.FalseKeyword; 72public int IfKeyword => (int)SyntaxKind.IfKeyword; 73public int NewKeyword => (int)SyntaxKind.NewKeyword; 74public int PartialKeyword => (int)SyntaxKind.PartialKeyword; 75public int TrueKeyword => (int)SyntaxKind.TrueKeyword; 76public int UsingKeyword => (int)SyntaxKind.UsingKeyword; 78public int? AliasQualifiedName => (int)SyntaxKind.AliasQualifiedName; 79public int GenericName => (int)SyntaxKind.GenericName; 80public int IdentifierName => (int)SyntaxKind.IdentifierName; 81public int QualifiedName => (int)SyntaxKind.QualifiedName; 83public int TupleType => (int)SyntaxKind.TupleType; 85public int CharacterLiteralExpression => (int)SyntaxKind.CharacterLiteralExpression; 86public int DefaultLiteralExpression => (int)SyntaxKind.DefaultLiteralExpression; 87public int FalseLiteralExpression => (int)SyntaxKind.FalseLiteralExpression; 88public int NullLiteralExpression => (int)SyntaxKind.NullLiteralExpression; 89public int NumericLiteralExpression => (int)SyntaxKind.NumericLiteralExpression; 90public int StringLiteralExpression => (int)SyntaxKind.StringLiteralExpression; 91public int TrueLiteralExpression => (int)SyntaxKind.TrueLiteralExpression; 93public int AddExpression => (int)SyntaxKind.AddExpression; 94public int AddressOfExpression => (int)SyntaxKind.AddressOfExpression; 95public int AnonymousObjectCreationExpression => (int)SyntaxKind.AnonymousObjectCreationExpression; 96public int ArrayCreationExpression => (int)SyntaxKind.ArrayCreationExpression; 97public int AwaitExpression => (int)SyntaxKind.AwaitExpression; 98public int BaseExpression => (int)SyntaxKind.BaseExpression; 99public int? CollectionExpression => (int)SyntaxKind.CollectionExpression; 100public int CollectionInitializerExpression => (int)SyntaxKind.CollectionInitializerExpression; 101public int ConditionalAccessExpression => (int)SyntaxKind.ConditionalAccessExpression; 102public int ConditionalExpression => (int)SyntaxKind.ConditionalExpression; 103public int? FieldExpression => (int)SyntaxKind.FieldExpression; 104public int? ImplicitArrayCreationExpression => (int)SyntaxKind.ImplicitArrayCreationExpression; 105public int? ImplicitObjectCreationExpression => (int)SyntaxKind.ImplicitObjectCreationExpression; 106public int? IndexExpression => (int)SyntaxKind.IndexExpression; 107public int InvocationExpression => (int)SyntaxKind.InvocationExpression; 108public int? IsPatternExpression => (int)SyntaxKind.IsPatternExpression; 109public int IsTypeExpression => (int)SyntaxKind.IsExpression; 111public int LogicalAndExpression => (int)SyntaxKind.LogicalAndExpression; 112public int LogicalOrExpression => (int)SyntaxKind.LogicalOrExpression; 113public int LogicalNotExpression => (int)SyntaxKind.LogicalNotExpression; 114public int ObjectCreationExpression => (int)SyntaxKind.ObjectCreationExpression; 115public int ParenthesizedExpression => (int)SyntaxKind.ParenthesizedExpression; 116public int QueryExpression => (int)SyntaxKind.QueryExpression; 117public int? RangeExpression => (int)SyntaxKind.RangeExpression; 118public int? RefExpression => (int)SyntaxKind.RefExpression; 119public int ReferenceEqualsExpression => (int)SyntaxKind.EqualsExpression; 120public int ReferenceNotEqualsExpression => (int)SyntaxKind.NotEqualsExpression; 121public int SimpleAssignmentExpression => (int)SyntaxKind.SimpleAssignmentExpression; 122public int SimpleMemberAccessExpression => (int)SyntaxKind.SimpleMemberAccessExpression; 123public int? SizeOfExpression => (int)SyntaxKind.SizeOfExpression; 124public int? SuppressNullableWarningExpression => (int)SyntaxKind.SuppressNullableWarningExpression; 125public int TernaryConditionalExpression => (int)SyntaxKind.ConditionalExpression; 126public int ThisExpression => (int)SyntaxKind.ThisExpression; 127public int? ThrowExpression => (int)SyntaxKind.ThrowExpression; 128public int TupleExpression => (int)SyntaxKind.TupleExpression; 129public int TypeOfExpression => (int)SyntaxKind.TypeOfExpression; 131public int? AndPattern => (int)SyntaxKind.AndPattern; 132public int? ConstantPattern => (int)SyntaxKind.ConstantPattern; 133public int? DeclarationPattern => (int)SyntaxKind.DeclarationPattern; 134public int? ListPattern => (int)SyntaxKind.ListPattern; 135public int? NotPattern => (int)SyntaxKind.NotPattern; 136public int? OrPattern => (int)SyntaxKind.OrPattern; 137public int? ParenthesizedPattern => (int)SyntaxKind.ParenthesizedPattern; 138public int? RecursivePattern => (int)SyntaxKind.RecursivePattern; 139public int? RelationalPattern => (int)SyntaxKind.RelationalPattern; 140public int? TypePattern => (int)SyntaxKind.TypePattern; 141public int? VarPattern => (int)SyntaxKind.VarPattern; 143public int EndOfFileToken => (int)SyntaxKind.EndOfFileToken; 144public int AwaitKeyword => (int)SyntaxKind.AwaitKeyword; 145public int AsyncKeyword => (int)SyntaxKind.AsyncKeyword; 146public int IdentifierToken => (int)SyntaxKind.IdentifierToken; 147public int GlobalKeyword => (int)SyntaxKind.GlobalKeyword; 148public int IncompleteMember => (int)SyntaxKind.IncompleteMember; 149public int HashToken => (int)SyntaxKind.HashToken; 151public int ExpressionStatement => (int)SyntaxKind.ExpressionStatement; 152public int ForEachStatement => (int)SyntaxKind.ForEachStatement; 153public int ForStatement => (int)SyntaxKind.ForStatement; 154public int IfStatement => (int)SyntaxKind.IfStatement; 155public int LocalDeclarationStatement => (int)SyntaxKind.LocalDeclarationStatement; 156public int? LocalFunctionStatement => (int)SyntaxKind.LocalFunctionStatement; 157public int LockStatement => (int)SyntaxKind.LockStatement; 158public int ReturnStatement => (int)SyntaxKind.ReturnStatement; 159public int ThrowStatement => (int)SyntaxKind.ThrowStatement; 160public int UsingStatement => (int)SyntaxKind.UsingStatement; 161public int WhileStatement => (int)SyntaxKind.WhileStatement; 162public int YieldReturnStatement => (int)SyntaxKind.YieldReturnStatement; 163public int Attribute => (int)SyntaxKind.Attribute; 164public int ClassDeclaration => (int)SyntaxKind.ClassDeclaration; 165public int ConstructorDeclaration => (int)SyntaxKind.ConstructorDeclaration; 166public int EnumDeclaration => (int)SyntaxKind.EnumDeclaration; 167public int InterfaceDeclaration => (int)SyntaxKind.InterfaceDeclaration; 168public int? StructDeclaration => (int)SyntaxKind.StructDeclaration; 169public int Parameter => (int)SyntaxKind.Parameter; 170public int TypeConstraint => (int)SyntaxKind.TypeConstraint; 171public int VariableDeclarator => (int)SyntaxKind.VariableDeclarator; 172public int FieldDeclaration => (int)SyntaxKind.FieldDeclaration; 173public int PropertyDeclaration => (int)SyntaxKind.PropertyDeclaration; 174public int ParameterList => (int)SyntaxKind.ParameterList; 175public int TypeArgumentList => (int)SyntaxKind.TypeArgumentList; 176public int? GlobalStatement => (int)SyntaxKind.GlobalStatement; 178public int ElseClause => (int)SyntaxKind.ElseClause; 179public int EqualsValueClause => (int)SyntaxKind.EqualsValueClause; 181public int? ExpressionElement => (int)SyntaxKind.ExpressionElement; 182public int? ImplicitElementAccess => (int)SyntaxKind.ImplicitElementAccess; 183public int Interpolation => (int)SyntaxKind.Interpolation; 184public int InterpolatedStringExpression => (int)SyntaxKind.InterpolatedStringExpression; 185public int InterpolatedStringText => (int)SyntaxKind.InterpolatedStringText; 186public int? IndexerMemberCref => (int)SyntaxKind.IndexerMemberCref; 187public int? PrimaryConstructorBaseType => (int)SyntaxKind.PrimaryConstructorBaseType;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
14if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (21)
56return cast.Kind() == SyntaxKind.AsExpression && 126if (leftOrRightChild.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) binary) 160if (castExpression.WalkUpParentheses().Parent is PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression) parent && 187var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 231if (castSyntax.WalkUpParentheses().GetRequiredParent().Kind() is SyntaxKind.BitwiseOrExpression or SyntaxKind.OrAssignmentExpression) 334var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 504if (castNode.WalkUpParentheses().Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) isExpression && 570if (castNode.IsParentKind(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object) 815if (parent is not PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression)) 820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 947if (armExpression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 998if (castExpression.Expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 1063is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) parentBinary) 1151=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.CastExpression or SyntaxKind.AsExpression; 1188if (otherSide.WalkDownParentheses().Kind() == SyntaxKind.NullLiteralExpression) 1257else if (castNode.Parent is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 1365if (!haveHitArgumentNode && currentOld.Kind() != SyntaxKind.Argument)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (46)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None); 40while (currentToken.Kind() != SyntaxKind.CloseBraceToken && previousToken.Kind() == SyntaxKind.OpenBraceToken) 43if (closeBrace.Kind() == SyntaxKind.None || !AreTwoTokensOnSameLine(previousToken, closeBrace)) 60case SyntaxKind.CloseBraceToken: 63case SyntaxKind.SemicolonToken: 66case SyntaxKind.ColonToken: 76if (endToken.Kind() == SyntaxKind.SkippedTokensTrivia) 88if (parent.Kind() is SyntaxKind.StringLiteralExpression or SyntaxKind.CharacterLiteralExpression) 100if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 152if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 252if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 259if (endToken.Kind() == SyntaxKind.ColonToken && parent is LabeledStatementSyntax) 268return previousToken.Kind() == SyntaxKind.None ? token : previousToken; 290if (previousToken.Kind() == SyntaxKind.None) 327return previousToken.IsKind(SyntaxKind.OpenBraceToken) && 328(previousToken.Parent.IsKind(SyntaxKind.Block) || 336node.Kind() is SyntaxKind.IfStatement or 337SyntaxKind.ElseClause or 338SyntaxKind.WhileStatement or 339SyntaxKind.ForStatement or 340SyntaxKind.ForEachStatement or 341SyntaxKind.ForEachVariableStatement or 342SyntaxKind.UsingStatement or 343SyntaxKind.DoStatement or 344SyntaxKind.TryStatement or 345SyntaxKind.CatchClause or 346SyntaxKind.FinallyClause or 347SyntaxKind.LabeledStatement or 348SyntaxKind.LockStatement or 349SyntaxKind.FixedStatement or 350SyntaxKind.UncheckedStatement or 351SyntaxKind.CheckedStatement or 352SyntaxKind.GetAccessorDeclaration or 353SyntaxKind.SetAccessorDeclaration or 354SyntaxKind.InitAccessorDeclaration or 355SyntaxKind.AddAccessorDeclaration or 356SyntaxKind.RemoveAccessorDeclaration; 388return token.Kind() == SyntaxKind.ColonToken && 395if (previousToken.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 400if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 417if (token.Kind() == SyntaxKind.CloseBraceToken) 419if (token.Parent.Kind() is SyntaxKind.Block or 420SyntaxKind.AccessorList)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (4)
84case SyntaxKind.QualifiedName: 89case SyntaxKind.AliasQualifiedName: 94case SyntaxKind.IdentifierName: 97case SyntaxKind.GenericName:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (57)
69=> expression.Kind() is SyntaxKind.ThisExpression or SyntaxKind.BaseExpression; 82if (node.Kind() is not SyntaxKind.PrimaryConstructorBaseType || 83previousNode.Kind() is SyntaxKind.ArgumentList) 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 97node.Kind() is SyntaxKind.Attribute or 98SyntaxKind.ThisConstructorInitializer or 99SyntaxKind.BaseConstructorInitializer or 100SyntaxKind.EqualsValueClause or 101SyntaxKind.ArrowExpressionClause or 102SyntaxKind.PrimaryConstructorBaseType; 109node => node.Kind() is SyntaxKind.UnknownAccessorDeclaration or SyntaxKind.IncompleteMember or SyntaxKind.BracketedArgumentList), 158case SyntaxKind.Attribute: 162case SyntaxKind.BaseConstructorInitializer: 163case SyntaxKind.ThisConstructorInitializer: 167case SyntaxKind.EqualsValueClause: 171case SyntaxKind.ArrowExpressionClause: 175case SyntaxKind.PrimaryConstructorBaseType: 201case SyntaxKind.ParenthesizedLambdaExpression: 235case SyntaxKind.SimpleLambdaExpression: 300if (currentOriginalNode.Kind() is SyntaxKind.CaseSwitchLabel or SyntaxKind.ConstantPattern) 303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 315else if (currentOriginalNode.Kind() == SyntaxKind.LogicalNotExpression) 319else if (currentOriginalNode.Kind() == SyntaxKind.ConditionalAccessExpression) 336else if (currentOriginalNode.Kind() == SyntaxKind.VariableDeclarator) 467if (previousReplacedExpression.WalkDownParentheses().Kind() is SyntaxKind.NullLiteralExpression or SyntaxKind.DefaultLiteralExpression) 515else if (currentOriginalNode.Kind() == SyntaxKind.CollectionInitializerExpression) 520else if (currentOriginalNode.Kind() == SyntaxKind.ImplicitArrayCreationExpression) 529else if (currentOriginalNode.Kind() == SyntaxKind.DefaultExpression) 582SyntaxKind.InvocationExpression or 583SyntaxKind.ElementAccessExpression or 584SyntaxKind.SimpleMemberAccessExpression or 585SyntaxKind.ImplicitElementAccess or 586SyntaxKind.ObjectCreationExpression; 602SyntaxKind.InvocationExpression => ((InvocationExpressionSyntax)expression).ArgumentList, 603SyntaxKind.ObjectCreationExpression => ((ObjectCreationExpressionSyntax)expression).ArgumentList, 604SyntaxKind.ElementAccessExpression => ((ElementAccessExpressionSyntax)expression).ArgumentList, 615case SyntaxKind.SimpleMemberAccessExpression: 618case SyntaxKind.InvocationExpression: 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 629case SyntaxKind.ElementAccessExpression: 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 673if (binaryExpression.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression && 720assignmentExpression.Kind() != SyntaxKind.LeftShiftAssignmentExpression && 721assignmentExpression.Kind() != SyntaxKind.RightShiftAssignmentExpression && 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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (4)
23x.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword && 24y.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (9)
38if (typeName?.FirstAncestorOrSelf<SyntaxNode>(a => a.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement) is not { } declaration) 61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression); 84SyntaxKind.LocalDeclarationStatement or 85SyntaxKind.ForStatement or 86SyntaxKind.UsingStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
104/// to var. <see cref="SyntaxFacts.IsPredefinedType(SyntaxKind)"/> considers string
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (4)
66declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation)) 78if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
104if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) }) 117if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType) && 248if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 252if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (3)
47case SyntaxKind.ArrayType: 50case SyntaxKind.PointerType: 53case SyntaxKind.NullableType:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (5)
29.Select(n => n.GetTrailingTrivia().FirstOrNull(t => t.Kind() == SyntaxKind.EndOfLineTrivia)) 71var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 72var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 170if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 188=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1404)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (8)
46if (node.Kind() is not SyntaxKind.MethodDeclaration and not SyntaxKind.PropertyDeclaration and not SyntaxKind.VariableDeclarator) 49if (node.IsKind(SyntaxKind.VariableDeclarator) && node is not { Parent.Parent: EventFieldDeclarationSyntax }) 81var xmlSpaceAfterTripleSlash = Token(leading: [DocumentationCommentExterior("///")], SyntaxKind.XmlTextLiteralToken, text: " ", valueText: " ", trailing: default); 85var xmlNewLineToken = Token(leading: default, SyntaxKind.XmlTextLiteralNewLineToken, text: newLine, valueText: newLine, trailing: default); 88kind: SyntaxKind.SingleLineDocumentationCommentTrivia, 107if (finalLeadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
66if (constructorInitializer.IsKind(SyntaxKind.BaseConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
86parenthesizedExpression.GetAncestor<InterpolatedStringExpressionSyntax>()?.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (21)
136if (stringLiteral.Kind() is SyntaxKind.InterpolatedStringTextToken) 138if (stringLiteral.GetRequiredParent() is not InterpolatedStringTextSyntax { Parent: InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString }) 143else if (stringLiteral.Kind() is SyntaxKind.InterpolatedRawStringEndToken) 145if (stringLiteral.GetRequiredParent() is not InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString) 150else if (stringLiteral.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 228if (token.IsKind(SyntaxKind.HashToken) && token.Parent!.Kind() is not (SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia)) 287if (firstBodyToken.Kind() != SyntaxKind.EndOfFileToken 307if (leadingTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..]) 313if (leadingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), (kind: SyntaxKind.EndOfLineTrivia), ..]) 350var originalHadTrailingNewLine = namespaceDeclaration.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia)]; 358if (trailingTrivia is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 367(kind: SyntaxKind.EndOfLineTrivia or SyntaxKind.EndIfDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia), 368(kind: SyntaxKind.EndOfLineTrivia) 388if (openBraceToken.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 400if (!fileScopedNamespace.GetLastToken().GetNextTokenOrEndOfFile().IsKind(SyntaxKind.EndOfFileToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (5)
59var nodeToGenerate = (SyntaxKind)int.Parse(properties[Constants.NodeToGenerateKey]!); 99Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement); 100editor.RemoveNode(nextStatement.IsParentKind(SyntaxKind.GlobalStatement) ? nextStatement.GetRequiredParent() : nextStatement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (17)
41SyntaxKind nodeToGenerate, 52var rewriter = new Rewriter(model, isAllThrowStatements: nodeToGenerate == SyntaxKind.ThrowStatement, cancellationToken); 68SyntaxKind nodeToGenerate, 73case SyntaxKind.ReturnStatement: 75Token(leadingTrivia, SyntaxKind.ReturnKeyword, trailing: default), 78case SyntaxKind.ThrowStatement: 80Token(leadingTrivia, SyntaxKind.ThrowKeyword, trailing: default), 93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia) 151totalPattern = BinaryPattern(SyntaxKind.OrPattern, totalPattern.Parenthesize(), nextPatternPart.Parenthesize()); 162case SyntaxKind.CasePatternSwitchLabel: 167case SyntaxKind.CaseSwitchLabel: 171case SyntaxKind.DefaultSwitchLabel: 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement)); 234if (nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement)) 250Token(leading: default, SyntaxKind.SwitchKeyword, node.CloseParenToken.TrailingTrivia), 251Token(leading: default, SyntaxKind.OpenBraceToken, node.OpenBraceToken.TrailingTrivia),
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (2)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression)); 87if (!methodDeclaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (14)
37if (typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword)) 191SyntaxKind.ThisConstructorInitializer, 201=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.EqualsEqualsToken }); 203=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.ExclamationEqualsToken }); 418? SyntaxKind.RecordDeclaration 419: SyntaxKind.RecordStructDeclaration, 653SyntaxKind.MultiLineDocumentationCommentTrivia, 670SyntaxKind.MultiLineDocumentationCommentTrivia, 704if (docComment.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)) 739if (prevToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 796token.IsKind(SyntaxKind.XmlTextLiteralToken) 801tokens is [(kind: SyntaxKind.XmlTextLiteralNewLineToken), _, ..]) 811tokens is [.., (kind: SyntaxKind.XmlTextLiteralNewLineToken), (kind: SyntaxKind.XmlTextLiteralToken) textLiteral] &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
414? SyntaxKind.NullLiteralExpression 415: SyntaxKind.DefaultLiteralExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
153SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), newNameNode).WithAdditionalAnnotations(Simplifier.Annotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
42var docCommentNodes = leadingTrivia.Where(f => f.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (2)
47=> token.Kind() == SyntaxKind.XmlTextLiteralToken && IsWhitespace(token.Text); 50=> token.Kind() == SyntaxKind.XmlTextLiteralNewLineToken;
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (5)
52if (firstTrivia.Kind() != SyntaxKind.SkippedTokensTrivia) 60return enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword; 85var isEnumConstraint = enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword; 104SyntaxKind.StructConstraint)));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (3)
58=> typeSyntax is PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword }; 144MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 147LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (2)
57typeToGenerateIn = constructorInitializer.IsKind(SyntaxKind.ThisConstructorInitializer) 188constructorDeclarationSyntax.Initializer.IsKind(SyntaxKind.ThisConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
46if (baseList.Parent is TypeDeclarationSyntax(SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration) parentTypeDecl &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\CSharpGenerateEnumMemberService.cs (4)
42is SyntaxKind.InvocationExpression 43or SyntaxKind.ObjectCreationExpression 44or SyntaxKind.GotoStatement 45or SyntaxKind.AliasQualifiedName)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (4)
37is SyntaxKind.IdentifierName 38or SyntaxKind.MethodDeclaration 39or SyntaxKind.InvocationExpression 40or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (3)
46.FirstOrDefault(n => n.Kind() is SyntaxKind.SimpleAssignmentExpression or SyntaxKind.ForEachVariableStatement or SyntaxKind.PositionalPatternClause);
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (4)
56is SyntaxKind.IdentifierName 57or SyntaxKind.MethodDeclaration 58or SyntaxKind.InvocationExpression 59or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (2)
66SyntaxKind.ImplicitKeyword, 92SyntaxKind.ImplicitKeyword,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
109if (simpleNameOrMemberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocationExpressionOpt))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (2)
35=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 137=> State.SimpleNameOpt.Kind() == SyntaxKind.IdentifierName;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (4)
61SyntaxKind.ClassDeclaration or 62SyntaxKind.StructDeclaration or 63SyntaxKind.RecordDeclaration or 64SyntaxKind.RecordStructDeclaration) typeDeclaration)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
96if (ifStatement.Parent.IsKind(SyntaxKind.ElseClause) && 151var expressionTriviaWithoutEndOfLine = expressionTrivia.Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
76SyntaxKind.YieldReturnStatement, 220node = ancestors.FirstOrDefault(n => n.Span.Contains(span) && n != root && n.IsKind(SyntaxKind.ReturnStatement));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
161syntaxEditor.ReplaceNode(name, MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("@this"), name));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberStatic\CSharpMakeMemberStaticCodeFixProvider.cs (1)
31if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax })
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
51return token.Kind() == SyntaxKind.IdentifierToken && token.Text == "await"; 192var partialModifier = modifiers.FirstOrDefault(static m => m.IsKind(SyntaxKind.PartialKeyword));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (3)
97SyntaxKind.ForEachStatement or 98SyntaxKind.ForEachVariableStatement or 99SyntaxKind.UsingStatement))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
77if (otherAccessor.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (4)
50if (enclosingType?.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration && 51!enclosingType.Modifiers.Any(SyntaxKind.AbstractKeyword) && !enclosingType.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
342.SkipWhile(trivia => trivia.All(t => t.IsWhitespaceOrEndOfLine()) && trivia.Last().IsKind(SyntaxKind.EndOfLineTrivia)) 376if (firstMemberTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..])
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
68if (!token.IsKind(SyntaxKind.CloseBraceToken)) 75if (!firstBrace.IsKind(SyntaxKind.CloseBraceToken))
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
105return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (25)
66if (node.IsKind(SyntaxKind.ConditionalAccessExpression)) 116if (node.Parent is (kind: SyntaxKind.ReturnStatement or SyntaxKind.YieldReturnStatement)) 120SyntaxKind.MethodDeclaration or 121SyntaxKind.PropertyDeclaration or 122SyntaxKind.ParenthesizedLambdaExpression or 123SyntaxKind.SimpleLambdaExpression or 124SyntaxKind.LocalFunctionStatement or 125SyntaxKind.AnonymousMethodExpression or 126SyntaxKind.ConstructorDeclaration or 127SyntaxKind.DestructorDeclaration or 128SyntaxKind.OperatorDeclaration or 129SyntaxKind.IndexerDeclaration or 130SyntaxKind.EventDeclaration); 135var onYield = node.IsParentKind(SyntaxKind.YieldReturnStatement); 260if (node.IsParentKind(SyntaxKind.ArrowExpressionClause) && 271if (modifiers.Any(SyntaxKind.AsyncKeyword) || onYield) 316SyntaxKind.NullLiteralExpression or 317SyntaxKind.AsExpression or 318SyntaxKind.DefaultExpression or 319SyntaxKind.DefaultLiteralExpression or 320SyntaxKind.ConditionalExpression or 321SyntaxKind.ConditionalAccessExpression or 322SyntaxKind.PropertyDeclaration or 323SyntaxKind.VariableDeclarator;
src\roslyn\src\Analyzers\CSharp\CodeFixes\PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs (1)
47insertLocation, newArms, SyntaxKind.CommaToken));
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
35var asyncTokenIndex = modifiers.IndexOf(SyntaxKind.AsyncKeyword);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (4)
67Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression); 75n => n.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (1)
53SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (3)
81is not SyntaxKind.Block 82and not SyntaxKind.SwitchSection 83and not SyntaxKind.GlobalStatement)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (12)
48case SyntaxKind.IdentifierName: 52case SyntaxKind.VariableDeclarator: 71case SyntaxKind.SingleVariableDesignation: 76case SyntaxKind.CatchDeclaration: 80case SyntaxKind.VarPattern: 81return node.IsParentKind(SyntaxKind.Subpattern) 93if (newNameNode.IsKind(SyntaxKind.DiscardDesignation)) 212if (originalCompoundAssignment.Parent.IsKind(SyntaxKind.ExpressionStatement)) 214if (!originalCompoundAssignment.IsKind(SyntaxKind.CoalesceAssignmentExpression)) 225BinaryExpression(SyntaxKind.CoalesceExpression, leftOfAssignment, rightOfAssignment)); 231var mappedBinaryExpressionKind = originalCompoundAssignment.Kind().MapCompoundAssignmentKindToBinaryExpressionKind(); 232if (mappedBinaryExpressionKind == SyntaxKind.None)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
44token.IsKind(SyntaxKind.DefaultKeyword) && 45token.Parent is LiteralExpressionSyntax(SyntaxKind.DefaultLiteralExpression) defaultLiteral)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyInterpolation\CSharpSimplifyInterpolationCodeFixProvider.cs (1)
39if (interpolatedString.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (1)
52containingProperty.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
103return MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, outerExpression, innerName);
src\roslyn\src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (4)
45var skippedTriviaIndex = leadingTrivia.IndexOf(SyntaxKind.SkippedTokensTrivia); 54if (classOrStructKeyword.Kind() is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword) 60var trailingTriviaTakeUntil = remainingLeadingTrivia.IndexOf(SyntaxKind.EndOfLineTrivia) is >= 0 and var eolIndex
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (8)
51=> accessor.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration; 122var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration).WithSemicolonToken(SemicolonToken); 129.WithModifiers(TokenList(updatedProperty.Modifiers.Where(token => !token.IsKind(SyntaxKind.ReadOnlyKeyword)))); 154var indentation = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespaceTrivia] 185=> attributeList.WithTarget(AttributeTargetSpecifier(Identifier(SyntaxFacts.GetText(SyntaxKind.FieldKeyword)), ColonToken.WithTrailingTrivia(Space))); 194AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 203(isTrivialGetAccessor && accessor.Kind() is SyntaxKind.GetAccessorDeclaration) ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\SingleLinePropertyFormattingRule.cs (7)
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)) 25if (previousToken.IsKind(SyntaxKind.SemicolonToken) && currentToken.Parent is AccessorDeclarationSyntax)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\UseAutoPropertyRewriter.cs (2)
26if (node.Expression.IsKind(SyntaxKind.ThisExpression)) 47Parent: InitializerExpressionSyntax { RawKind: (int)SyntaxKind.ObjectInitializerExpression }
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (6)
103SyntaxKind.CollectionInitializerExpression, 105[LiteralExpression(SyntaxKind.NullLiteralExpression, NullKeyword.WithAdditionalAnnotations(nullTokenAnnotation))], 129if (nodesAndTokens.Count > 0 && nodesAndTokens.Last().GetTrailingTrivia() is [.., (kind: not SyntaxKind.EndOfLineTrivia)]) 549SyntaxKind.SimpleMemberAccessExpression, 674if (token.LeadingTrivia is not [.., (kind: SyntaxKind.WhitespaceTrivia)]) 925while (index - 1 >= 0 && trivia[index - 1].Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
23SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
80if (addLineBreak && item.GetTrailingTrivia() is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 134SyntaxKind.ComplexElementInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (11)
20: AbstractUseCompoundAssignmentCodeFixProvider<SyntaxKind, AssignmentExpressionSyntax, ExpressionSyntax>(Utilities.Kinds) 22protected override SyntaxToken Token(SyntaxKind kind) 26SyntaxKind assignmentOpKind, ExpressionSyntax left, SyntaxToken syntaxToken, ExpressionSyntax right) 33? Postfix(SyntaxKind.PostIncrementExpression, left) 34: Prefix(SyntaxKind.PreIncrementExpression, left); 38? Postfix(SyntaxKind.PostDecrementExpression, left) 39: Prefix(SyntaxKind.PreDecrementExpression, left); 41private static ExpressionSyntax Postfix(SyntaxKind kind, ExpressionSyntax operand) 44private static ExpressionSyntax Prefix(SyntaxKind kind, ExpressionSyntax operand) 47protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
60SyntaxKind.CoalesceAssignmentExpression, 107SyntaxKind.CoalesceAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\MultiLineConditionalExpressionFormattingRule.cs (2)
34=> token.Kind() is SyntaxKind.QuestionToken or SyntaxKind.ColonToken && token.GetRequiredParent().HasAnnotation(SpecializedFormattingAnnotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
138SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
59SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134a => a.Expression.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.Expression).Type)); 152SyntaxKind.SimpleMemberAccessExpression, 166SyntaxKind.ArrayInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (4)
200case SyntaxKind.SingleVariableDesignation: 206case SyntaxKind.DiscardDesignation: 210case SyntaxKind.ParenthesizedVariableDesignation: 225var separatorBuilder = ArrayBuilder<SyntaxToken>.GetInstance(builder.Count - 1, Token(leading: default, SyntaxKind.CommaToken, trailing: default));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\Helpers.cs (1)
17SyntaxKind.IndexExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
54var newStartToken = SyntaxFactory.Token(oldStartToken.LeadingTrivia, SyntaxKind.InterpolatedVerbatimStringStartToken,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (3)
68if (binary.IsKind(SyntaxKind.EqualsExpression)) 81SyntaxKind.IsExpression, 88=> binary.Right.IsKind(SyntaxKind.NullLiteralExpression)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (3)
25= LiteralExpression(SyntaxKind.NullLiteralExpression); 34=> BinaryExpression(SyntaxKind.EqualsExpression, argument, s_nullLiteralExpression).Parenthesize(); 52SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
26private static readonly ConstantPatternSyntax s_nullConstantPattern = ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
214if (anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
21SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
29SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (3)
28var initializerKind = firstExpression is AssignmentExpressionSyntax 29? SyntaxKind.ObjectInitializerExpression 30: SyntaxKind.CollectionInitializerExpression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (12)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken, 93p.IsDisjunctive ? SyntaxKind.OrPattern : SyntaxKind.AndPattern, 95Token(p.Token.LeadingTrivia, p.IsDisjunctive ? SyntaxKind.OrKeyword : SyntaxKind.AndKeyword, 115if (unwrapped is UnaryPatternSyntax(SyntaxKind.NotPattern) unaryPattern) 129if (expr.IsKind(SyntaxKind.DefaultLiteralExpression)) 133if (expr.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (7)
123if (isPatternExpression.Pattern is UnaryPatternSyntax(kind: SyntaxKind.NotPattern) unaryPattern && 137SyntaxKind.EqualsExpression => ConstantPattern(binaryExpression.Right), 139SyntaxKind.NotEqualsExpression => UnaryPattern(ConstantPattern(binaryExpression.Right)), 142SyntaxKind.GreaterThanExpression or 143SyntaxKind.GreaterThanOrEqualExpression or 144SyntaxKind.LessThanExpression or 145SyntaxKind.LessThanOrEqualExpression => RelationalPattern(binaryExpression.OperatorToken, binaryExpression.Right),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (3)
168if (comparison.Kind() is not (SyntaxKind.EqualsExpression or SyntaxKind.IsPatternExpression)) 179return PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, isPatternExpression.Parenthesize());
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
88newIf = originalIf.IsParentKind(SyntaxKind.ElseClause)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (7)
42Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.EndOfLineTrivia, "first end of line"), 43Matcher.Repeat(Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.WhitespaceTrivia, "whitespace")), 44Matcher.Single<SyntaxTrivia>(t => t.IsKind(SyntaxKind.EndOfLineTrivia), "second end of line")); 265var inKeyword = current.Modifiers.FirstOrDefault(t => t.Kind() == SyntaxKind.InKeyword); 334: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, containingTypeSyntax, currentName); 374=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace] ? whitespace.ToString() : ""; 550=> memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (3)
132var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)] 159SyntaxKind.SingleLineDocumentationCommentTrivia, 220Trivia(DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. allContent])));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
147.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (1)
59SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
63if (current.Arguments.Any(a => a.Kind() != SyntaxKind.OmittedTypeArgument))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
161if (argument.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken) 202SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (3)
95var kind = CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(constructor) != null 96? SyntaxKind.ThisConstructorInitializer 97: SyntaxKind.BaseConstructorInitializer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (12)
95if (t1.Kind() == SyntaxKind.MultiLineCommentTrivia) 100return SyntaxTrivia(SyntaxKind.MultiLineCommentTrivia, text + MultiLineCommentTerminator); 103else if (t1.Kind() == SyntaxKind.SkippedTokensTrivia) 196=> declaration.ChildTokens().Where(t => t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken && t.IsMissing).Any(); 233SyntaxKind.ClassDeclaration => CodeGenerationDestination.ClassType, 234SyntaxKind.CompilationUnit => CodeGenerationDestination.CompilationUnit, 235SyntaxKind.EnumDeclaration => CodeGenerationDestination.EnumType, 236SyntaxKind.InterfaceDeclaration => CodeGenerationDestination.InterfaceType, 237SyntaxKind.FileScopedNamespaceDeclaration => CodeGenerationDestination.Namespace, 238SyntaxKind.NamespaceDeclaration => CodeGenerationDestination.Namespace, 239SyntaxKind.StructDeclaration => CodeGenerationDestination.StructType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (20)
457ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); 463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); 511var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1; 515else if (destinationMember is StatementSyntax statement && statement.IsParentKind(SyntaxKind.GlobalStatement)) 786case SyntaxKind.DelegateDeclaration: 794case SyntaxKind.MethodDeclaration: 802case SyntaxKind.OperatorDeclaration: 810case SyntaxKind.ConversionOperatorDeclaration: 818case SyntaxKind.PropertyDeclaration: 826case SyntaxKind.EventDeclaration: 834case SyntaxKind.IndexerDeclaration: 842case SyntaxKind.Parameter: 856case SyntaxKind.IncompleteMember: 870case SyntaxKind.ArrayType: 878case SyntaxKind.PointerType: 886case SyntaxKind.VariableDeclaration: 894case SyntaxKind.CatchDeclaration: 918case SyntaxKind.CompilationUnit: 919case SyntaxKind.NamespaceDeclaration: 920case SyntaxKind.FileScopedNamespaceDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (78)
15private static readonly Dictionary<SyntaxKind, int> s_kindPrecedenceMap = new(SyntaxFacts.EqualityComparer) 17{ SyntaxKind.FieldDeclaration, 0 }, 18{ SyntaxKind.ConstructorDeclaration, 1 }, 19{ SyntaxKind.DestructorDeclaration, 2 }, 20{ SyntaxKind.IndexerDeclaration, 3 }, 21{ SyntaxKind.PropertyDeclaration, 4 }, 22{ SyntaxKind.EventFieldDeclaration, 5 }, 23{ SyntaxKind.EventDeclaration, 6 }, 24{ SyntaxKind.MethodDeclaration, 7 }, 25{ SyntaxKind.OperatorDeclaration, 8 }, 26{ SyntaxKind.ConversionOperatorDeclaration, 9 }, 27{ SyntaxKind.EnumDeclaration, 10 }, 28{ SyntaxKind.InterfaceDeclaration, 11 }, 29{ SyntaxKind.StructDeclaration, 12 }, 30{ SyntaxKind.ClassDeclaration, 13 }, 31{ SyntaxKind.RecordDeclaration, 14 }, 32{ SyntaxKind.RecordStructDeclaration, 15 }, 33{ SyntaxKind.DelegateDeclaration, 16 } 36private static readonly Dictionary<SyntaxKind, int> s_operatorPrecedenceMap = new(SyntaxFacts.EqualityComparer) 38{ SyntaxKind.PlusToken, 0 }, 39{ SyntaxKind.MinusToken, 1 }, 40{ SyntaxKind.ExclamationToken, 2 }, 41{ SyntaxKind.TildeToken, 3 }, 42{ SyntaxKind.PlusPlusToken, 4 }, 43{ SyntaxKind.MinusMinusToken, 5 }, 44{ SyntaxKind.AsteriskToken, 6 }, 45{ SyntaxKind.SlashToken, 7 }, 46{ SyntaxKind.PercentToken, 8 }, 47{ SyntaxKind.AmpersandToken, 9 }, 48{ SyntaxKind.BarToken, 10 }, 49{ SyntaxKind.CaretToken, 11 }, 50{ SyntaxKind.LessThanLessThanToken, 12 }, 51{ SyntaxKind.GreaterThanGreaterThanToken, 13 }, 52{ SyntaxKind.EqualsEqualsToken, 14 }, 53{ SyntaxKind.ExclamationEqualsToken, 15 }, 54{ SyntaxKind.LessThanToken, 16 }, 55{ SyntaxKind.GreaterThanToken, 17 }, 56{ SyntaxKind.LessThanEqualsToken, 18 }, 57{ SyntaxKind.GreaterThanEqualsToken, 19 }, 58{ SyntaxKind.TrueKeyword, 20 }, 59{ SyntaxKind.FalseKeyword, 21 }, 60{ SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 22 }, 103case SyntaxKind.DelegateDeclaration: 106case SyntaxKind.FieldDeclaration: 107case SyntaxKind.EventFieldDeclaration: 110case SyntaxKind.ConstructorDeclaration: 113case SyntaxKind.DestructorDeclaration: 117case SyntaxKind.MethodDeclaration: 120case SyntaxKind.OperatorDeclaration: 123case SyntaxKind.EventDeclaration: 126case SyntaxKind.IndexerDeclaration: 129case SyntaxKind.PropertyDeclaration: 132case SyntaxKind.EnumDeclaration: 135case SyntaxKind.InterfaceDeclaration: 136case SyntaxKind.StructDeclaration: 137case SyntaxKind.RecordStructDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.RecordDeclaration: 142case SyntaxKind.ConversionOperatorDeclaration: 145case SyntaxKind.IncompleteMember: 148case SyntaxKind.GlobalStatement: 217return x.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword ? -1 : 1; 301private static bool ContainsToken(SyntaxTokenList list, SyntaxKind kind) 316if (ContainsToken(modifiers, SyntaxKind.PublicKeyword)) 320else if (ContainsToken(modifiers, SyntaxKind.ProtectedKeyword)) 322if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 327if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 334else if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 338else if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 347if (node.Kind() == SyntaxKind.InterfaceDeclaration) 352else if (node.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration) 362private static bool BothHaveModifier(SyntaxTokenList x, SyntaxTokenList y, SyntaxKind modifierKind, out int comparisonResult) 378=> BothHaveModifier(x, y, SyntaxKind.StaticKeyword, out comparisonResult); 381=> BothHaveModifier(x, y, SyntaxKind.ConstKeyword, out comparisonResult); 384=> BothHaveModifier(x, y, SyntaxKind.ReadOnlyKeyword, out comparisonResult);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (9)
34else if (members.LastOrDefault().Kind() == SyntaxKind.CommaToken) 118if (lastExpression.Kind() == SyntaxKind.LeftShiftExpression && 122if (binaryExpression.Left.Kind() == SyntaxKind.NumericLiteralExpression) 132SyntaxKind.LeftShiftExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)), 134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(shiftValue.ToString(), shiftValue))); 138else if (lastExpression is LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) numericLiteral) 146return LiteralExpression(SyntaxKind.NumericLiteralExpression, 151return LiteralExpression(SyntaxKind.NumericLiteralExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (7)
28if (eventDeclaration.Kind() == SyntaxKind.EventFieldDeclaration) 36if (eventDeclaration.Kind() == SyntaxKind.EventDeclaration) 53if (eventDeclaration.Kind() == SyntaxKind.FieldDeclaration) 164GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 165GenerateAccessorDeclaration(@event, @event.RemoveMethod, SyntaxKind.RemoveAccessorDeclaration, destination, info), 174SyntaxKind kind, 186SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (18)
42InitializerExpression(SyntaxKind.ArrayInitializerExpression, 51=> LiteralExpression(SyntaxKind.NullLiteralExpression); 108? SyntaxKind.TrueLiteralExpression 109: SyntaxKind.FalseLiteralExpression); 116SyntaxKind.StringLiteralExpression, Literal(valueString, val)); 123SyntaxKind.CharacterLiteralExpression, Literal(literal, val)); 186return BinaryExpression(SyntaxKind.DivideExpression, 192return BinaryExpression(SyntaxKind.DivideExpression, 198return BinaryExpression(SyntaxKind.DivideExpression, 199PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateDoubleLiteralExpression(null, 1.0, false)), 215return BinaryExpression(SyntaxKind.DivideExpression, 221return BinaryExpression(SyntaxKind.DivideExpression, 227return BinaryExpression(SyntaxKind.DivideExpression, 228PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateSingleLiteralExpression(null, 1.0F, false)), 279SyntaxKind.NumericLiteralExpression, tokenFactory(stringValue, nonNegativeValue)); 282? PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, literal) 299var result = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccess, IdentifierName(constant.Value)); 315: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, result, name);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (6)
28.Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)) 33if (fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword)) 39.Where(f => f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) 43.Where(f => !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) && !f.Modifiers.Any(SyntaxKind.ConstKeyword)) 48return fieldDeclaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
26private static readonly TypeParameterConstraintSyntax s_classConstraint = ClassOrStructConstraint(SyntaxKind.ClassConstraint); 27private static readonly TypeParameterConstraintSyntax s_structConstraint = ClassOrStructConstraint(SyntaxKind.StructConstraint);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
168case SyntaxKind.EnumDeclaration: 171case SyntaxKind.StructDeclaration: 172case SyntaxKind.RecordStructDeclaration: 173case SyntaxKind.InterfaceDeclaration: 174case SyntaxKind.ClassDeclaration: 175case SyntaxKind.RecordDeclaration: 201var declarationKind = isRecordClass ? SyntaxKind.RecordDeclaration : SyntaxKind.RecordStructDeclaration; 202var classOrStructKeyword = Token(isRecordClass ? default : SyntaxKind.StructKeyword); 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (2)
82var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); 83if (operatorSyntaxKind == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (8)
185if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 282GenerateAccessorDeclaration(property, property.GetMethod, SyntaxKind.GetAccessorDeclaration, destination, info, cancellationToken), 294SyntaxKind kind, 308SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (7)
164case SyntaxKind.IdentifierName: 165case SyntaxKind.GenericName: 169case SyntaxKind.SimpleMemberAccessExpression: 170case SyntaxKind.PointerMemberAccessExpression: 174case SyntaxKind.SimpleLambdaExpression: 175case SyntaxKind.ParenthesizedLambdaExpression: 176case SyntaxKind.AnonymousMethodExpression:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (4)
21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 22case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).SemicolonToken; 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 40case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).WithSemicolonToken(semicolonToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (4)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None)); 131if (!endOfLine.IsKind(SyntaxKind.None)) 150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (42)
48public readonly ISet<SyntaxKind> PrecedingModifiers; 111ISet<SyntaxKind> precedingModifiers, 213targetToken.IsKind(SyntaxKind.TildeToken) && 214targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) && 215targetToken.Parent.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration); 224var isOnArgumentListBracketOrComma = targetToken.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier); 246isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 263isTaskLikeTypeContext: precedingModifiers.Contains(SyntaxKind.AsyncKeyword), 312if (token.Kind() == SyntaxKind.OpenBracketToken && 313token.Parent.IsKind(SyntaxKind.AttributeList) && 324ISet<SyntaxKind>? validModifiers = null, 325ISet<SyntaxKind>? validTypeDeclarations = null, 332public bool IsRecordDeclarationContext(ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) 336if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 346ISet<SyntaxKind> validTypeDeclarations, bool includingRecordParameters, CancellationToken cancellationToken) 352if (token.Kind() == SyntaxKind.OpenBracketToken && 353token.Parent.IsKind(SyntaxKind.AttributeList)) 376if (token.Kind() == SyntaxKind.OpenBracketToken && 377token.Parent.IsKind(SyntaxKind.AttributeList) && 392if (token.Kind() == SyntaxKind.OpenBracketToken && 393token.Parent.IsKind(SyntaxKind.AttributeList) && 403ISet<SyntaxKind>? validModifiers = null, 404ISet<SyntaxKind>? validTypeDeclarations = null, 439if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 450&& targetToken.IsKind(SyntaxKind.IdentifierToken) 451&& targetToken.HasMatchingText(SyntaxKind.AwaitKeyword)) 483if (node.IsKind(SyntaxKind.QueryExpression)) 487if (targetToken.IsKind(SyntaxKind.InKeyword)) 534SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword => AttributeTargets.Assembly | AttributeTargets.Module, 535SyntaxKind.TypeKeyword => AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, 536SyntaxKind.MethodKeyword => AttributeTargets.Method, 537SyntaxKind.FieldKeyword => AttributeTargets.Field, 538SyntaxKind.PropertyKeyword => AttributeTargets.Property, 539SyntaxKind.EventKeyword => AttributeTargets.Event, 540SyntaxKind.ParamKeyword => AttributeTargets.Parameter, 541SyntaxKind.ReturnKeyword => AttributeTargets.ReturnValue, 542SyntaxKind.TypeVarKeyword => AttributeTargets.GenericParameter, 558RecordDeclarationSyntax record => record.ClassOrStructKeyword.IsKind(SyntaxKind.StructKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (114)
19token.Kind() is SyntaxKind.UsingKeyword or 20SyntaxKind.ExternKeyword; 25if (token.IsKind(SyntaxKind.UsingKeyword)) 41if (token is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 47if (token.IsKind(SyntaxKind.UnsafeKeyword) && 48token.GetPreviousToken() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 118case SyntaxKind.SemicolonToken: 120return statement != null && !statement.IsParentKind(SyntaxKind.GlobalStatement) && 123case SyntaxKind.CloseBraceToken: 124if (token.Parent.IsKind(SyntaxKind.Block)) 135if (token.Parent.Parent.Kind() is not SyntaxKind.TryStatement and not SyntaxKind.DoStatement) 139is SyntaxKind.ElseClause 140or SyntaxKind.FinallyClause 141or SyntaxKind.CatchClause 142or SyntaxKind.SwitchSection) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 155case SyntaxKind.ColonToken: 156return token.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel or SyntaxKind.LabeledStatement); 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 161case SyntaxKind.CloseParenToken: 164is SyntaxKind.ForStatement 165or SyntaxKind.ForEachStatement 166or SyntaxKind.ForEachVariableStatement 167or SyntaxKind.WhileStatement 168or SyntaxKind.IfStatement 169or SyntaxKind.LockStatement 170or SyntaxKind.UsingStatement 171or SyntaxKind.FixedStatement; 173case SyntaxKind.ElseKeyword: 174return token.Parent.IsKind(SyntaxKind.ElseClause); 176case SyntaxKind.CloseBracketToken: 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 207if (token.Kind() == SyntaxKind.CloseBraceToken) 211memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 217if (token.Kind() == SyntaxKind.SemicolonToken) 230memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 250if (token.Kind() == SyntaxKind.CloseBracketToken) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 272if (token.Kind() == SyntaxKind.CloseParenToken) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 300if (token.Kind() == SyntaxKind.IdentifierToken && 301token.GetPreviousToken(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword) 326if (targetToken.Kind() is SyntaxKind.IfKeyword or 327SyntaxKind.ElifKeyword) 333if (targetToken.Kind() == SyntaxKind.OpenParenToken && 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 363if (targetToken.Kind() is not (SyntaxKind.IdentifierToken or SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken)) 395if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 401if (targetToken.Kind() == SyntaxKind.ColonToken) 403if (targetToken.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel)) 409if (targetToken.Kind() is SyntaxKind.SemicolonToken or 410SyntaxKind.CloseBraceToken) 430return targetToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken && 431targetToken.Parent is (kind: SyntaxKind.CrefBracketedParameterList or SyntaxKind.CrefParameterList); 449if (targetToken.Kind() == SyntaxKind.ColonToken && 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 456is SyntaxKind.InvocationExpression 457or SyntaxKind.ObjectCreationExpression 458or SyntaxKind.BaseConstructorInitializer 459or SyntaxKind.ThisConstructorInitializer) 465if (targetToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 467if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 470is SyntaxKind.ObjectCreationExpression 471or SyntaxKind.BaseConstructorInitializer 472or SyntaxKind.ThisConstructorInitializer) 480if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression()) 492if (targetToken.Kind() == SyntaxKind.OperatorKeyword && 504targetToken.GetAncestors<StatementSyntax>().Any(s => s.IsKind(SyntaxKind.UnsafeStatement)) || 505targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword) || 506targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) || 507targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.UnsafeKeyword)); 515return targetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword); 518public static bool IsAnyAccessorDeclarationContext(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 525public static bool IsAccessorDeclarationContext<TMemberNode>(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 545if (existingAccessor.Kind() != SyntaxKind.None) 569while (targetToken.Kind() is SyntaxKind.InternalKeyword or 570SyntaxKind.PublicKeyword or 571SyntaxKind.ProtectedKeyword or 572SyntaxKind.PrivateKeyword or 573SyntaxKind.ReadOnlyKeyword) 580if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 581targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 588if (targetToken.Kind() == SyntaxKind.CloseBraceToken && 589targetToken.Parent.IsKind(SyntaxKind.Block) && 596if (targetToken.Kind() == SyntaxKind.SemicolonToken && 603if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 604targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 615if (node.IsKind(SyntaxKind.TypeParameterList)) 617if (node?.Parent is TypeDeclarationSyntax(SyntaxKind.InterfaceDeclaration) typeDecl) 636if (targetToken.Kind() == SyntaxKind.LessThanToken && 642if (targetToken.Kind() == SyntaxKind.CommaToken && 648if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 649targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 650targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) && 661if (token.Kind() == SyntaxKind.CommaToken && token.Parent is BaseArgumentListSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (444)
21private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.ExternKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.AsyncKeyword, 26SyntaxKind.UnsafeKeyword, 36if (token.IsKind(SyntaxKind.OpenBracketToken) && 37token.Parent.IsKind(SyntaxKind.AttributeList)) 44if (token.IsKind(SyntaxKind.CommaToken) && 45token.Parent.IsKind(SyntaxKind.AttributeList)) 52if (token.IsKind(SyntaxKind.ColonToken) && 53token.Parent.IsKind(SyntaxKind.AttributeTargetSpecifier)) 60if (token.Parent.IsKind(SyntaxKind.QualifiedName) && 61token.Parent.IsParentKind(SyntaxKind.Attribute)) 68if (token.Parent.IsKind(SyntaxKind.AliasQualifiedName) && 69token.Parent.IsParentKind(SyntaxKind.Attribute)) 80ISet<SyntaxKind> validModifiers, 95if (token.IsKind(SyntaxKind.CloseBracketToken) 115if (parent.IsKind(SyntaxKind.CompilationUnit) || 116(parent is MemberDeclarationSyntax && parent.IsParentKind(SyntaxKind.CompilationUnit))) 129return kind is ((int)SyntaxKind.AssemblyKeyword) 130or ((int)SyntaxKind.ModuleKeyword); 166if (token.IsKind(SyntaxKind.OpenBraceToken)) 177if (token.IsKind(SyntaxKind.SemicolonToken)) 194if (token.IsKind(SyntaxKind.CloseBraceToken)) 208token.Parent.IsKind(SyntaxKind.Block) && 220if (token.IsKind(SyntaxKind.CloseBracketToken) && 221token.Parent.IsKind(SyntaxKind.AttributeList)) 243ISet<SyntaxKind>? validModifiers, 244ISet<SyntaxKind>? validTypeDeclarations, 257validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 285token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 294validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 299if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 322SyntaxKind otherModifier, 330return modifierTokens.Contains(otherModifier) && IsLambdaDeclarationContext(syntaxTree, position, SyntaxKind.None, cancellationToken); 342ISet<SyntaxKind> validModifiers, 359if (token.Kind() == SyntaxKind.CloseBracketToken && token.Parent is AttributeListSyntax) 420(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 426if (token.IsKind(SyntaxKind.None)) 440if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 455if (token.IsKind(SyntaxKind.SemicolonToken)) 457if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 477if (token.IsKind(SyntaxKind.CloseBraceToken)) 483else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 492token.Parent.IsKind(SyntaxKind.Block) && 507if (token.IsKind(SyntaxKind.CloseBracketToken) && 508token.Parent.IsKind(SyntaxKind.AttributeList)) 511if (token.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 532ISet<SyntaxKind>? validModifiers, 533ISet<SyntaxKind>? validTypeDeclarations, 543validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 576token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 591validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 602return incompleteMember.Type.IsKind(SyntaxKind.RefType); 609if (modifierTokens.Contains(SyntaxKind.FileKeyword)) 612if (modifierTokens.Contains(SyntaxKind.ClosedKeyword)) 638if (token.IsKind(SyntaxKind.ColonColonToken) && 639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 651if (token.IsKind(SyntaxKind.UsingKeyword)) 656if (token.GetNextToken(includeSkipped: true).Kind() != SyntaxKind.EqualsToken && 701is SyntaxKind.ClassKeyword 702or SyntaxKind.StructKeyword 703or SyntaxKind.InterfaceKeyword && 704token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 737syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 738syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || 739syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || 740syntaxTree.IsAfterKeyword(position, SyntaxKind.CaseKeyword, cancellationToken) || 741syntaxTree.IsAfterKeyword(position, SyntaxKind.EventKeyword, cancellationToken) || 742syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) || 785if (token.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken && 801if (token.IsKind(SyntaxKind.EqualsToken) && 831if (token.IsKind(SyntaxKind.WhereKeyword) && 832token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 837if (token.IsKind(SyntaxKind.IdentifierToken) && 838token.HasMatchingText(SyntaxKind.WhereKeyword) && 839token.Parent.IsKind(SyntaxKind.IdentifierName) && 840token.Parent.IsParentKind(SyntaxKind.SimpleBaseType) && 841token.Parent.Parent.IsParentKind(SyntaxKind.BaseList)) 858if (token.IsKind(SyntaxKind.ColonToken) && 859token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 860token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 884if (token.IsKind(SyntaxKind.CommaToken) && 903if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 915if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 928if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 947case SyntaxKind.LessThanToken: 948case SyntaxKind.CommaToken: 949return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955{ Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } => true, 957{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 963=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 964targetToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken; 980if (token.Kind() is not SyntaxKind.LessThanToken and not SyntaxKind.CommaToken) 1015if (name.IsParentKind(SyntaxKind.LessThanExpression) && 1017conditional.IsParentKind(SyntaxKind.ExpressionStatement) && 1018conditional.Parent.IsParentKind(SyntaxKind.GlobalStatement)) 1060out SyntaxKind previousModifier) 1069previousModifier = SyntaxKind.None; 1071if (token.IsKind(SyntaxKind.OpenParenToken) && 1079if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1085if (token.IsKind(SyntaxKind.CommaToken) && 1095if (token.IsKind(SyntaxKind.CommaToken) && 1104if (token.IsKind(SyntaxKind.CloseBracketToken) && 1105token.Parent.IsKind(SyntaxKind.AttributeList) && 1115if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.OutKeyword or SyntaxKind.ThisKeyword or SyntaxKind.ParamsKeyword or SyntaxKind.ScopedKeyword) 1120else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName }) 1123previousModifier = SyntaxKind.ScopedKeyword; 1150if (syntaxTree.IsParameterModifierContext(position, tokenOnLeftOfPosition, includeOperators: false, out _, out var previousModifier) && 1151previousModifier == SyntaxKind.None) 1164if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken) 1166return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1178if (token.IsKind(SyntaxKind.DelegateKeyword) && 1179token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1193if (token.IsKind(SyntaxKind.OperatorKeyword) && 1194token.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 1210if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 1211token.Parent is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList)) 1225typeDecl.IsKind(SyntaxKind.ClassDeclaration) && 1226method.Modifiers.Any(SyntaxKind.StaticKeyword) && 1227typeDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 1236if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1238if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1239token.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 1255if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 1269if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1273else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1277else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName } && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1286return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1295if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 1328if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1331SyntaxKind.ParenthesizedExpression or 1332SyntaxKind.TupleExpression or 1333SyntaxKind.TupleType)) 1345if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1356if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1357leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1358leftToken.Parent.Parent is (kind: SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression)) 1374if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1384if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1392if (leftToken.Kind() is SyntaxKind.CaseKeyword or SyntaxKind.IsKeyword) 1399if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1406if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1413if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1420if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1428if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1429leftToken.Parent.IsParentKind(SyntaxKind.Subpattern)) 1439if (leftToken.IsKindOrHasMatchingText(SyntaxKind.AndKeyword) || leftToken.IsKindOrHasMatchingText(SyntaxKind.OrKeyword)) 1446if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1455if (leftToken.Kind() is SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken or SyntaxKind.LessThanToken or SyntaxKind.LessThanEqualsToken && 1456leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1472if (leftToken.IsKind(SyntaxKind.DotToken) || 1473leftToken.IsKind(SyntaxKind.MinusGreaterThanToken)) 1492return leftToken.Kind() is not (SyntaxKind.OrKeyword 1493or SyntaxKind.AndKeyword 1494or SyntaxKind.NotKeyword 1495or SyntaxKind.OpenParenToken 1496or SyntaxKind.ColonColonToken 1497or SyntaxKind.DotDotToken 1498or SyntaxKind.OpenBraceToken); 1534binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1576if (possibleCommaOrParen.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 1582SyntaxKind.ParenthesizedExpression or 1583SyntaxKind.TupleExpression or 1584SyntaxKind.TupleType or 1585SyntaxKind.CastExpression)) 1591if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1616if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation) || 1617leftToken.Parent.IsParentKind(SyntaxKind.ParenthesizedVariableDesignation)) 1637if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1647if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.TupleExpression)) 1657if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1681if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1687if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1699if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 1700leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1793if (token.IsKind(SyntaxKind.ConstKeyword) && 1794token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1803if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword) 1806if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement)) 1808if (parent.IsParentKind(SyntaxKind.VariableDeclaration) && 1810SyntaxKind.LocalDeclarationStatement or 1811SyntaxKind.ForStatement or 1812SyntaxKind.ForEachVariableStatement)) 1817if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement)) 1825if (token.IsKind(SyntaxKind.OutKeyword) && 1837if (token.IsKind(SyntaxKind.OpenParenToken)) 1840if (previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword or SyntaxKind.UsingKeyword) 1846if (token.IsKind(SyntaxKind.UsingKeyword) && 1854if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) && 1861if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1873if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1879if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax or ScopedTypeSyntax) 1896if (token.IsKind(SyntaxKind.OpenParenToken) && 1897token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1913if (token.IsKind(SyntaxKind.OpenParenToken) && 1914token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1927if (token.Kind() is SyntaxKind.IsKeyword or SyntaxKind.AsKeyword) 1938if (token.IsKind(SyntaxKind.NewKeyword)) 1992if (token.IsKind(SyntaxKind.None)) 2042if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2056if (token.IsKind(SyntaxKind.OpenParenToken) && 2057token.Parent.IsKind(SyntaxKind.CastExpression)) 2076if (token.IsKind(SyntaxKind.CaseKeyword) && 2077token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2082if (token.IsKind(SyntaxKind.EqualsToken) && 2085if (equalsValue.IsParentKind(SyntaxKind.VariableDeclarator) && 2086equalsValue.Parent.IsParentKind(SyntaxKind.VariableDeclaration)) 2092return fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2099return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2104if (equalsValue.IsParentKind(SyntaxKind.EnumMemberDeclaration)) 2110if (equalsValue.IsParentKind(SyntaxKind.Parameter)) 2118if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2119token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken) 2125if (token.IsKind(SyntaxKind.ColonToken) && 2126token.Parent.IsKind(SyntaxKind.NameColon) && 2127token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2133if (token.IsKind(SyntaxKind.EqualsToken) && 2134token.Parent.IsKind(SyntaxKind.NameEquals) && 2135token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2205is SyntaxKind.DotToken 2206or SyntaxKind.ColonColonToken 2207or SyntaxKind.MinusGreaterThanToken) 2214if (token.IsKind(SyntaxKind.EqualsToken)) 2216if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2217token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2237is SyntaxKind.EqualsToken 2238or SyntaxKind.MinusEqualsToken 2239or SyntaxKind.AsteriskEqualsToken 2240or SyntaxKind.PlusEqualsToken 2241or SyntaxKind.SlashEqualsToken 2242or SyntaxKind.ExclamationEqualsToken 2243or SyntaxKind.CaretEqualsToken 2244or SyntaxKind.AmpersandEqualsToken 2245or SyntaxKind.BarEqualsToken 2246or SyntaxKind.PercentEqualsToken 2247or SyntaxKind.LessThanLessThanEqualsToken 2248or SyntaxKind.GreaterThanGreaterThanEqualsToken 2249or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2250or SyntaxKind.QuestionQuestionEqualsToken) 2256if (token.IsKind(SyntaxKind.OpenParenToken)) 2258if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2331if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2348tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2351if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2352previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2355if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2374if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2375token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2382if (token.IsKind(SyntaxKind.DotDotToken) && 2383token.Parent.IsKind(SyntaxKind.RangeExpression) && 2390if (token.IsKind(SyntaxKind.QuestionToken) && 2399if (token.IsKind(SyntaxKind.ColonToken) && 2400token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2408if (token.IsKind(SyntaxKind.OpenParenToken)) 2410if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2419if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2430if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2431token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2440if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2442if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2453if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2455if (token.Parent.IsKind(SyntaxKind.Argument)) 2459else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2463if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2473if (token.IsKind(SyntaxKind.ColonToken) && 2474token.Parent.IsKind(SyntaxKind.NameColon) && 2475token.Parent.IsParentKind(SyntaxKind.Argument)) 2481if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2488if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2494if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2497if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2524if (token.IsKind(SyntaxKind.SemicolonToken) && 2535if (token.IsKind(SyntaxKind.OpenParenToken) && 2544if (token.IsKind(SyntaxKind.CommaToken) && 2545token.Parent.IsKind(SyntaxKind.ForStatement)) 2554if (token.IsKind(SyntaxKind.InKeyword)) 2557SyntaxKind.ForEachStatement or 2558SyntaxKind.ForEachVariableStatement or 2559SyntaxKind.FromClause or 2560SyntaxKind.JoinClause)) 2568if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2569token.Parent.IsKind(SyntaxKind.JoinClause)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2576token.Parent.IsKind(SyntaxKind.WhereClause)) 2583if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2584token.Parent.IsKind(SyntaxKind.OrderByClause)) 2590if (token.IsKind(SyntaxKind.SelectKeyword) && 2591token.Parent.IsKind(SyntaxKind.SelectClause)) 2598if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2599token.Parent.IsKind(SyntaxKind.GroupClause)) 2607if (token.IsKind(SyntaxKind.ReturnKeyword)) 2609if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2616if (token.IsKind(SyntaxKind.ThrowKeyword)) 2622if (token.IsKind(SyntaxKind.OpenParenToken) && 2623token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2632if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2673if (token.IsKind(SyntaxKind.OpenParenToken) && 2674token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2680if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2697if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2698token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2706if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2707token.Parent.IsKind(SyntaxKind.ListPattern)) 2715if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2716token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2724if (token.Kind() is SyntaxKind.DotDotToken && 2725token.Parent.IsKind(SyntaxKind.SpreadElement)) 2736if (token.IsKind(SyntaxKind.OpenBraceToken)) 2757if (token.IsKind(SyntaxKind.DotToken)) 2760if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2763while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2768if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2776if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2779while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2784if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2795if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2829if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2859if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2874if (token.IsKind(SyntaxKind.IdentifierToken) && 2875token.Parent.IsKind(SyntaxKind.IdentifierName) && 2876token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2882if (token.Kind() is SyntaxKind.IdentifierToken && 2883token.Parent.IsKind(SyntaxKind.IdentifierName)) 2885if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2889if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2907if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2925case SyntaxKind.QualifiedName: 2927case SyntaxKind.AliasQualifiedName: 2929case SyntaxKind.SimpleMemberAccessExpression: 2958if (token.IsKind(SyntaxKind.CloseBraceToken)) 2964block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2984if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2989if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2990token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3007targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3018targetToken.IsKind(SyntaxKind.ColonToken) && 3019targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3020targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3029if (!token.IsKind(SyntaxKind.DotToken)) 3035if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3041token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3080return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3081targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
30if (expression.IsKind(SyntaxKind.RefExpression)) 42if (expression.IsKind(SyntaxKind.ThrowExpression)) 58Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 60Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 72Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 74Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (2)
43constraints.Add(ClassOrStructConstraint(SyntaxKind.ClassConstraint)); 51constraints.Add(ClassOrStructConstraint(SyntaxKind.StructConstraint));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
97if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
111SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\NameSyntaxExtensions.cs (4)
36is SyntaxKind.AliasQualifiedName 37or SyntaxKind.NameColon 38or SyntaxKind.NameEquals 39or SyntaxKind.TypeParameterConstraintClause)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (4)
12this SeparatedSyntaxList<T> separatedList, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken) 19this SeparatedSyntaxList<T> separatedList, int index, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (2)
23var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 47default, SyntaxKind.None, "@" + unescaped, unescaped, default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenListExtensions.cs (1)
12public static IEnumerable<SyntaxToken> SkipKinds(this SyntaxTokenList tokenList, params SyntaxKind[] kinds)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs (17)
58if (token.Kind() == SyntaxKind.None) 74case SyntaxKind.LessThanToken: 81if (token.Kind() == SyntaxKind.None) 92if (token.Kind() == SyntaxKind.IdentifierToken) 113case SyntaxKind.GreaterThanToken: 114case SyntaxKind.GreaterThanGreaterThanToken: 115case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 127case SyntaxKind.AsteriskToken: // for int* 128case SyntaxKind.QuestionToken: // for int? 129case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 130case SyntaxKind.ColonColonToken: // for global:: 131case SyntaxKind.CloseBracketToken: 132case SyntaxKind.OpenBracketToken: 133case SyntaxKind.DotToken: 134case SyntaxKind.IdentifierToken: 137case SyntaxKind.CommaToken: 162if (token.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (6)
74if (typeNode.Modifiers.Any(SyntaxKind.PartialKeyword)) 97private static SyntaxToken EnsureToken(SyntaxToken token, SyntaxKind kind, bool prependNewLineIfMissing = false, bool appendNewLineIfMissing = false) 99if (token.IsMissing || token.IsKind(SyntaxKind.None)) 111var openBrace = EnsureToken(typeDeclaration.OpenBraceToken, SyntaxKind.OpenBraceToken); 112var closeBrace = EnsureToken(typeDeclaration.CloseBraceToken, SyntaxKind.CloseBraceToken, appendNewLineIfMissing: true); 117if (addedBraces && typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (26)
50token.Kind() is SyntaxKind.EndOfFileToken or SyntaxKind.None || 58if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 63if (token.IsKind(SyntaxKind.ColonToken) && !token.Parent.IsKind(SyntaxKind.LabeledStatement) && token.Parent is not SwitchLabelSyntax) 67if (token.IsKind(SyntaxKind.OpenBraceToken) && !token.IsFirstTokenOnLine(documentSyntax.Text)) 129(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 130(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 151if (token.Kind() != SyntaxKind.ElseKeyword || 199if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 289if (tokenBeforeCaret.Kind() is SyntaxKind.CloseBraceToken or 290SyntaxKind.EndOfFileToken) 301internal static bool ValidSingleOrMultiCharactersTokenKind(char typedChar, SyntaxKind kind) 304'n' => kind is SyntaxKind.RegionKeyword or SyntaxKind.EndRegionKeyword, 305't' => kind is SyntaxKind.SelectKeyword, 306'e' => kind is SyntaxKind.WhereKeyword or SyntaxKind.ElseKeyword, 317is SyntaxKind.None 318or SyntaxKind.EndOfDirectiveToken 319or SyntaxKind.EndOfFileToken; 354if (currentToken.Kind() == SyntaxKind.OpenBraceToken && 356currentTokenParentParent.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
104while (node != null && node.Kind() != SyntaxKind.CompilationUnit)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (8)
79if (token.IsKind(SyntaxKind.None) || 89if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing) 109return token.Kind() is SyntaxKind.None or SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken; 125node.IsKind(SyntaxKind.Interpolation)) 132!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) && 141constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (22)
74Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 81if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 120if (token.Kind() is SyntaxKind.InterpolatedMultiLineRawStringStartToken or SyntaxKind.InterpolatedStringTextToken 121|| token is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax }) 125if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 139if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 175token.Kind() is SyntaxKind.InterpolatedVerbatimStringStartToken or SyntaxKind.InterpolatedStringTextToken || 176(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 240case SyntaxKind.SemicolonToken: 251case SyntaxKind.CloseBraceToken: 253if (token.Parent.IsKind(SyntaxKind.AccessorList) && 254token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 265case SyntaxKind.OpenBraceToken: 270case SyntaxKind.ColonToken: 283case SyntaxKind.CloseBracketToken: 297case SyntaxKind.XmlTextLiteralToken: 302case SyntaxKind.CommaToken: 307case SyntaxKind.CloseParenToken: 309if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
103=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63(i == 0 && currentUsing.IsParentKind(SyntaxKind.FileScopedNamespaceDeclaration)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
85if (braces.openBrace.Kind() == SyntaxKind.None && 86braces.closeBrace.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (19)
67.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 109=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 126SyntaxKind.InterpolatedStringTextToken, 139SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 216=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 242=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 270return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 276return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 289SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 313SyntaxKind.SimpleMemberAccessExpression, 325is SyntaxKind.ThisExpression 326or SyntaxKind.BaseExpression 327or SyntaxKind.ParenthesizedExpression 328or SyntaxKind.SimpleMemberAccessExpression 329or SyntaxKind.InvocationExpression 330or SyntaxKind.ElementAccessExpression 331or SyntaxKind.MemberBindingExpression) 340=> CreateBinaryExpression(SyntaxKind.BitwiseOrExpression, left, right); 342public static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (81)
327if (argument.Parent.IsParentKind(SyntaxKind.ImplicitElementAccess) && 328argument.Parent.Parent.IsParentKind(SyntaxKind.SimpleAssignmentExpression) && 329argument.Parent.Parent.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression) && 350if (previousToken.IsKind(SyntaxKind.CommaToken)) 431if (previousToken.Kind() == SyntaxKind.NewKeyword && 432previousToken.GetPreviousToken().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 518if (previousToken != argumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 548if (previousToken != attributeArgumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 822if (previousToken.HasValue && previousToken.Value.GetPreviousToken().Kind() == SyntaxKind.EqualsToken) 897if (previousToken != bracketedArgumentList.OpenBracketToken && previousToken.Kind() != SyntaxKind.CommaToken) 954if (binop.Kind() == SyntaxKind.CoalesceExpression) 962case SyntaxKind.LessThanLessThanToken: 963case SyntaxKind.GreaterThanGreaterThanToken: 964case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 965case SyntaxKind.LessThanLessThanEqualsToken: 966case SyntaxKind.GreaterThanGreaterThanEqualsToken: 967case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 979if (operatorToken.Kind() is SyntaxKind.AmpersandAmpersandToken or 980SyntaxKind.BarBarToken) 986if (binop.Kind() == SyntaxKind.SimpleAssignmentExpression && 1015if (operatorToken.Kind() is SyntaxKind.AmpersandToken or 1016SyntaxKind.AmpersandEqualsToken or 1017SyntaxKind.BarToken or 1018SyntaxKind.BarEqualsToken or 1019SyntaxKind.CaretToken or 1020SyntaxKind.CaretEqualsToken) 1031if (operatorToken.Kind() == SyntaxKind.PlusToken) 1046case SyntaxKind.BarToken: 1047case SyntaxKind.CaretToken: 1048case SyntaxKind.AmpersandToken: 1049case SyntaxKind.LessThanToken: 1050case SyntaxKind.LessThanEqualsToken: 1051case SyntaxKind.GreaterThanToken: 1052case SyntaxKind.GreaterThanEqualsToken: 1053case SyntaxKind.PlusToken: 1054case SyntaxKind.MinusToken: 1055case SyntaxKind.AsteriskToken: 1056case SyntaxKind.SlashToken: 1057case SyntaxKind.PercentToken: 1058case SyntaxKind.CaretEqualsToken: 1059case SyntaxKind.PlusEqualsToken: 1060case SyntaxKind.MinusEqualsToken: 1061case SyntaxKind.AsteriskEqualsToken: 1062case SyntaxKind.SlashEqualsToken: 1063case SyntaxKind.PercentEqualsToken: 1064case SyntaxKind.LessThanLessThanToken: 1065case SyntaxKind.GreaterThanGreaterThanToken: 1066case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1067case SyntaxKind.LessThanLessThanEqualsToken: 1068case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1069case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1072case SyntaxKind.BarEqualsToken: 1073case SyntaxKind.AmpersandEqualsToken: 1224if (equalsValue.IsParentKind(SyntaxKind.Parameter) && 1381if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1401else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression)) 1423foreach (var sibling in initializerExpression.Expressions.Where(e => e.Kind() != SyntaxKind.ComplexElementInitializerExpression)) 1492else if (initializerExpression.IsParentKind(SyntaxKind.SimpleAssignmentExpression)) 1582if (identifier.HasMatchingText(SyntaxKind.OrKeyword) || 1583identifier.HasMatchingText(SyntaxKind.AndKeyword)) 1703var isAsync = anonymousFunction.AsyncKeyword.Kind() != SyntaxKind.None; 1807memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) 1831if (ienumerableType != null && memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocation)) 1973case SyntaxKind.PostDecrementExpression: 1974case SyntaxKind.PostIncrementExpression: 1988case SyntaxKind.PreDecrementExpression: 1989case SyntaxKind.PreIncrementExpression: 1990case SyntaxKind.UnaryPlusExpression: 1991case SyntaxKind.UnaryMinusExpression: 1995case SyntaxKind.BitwiseNotExpression: 2007case SyntaxKind.LogicalNotExpression: 2011case SyntaxKind.AddressOfExpression: 2062if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))) 2180if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2192switchLabel.Kind() != SyntaxKind.CaseSwitchLabel) 2211.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2270if (variableDeclaration.IsParentKind(SyntaxKind.UsingStatement)) 2274if (variableDeclaration.IsParentKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
276.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (5)
23if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 28if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 34if (parentOfToken is SimpleNameSyntax && parent.Kind() == SyntaxKind.XmlNameAttribute) 41if (parent.Kind() == SyntaxKind.AliasQualifiedName &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NameSyntaxIterator.cs (1)
27if (currentNode.Kind() == SyntaxKind.QualifiedName)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (101)
11public static readonly ISet<SyntaxKind> AllTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 13SyntaxKind.AbstractKeyword, 15SyntaxKind.ClosedKeyword, 17SyntaxKind.FileKeyword, 18SyntaxKind.InternalKeyword, 19SyntaxKind.NewKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.RefKeyword 30public static readonly ISet<SyntaxKind> AllMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.AbstractKeyword, 33SyntaxKind.AsyncKeyword, 34SyntaxKind.ExternKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.NewKeyword, 37SyntaxKind.OverrideKeyword, 38SyntaxKind.PublicKeyword, 39SyntaxKind.PrivateKeyword, 40SyntaxKind.ProtectedKeyword, 41SyntaxKind.ReadOnlyKeyword, 42SyntaxKind.RequiredKeyword, 43SyntaxKind.SealedKeyword, 44SyntaxKind.StaticKeyword, 45SyntaxKind.UnsafeKeyword, 46SyntaxKind.VirtualKeyword, 47SyntaxKind.VolatileKeyword, 50public static readonly ISet<SyntaxKind> AllGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 52SyntaxKind.ExternKeyword, 53SyntaxKind.InternalKeyword, 54SyntaxKind.NewKeyword, 55SyntaxKind.OverrideKeyword, 56SyntaxKind.PublicKeyword, 57SyntaxKind.PrivateKeyword, 58SyntaxKind.ReadOnlyKeyword, 59SyntaxKind.StaticKeyword, 60SyntaxKind.UnsafeKeyword, 61SyntaxKind.VolatileKeyword, 64public static readonly ISet<SyntaxKind> AccessibilityModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 66SyntaxKind.PublicKeyword, 67SyntaxKind.PrivateKeyword, 68SyntaxKind.ProtectedKeyword, 69SyntaxKind.InternalKeyword, 72public static readonly ISet<SyntaxKind> AllTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 74SyntaxKind.InterfaceDeclaration, 75SyntaxKind.ClassDeclaration, 76SyntaxKind.RecordDeclaration, 77SyntaxKind.StructDeclaration, 78SyntaxKind.RecordStructDeclaration, 80SyntaxKind.UnionDeclaration, 82SyntaxKind.EnumDeclaration, 85public static readonly ISet<SyntaxKind> ClassInterfaceStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 87SyntaxKind.InterfaceDeclaration, 88SyntaxKind.ClassDeclaration, 89SyntaxKind.RecordDeclaration, 90SyntaxKind.StructDeclaration, 91SyntaxKind.RecordStructDeclaration, 93SyntaxKind.UnionDeclaration, 97public static readonly ISet<SyntaxKind> NonEnumTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 99SyntaxKind.ClassDeclaration, 101SyntaxKind.ExtensionBlockDeclaration, 102SyntaxKind.UnionDeclaration, 104SyntaxKind.InterfaceDeclaration, 105SyntaxKind.RecordDeclaration, 106SyntaxKind.RecordStructDeclaration, 107SyntaxKind.StructDeclaration, 110public static readonly ISet<SyntaxKind> ClassInterfaceRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 112SyntaxKind.InterfaceDeclaration, 113SyntaxKind.ClassDeclaration, 114SyntaxKind.RecordDeclaration, 117public static readonly ISet<SyntaxKind> ClassRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 119SyntaxKind.ClassDeclaration, 120SyntaxKind.RecordDeclaration, 123public static readonly ISet<SyntaxKind> ClassStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 125SyntaxKind.ClassDeclaration, 126SyntaxKind.RecordDeclaration, 127SyntaxKind.StructDeclaration, 128SyntaxKind.RecordStructDeclaration, 130SyntaxKind.UnionDeclaration, 134public static readonly ISet<SyntaxKind> StructOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 136SyntaxKind.StructDeclaration, 137SyntaxKind.RecordStructDeclaration, 139SyntaxKind.UnionDeclaration, 143public static readonly ISet<SyntaxKind> InterfaceOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 145SyntaxKind.InterfaceDeclaration,
Microsoft.CodeAnalysis.CSharp.Features (4100)
AddImport\CSharpAddImportFeatureService.cs (10)
55if (node.Parent is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) simpleMemberAccess || 75else if (node.Parent.IsKind(SyntaxKind.CollectionInitializerExpression)) 126if (nameNode?.Parent?.Kind() is not SyntaxKind.SimpleMemberAccessExpression and not SyntaxKind.MemberBindingExpression) 131if (memberAccess?.Parent?.Kind() is SyntaxKind.SimpleMemberAccessExpression or SyntaxKind.ElementAccessExpression || 132memberBinding?.Parent?.Kind() is SyntaxKind.SimpleMemberAccessExpression or SyntaxKind.ElementAccessExpression) 422if (SyntaxFacts.GetKeywordKind(part) != SyntaxKind.None) 623if (node.Parent.IsKind(SyntaxKind.CollectionInitializerExpression))
BraceCompletion\BracketBraceCompletionService.cs (4)
31protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.OpenBracketToken); 33protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CloseBracketToken); 49if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && currentToken.Parent.IsKind(SyntaxKind.ListPattern))
BraceCompletion\CharLiteralBraceCompletionService.cs (2)
25protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CharacterLiteralToken); 27protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CharacterLiteralToken);
BraceCompletion\CurlyBraceCompletionService.cs (32)
48=> token.IsKind(SyntaxKind.OpenBraceToken) && !token.Parent.IsKind(SyntaxKind.Interpolation); 51=> token.IsKind(SyntaxKind.CloseBraceToken); 126if (!currentToken.IsKind(SyntaxKind.OpenBraceToken)) 140SyntaxKind.ObjectInitializerExpression or 141SyntaxKind.CollectionInitializerExpression or 142SyntaxKind.ArrayInitializerExpression or 143SyntaxKind.ImplicitArrayCreationExpression or 144SyntaxKind.WithInitializerExpression or 145SyntaxKind.PropertyPatternClause)) 159if (currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 165if (currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 177if (currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 201if (node.IsKind(SyntaxKind.SwitchStatement)) 210case SyntaxKind.IfStatement: 211case SyntaxKind.ElseClause: 212case SyntaxKind.WhileStatement: 213case SyntaxKind.DoStatement: 214case SyntaxKind.ForEachStatement: 215case SyntaxKind.ForEachVariableStatement: 216case SyntaxKind.UsingStatement: 217case SyntaxKind.ForStatement: 218case SyntaxKind.TryStatement: 219case SyntaxKind.CatchClause: 220case SyntaxKind.FinallyClause: 221case SyntaxKind.LockStatement: 222case SyntaxKind.CheckedStatement: 223case SyntaxKind.UncheckedStatement: 224case SyntaxKind.SwitchSection: 225case SyntaxKind.FixedStatement: 226case SyntaxKind.UnsafeStatement:
BraceCompletion\InterpolatedStringBraceCompletionService.cs (3)
37=> leftToken.Kind() is SyntaxKind.InterpolatedStringStartToken or SyntaxKind.InterpolatedVerbatimStringStartToken; 40=> rightToken.IsKind(SyntaxKind.InterpolatedStringEndToken);
BraceCompletion\InterpolationBraceCompletionService.cs (5)
42=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation); 45=> token.IsKind(SyntaxKind.CloseBraceToken); 67return token.Parent.IsKind(SyntaxKind.InterpolatedStringExpression) || token.Parent.IsParentKind(SyntaxKind.InterpolatedStringExpression);
BraceCompletion\LessAndGreaterThanBraceCompletionService.cs (3)
33=> token.IsKind(SyntaxKind.LessThanToken); 36=> token.IsKind(SyntaxKind.GreaterThanToken); 52if (token.Parent is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) node || node.OperatorToken != token)
BraceCompletion\ParenthesisBraceCompletionService.cs (3)
26protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.OpenParenToken); 28protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CloseParenToken); 44if (closeParen.Kind() != SyntaxKind.CloseParenToken || closeParen.Span.Length == 0)
BraceCompletion\StringLiteralBraceCompletionService.cs (4)
51protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.StringLiteralToken); 53protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.StringLiteralToken); 73if (token.IsKind(SyntaxKind.StringLiteralToken) && 96while (!token.IsKind(SyntaxKind.None) && !token.TrailingTrivia.Contains(t => t.IsEndOfLine()))
BraceMatching\AbstractCSharpBraceMatcher.cs (2)
11protected AbstractCSharpBraceMatcher(SyntaxKind openBrace, SyntaxKind closeBrace)
BraceMatching\BlockCommentBraceMatcher.cs (2)
47if (trivia.Kind() is SyntaxKind.MultiLineCommentTrivia && 52else if (trivia.Kind() is SyntaxKind.MultiLineDocumentationCommentTrivia)
BraceMatching\LessThanGreaterThanBraceMatcher.cs (2)
18: base(SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken)
BraceMatching\OpenCloseBraceBraceMatcher.cs (2)
18: base(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken)
BraceMatching\OpenCloseBracketBraceMatcher.cs (2)
18: base(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken)
BraceMatching\OpenCloseParenBraceMatcher.cs (2)
18: base(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken)
BraceMatching\StringLiteralBraceMatcher.cs (5)
33if (token.IsKind(SyntaxKind.StringLiteralToken)) 37else if (token.IsKind(SyntaxKind.Utf8StringLiteralToken)) 41else if (token.Kind() is SyntaxKind.InterpolatedStringStartToken or SyntaxKind.InterpolatedVerbatimStringStartToken) 48else if (token.IsKind(SyntaxKind.InterpolatedStringEndToken))
ChangeSignature\ChangeSignatureFormattingRule.cs (7)
19private static readonly ImmutableArray<SyntaxKind> s_allowableKinds = 21SyntaxKind.ParameterList, 22SyntaxKind.ArgumentList, 23SyntaxKind.BracketedParameterList, 24SyntaxKind.BracketedArgumentList, 25SyntaxKind.AttributeArgumentList, 54if (previousToken.Kind() == SyntaxKind.CommaToken && s_allowableKinds.Contains(previousToken.Parent.Kind()))
ChangeSignature\CSharpChangeSignatureService.cs (83)
41private static readonly ImmutableArray<SyntaxKind> _declarationKinds = 43SyntaxKind.MethodDeclaration, 44SyntaxKind.ConstructorDeclaration, 45SyntaxKind.IndexerDeclaration, 46SyntaxKind.DelegateDeclaration, 47SyntaxKind.SimpleLambdaExpression, 48SyntaxKind.ParenthesizedLambdaExpression, 49SyntaxKind.LocalFunctionStatement, 50SyntaxKind.RecordStructDeclaration, 51SyntaxKind.RecordDeclaration, 52SyntaxKind.StructDeclaration, 53SyntaxKind.ClassDeclaration, 56private static readonly ImmutableArray<SyntaxKind> _declarationAndInvocableKinds = 58SyntaxKind.InvocationExpression, 59SyntaxKind.ElementAccessExpression, 60SyntaxKind.ThisConstructorInitializer, 61SyntaxKind.BaseConstructorInitializer, 62SyntaxKind.ObjectCreationExpression, 63SyntaxKind.ImplicitObjectCreationExpression, 64SyntaxKind.Attribute, 65SyntaxKind.NameMemberCref]; 67private static readonly ImmutableArray<SyntaxKind> _updatableAncestorKinds = 69SyntaxKind.ConstructorDeclaration, 70SyntaxKind.IndexerDeclaration, 71SyntaxKind.InvocationExpression, 72SyntaxKind.ElementAccessExpression, 73SyntaxKind.ThisConstructorInitializer, 74SyntaxKind.BaseConstructorInitializer, 75SyntaxKind.ObjectCreationExpression, 76SyntaxKind.Attribute, 77SyntaxKind.DelegateDeclaration, 78SyntaxKind.SimpleLambdaExpression, 79SyntaxKind.ParenthesizedLambdaExpression, 80SyntaxKind.NameMemberCref, 81SyntaxKind.PrimaryConstructorBaseType, 84private static readonly ImmutableArray<SyntaxKind> _updatableNodeKinds = 86SyntaxKind.MethodDeclaration, 87SyntaxKind.LocalFunctionStatement, 88SyntaxKind.ConstructorDeclaration, 89SyntaxKind.IndexerDeclaration, 90SyntaxKind.InvocationExpression, 91SyntaxKind.ElementAccessExpression, 92SyntaxKind.ThisConstructorInitializer, 93SyntaxKind.BaseConstructorInitializer, 94SyntaxKind.ObjectCreationExpression, 95SyntaxKind.ImplicitObjectCreationExpression, 96SyntaxKind.Attribute, 97SyntaxKind.DelegateDeclaration, 98SyntaxKind.NameMemberCref, 99SyntaxKind.AnonymousMethodExpression, 100SyntaxKind.ParenthesizedLambdaExpression, 101SyntaxKind.SimpleLambdaExpression, 102SyntaxKind.RecordStructDeclaration, 103SyntaxKind.RecordDeclaration, 104SyntaxKind.StructDeclaration, 105SyntaxKind.ClassDeclaration, 106SyntaxKind.PrimaryConstructorBaseType, 124if (token.Kind() == SyntaxKind.SemicolonToken && token.Parent is StatementSyntax) 200current.Kind() == SyntaxKind.Block || current.Kind() == SyntaxKind.ArrowExpressionClause) 264case SyntaxKind.InvocationExpression: 267case SyntaxKind.ElementAccessExpression: 270case SyntaxKind.ObjectCreationExpression: 273case SyntaxKind.PrimaryConstructorBaseType: 274case SyntaxKind.ConstructorDeclaration: 275case SyntaxKind.IndexerDeclaration: 276case SyntaxKind.ThisConstructorInitializer: 277case SyntaxKind.BaseConstructorInitializer: 278case SyntaxKind.Attribute: 279case SyntaxKind.DelegateDeclaration: 280case SyntaxKind.NameMemberCref: 301is SyntaxKind.MethodDeclaration 302or SyntaxKind.ConstructorDeclaration 303or SyntaxKind.IndexerDeclaration 304or SyntaxKind.DelegateDeclaration 305or SyntaxKind.RecordStructDeclaration 306or SyntaxKind.RecordDeclaration 307or SyntaxKind.StructDeclaration 308or SyntaxKind.ClassDeclaration) 695var oldOnlyHasWhitespaceTrivia = oldTrivia.All(t => t.IsKind(SyntaxKind.WhitespaceTrivia)); 698var newOnlyHasWhitespaceTrivia = newTrivia.All(t => t.IsKind(SyntaxKind.WhitespaceTrivia)); 878if (!node.IsKind(SyntaxKind.IdentifierName) || 924var initializerExpression = InitializerExpression(SyntaxKind.ArrayInitializerExpression, listOfArguments);
ChangeSignature\UnifiedArgumentSyntax.cs (2)
19Debug.Assert(argument.Kind() is SyntaxKind.Argument or SyntaxKind.AttributeArgument);
CodeFixes\GenerateType\GenerateTypeCodeFixProvider.cs (1)
44SimpleNameSyntax simple => !simple.IsParentKind(SyntaxKind.QualifiedName),
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (15)
90attributeList.Target.Identifier.Kind() == SyntaxKind.AssemblyKeyword; 94=> trivia.Kind() is SyntaxKind.EndOfLineTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia; 97=> token.Kind() == SyntaxKind.EndOfFileToken; 180var category = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(diagnostic.Descriptor.Category)); 185var ruleId = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(ruleIdText)); 188var justificationExpr = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(FeaturesResources.Pending)); 198var scopeExpr = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(scopeString)); 202var targetExpr = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(targetString)); 224if (trivia.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia) 227enableDirective = pragmaWarning.DisableOrRestoreKeyword.Kind() == SyntaxKind.RestoreKeyword; 241var toggledKeywordKind = currentKeyword.Kind() == SyntaxKind.DisableKeyword ? SyntaxKind.RestoreKeyword : SyntaxKind.DisableKeyword;
CodeLens\CSharpCodeLensDisplayInfoService.cs (15)
40case SyntaxKind.LocalDeclarationStatement: 46case SyntaxKind.FieldDeclaration: 47case SyntaxKind.EventFieldDeclaration: 53case SyntaxKind.VariableDeclaration: 58case SyntaxKind.PredefinedType: 62case SyntaxKind.MultiLineDocumentationCommentTrivia: 63case SyntaxKind.SingleLineDocumentationCommentTrivia: 96if (node.Parent.IsKind(SyntaxKind.AccessorList) && 97node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration)) 104case SyntaxKind.ConstructorDeclaration: 119case SyntaxKind.IndexerDeclaration: 132case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.UsingDirective: 166case SyntaxKind.ExternAliasDirective:
CodeRefactorings\AddAwait\CSharpAddAwaitCodeRefactoringProvider.cs (1)
39return methodDeclaration.Modifiers.Any(SyntaxKind.AsyncKeyword);
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
240if (node.IsParentKind(SyntaxKind.CastExpression))
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (29)
27directive => directive.IsKind(SyntaxKind.NullableDirectiveTrivia); 48if (token.IsKind(SyntaxKind.EndOfDirectiveToken)) 51if (token.Kind() is not (SyntaxKind.EnableKeyword or SyntaxKind.RestoreKeyword or SyntaxKind.DisableKeyword or SyntaxKind.NullableKeyword or SyntaxKind.HashToken) || 100if (firstToken.IsKind(SyntaxKind.None)) 121if (firstNonDirectiveToken.IsKind(SyntaxKind.None) && firstDirective is null) 138if (originalNode.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 144if (originalNode.SettingToken.IsKind(SyntaxKind.RestoreKeyword)) 149if (originalNode.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 176else if (leadingDirective.SettingToken.IsKind(SyntaxKind.RestoreKeyword) && leadingDirective.TargetToken.IsKind(SyntaxKind.None)) 197case SyntaxKind.WhitespaceTrivia: 198case SyntaxKind.EndOfLineTrivia: 199case SyntaxKind.SingleLineCommentTrivia: 200case SyntaxKind.MultiLineCommentTrivia: 203case SyntaxKind.SingleLineDocumentationCommentTrivia: 204case SyntaxKind.MultiLineDocumentationCommentTrivia: 220if (firstToken.IsKind(SyntaxKind.None)) 225if (firstToken.IsKind(SyntaxKind.HashToken) && firstToken.Parent.IsKind(SyntaxKind.RegionDirectiveTrivia)) 230if (nextToken.IsKind(SyntaxKind.HashToken) && nextToken.Parent.IsKind(SyntaxKind.EndRegionDirectiveTrivia)) 243var firstRelevantDirective = root.GetFirstDirective(static directive => directive.Kind() is SyntaxKind.NullableDirectiveTrivia or SyntaxKind.IfDirectiveTrivia); 245&& nullableDirective.TargetToken.IsKind(SyntaxKind.None)) 248if (firstSemanticToken.IsKind(SyntaxKind.None) || firstSemanticToken.SpanStart > nullableDirective.Span.End)
CodeRefactorings\InlineMethod\CSharpInlineMethodRefactoringProvider.cs (11)
66=> node.IsKind(SyntaxKind.FieldDeclaration); 91is SyntaxKind.InvocationExpression 92or SyntaxKind.ObjectCreationExpression 93or SyntaxKind.PreIncrementExpression 94or SyntaxKind.PreDecrementExpression 95or SyntaxKind.PostIncrementExpression 96or SyntaxKind.PostDecrementExpression 97or SyntaxKind.AwaitExpression; 112BinaryExpressionSyntax(kind: SyntaxKind.CoalesceExpression) binaryExpressionSyntax 116var parent => parent.IsKind(SyntaxKind.ArrowExpressionClause), 133(whenNotNull.IsKind(SyntaxKind.InvocationExpression) || IsNullConditionalInvocationExpression(whenNotNull));
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (22)
64variableDeclarator.Initializer.Value.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 69if (variableDeclaration.Type.Kind() == SyntaxKind.RefType) 112if (argument.RefOrOutKeyword.Kind() != SyntaxKind.None) 116SyntaxKind.PreDecrementExpression or 117SyntaxKind.PreIncrementExpression or 118SyntaxKind.PostDecrementExpression or 119SyntaxKind.PostIncrementExpression or 120SyntaxKind.AddressOfExpression) 264var leadingTrivia = spreadElement.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) space] 307if (descendantNodesAndSelf.Any(n => n.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.InvocationExpression)) 341while (scope.IsKind(SyntaxKind.LabeledStatement)) 347if (scope.IsKind(SyntaxKind.GlobalStatement)) 394.SkipWhile(t => t.IsKind(SyntaxKind.WhitespaceTrivia)) 400.SkipWhile(t => t is (kind: SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia)) 462else if (expression is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 506while (parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 509while (parent.IsKind(SyntaxKind.Argument)) 512if (!parent.IsKind(SyntaxKind.TupleExpression)) 516else if (parent?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
168newNode = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccessNamespaceName, nameRef.WithoutTrivia()); 448SyntaxKind.SimpleMemberAccessExpression,
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (3)
41Debug.Assert(declaration.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (6)
30using static SyntaxKind; 318if (designation is not { Parent: PatternSyntax(not SyntaxKind.ListPattern) containingPattern }) 324Debug.Assert(containingPattern.Kind() is SyntaxKind.VarPattern or SyntaxKind.DeclarationPattern or SyntaxKind.RecursivePattern); 558when canConvertToSubpattern(name, arg) && !memberAccess.Expression.IsKind(SyntaxKind.BaseExpression):
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (6)
68if (token.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 111if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList) 133if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList) 161var displayTextSuffix = rightToken.IsKind(SyntaxKind.EqualsToken) ? null : SpaceEqualsString; 183var displayTextSuffix = rightToken.IsKind(SyntaxKind.ColonToken) ? null : ColonString;
Completion\CompletionProviders\AwaitCompletionProvider.cs (3)
81if (existingReturnType is PredefinedTypeSyntax { Keyword: (kind: SyntaxKind.VoidKeyword) }) 138if (node?.Parent is AssignmentExpressionSyntax(kind: SyntaxKind.AddAssignmentExpression or SyntaxKind.SubtractAssignmentExpression) assignment)
Completion\CompletionProviders\CompletionUtilities.cs (9)
34if (token.Kind() == SyntaxKind.DotToken) 38if (token.Kind() == SyntaxKind.DotDotToken && token.SpanStart == characterPosition) 54if (dotToken.GetPreviousToken().Kind() == SyntaxKind.NumericLiteralToken) 167symbol.DeclaringSyntaxReferences[0].GetSyntax().Kind() == SyntaxKind.DefaultSwitchLabel) 327if (tokenLeftOfGenericName.IsKind(SyntaxKind.DotToken) && tokenLeftOfGenericName.Parent.IsKind(SyntaxKind.QualifiedName)) 341if (prevToken.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword && prevToken.Parent.IsKind(SyntaxKind.RefType))
Completion\CompletionProviders\CrefCompletionProvider.cs (15)
120return token.Kind() is SyntaxKind.DoubleQuoteToken or SyntaxKind.SingleQuoteToken && 121token.Parent.IsKind(SyntaxKind.XmlCrefAttribute); 136if (token.Parent?.Kind() is not (SyntaxKind.CrefParameterList or SyntaxKind.CrefBracketedParameterList)) 139if (token.IsKind(SyntaxKind.OpenParenToken) && 140token.Parent.IsKind(SyntaxKind.CrefParameterList)) 145if (token.IsKind(SyntaxKind.OpenBracketToken) && 146token.Parent.IsKind(SyntaxKind.CrefBracketedParameterList)) 151return token is (kind: SyntaxKind.CommaToken or SyntaxKind.RefKeyword or SyntaxKind.OutKeyword); 159return token.IsKind(SyntaxKind.DotToken) 160&& token.Parent.IsKind(SyntaxKind.QualifiedCref); 275if (symbol is INamespaceOrTypeSymbol && token.IsKind(SyntaxKind.DotToken))
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (25)
41if (token.Kind() == SyntaxKind.None) 62else if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) || token.IsKindOrHasMatchingText(SyntaxKind.JoinKeyword)) 74case SyntaxKind.ClassKeyword: 77case SyntaxKind.StructKeyword: 80case SyntaxKind.InterfaceKeyword: 100return token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken; 109if (token.IsKind(SyntaxKind.NewKeyword) && token.Parent.IsKind(SyntaxKind.ObjectCreationExpression)) 117if (token.Kind() == SyntaxKind.LessThanToken && token.Parent is BinaryExpressionSyntax) 123if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 143if (token.Kind() == SyntaxKind.OpenParenToken && 144token.GetRequiredParent().Kind() == SyntaxKind.ParenthesizedExpression) 151if (token.Kind() == SyntaxKind.OpenParenToken && 152token.GetRequiredParent().Kind() == SyntaxKind.CastExpression) 161if (previousToken.IsKind(SyntaxKind.DotToken) && 162previousToken.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 170if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.ArgumentList) 174if (identifier.Identifier.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword)) 219if (current.IsKind(SyntaxKind.OrPattern)) 225if (current.IsKind(SyntaxKind.NotPattern))
Completion\CompletionProviders\DeclarationName\DeclarationNameCompletionProvider.cs (2)
61if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword) || 62context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword))
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (37)
122if (token.GetAncestor(node => node.IsKind(SyntaxKind.TupleExpression)) != null) 206if (token.IsKind(SyntaxKind.IdentifierToken) && 207token.Parent.IsKind(SyntaxKind.IdentifierName)) 213if (argument is { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) }) 294var afterComma = token.IsKind(SyntaxKind.CommaToken); 424var possibleDeclarationComputer = token.IsKind(SyntaxKind.CommaToken) 444if (token.IsKind(SyntaxKind.QuestionToken) && 496if (token.Kind() is SyntaxKind.LessThanToken or SyntaxKind.CommaToken && 497token.Parent.IsKind(SyntaxKind.TypeParameterList)) 521token.GetAncestor<ParameterSyntax>()?.Parent?.Parent is (kind: SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration)) 551if (token.Kind() is SyntaxKind.GreaterThanToken && 557if (parent.IsParentKind(SyntaxKind.IsExpression)) 566else if (parent.IsParentKind(SyntaxKind.CaseSwitchLabel)) 575else if (parent.IsParentKind(SyntaxKind.DeclarationPattern)) 590SyntaxKind.IdentifierToken or 591SyntaxKind.GreaterThanToken or 592SyntaxKind.CloseBracketToken or 593SyntaxKind.QuestionToken || 594token.Parent.IsKind(SyntaxKind.PredefinedType); 640case SyntaxKind.StaticKeyword: 643case SyntaxKind.AbstractKeyword: 646case SyntaxKind.NewKeyword: 649case SyntaxKind.UnsafeKeyword: 652case SyntaxKind.ReadOnlyKeyword: 655case SyntaxKind.VirtualKeyword: 658case SyntaxKind.OverrideKeyword: 661case SyntaxKind.SealedKeyword: 664case SyntaxKind.ConstKeyword: 667case SyntaxKind.AsyncKeyword: 670case SyntaxKind.PartialKeyword: 686case SyntaxKind.PrivateKeyword: 688case SyntaxKind.PublicKeyword: 690case SyntaxKind.ProtectedKeyword: 692case SyntaxKind.InternalKeyword: 704case SyntaxKind.DeclarationExpression:
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
303var parameterSyntax = context.LeftToken.GetAncestor(n => n.IsKind(SyntaxKind.Parameter)) as ParameterSyntax;
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (4)
83if (token.IsKind(SyntaxKind.DotToken)) 279if (token.Kind() is SyntaxKind.BarToken or 280SyntaxKind.AmpersandToken or 281SyntaxKind.CaretToken)
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (8)
80var kind = ancestor.Kind(); 83case SyntaxKind.EventFieldDeclaration: 84case SyntaxKind.EventDeclaration: 85case SyntaxKind.PropertyDeclaration: 86case SyntaxKind.IndexerDeclaration: 87case SyntaxKind.OperatorDeclaration: 88case SyntaxKind.ConversionOperatorDeclaration: 89case SyntaxKind.MethodDeclaration:
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.ItemGetter.cs (1)
90when node.Parent.IsKind(SyntaxKind.IncompleteMember):
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (12)
70if (SyntaxFacts.GetContextualKeywordKind(targetToken.ValueText) == SyntaxKind.AsyncKeyword) 74if (targetToken.IsKind(SyntaxKind.GreaterThanToken) && potentialTypeNode is TypeArgumentListSyntax typeArgumentList) 123while (tokenBeforeType.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.StaticKeyword) 127if (tokenBeforeType.Kind() == SyntaxKind.OpenBraceToken) 130if (tokenBeforeType.Kind() is SyntaxKind.CloseBraceToken or SyntaxKind.SemicolonToken) 142=> node.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration or 143SyntaxKind.InterfaceDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration;
Completion\CompletionProviders\ExternAliasCompletionProvider.cs (6)
58if (!targetToken.IsKind(SyntaxKind.AliasKeyword) 59&& !(targetToken.IsKind(SyntaxKind.IdentifierToken) && targetToken.HasMatchingText(SyntaxKind.AliasKeyword))) 64if (targetToken.Parent.IsKind(SyntaxKind.ExternAliasDirective) 65|| (targetToken.Parent.IsKind(SyntaxKind.IdentifierName) && targetToken.Parent.IsParentKind(SyntaxKind.IncompleteMember)))
Completion\CompletionProviders\FunctionPointerUnmanagedCallingConventionCompletionProvider.cs (2)
61if (token.Kind() is not (SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken))
Completion\CompletionProviders\ImportCompletion\ExtensionMemberImportCompletionProvider.cs (1)
38if (token.IsKind(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\ImportCompletion\TypeImportCompletionProvider.cs (1)
40if (token.IsKind(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (4)
64if (token.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken)) 194var type = constructorInitializer.Kind() == SyntaxKind.BaseConstructorInitializer
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (12)
102if (token.Kind() is not SyntaxKind.CommaToken and not SyntaxKind.OpenBraceToken) 109if (token.Kind() == SyntaxKind.CommaToken && 110token.Parent.Kind() is not (SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression)) 119return (type, token.GetLocation(), token.Parent.Kind() is not SyntaxKind.WithInitializerExpression); 128if (parent is (kind: SyntaxKind.ObjectCreationExpression or SyntaxKind.ImplicitObjectCreationExpression)) 134if (parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 157if (token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenBraceToken && 161.Where(b => b.OperatorToken.Kind() == SyntaxKind.EqualsToken)
Completion\CompletionProviders\ObjectCreationCompletionProvider.cs (1)
51if (newToken.Kind() == SyntaxKind.NewKeyword)
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (2)
84var expression = dotToken.Kind() == SyntaxKind.DotToken 189var questionToken = dotToken.GetPreviousToken().Kind() == SyntaxKind.QuestionToken
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (1)
84var questionToken = dotToken.GetPreviousToken().Kind() == SyntaxKind.QuestionToken
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
147dotLikeToken.Kind() == SyntaxKind.DotDotToken ? dotLikeToken.Span.Start + 1 : dotLikeToken.Span.End),
Completion\CompletionProviders\OverrideCompletionProvider.cs (12)
59identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 100if (token.Kind() == SyntaxKind.CloseBracketToken) 118case SyntaxKind.AbstractKeyword: 121case SyntaxKind.ExternKeyword: 124case SyntaxKind.OverrideKeyword: 127case SyntaxKind.RequiredKeyword: 130case SyntaxKind.SealedKeyword: 133case SyntaxKind.UnsafeKeyword: 139case SyntaxKind.PublicKeyword: 144case SyntaxKind.PrivateKeyword: 153case SyntaxKind.InternalKeyword: 162case SyntaxKind.ProtectedKeyword:
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (14)
37case SyntaxKind.PublicKeyword: 38case SyntaxKind.ProtectedKeyword: 39case SyntaxKind.InternalKeyword: 40case SyntaxKind.PrivateKeyword: 79return declarations.Any(d => d.Body == null && d.Modifiers.Any(SyntaxKind.PartialKeyword)); 92if (targetToken.Kind() is SyntaxKind.VoidKeyword or SyntaxKind.PartialKeyword || 93(targetToken.Kind() == SyntaxKind.IdentifierToken && targetToken.HasMatchingText(SyntaxKind.PartialKeyword))) 107var foundPartial = touchingToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword); 112if (token.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword)) 117foundPartial = foundPartial || token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword); 129return !syntaxToken.IsKind(SyntaxKind.None) 130&& !touchingToken.IsKind(SyntaxKind.None)
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
73=> syntax is BaseTypeDeclarationSyntax declarationSyntax && declarationSyntax.Modifiers.Any(SyntaxKind.PartialKeyword);
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (4)
190if (token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenBraceToken) 197if (token.IsKind(SyntaxKind.DotToken)) 210while (memberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression))
Completion\CompletionProviders\Scripting\DirectiveCompletionProviderUtilities.cs (4)
12internal static bool TryGetStringLiteralToken(SyntaxTree tree, int position, SyntaxKind directiveKind, out SyntaxToken stringLiteral, CancellationToken cancellationToken) 17if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 22if (token.Kind() == SyntaxKind.StringLiteralToken && token.Parent!.Kind() == directiveKind)
Completion\CompletionProviders\Scripting\LoadDirectiveCompletionProvider.cs (1)
29=> DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.LoadDirectiveTrivia, out stringLiteral, cancellationToken);
Completion\CompletionProviders\Scripting\ReferenceDirectiveCompletionProvider.cs (1)
28=> DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.ReferenceDirectiveTrivia, out stringLiteral, cancellationToken);
Completion\CompletionProviders\SnippetCompletionProvider.cs (11)
127SyntaxKind.IfKeyword or 128SyntaxKind.RegionKeyword or 129SyntaxKind.ElseKeyword or 130SyntaxKind.ElifKeyword or 131SyntaxKind.ErrorKeyword or 132SyntaxKind.LineKeyword or 133SyntaxKind.PragmaKeyword or 134SyntaxKind.EndIfKeyword or 135SyntaxKind.UndefKeyword or 136SyntaxKind.EndRegionKeyword or 137SyntaxKind.WarningKeyword))
Completion\CompletionProviders\SymbolCompletionProvider.cs (6)
113=> context.TargetToken.Parent?.Parent?.IsKind(SyntaxKind.PrimaryConstructorBaseType) is true; 171return token.GetPreviousToken().Kind() != SyntaxKind.NumericLiteralToken; 186if (token.Parent?.Kind() is not (SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier))
Completion\CompletionProviders\TupleNameCompletionProvider.cs (5)
75if (token.IsKind(SyntaxKind.OpenParenToken)) 77if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 83if (token.IsKind(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax tupleExpr)
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (25)
46foreach (var keywordKind in SyntaxFacts.GetKeywordKinds()) 85if (attachedToken.Kind() == SyntaxKind.None) 111addEqualsAndQuotes: !nextToken.IsKind(SyntaxKind.EqualsToken) || nextToken.HasLeadingTrivia); 142if (token.Parent?.Kind() is SyntaxKind.XmlEmptyElement or SyntaxKind.XmlText || 143(token.Parent.IsKind(SyntaxKind.XmlElementEndTag) && token.IsKind(SyntaxKind.GreaterThanToken)) || 144(token.Parent.IsKind(SyntaxKind.XmlName) && token.Parent.IsParentKind(SyntaxKind.XmlEmptyElement))) 147if (token.Parent.IsParentKind(SyntaxKind.XmlElement) || 148token.Parent.Parent.IsParentKind(SyntaxKind.XmlElement)) 154var xmlNameOnly = token.IsKind(SyntaxKind.LessThanToken) 155|| (token.Parent.IsKind(SyntaxKind.XmlName) && !token.HasLeadingTrivia); 166if (token.Parent.IsParentKind(SyntaxKind.XmlEmptyElement) && 173(token.Parent.Parent.IsKind(SyntaxKind.XmlEmptyElement) && token.Parent.Parent.Parent is DocumentationCommentTriviaSyntax)) 215if (token.IsKind(SyntaxKind.XmlTextLiteralToken) && string.IsNullOrWhiteSpace(token.Text)) 231if (token.IsKind(SyntaxKind.IdentifierToken) && token.Parent.IsKind(SyntaxKind.XmlName)) 238SyntaxKind.XmlCrefAttribute or 239SyntaxKind.XmlNameAttribute or 240SyntaxKind.XmlTextAttribute) attributeSyntax) 293if (token.Parent.IsKind(SyntaxKind.IdentifierName) && 299else if (token.IsKind(SyntaxKind.XmlTextLiteralToken) && 305else if (token.Parent.IsKind(SyntaxKind.XmlNameAttribute, out attributeSyntax) || 306token.Parent.IsKind(SyntaxKind.XmlTextAttribute, out attributeSyntax))
Completion\KeywordRecommenders\AbstractKeywordRecommender.cs (29)
12internal sealed class AbstractKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AbstractKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.UnsafeKeyword, 22SyntaxKind.OverrideKeyword, 25private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 27SyntaxKind.ExternKeyword, 28SyntaxKind.InternalKeyword, 29SyntaxKind.NewKeyword, 30SyntaxKind.PublicKeyword, 31SyntaxKind.ProtectedKeyword, 32SyntaxKind.StaticKeyword, 33SyntaxKind.UnsafeKeyword, 34SyntaxKind.OverrideKeyword, 37private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 39SyntaxKind.InternalKeyword, 40SyntaxKind.NewKeyword, 41SyntaxKind.PublicKeyword, 42SyntaxKind.PrivateKeyword, 43SyntaxKind.ProtectedKeyword, 44SyntaxKind.UnsafeKeyword, 45SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\AbstractSpecialTypePreselectingKeywordRecommender.cs (5)
16SyntaxKind keywordKind, 44if (!syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) && 45!syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken)) 54if (token.Kind() is SyntaxKind.ReadOnlyKeyword) 58if (token.Kind() != SyntaxKind.RefKeyword)
Completion\KeywordRecommenders\AbstractSyntacticSingleKeywordRecommender.cs (3)
15public readonly SyntaxKind KeywordKind; 29SyntaxKind keywordKind, 62private SyntaxKind? RecommendKeyword(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)
Completion\KeywordRecommenders\AddKeywordRecommender.cs (2)
11internal sealed class AddKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AddKeyword) 14=> context.TargetToken.IsAccessorDeclarationContext<EventDeclarationSyntax>(position, SyntaxKind.AddKeyword);
Completion\KeywordRecommenders\AliasKeywordRecommender.cs (2)
12internal sealed class AliasKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AliasKeyword) 21if (token.Kind() == SyntaxKind.ExternKeyword)
Completion\KeywordRecommenders\AllowsKeywordRecommender.cs (3)
12internal sealed class AllowsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AllowsKeyword) 35if (token.Kind() == SyntaxKind.CommaToken && 40.Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.ClassKeyword))
Completion\KeywordRecommenders\AndKeywordRecommender.cs (1)
10internal sealed class AndKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AndKeyword)
Completion\KeywordRecommenders\AnnotationsKeywordRecommender.cs (6)
11: AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AnnotationsKeyword, isValidInPreprocessorContext: true) 22(previousToken1.Kind() == SyntaxKind.EnableKeyword || previousToken1.Kind() == SyntaxKind.DisableKeyword || previousToken1.Kind() == SyntaxKind.RestoreKeyword) && 23previousToken2.Kind() == SyntaxKind.NullableKeyword && 24previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\AscendingKeywordRecommender.cs (1)
10internal sealed class AscendingKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AscendingKeyword)
Completion\KeywordRecommenders\AsKeywordRecommender.cs (1)
10internal sealed class AsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AsKeyword)
Completion\KeywordRecommenders\AssemblyKeywordRecommender.cs (3)
12internal sealed class AssemblyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AssemblyKeyword) 18if (token.Kind() == SyntaxKind.OpenBracketToken && 19token.GetRequiredParent().Kind() == SyntaxKind.AttributeList)
Completion\KeywordRecommenders\AsyncKeywordRecommender.cs (8)
13internal sealed class AsyncKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AsyncKeyword, isValidInPreprocessorContext: false) 15private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.StaticKeyword, 18SyntaxKind.UnsafeKeyword 23if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword) || 24context.PrecedingModifiers.Contains(SyntaxKind.AsyncKeyword)) 30|| context.SyntaxTree.IsLambdaDeclarationContext(position, otherModifier: SyntaxKind.StaticKeyword, cancellationToken)
Completion\KeywordRecommenders\BaseKeywordRecommender.cs (6)
13internal sealed class BaseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.BaseKeyword) 46if (token.Kind() == SyntaxKind.ColonToken && 48token.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration) && 49token.Parent.Parent?.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration)) 52if (constructor.Modifiers.Any(SyntaxKind.StaticKeyword))
Completion\KeywordRecommenders\BoolKeywordRecommender.cs (3)
14internal sealed class BoolKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.BoolKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\BreakKeywordRecommender.cs (1)
13internal sealed class BreakKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.BreakKeyword)
Completion\KeywordRecommenders\ByKeywordRecommender.cs (2)
13internal sealed class ByKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ByKeyword) 40token.Kind() == SyntaxKind.IdentifierToken &&
Completion\KeywordRecommenders\ByteKeywordRecommender.cs (3)
14internal sealed class ByteKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ByteKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\CaseKeywordRecommender.cs (2)
12internal sealed class CaseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.CaseKeyword) 25if (token.Kind() == SyntaxKind.GotoKeyword &&
Completion\KeywordRecommenders\CatchKeywordRecommender.cs (1)
10internal sealed class CatchKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.CatchKeyword)
Completion\KeywordRecommenders\CharKeywordRecommender.cs (3)
14internal sealed class CharKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.CharKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\CheckedKeywordRecommender.cs (3)
13internal sealed class CheckedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.CheckedKeyword) 26if (targetToken.Kind() == SyntaxKind.OperatorKeyword) 53if (previousToken.Kind() == SyntaxKind.ExplicitKeyword)
Completion\KeywordRecommenders\ChecksumKeywordRecommender.cs (3)
10internal sealed class ChecksumKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ChecksumKeyword, isValidInPreprocessorContext: true) 20previousToken1.Kind() == SyntaxKind.PragmaKeyword && 21previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\ClassKeywordRecommender.cs (14)
12internal sealed class ClassKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ClassKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.AbstractKeyword, 22SyntaxKind.ClosedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\ClosedKeywordRecommender.cs (8)
14internal sealed class ClosedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ClosedKeyword) 16private static readonly ISet<SyntaxKind> s_validModifiers = SyntaxKindSet.AllTypeModifiers 17.Where(s => s is not (SyntaxKind.ClosedKeyword or SyntaxKind.AbstractKeyword or SyntaxKind.SealedKeyword or SyntaxKind.StaticKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.RefKeyword))
Completion\KeywordRecommenders\ConstKeywordRecommender.cs (14)
12internal sealed class ConstKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ConstKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 23private static readonly ISet<SyntaxKind> s_validGlobalModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 25SyntaxKind.NewKeyword, 26SyntaxKind.PublicKeyword, 27SyntaxKind.InternalKeyword, 28SyntaxKind.PrivateKeyword,
Completion\KeywordRecommenders\ContinueKeywordRecommender.cs (1)
13internal sealed class ContinueKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ContinueKeyword)
Completion\KeywordRecommenders\DecimalKeywordRecommender.cs (3)
14internal sealed class DecimalKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.DecimalKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\DefaultKeywordRecommender.cs (3)
10internal sealed class DefaultKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DefaultKeyword, isValidInPreprocessorContext: true) 35previousToken1.Kind() == SyntaxKind.LineKeyword && 36previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\DefineKeywordRecommender.cs (1)
11internal sealed class DefineKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DefineKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\DelegateKeywordRecommender.cs (9)
13internal sealed class DelegateKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DelegateKeyword) 15private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.PrivateKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.UnsafeKeyword 59context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword) &&
Completion\KeywordRecommenders\DescendingKeywordRecommender.cs (1)
10internal sealed class DescendingKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DescendingKeyword)
Completion\KeywordRecommenders\DisableKeywordRecommender.cs (6)
10internal sealed class DisableKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DisableKeyword, isValidInPreprocessorContext: true) 18if (previousToken1.Kind() == SyntaxKind.NullableKeyword && 19previousToken2.Kind() == SyntaxKind.HashToken) 29previousToken1.Kind() == SyntaxKind.WarningKeyword && 30previousToken2.Kind() == SyntaxKind.PragmaKeyword && 31previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\DoKeywordRecommender.cs (1)
10internal sealed class DoKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DoKeyword)
Completion\KeywordRecommenders\DoubleKeywordRecommender.cs (3)
14internal sealed class DoubleKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.DoubleKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\DynamicKeywordRecommender.cs (4)
55syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 72=> context.TargetToken.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword && 73context.TargetToken.Parent.IsKind(SyntaxKind.RefType);
Completion\KeywordRecommenders\ElifKeywordRecommender.cs (1)
10internal sealed class ElifKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ElifKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\ElseKeywordRecommender.cs (1)
12internal sealed class ElseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ElseKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\EnableKeywordRecommender.cs (6)
10internal sealed class EnableKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EnableKeyword, isValidInPreprocessorContext: true) 19if (previousToken1.Kind() == SyntaxKind.NullableKeyword && 20previousToken2.Kind() == SyntaxKind.HashToken) 30previousToken1.Kind() == SyntaxKind.WarningKeyword && 31previousToken2.Kind() == SyntaxKind.PragmaKeyword && 32previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\EndIfKeywordRecommender.cs (1)
10internal sealed class EndIfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EndIfKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\EndRegionKeywordRecommender.cs (1)
10internal sealed class EndRegionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EndRegionKeyword, isValidInPreprocessorContext: true, shouldFormatOnCommit: true)
Completion\KeywordRecommenders\EnumKeywordRecommender.cs (7)
12internal sealed class EnumKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EnumKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.InternalKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.PrivateKeyword, 19SyntaxKind.ProtectedKeyword,
Completion\KeywordRecommenders\EqualsKeywordRecommender.cs (1)
12internal sealed class EqualsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EqualsKeyword)
Completion\KeywordRecommenders\ErrorKeywordRecommender.cs (1)
10internal sealed class ErrorKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ErrorKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\EventKeywordRecommender.cs (18)
13internal sealed class EventKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EventKeyword) 15private static readonly ISet<SyntaxKind> s_validClassModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.NewKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.InternalKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.StaticKeyword, 23SyntaxKind.VirtualKeyword, 24SyntaxKind.SealedKeyword, 25SyntaxKind.OverrideKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.ExternKeyword, 28SyntaxKind.UnsafeKeyword 31private static readonly ISet<SyntaxKind> s_validStructModifiers = new HashSet<SyntaxKind>(s_validClassModifiers, SyntaxFacts.EqualityComparer) 33SyntaxKind.ReadOnlyKeyword,
Completion\KeywordRecommenders\ExplicitKeywordRecommender.cs (17)
12internal sealed class ExplicitKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ExplicitKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.StaticKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ExternKeyword, 19SyntaxKind.UnsafeKeyword, 22private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 24SyntaxKind.StaticKeyword, 25SyntaxKind.PublicKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.UnsafeKeyword, 38modifiers.Contains(SyntaxKind.PublicKeyword) && 39modifiers.Contains(SyntaxKind.StaticKeyword); 47modifiers.Contains(SyntaxKind.AbstractKeyword) && 48modifiers.Contains(SyntaxKind.StaticKeyword);
Completion\KeywordRecommenders\ExtensionKeywordRecommender.cs (7)
11internal sealed class ExtensionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ExtensionKeyword) 13private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 14private static readonly ISet<SyntaxKind> s_validTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ClassDeclaration 22context.ContainingTypeDeclaration?.Modifiers.Any(SyntaxKind.StaticKeyword) is true &&
Completion\KeywordRecommenders\ExternKeywordRecommender.cs (32)
13internal sealed class ExternKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ExternKeyword) 15private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.OverrideKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.VirtualKeyword, 29private static readonly ISet<SyntaxKind> s_validGlobalModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 31SyntaxKind.InternalKeyword, 32SyntaxKind.NewKeyword, 33SyntaxKind.PublicKeyword, 34SyntaxKind.PrivateKeyword, 35SyntaxKind.StaticKeyword, 36SyntaxKind.UnsafeKeyword, 39private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 41SyntaxKind.StaticKeyword, 42SyntaxKind.UnsafeKeyword 79if (token.Kind() == SyntaxKind.None) 85if (token.Kind() == SyntaxKind.OpenBraceToken && 86token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 93if (token.Kind() == SyntaxKind.SemicolonToken && 94token.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)) 101if (token.Kind() == SyntaxKind.SemicolonToken && 102token.Parent.IsKind(SyntaxKind.ExternAliasDirective))
Completion\KeywordRecommenders\FalseKeywordRecommender.cs (1)
10internal sealed class FalseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FalseKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\FieldKeywordRecommender.cs (8)
13: AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FieldKeyword) 16private static readonly ISet<SyntaxKind> s_validTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 18SyntaxKind.StructDeclaration, 19SyntaxKind.ClassDeclaration, 20SyntaxKind.RecordDeclaration, 21SyntaxKind.RecordStructDeclaration, 22SyntaxKind.EnumDeclaration,
Completion\KeywordRecommenders\FileKeywordRecommender.cs (4)
14internal sealed class FileKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FileKeyword) 16private static readonly ISet<SyntaxKind> s_validModifiers = SyntaxKindSet.AllMemberModifiers 17.Where(s => s != SyntaxKind.FileKeyword && s != SyntaxKind.ExternKeyword && !SyntaxFacts.IsAccessibilityModifier(s))
Completion\KeywordRecommenders\FinallyKeywordRecommender.cs (1)
10internal sealed class FinallyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FinallyKeyword)
Completion\KeywordRecommenders\FixedKeywordRecommender.cs (9)
12internal sealed class FixedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FixedKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.UnsafeKeyword,
Completion\KeywordRecommenders\FloatKeywordRecommender.cs (3)
14internal sealed class FloatKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.FloatKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ForEachKeywordRecommender.cs (1)
10internal sealed class ForEachKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ForEachKeyword)
Completion\KeywordRecommenders\ForKeywordRecommender.cs (1)
10internal sealed class ForKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ForKeyword)
Completion\KeywordRecommenders\FromKeywordRecommender.cs (1)
10internal sealed class FromKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FromKeyword)
Completion\KeywordRecommenders\GetKeywordRecommender.cs (3)
11internal sealed class GetKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GetKeyword) 16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.GetKeyword) || 17context.TargetToken.IsAccessorDeclarationContext<IndexerDeclarationSyntax>(position, SyntaxKind.GetKeyword);
Completion\KeywordRecommenders\GlobalKeywordRecommender.cs (1)
12internal sealed class GlobalKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GlobalKeyword)
Completion\KeywordRecommenders\GotoKeywordRecommender.cs (1)
10internal sealed class GotoKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GotoKeyword)
Completion\KeywordRecommenders\GroupKeywordRecommender.cs (1)
11internal sealed class GroupKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GroupKeyword)
Completion\KeywordRecommenders\HiddenKeywordRecommender.cs (3)
10internal sealed class HiddenKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.HiddenKeyword, isValidInPreprocessorContext: true) 24previousToken1.Kind() == SyntaxKind.LineKeyword && 25previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\IfKeywordRecommender.cs (1)
10internal sealed class IfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.IfKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\ImplicitKeywordRecommender.cs (17)
12internal sealed class ImplicitKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ImplicitKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.StaticKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ExternKeyword, 19SyntaxKind.UnsafeKeyword, 22private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 24SyntaxKind.StaticKeyword, 25SyntaxKind.PublicKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.UnsafeKeyword, 38modifiers.Contains(SyntaxKind.PublicKeyword) && 39modifiers.Contains(SyntaxKind.StaticKeyword); 47modifiers.Contains(SyntaxKind.AbstractKeyword) && 48modifiers.Contains(SyntaxKind.StaticKeyword);
Completion\KeywordRecommenders\InitKeywordRecommender.cs (3)
11internal sealed class InitKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InitKeyword) 16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.InitKeyword) || 17context.TargetToken.IsAccessorDeclarationContext<IndexerDeclarationSyntax>(position, SyntaxKind.InitKeyword);
Completion\KeywordRecommenders\InKeywordRecommender.cs (10)
13internal sealed class InKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InKeyword) 32position, context.LeftToken, includeOperators: true, out var parameterIndex, out var previousModifier)) 34if (previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword) 39if (previousModifier == SyntaxKind.ThisKeyword && 59if (token.Kind() == SyntaxKind.IdentifierToken) 66else if (token.Kind() == SyntaxKind.CloseParenToken) 82if (token.Kind() == SyntaxKind.IdentifierToken) 86if (token.GetPreviousToken(includeSkipped: true).IsKindOrHasMatchingText(SyntaxKind.FromKeyword)) 113if (token.Kind() == SyntaxKind.IdentifierToken)
Completion\KeywordRecommenders\InterfaceKeywordRecommender.cs (8)
12internal sealed class InterfaceKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InterfaceKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.InternalKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.PrivateKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.UnsafeKeyword
Completion\KeywordRecommenders\InternalKeywordRecommender.cs (5)
12internal sealed class InternalKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InternalKeyword) 60!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 61!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 62!precedingModifiers.Contains(SyntaxKind.InternalKeyword) && 63!precedingModifiers.Contains(SyntaxKind.PrivateKeyword);
Completion\KeywordRecommenders\IntKeywordRecommender.cs (3)
14internal sealed class IntKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.IntKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\IntoKeywordRecommender.cs (2)
13internal sealed class IntoKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.IntoKeyword) 42if (lastCompleteToken.Kind() == SyntaxKind.DotToken)
Completion\KeywordRecommenders\IsKeywordRecommender.cs (1)
10internal sealed class IsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.IsKeyword)
Completion\KeywordRecommenders\JoinKeywordRecommender.cs (1)
10internal sealed class JoinKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.JoinKeyword)
Completion\KeywordRecommenders\LetKeywordRecommender.cs (1)
11internal sealed class LetKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LetKeyword)
Completion\KeywordRecommenders\LineKeywordRecommender.cs (1)
10internal sealed class LineKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LineKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\LoadKeywordRecommender.cs (1)
11internal sealed class LoadKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LoadKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\LockKeywordRecommender.cs (1)
10internal sealed class LockKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LockKeyword)
Completion\KeywordRecommenders\LongKeywordRecommender.cs (3)
14internal sealed class LongKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.LongKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ManagedKeywordRecommender.cs (1)
10internal sealed class ManagedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ManagedKeyword)
Completion\KeywordRecommenders\MethodKeywordRecommender.cs (4)
13internal sealed class MethodKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.MethodKeyword) 22if (token.Kind() == SyntaxKind.OpenBracketToken) 30or TypeDeclarationSyntax(kind: SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration) { ParameterList: not null }
Completion\KeywordRecommenders\ModuleKeywordRecommender.cs (2)
13internal sealed class ModuleKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ModuleKeyword) 22return type == null || type.IsParentKind(SyntaxKind.CompilationUnit);
Completion\KeywordRecommenders\NameOfKeywordRecommender.cs (1)
10internal sealed class NameOfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NameOfKeyword)
Completion\KeywordRecommenders\NamespaceKeywordRecommender.cs (16)
13internal sealed class NamespaceKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NamespaceKeyword) 80(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 86if (token.Kind() == SyntaxKind.None) 99if (token.Kind() == SyntaxKind.OpenBraceToken && 100token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 110if (token.Kind() == SyntaxKind.SemicolonToken) 112if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective) && 113!token.Parent.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)) 121if (token.Kind() == SyntaxKind.CloseBraceToken) 128else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 137if (token.Kind() == SyntaxKind.SemicolonToken) 139if (token.Parent.IsKind(SyntaxKind.DelegateDeclaration) && 149if (token.Kind() == SyntaxKind.CloseBracketToken && 150token.Parent.IsKind(SyntaxKind.AttributeList) && 151token.Parent.IsParentKind(SyntaxKind.CompilationUnit))
Completion\KeywordRecommenders\NewKeywordRecommender.cs (27)
15internal sealed class NewKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NewKeyword) 17private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 19SyntaxKind.AbstractKeyword, 20SyntaxKind.ExternKeyword, 21SyntaxKind.InternalKeyword, 22SyntaxKind.PublicKeyword, 23SyntaxKind.PrivateKeyword, 24SyntaxKind.ProtectedKeyword, 25SyntaxKind.ReadOnlyKeyword, 26SyntaxKind.SealedKeyword, 27SyntaxKind.StaticKeyword, 28SyntaxKind.UnsafeKeyword, 29SyntaxKind.VirtualKeyword, 30SyntaxKind.VolatileKeyword, 33private static readonly ISet<SyntaxKind> ValidTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 35SyntaxKind.AbstractKeyword, 36SyntaxKind.InternalKeyword, 37SyntaxKind.PublicKeyword, 38SyntaxKind.PrivateKeyword, 39SyntaxKind.ProtectedKeyword, 40SyntaxKind.SealedKeyword, 41SyntaxKind.StaticKeyword, 42SyntaxKind.UnsafeKeyword 96if (token.Kind() == SyntaxKind.CommaToken && 101.Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.StructKeyword))
Completion\KeywordRecommenders\NotKeywordRecommender.cs (1)
10internal sealed class NotKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NotKeyword)
Completion\KeywordRecommenders\NullableKeywordRecommender.cs (1)
10internal sealed class NullableKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NullableKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\NullKeywordRecommender.cs (1)
10internal sealed class NullKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NullKeyword)
Completion\KeywordRecommenders\ObjectKeywordRecommender.cs (2)
14internal sealed class ObjectKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ObjectKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) ||
Completion\KeywordRecommenders\OnKeywordRecommender.cs (1)
12internal sealed class OnKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OnKeyword)
Completion\KeywordRecommenders\OperatorKeywordRecommender.cs (3)
10internal sealed class OperatorKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OperatorKeyword) 20token.Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword;
Completion\KeywordRecommenders\OrderByKeywordRecommender.cs (1)
11internal sealed class OrderByKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OrderByKeyword)
Completion\KeywordRecommenders\OrKeywordRecommender.cs (1)
10internal sealed class OrKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OrKeyword)
Completion\KeywordRecommenders\OutKeywordRecommender.cs (4)
10internal sealed class OutKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OutKeyword) 28position, context.LeftToken, includeOperators: false, out _, out var previousModifier) && 29previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword;
Completion\KeywordRecommenders\OverrideKeywordRecommender.cs (13)
12internal sealed class OverrideKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OverrideKeyword) 14private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.UnsafeKeyword, 22SyntaxKind.SealedKeyword, 23SyntaxKind.AbstractKeyword, 38return !modifiers.Contains(SyntaxKind.PrivateKeyword) || modifiers.Contains(SyntaxKind.ProtectedKeyword);
Completion\KeywordRecommenders\ParamKeywordRecommender.cs (5)
13internal sealed class ParamKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ParamKeyword) 15private static readonly ISet<SyntaxKind> s_validTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 28if (token.Kind() == SyntaxKind.OpenBracketToken && 29token.Parent.IsKind(SyntaxKind.AttributeList))
Completion\KeywordRecommenders\ParamsKeywordRecommender.cs (1)
10internal sealed class ParamsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ParamsKeyword)
Completion\KeywordRecommenders\PartialKeywordRecommender.cs (2)
15internal sealed class PartialKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PartialKeyword) 37if (!decl.Modifiers.Any(t => t.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)))
Completion\KeywordRecommenders\PragmaKeywordRecommender.cs (1)
10internal sealed class PragmaKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PragmaKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\PrivateKeywordRecommender.cs (9)
13internal sealed class PrivateKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PrivateKeyword) 43if (modifiers.Contains(SyntaxKind.AbstractKeyword) || 44modifiers.Contains(SyntaxKind.VirtualKeyword) || 45modifiers.Contains(SyntaxKind.OverrideKeyword) || 46modifiers.Contains(SyntaxKind.SealedKeyword)) 79!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 80!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 81!precedingModifiers.Contains(SyntaxKind.InternalKeyword) && 82!precedingModifiers.Contains(SyntaxKind.PrivateKeyword);
Completion\KeywordRecommenders\PropertyKeywordRecommender.cs (1)
11internal sealed class PropertyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PropertyKeyword)
Completion\KeywordRecommenders\ProtectedKeywordRecommender.cs (4)
12internal sealed class ProtectedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ProtectedKeyword) 65!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 66!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 67!precedingModifiers.Contains(SyntaxKind.ProtectedKeyword);
Completion\KeywordRecommenders\PublicKeywordRecommender.cs (6)
11internal sealed class PublicKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PublicKeyword) 50!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 51!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 52!precedingModifiers.Contains(SyntaxKind.InternalKeyword) && 53!precedingModifiers.Contains(SyntaxKind.ProtectedKeyword) && 54!precedingModifiers.Contains(SyntaxKind.PrivateKeyword);
Completion\KeywordRecommenders\ReadOnlyKeywordRecommender.cs (15)
14internal sealed class ReadOnlyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ReadOnlyKeyword) 16private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.InternalKeyword, 22SyntaxKind.PrivateKeyword, 23SyntaxKind.StaticKeyword, 42=> context.TargetToken.IsKind(SyntaxKind.RefKeyword) && 43(context.TargetToken.Parent.IsKind(SyntaxKind.RefType) || 50return context.IsTypeDeclarationContext(validModifiers: SyntaxKindSet.AllTypeModifiers.Except([SyntaxKind.ReadOnlyKeyword]).ToSet(), 58type.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration && 59context.TargetToken.IsAnyAccessorDeclarationContext(context.Position, SyntaxKind.ReadOnlyKeyword);
Completion\KeywordRecommenders\RecordKeywordRecommender.cs (15)
12internal sealed class RecordKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RecordKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.AbstractKeyword, 22SyntaxKind.ClosedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\ReferenceKeywordRecommender.cs (1)
11internal sealed class ReferenceKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ReferenceKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\RefKeywordRecommender.cs (60)
16internal sealed class RefKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RefKeyword) 21private static readonly ISet<SyntaxKind> RefMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.AbstractKeyword, 25SyntaxKind.ExternKeyword, 26SyntaxKind.InternalKeyword, 27SyntaxKind.NewKeyword, 28SyntaxKind.OverrideKeyword, 29SyntaxKind.PublicKeyword, 30SyntaxKind.PrivateKeyword, 31SyntaxKind.ProtectedKeyword, 33SyntaxKind.SealedKeyword, 34SyntaxKind.StaticKeyword, 35SyntaxKind.UnsafeKeyword, 36SyntaxKind.VirtualKeyword, 43private static readonly ISet<SyntaxKind> RefGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 46SyntaxKind.ExternKeyword, 47SyntaxKind.InternalKeyword, 48SyntaxKind.NewKeyword, 49SyntaxKind.OverrideKeyword, 50SyntaxKind.PublicKeyword, 51SyntaxKind.PrivateKeyword, 52SyntaxKind.ReadOnlyKeyword, 53SyntaxKind.StaticKeyword, 54SyntaxKind.UnsafeKeyword, 55SyntaxKind.VolatileKeyword, 61private static readonly ISet<SyntaxKind> RefGlobalMemberScriptModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 64SyntaxKind.ExternKeyword, 65SyntaxKind.InternalKeyword, 66SyntaxKind.NewKeyword, 67SyntaxKind.OverrideKeyword, 68SyntaxKind.PublicKeyword, 69SyntaxKind.PrivateKeyword, 71SyntaxKind.StaticKeyword, 72SyntaxKind.UnsafeKeyword, 110if (context.TargetToken.IsKind(SyntaxKind.ColonToken)) 115else if (context.TargetToken.Kind() == SyntaxKind.OpenParenToken) 119else if (context.TargetToken.Kind() == SyntaxKind.CommaToken) 147if (token.Kind() == SyntaxKind.IdentifierToken && SyntaxFacts.GetContextualKeywordKind((string)token.Value!) == SyntaxKind.AllowsKeyword && 154.Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.ClassKeyword)) 166position, context.LeftToken, includeOperators: false, out var parameterIndex, out var previousModifier)) 168if (previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword) 173if (previousModifier == SyntaxKind.ThisKeyword && 222case SyntaxKind.ReturnKeyword: 226case SyntaxKind.ScopedKeyword: 227case SyntaxKind.IdentifierToken when token.Text == "scoped": 233case SyntaxKind.EqualsGreaterThanToken: 241case SyntaxKind.OpenParenToken: 243return previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword; 248case SyntaxKind.EqualsToken: 250return parent?.Kind() == SyntaxKind.SimpleAssignmentExpression 251|| parent?.Parent?.Kind() == SyntaxKind.VariableDeclarator; 256case SyntaxKind.QuestionToken: 257case SyntaxKind.ColonToken: 258return token.Parent?.Kind() == SyntaxKind.ConditionalExpression;
Completion\KeywordRecommenders\RegionKeywordRecommender.cs (1)
10internal sealed class RegionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RegionKeyword, isValidInPreprocessorContext: true, shouldFormatOnCommit: true)
Completion\KeywordRecommenders\RemoveKeywordRecommender.cs (2)
11internal sealed class RemoveKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RemoveKeyword) 14=> context.TargetToken.IsAccessorDeclarationContext<EventDeclarationSyntax>(position, SyntaxKind.RemoveKeyword);
Completion\KeywordRecommenders\RequiredKeywordRecommender.cs (7)
14internal sealed class RequiredKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RequiredKeyword) 16private static readonly ISet<SyntaxKind> s_validModifiers = SyntaxKindSet.AllMemberModifiers.Where(s => s is not (SyntaxKind.RequiredKeyword or SyntaxKind.StaticKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.ConstKeyword)).ToSet(); 18private static readonly ISet<SyntaxKind> s_validTypeDeclarations = SyntaxKindSet.ClassStructRecordTypeDeclarations;
Completion\KeywordRecommenders\RestoreKeywordRecommender.cs (6)
10internal sealed class RestoreKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RestoreKeyword, isValidInPreprocessorContext: true) 21(previousToken1.Kind() == SyntaxKind.WarningKeyword && 22previousToken2.Kind() == SyntaxKind.PragmaKeyword && 23previousToken3.Kind() == SyntaxKind.HashToken) || 26(previousToken1.Kind() == SyntaxKind.NullableKeyword && 27previousToken2.Kind() == SyntaxKind.HashToken);
Completion\KeywordRecommenders\ReturnKeywordRecommender.cs (2)
13internal sealed class ReturnKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ReturnKeyword) 35return token.Kind() == SyntaxKind.OpenBracketToken &&
Completion\KeywordRecommenders\SByteKeywordRecommender.cs (3)
14internal sealed class SByteKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.SByteKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ScopedKeywordRecommender.cs (5)
11internal sealed class ScopedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ScopedKeyword) 36case SyntaxKind.OpenParenToken: 38return previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword; 41case SyntaxKind.OutKeyword:
Completion\KeywordRecommenders\SealedKeywordRecommender.cs (29)
12internal sealed class SealedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SealedKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.OverrideKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.ProtectedKeyword, 22SyntaxKind.UnsafeKeyword, 25private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 27SyntaxKind.ExternKeyword, 28SyntaxKind.InternalKeyword, 29SyntaxKind.NewKeyword, 30SyntaxKind.OverrideKeyword, 31SyntaxKind.PublicKeyword, 32SyntaxKind.ProtectedKeyword, 33SyntaxKind.StaticKeyword, 34SyntaxKind.UnsafeKeyword, 37private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 39SyntaxKind.InternalKeyword, 40SyntaxKind.NewKeyword, 41SyntaxKind.PublicKeyword, 42SyntaxKind.PrivateKeyword, 43SyntaxKind.ProtectedKeyword, 44SyntaxKind.UnsafeKeyword, 45SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\SelectKeywordRecommender.cs (1)
11internal sealed class SelectKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SelectKeyword)
Completion\KeywordRecommenders\SetKeywordRecommender.cs (3)
11internal sealed class SetKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SetKeyword) 16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.SetKeyword) || 17context.TargetToken.IsAccessorDeclarationContext<IndexerDeclarationSyntax>(position, SyntaxKind.SetKeyword);
Completion\KeywordRecommenders\ShortKeywordRecommender.cs (3)
14internal sealed class ShortKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ShortKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\SizeOfKeywordRecommender.cs (1)
10internal sealed class SizeOfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SizeOfKeyword)
Completion\KeywordRecommenders\StackAllocKeywordRecommender.cs (1)
10internal sealed class StackAllocKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.StackAllocKeyword)
Completion\KeywordRecommenders\StaticKeywordRecommender.cs (55)
13internal sealed class StaticKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.StaticKeyword) 15private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.ProtectedKeyword, 22SyntaxKind.UnsafeKeyword, 23SyntaxKind.FileKeyword, 26private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 28SyntaxKind.AsyncKeyword, 29SyntaxKind.ExternKeyword, 30SyntaxKind.InternalKeyword, 31SyntaxKind.NewKeyword, 32SyntaxKind.PublicKeyword, 33SyntaxKind.PrivateKeyword, 34SyntaxKind.ProtectedKeyword, 35SyntaxKind.ReadOnlyKeyword, 36SyntaxKind.UnsafeKeyword, 37SyntaxKind.VolatileKeyword, 40private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 42SyntaxKind.AbstractKeyword, 43SyntaxKind.AsyncKeyword, 44SyntaxKind.ExternKeyword, 45SyntaxKind.InternalKeyword, 46SyntaxKind.NewKeyword, 47SyntaxKind.PublicKeyword, 48SyntaxKind.PrivateKeyword, 49SyntaxKind.ProtectedKeyword, 50SyntaxKind.ReadOnlyKeyword, 51SyntaxKind.SealedKeyword, 52SyntaxKind.UnsafeKeyword, 53SyntaxKind.VolatileKeyword, 54SyntaxKind.VirtualKeyword, 57private static readonly ISet<SyntaxKind> s_validGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 59SyntaxKind.ExternKeyword, 60SyntaxKind.InternalKeyword, 61SyntaxKind.NewKeyword, 62SyntaxKind.PublicKeyword, 63SyntaxKind.PrivateKeyword, 64SyntaxKind.ReadOnlyKeyword, 65SyntaxKind.UnsafeKeyword, 66SyntaxKind.VolatileKeyword, 69private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 71SyntaxKind.ExternKeyword, 72SyntaxKind.AsyncKeyword, 73SyntaxKind.UnsafeKeyword 81(context.TargetToken.IsKind(SyntaxKind.UsingKeyword) && context.TargetToken.Parent?.IsParentKind(SyntaxKind.GlobalStatement) == true) || 84context.SyntaxTree.IsLambdaDeclarationContext(position, otherModifier: SyntaxKind.AsyncKeyword, cancellationToken) ||
Completion\KeywordRecommenders\StringKeywordRecommender.cs (2)
14internal sealed class StringKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.StringKeyword) 39syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) ||
Completion\KeywordRecommenders\StructKeywordRecommender.cs (12)
13internal sealed class StructKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.StructKeyword) 15private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.PrivateKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.UnsafeKeyword, 22SyntaxKind.RefKeyword, 23SyntaxKind.ReadOnlyKeyword, 24SyntaxKind.FileKeyword, 57if (token.Kind() == SyntaxKind.RefKeyword &&
Completion\KeywordRecommenders\SwitchKeywordRecommender.cs (1)
10internal sealed class SwitchKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SwitchKeyword)
Completion\KeywordRecommenders\ThisKeywordRecommender.cs (8)
13internal sealed class ThisKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ThisKeyword) 31token.Kind() == SyntaxKind.ColonToken && 33!constructor.Modifiers.Any(SyntaxKind.StaticKeyword); 39context.Position, context.LeftToken, includeOperators: false, out var parameterIndex, out var previousModifier)) 42is SyntaxKind.None 43or SyntaxKind.RefKeyword 44or SyntaxKind.InKeyword 45or SyntaxKind.ReadOnlyKeyword)
Completion\KeywordRecommenders\ThrowKeywordRecommender.cs (6)
10internal sealed class ThrowKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ThrowKeyword) 20if (context.TargetToken.IsKind(SyntaxKind.EqualsGreaterThanToken)) 26if (context.TargetToken.IsKind(SyntaxKind.QuestionQuestionToken)) 33if (context.TargetToken.Kind() is SyntaxKind.QuestionToken or 34SyntaxKind.ColonToken) 36return context.TargetToken.Parent.IsKind(SyntaxKind.ConditionalExpression);
Completion\KeywordRecommenders\TrueKeywordRecommender.cs (1)
10internal sealed class TrueKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TrueKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\TryKeywordRecommender.cs (1)
10internal sealed class TryKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TryKeyword)
Completion\KeywordRecommenders\TypeKeywordRecommender.cs (1)
10internal sealed class TypeKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TypeKeyword)
Completion\KeywordRecommenders\TypeOfKeywordRecommender.cs (1)
12internal sealed class TypeOfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TypeOfKeyword)
Completion\KeywordRecommenders\TypeVarKeywordRecommender.cs (3)
12internal sealed class TypeVarKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TypeVarKeyword) 18if (token.Kind() == SyntaxKind.OpenBracketToken && 19token.Parent.IsKind(SyntaxKind.AttributeList))
Completion\KeywordRecommenders\UIntKeywordRecommender.cs (3)
14internal sealed class UIntKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.UIntKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ULongKeywordRecommender.cs (3)
14internal sealed class ULongKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ULongKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\UncheckedKeywordRecommender.cs (1)
10internal sealed class UncheckedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UncheckedKeyword)
Completion\KeywordRecommenders\UndefKeywordRecommender.cs (1)
11internal sealed class UndefKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UndefKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\UnionKeywordRecommender.cs (10)
12internal sealed class UnionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UnionKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.InternalKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.PrivateKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.UnsafeKeyword, 21SyntaxKind.ReadOnlyKeyword, 22SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\UnmanagedKeywordRecommender.cs (1)
10internal sealed class UnmanagedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UnmanagedKeyword)
Completion\KeywordRecommenders\UnsafeKeywordRecommender.cs (45)
12internal sealed class UnsafeKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UnsafeKeyword) 14private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.AbstractKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.ProtectedKeyword, 22SyntaxKind.ClosedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.FileKeyword, 28private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 30SyntaxKind.AbstractKeyword, 31SyntaxKind.ExternKeyword, 32SyntaxKind.InternalKeyword, 33SyntaxKind.NewKeyword, 34SyntaxKind.OverrideKeyword, 35SyntaxKind.PublicKeyword, 36SyntaxKind.PrivateKeyword, 37SyntaxKind.ProtectedKeyword, 38SyntaxKind.ReadOnlyKeyword, 39SyntaxKind.SealedKeyword, 40SyntaxKind.StaticKeyword, 41SyntaxKind.VirtualKeyword, 42SyntaxKind.VolatileKeyword, 45private static readonly ISet<SyntaxKind> s_validGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 47SyntaxKind.ExternKeyword, 48SyntaxKind.InternalKeyword, 49SyntaxKind.NewKeyword, 50SyntaxKind.PublicKeyword, 51SyntaxKind.PrivateKeyword, 52SyntaxKind.ReadOnlyKeyword, 53SyntaxKind.StaticKeyword, 54SyntaxKind.VolatileKeyword, 57private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 59SyntaxKind.ExternKeyword, 60SyntaxKind.StaticKeyword, 61SyntaxKind.AsyncKeyword 78(context.IsInImportsDirective && context.TargetToken.Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword);
Completion\KeywordRecommenders\UShortKeywordRecommender.cs (3)
15internal sealed class UShortKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.UShortKeyword) 45syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 46syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\UsingKeywordRecommender.cs (21)
12internal sealed class UsingKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UsingKeyword) 91if (token.Kind() == SyntaxKind.None) 98if ((token.Kind() == SyntaxKind.OpenBraceToken && token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 99|| (token.Kind() == SyntaxKind.SemicolonToken && token.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration))) 103if (nextToken.Kind() == SyntaxKind.ExternKeyword) 116if (token.Kind() == SyntaxKind.SemicolonToken) 118if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 134if (previousToken.Kind() == SyntaxKind.None) 137if (token.Kind() == SyntaxKind.GlobalKeyword) 141else if (token.Kind() == SyntaxKind.IdentifierToken && SyntaxFacts.GetContextualKeywordKind((string)token.Value!) == SyntaxKind.GlobalKeyword) 146else if (previousToken.Kind() == SyntaxKind.SemicolonToken && 147previousToken.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 149if (token.Kind() == SyntaxKind.GlobalKeyword) 153else if (token.Kind() == SyntaxKind.IdentifierToken && SyntaxFacts.GetContextualKeywordKind((string)token.Value!) == SyntaxKind.GlobalKeyword) 166if (nextToken.Kind() == SyntaxKind.ExternKeyword ||
Completion\KeywordRecommenders\VirtualKeywordRecommender.cs (22)
12internal sealed class VirtualKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.VirtualKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.UnsafeKeyword, 25private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 27SyntaxKind.ExternKeyword, 28SyntaxKind.InternalKeyword, 29SyntaxKind.NewKeyword, 30SyntaxKind.PublicKeyword, 31SyntaxKind.ProtectedKeyword, 32SyntaxKind.PrivateKeyword, 33SyntaxKind.StaticKeyword, 34SyntaxKind.UnsafeKeyword, 54return !modifiers.Contains(SyntaxKind.PrivateKeyword) || modifiers.Contains(SyntaxKind.ProtectedKeyword);
Completion\KeywordRecommenders\VoidKeywordRecommender.cs (21)
13internal sealed class VoidKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.VoidKeyword) 15private static readonly ISet<SyntaxKind> s_validClassInterfaceRecordModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.NewKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.InternalKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.StaticKeyword, 23SyntaxKind.VirtualKeyword, 24SyntaxKind.SealedKeyword, 25SyntaxKind.OverrideKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.ExternKeyword, 28SyntaxKind.UnsafeKeyword, 29SyntaxKind.AsyncKeyword 32private static readonly ISet<SyntaxKind> s_validStructModifiers = new HashSet<SyntaxKind>(s_validClassInterfaceRecordModifiers, SyntaxFacts.EqualityComparer) 34SyntaxKind.ReadOnlyKeyword, 75if (token.Kind() == SyntaxKind.OpenParenToken && 76token.Parent.IsKind(SyntaxKind.ParenthesizedExpression))
Completion\KeywordRecommenders\VolatileKeywordRecommender.cs (9)
13internal sealed class VolatileKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.VolatileKeyword) 15private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.NewKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.InternalKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.StaticKeyword,
Completion\KeywordRecommenders\WarningKeywordRecommender.cs (3)
10internal sealed class WarningKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WarningKeyword, isValidInPreprocessorContext: true) 26previousToken1.Kind() == SyntaxKind.PragmaKeyword && 27previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\WarningsKeywordRecommender.cs (6)
10internal sealed class WarningsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WarningsKeyword, isValidInPreprocessorContext: true) 21(previousToken1.Kind() == SyntaxKind.EnableKeyword || previousToken1.Kind() == SyntaxKind.DisableKeyword || previousToken1.Kind() == SyntaxKind.RestoreKeyword) && 22previousToken2.Kind() == SyntaxKind.NullableKeyword && 23previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\WhenKeywordRecommender.cs (1)
13internal sealed class WhenKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WhenKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (6)
14internal sealed class WhereKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WhereKeyword) 40if (token.Kind() == SyntaxKind.GreaterThanToken) 61if (token.Kind() == SyntaxKind.CloseParenToken && 80if (token.Parent is IdentifierNameSyntax && token.HasMatchingText(SyntaxKind.WhereKeyword)) 86.IsKindOrHasMatchingText(SyntaxKind.WhereKeyword); 91if (token.IsKind(SyntaxKind.DotToken))
Completion\KeywordRecommenders\WhileKeywordRecommender.cs (4)
11internal sealed class WhileKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WhileKeyword) 35if (token.Kind() == SyntaxKind.CloseBraceToken && 36token.Parent.IsKind(SyntaxKind.Block) && 37token.Parent.IsParentKind(SyntaxKind.DoStatement))
Completion\KeywordRecommenders\WithKeywordRecommender.cs (2)
11internal sealed class WithKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WithKeyword) 22if (targetToken.Kind() == SyntaxKind.OpenBracketToken &&
Completion\KeywordRecommenders\YieldKeywordRecommender.cs (1)
10internal sealed class YieldKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.YieldKeyword)
Completion\Providers\ContextVariableArgumentProvider.cs (1)
26protected override string ThisOrMeKeyword => SyntaxFacts.GetText(SyntaxKind.ThisKeyword);
Completion\Providers\OutVariableArgumentProvider.cs (3)
44if (SyntaxFacts.GetKeywordKind(name) != SyntaxKind.None 45|| SyntaxFacts.GetContextualKeywordKind(name) != SyntaxKind.None) 57contextualKind: SyntaxKind.None,
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (2)
49if (i == n - 1 && i < originalSeparators.Length && originalSeparators[i].TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia) newLine]) 71nameEquals.Name.GetTrailingTrivia() is [(kind: SyntaxKind.WhitespaceTrivia)]
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (5)
76SyntaxKind.SimpleAssignmentExpression, 122=> (accessorListSyntax.Accessors.FirstOrDefault(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)), 123accessorListSyntax.Accessors.FirstOrDefault(a => a.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration)); 138AccessorList.Accessors: [AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration)
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider.cs (5)
42=> literalExpression.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken; 46SyntaxKind newStartKind, Action<IVirtualCharService, StringBuilder, SyntaxToken> addStringText) 82SyntaxKind.InterpolatedStringTextToken, 88SyntaxKind.InterpolatedVerbatimStringStartToken, AddVerbatimStringText); 92SyntaxKind.InterpolatedStringStartToken, AddRegularStringText);
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (2)
30=> literalExpression.Kind() == SyntaxKind.StringLiteralExpression; 60SyntaxKind.StringLiteralToken,
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (2)
35protected override int FromKind => (int)SyntaxKind.CastExpression; 71return BinaryExpression(SyntaxKind.AsExpression, newExpression, newAsKeyword, newTypeNode);
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (2)
37protected override int FromKind => (int)SyntaxKind.AsExpression; 59if (expression.IsKind(SyntaxKind.NullLiteralExpression) && nullableContext.HasFlag(NullableContext.AnnotationsEnabled) && isReferenceType)
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (2)
50return foreachInfo.ForEachStatement.Parent.IsKind(SyntaxKind.Block); 100SyntaxKind.PostIncrementExpression, IdentifierName(indexVariable))],
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (4)
52if (forStatement is { Declaration.Variables: [{ Initializer: not null } declarator], Condition.RawKind: (int)SyntaxKind.LessThanExpression, Incrementors.Count: 1 }) 87case SyntaxKind.PostIncrementExpression: 92case SyntaxKind.PreIncrementExpression: 97case SyntaxKind.AddAssignmentExpression:
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
32=> !operation.SemanticModel.AnalyzeControlFlow(operation.Syntax).ExitPoints.Any(static n => n.IsKind(SyntaxKind.BreakStatement));
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (8)
22private static readonly Dictionary<BinaryOperatorKind, SyntaxKind> s_operatorMap = new() 24{ BinaryOperatorKind.LessThan, SyntaxKind.LessThanToken }, 25{ BinaryOperatorKind.GreaterThan, SyntaxKind.GreaterThanToken }, 26{ BinaryOperatorKind.LessThanOrEqual, SyntaxKind.LessThanEqualsToken }, 27{ BinaryOperatorKind.GreaterThanOrEqual, SyntaxKind.GreaterThanEqualsToken }, 52pattern = BinaryPattern(SyntaxKind.OrPattern, pattern.Parenthesize(), nextPattern.Parenthesize()); 84.AggregateOrDefault((prev, current) => BinaryExpression(SyntaxKind.LogicalAndExpression, prev, current))); 113AnalyzedPattern.And p => BinaryPattern(SyntaxKind.AndPattern, AsPatternSyntax(p.LeftPattern, feature).Parenthesize(), AsPatternSyntax(p.RightPattern, feature).Parenthesize()),
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (7)
71case SyntaxKind.VariableDeclarator: 80case SyntaxKind.ForEachStatement: 83case SyntaxKind.IfStatement: 205SyntaxKind.SimpleMemberAccessExpression, 246case SyntaxKind.ForEachStatement: 268case SyntaxKind.IfStatement: 280SyntaxKind.SimpleMemberAccessExpression,
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (6)
57case SyntaxKind.LocalDeclarationStatement: 74case SyntaxKind.ExpressionStatement: 147case SyntaxKind.LocalDeclarationStatement: 160case SyntaxKind.VariableDeclarator: 163case SyntaxKind.ExpressionStatement: 182SyntaxKind.SimpleMemberAccessExpression,
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (11)
55case SyntaxKind.Block: 94case SyntaxKind.ForEachStatement: 104case SyntaxKind.IfStatement: 123case SyntaxKind.LocalDeclarationStatement: 138case SyntaxKind.EmptyStatement: 214case SyntaxKind.ExpressionStatement: 219case SyntaxKind.PostIncrementExpression: 240case SyntaxKind.InvocationExpression: 276case SyntaxKind.YieldReturnStatement: 295.Where(statement => statement.Kind() != SyntaxKind.LocalFunctionStatement).ToArray(); 313lastNonLocalFunctionStatement.Kind() == SyntaxKind.YieldBreakStatement &&
ConvertLinq\ConvertForEachToLinqQuery\ToCountConverter.cs (1)
44SyntaxKind.AddAssignmentExpression,
ConvertLinq\ConvertForEachToLinqQuery\ToToListConverter.cs (1)
50SyntaxKind.SimpleMemberAccessExpression,
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (34)
70SyntaxKind.SingleLineCommentTrivia or 71SyntaxKind.MultiLineCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia) || 95if (!documentUpdateInfo.Source.IsParentKind(SyntaxKind.Block) && 118case SyntaxKind.WhereClause: 120case SyntaxKind.FromClause: 148case SyntaxKind.LetClause: 151case SyntaxKind.JoinClause: 201SyntaxKind.SimpleMemberAccessExpression, 209case SyntaxKind.SelectClause: 228case SyntaxKind.ReturnStatement: 231case SyntaxKind.ForEachStatement: 234case SyntaxKind.SimpleMemberAccessExpression: 318PostfixUnaryExpression(SyntaxKind.PostIncrementExpression, variableIdentifier)), // Generating 'count++' 319LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)), // count = 0 351SyntaxKind.SimpleMemberAccessExpression, 459case SyntaxKind.EqualsValueClause: 462SyntaxKind.VariableDeclarator or 463SyntaxKind.VariableDeclaration or 464SyntaxKind.LocalDeclarationStatement && 480case SyntaxKind.SimpleAssignmentExpression: 495case SyntaxKind.ReturnStatement: 572=> YieldStatement(SyntaxKind.YieldReturnStatement, expression); 591SyntaxKind.OpenBraceToken, 763var statements = GenerateStatements(expression => YieldStatement(SyntaxKind.YieldReturnStatement, expression), queryExpressionProcessingInfo); 766var yieldBreakStatement = YieldStatement(SyntaxKind.YieldBreakStatement); 839case SyntaxKind.WhereClause: 842case SyntaxKind.LetClause: 849case SyntaxKind.FromClause: 857case SyntaxKind.JoinClause: 930case SyntaxKind.AnonymousMethodExpression: 931case SyntaxKind.ParenthesizedLambdaExpression: 932case SyntaxKind.SimpleLambdaExpression: 934case SyntaxKind.LocalFunctionStatement:
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (7)
325var firstConstructorIndex = currentTypeDeclaration.Members.IndexOf(m => m is ConstructorDeclarationSyntax c && !c.Modifiers.Any(SyntaxKind.StaticKeyword)); 454=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace] ? whitespace.ToString() : ""; 468? MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), fieldName) 470var assignment = AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, left, parameter.Name.ToIdentifierName()); 480var left = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), fieldOrProperty.Name.ToIdentifierName()) 482var assignment = AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, left, initializer.EqualsToken, initializer.Value); 496baseType?.ArgumentList is null ? null : ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, baseType.ArgumentList),
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (7)
57t => t.Kind() == SyntaxKind.XmlTextLiteralNewLineToken || string.IsNullOrWhiteSpace(t.Text)))) 85if (lastIndex - 1 >= 0 && tokens[lastIndex - 1].Kind() == SyntaxKind.XmlTextLiteralToken && string.IsNullOrWhiteSpace(tokens[lastIndex - 1].Text)) 88if (lastIndex - 1 >= 0 && tokens[lastIndex - 1].Kind() == SyntaxKind.XmlTextLiteralNewLineToken) 134if (!content[0].GetLeadingTrivia().Any(SyntaxKind.DocumentationCommentExteriorTrivia)) 139var finalTrivia = DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. content]); 154if (textToken.Kind() == SyntaxKind.XmlTextLiteralNewLineToken) 157if (textToken.Kind() == SyntaxKind.XmlTextLiteralToken && string.IsNullOrWhiteSpace(textToken.Text))
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (5)
66declaration.Modifiers.Any(SyntaxKind.PartialKeyword); 137while (triviaToMove is [.., SyntaxTrivia(SyntaxKind.SingleLineCommentTrivia), SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 158c => c.Kind() is SyntaxKind.SingleLineCommentTrivia && c.ToString().Contains("https://aka.ms/new-console-template")); 165while (commentIndex < leadingTrivia.Count && leadingTrivia[commentIndex].Kind() is SyntaxKind.EndOfLineTrivia)
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (5)
239modifiers: [.. otherMethod.Modifiers.Where(m => m.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.UnsafeKeyword)], 263if (!statements[0].GetLeadingTrivia().Any(t => t.Kind() is SyntaxKind.EndOfLineTrivia) && 267namespaceDeclaration.GetLeadingTrivia().TakeWhile(t => t.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia));
ConvertToExtension\ConvertToExtensionCodeRefactoringProvider.cs (3)
75if (!firstParameter.Modifiers.Any(SyntaxKind.ThisKeyword)) 81if (!methodDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword)) 84if (!classDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword))
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (11)
40StringStartToken: (kind: SyntaxKind.InterpolatedStringStartToken or SyntaxKind.InterpolatedVerbatimStringStartToken), 68if (stringExpression.StringStartToken.Kind() is not SyntaxKind.InterpolatedStringStartToken and not SyntaxKind.InterpolatedVerbatimStringStartToken) 165stringExpression.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken) 225kind: SyntaxKind.InterpolatedSingleLineRawStringStartToken)) 230kind: SyntaxKind.InterpolatedRawStringEndToken)); 388kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 393kind: SyntaxKind.InterpolatedRawStringEndToken)); 500if (descendant is LiteralExpressionSyntax(kind: SyntaxKind.StringLiteralExpression) || 688public static SyntaxToken UpdateToken(SyntaxToken token, string text, string valueText = "", SyntaxKind? kind = null)
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (4)
31=> stringExpression.Kind() is SyntaxKind.StringLiteralExpression; 46if (token.Kind() != SyntaxKind.StringLiteralToken) 195SyntaxKind.SingleLineRawStringLiteralToken, 243SyntaxKind.MultiLineRawStringLiteralToken,
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (1)
147var syntaxTrivia = leadingTrivia.LastOrDefault(static trivia => trivia.IsKind(SyntaxKind.EndOfLineTrivia));
Debugging\BreakpointResolver.cs (2)
73if (token.IsKind(SyntaxKind.SemicolonToken)) 89!parts.Any(p => p.IsKind(SyntaxKind.AliasQualifiedName)))
Debugging\CSharpProximityExpressionsService.cs (2)
58if (token.Kind() == SyntaxKind.CloseBraceToken && token.GetPreviousToken().Kind() != SyntaxKind.None)
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (4)
114case SyntaxKind.TupleExpression: 124case SyntaxKind.DeclarationExpression: 142case SyntaxKind.ParenthesizedVariableDesignation: 149case SyntaxKind.SingleVariableDesignation:
Debugging\CSharpProximityExpressionsService.Worker.cs (37)
57SyntaxKind.SetAccessorDeclaration or 58SyntaxKind.InitAccessorDeclaration or 59SyntaxKind.AddAccessorDeclaration or 60SyntaxKind.RemoveAccessorDeclaration)) 70if (!memberDeclaration.IsKind(SyntaxKind.GlobalStatement) && !memberDeclaration.GetModifiers().Any(SyntaxKind.StaticKeyword)) 82catchClause.Declaration != null && catchClause.Declaration.Identifier.Kind() != SyntaxKind.None) 191case SyntaxKind.ExpressionStatement: 192case SyntaxKind.LocalDeclarationStatement: 195case SyntaxKind.DoStatement: 199case SyntaxKind.ForStatement: 200case SyntaxKind.ForEachStatement: 201case SyntaxKind.ForEachVariableStatement: 202case SyntaxKind.IfStatement: 203case SyntaxKind.CheckedStatement: 204case SyntaxKind.UncheckedStatement: 205case SyntaxKind.WhileStatement: 206case SyntaxKind.LockStatement: 207case SyntaxKind.SwitchStatement: 208case SyntaxKind.TryStatement: 209case SyntaxKind.UsingStatement: 220var statementAncestor = _parentStatement.Ancestors().OfType<StatementSyntax>().FirstOrDefault(node => !node.IsKind(SyntaxKind.Block)); 237case SyntaxKind.Block: 240case SyntaxKind.BreakStatement: 241case SyntaxKind.ContinueStatement: 244case SyntaxKind.CheckedStatement: 245case SyntaxKind.UncheckedStatement: 248case SyntaxKind.DoStatement: 251case SyntaxKind.ForStatement: 254case SyntaxKind.ForEachStatement: 255case SyntaxKind.ForEachVariableStatement: 258case SyntaxKind.IfStatement: 267case SyntaxKind.LockStatement: 270case SyntaxKind.SwitchStatement: 278case SyntaxKind.TryStatement: 294case SyntaxKind.UsingStatement: 297case SyntaxKind.WhileStatement:
Debugging\CSharpProximityExpressionsService_ExpressionTermCollector.cs (43)
64case SyntaxKind.ThisExpression: 65case SyntaxKind.BaseExpression: 72case SyntaxKind.IdentifierName: 77case SyntaxKind.CharacterLiteralExpression: 78case SyntaxKind.FalseLiteralExpression: 79case SyntaxKind.NullLiteralExpression: 80case SyntaxKind.NumericLiteralExpression: 81case SyntaxKind.StringLiteralExpression: 82case SyntaxKind.TrueLiteralExpression: 89case SyntaxKind.CastExpression: 93case SyntaxKind.SimpleMemberAccessExpression: 94case SyntaxKind.PointerMemberAccessExpression: 98case SyntaxKind.ObjectCreationExpression: 102case SyntaxKind.ArrayCreationExpression: 106case SyntaxKind.InvocationExpression: 189memberAccessExpression.Parent?.Kind() is not SyntaxKind.SimpleMemberAccessExpression and not SyntaxKind.PointerMemberAccessExpression) 197!memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression)) 282if (prefixUnaryExpression.Kind() is SyntaxKind.LogicalNotExpression or SyntaxKind.BitwiseNotExpression or SyntaxKind.UnaryMinusExpression or SyntaxKind.UnaryPlusExpression) 354case SyntaxKind.AddExpression: 355case SyntaxKind.SubtractExpression: 356case SyntaxKind.MultiplyExpression: 357case SyntaxKind.DivideExpression: 358case SyntaxKind.ModuloExpression: 359case SyntaxKind.LeftShiftExpression: 360case SyntaxKind.RightShiftExpression: 361case SyntaxKind.LogicalOrExpression: 362case SyntaxKind.LogicalAndExpression: 363case SyntaxKind.BitwiseOrExpression: 364case SyntaxKind.BitwiseAndExpression: 365case SyntaxKind.ExclusiveOrExpression: 366case SyntaxKind.EqualsExpression: 367case SyntaxKind.NotEqualsExpression: 368case SyntaxKind.LessThanExpression: 369case SyntaxKind.LessThanOrEqualExpression: 370case SyntaxKind.GreaterThanExpression: 371case SyntaxKind.GreaterThanOrEqualExpression: 372case SyntaxKind.IsExpression: 373case SyntaxKind.AsExpression: 374case SyntaxKind.CoalesceExpression:
Debugging\DataTipInfoGetter.cs (1)
32return token.IsKind(SyntaxKind.IdentifierToken)
Debugging\LocationInfoGetter.cs (3)
32if ((memberDeclaration == null) || (memberDeclaration.Kind() == SyntaxKind.GlobalStatement)) 40if (memberDeclaration.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration)
DecompiledSource\CSharpDecompiledSourceFormattingRule.cs (2)
29if (previousToken.Kind() != SyntaxKind.CloseBraceToken) 32if (currentToken.Kind() == SyntaxKind.CloseBraceToken)
Diagnostics\Analyzers\CSharpPreferFrameworkTypeDiagnosticAnalyzer.cs (5)
16SyntaxKind, 22protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; } = 23[SyntaxKind.PredefinedType, SyntaxKind.IdentifierName]; 29=> node.Keyword.Kind() != SyntaxKind.VoidKeyword;
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (18)
23: SimplifyTypeNamesDiagnosticAnalyzerBase<SyntaxKind, CSharpSimplifierOptions> 25private static readonly ImmutableArray<SyntaxKind> s_kindsOfInterest = 27SyntaxKind.QualifiedName, 28SyntaxKind.AliasQualifiedName, 29SyntaxKind.GenericName, 30SyntaxKind.IdentifierName, 31SyntaxKind.SimpleMemberAccessExpression, 32SyntaxKind.QualifiedCref, 41SyntaxKind.CompilationUnit or 42SyntaxKind.ClassDeclaration or 43SyntaxKind.RecordDeclaration or 44SyntaxKind.StructDeclaration or 45SyntaxKind.RecordStructDeclaration or 46SyntaxKind.InterfaceDeclaration or 47SyntaxKind.DelegateDeclaration or 48SyntaxKind.EnumDeclaration; 90if (node is MemberAccessExpressionSyntax memberAccess && memberAccess.Expression.IsKind(SyntaxKind.ThisExpression)) 129else if (node.Kind() == SyntaxKind.SimpleMemberAccessExpression)
Diagnostics\Analyzers\CSharpUnboundIdentifiersDiagnosticAnalyzer.cs (4)
16internal sealed class CSharpUnboundIdentifiersDiagnosticAnalyzer : UnboundIdentifiersDiagnosticAnalyzerBase<SyntaxKind, SimpleNameSyntax, QualifiedNameSyntax, IncompleteMemberSyntax> 21private static readonly ImmutableArray<SyntaxKind> s_kindsOfInterest = [SyntaxKind.IncompleteMember]; 23protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest => s_kindsOfInterest;
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))
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (40)
41case SyntaxKind.ClassDeclaration: 42case SyntaxKind.RecordDeclaration: 43case SyntaxKind.InterfaceDeclaration: 44case SyntaxKind.StructDeclaration: 45case SyntaxKind.RecordStructDeclaration: 46case SyntaxKind.DelegateDeclaration: 47case SyntaxKind.EnumDeclaration: 48case SyntaxKind.EnumMemberDeclaration: 49case SyntaxKind.FieldDeclaration: 50case SyntaxKind.MethodDeclaration: 51case SyntaxKind.ConstructorDeclaration: 52case SyntaxKind.DestructorDeclaration: 53case SyntaxKind.PropertyDeclaration: 54case SyntaxKind.IndexerDeclaration: 55case SyntaxKind.EventDeclaration: 56case SyntaxKind.EventFieldDeclaration: 57case SyntaxKind.OperatorDeclaration: 58case SyntaxKind.ConversionOperatorDeclaration: 59case SyntaxKind.ExtensionBlockDeclaration: 68=> member.GetFirstToken().LeadingTrivia.Any(t => t is (kind: SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia)); 77if (previousToken.Kind() != SyntaxKind.None) 131SyntaxKind.MethodDeclaration or 132SyntaxKind.IndexerDeclaration or 133SyntaxKind.DelegateDeclaration or 134SyntaxKind.OperatorDeclaration or 135SyntaxKind.ConstructorDeclaration or 136SyntaxKind.DestructorDeclaration) 140!(returnType is PredefinedTypeSyntax predefinedType && predefinedType.Keyword.IsKindOrHasMatchingText(SyntaxKind.VoidKeyword))) 156var throwExpressionsAndStatements = member.DescendantNodes().Where(n => n.Kind() is SyntaxKind.ThrowExpression or SyntaxKind.ThrowStatement); 171if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 260=> token.RawKind == (int)SyntaxKind.XmlTextLiteralNewLineToken; 263=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 306return lastTextToken.Kind() == SyntaxKind.XmlTextLiteralNewLineToken 308&& firstTextToken.LeadingTrivia is [(kind: SyntaxKind.DocumentationCommentExteriorTrivia) firstTrivia] 321if (token.LeadingTrivia.Any(SyntaxKind.DocumentationCommentExteriorTrivia)) 359return lastTextToken.Kind() == SyntaxKind.XmlTextLiteralNewLineToken 361&& firstTextToken.LeadingTrivia.ElementAt(0).Kind() == SyntaxKind.DocumentationCommentExteriorTrivia 370=> token.TrailingTrivia.Any(t => t.Kind() == SyntaxKind.SkippedTokensTrivia);
DocumentationComments\DocCommentConverter.cs (2)
48if (node.GetLeadingTrivia().Any(SyntaxKind.SingleLineDocumentationCommentTrivia)) 54if (trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia)
EditAndContinue\BreakpointSpans.cs (85)
174case SyntaxKind.MethodDeclaration: 175case SyntaxKind.OperatorDeclaration: 176case SyntaxKind.ConversionOperatorDeclaration: 177case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.ConstructorDeclaration: 184case SyntaxKind.RecordDeclaration: 185case SyntaxKind.RecordStructDeclaration: 186case SyntaxKind.StructDeclaration: 187case SyntaxKind.ClassDeclaration: 202var baseInitializer = (PrimaryConstructorBaseTypeSyntax?)typeDeclaration.BaseList?.Types.FirstOrDefault(t => t.IsKind(SyntaxKind.PrimaryConstructorBaseType)); 263case SyntaxKind.VariableDeclarator: 267case SyntaxKind.VariableDeclaration: 270case SyntaxKind.EventFieldDeclaration: 271case SyntaxKind.FieldDeclaration: 274case SyntaxKind.ElseClause: 277case SyntaxKind.CatchFilterClause: 280case SyntaxKind.CatchClause: 283case SyntaxKind.FinallyClause: 286case SyntaxKind.CaseSwitchLabel: 287case SyntaxKind.DefaultSwitchLabel: 290case SyntaxKind.CasePatternSwitchLabel: 296case SyntaxKind.SwitchExpressionArm: 303case SyntaxKind.SwitchExpression when 312case SyntaxKind.WhenClause: 315case SyntaxKind.GetAccessorDeclaration: 316case SyntaxKind.SetAccessorDeclaration: 317case SyntaxKind.InitAccessorDeclaration: 318case SyntaxKind.AddAccessorDeclaration: 319case SyntaxKind.RemoveAccessorDeclaration: 320case SyntaxKind.UnknownAccessorDeclaration: 335case SyntaxKind.PropertyDeclaration: 359case SyntaxKind.IndexerDeclaration: 373case SyntaxKind.EventDeclaration: 379case SyntaxKind.BaseConstructorInitializer: 380case SyntaxKind.ThisConstructorInitializer: 389case SyntaxKind.FromClause: 393case SyntaxKind.JoinClause: 397case SyntaxKind.LetClause: 401case SyntaxKind.WhereClause: 405case SyntaxKind.OrderByClause: 411case SyntaxKind.SelectClause: 415case SyntaxKind.GroupClause: 419case SyntaxKind.LocalFunctionStatement: 454if (constructorSyntax.Modifiers.Any(SyntaxKind.StaticKeyword)) 587case SyntaxKind.Block: 590case SyntaxKind.LocalDeclarationStatement: 598case SyntaxKind.LabeledStatement: 603case SyntaxKind.WhileStatement: 611case SyntaxKind.DoStatement: 626case SyntaxKind.ForStatement: 662case SyntaxKind.ForEachStatement: 663case SyntaxKind.ForEachVariableStatement: 675if (forEachStatement.Kind() == SyntaxKind.ForEachStatement) 694case SyntaxKind.UsingStatement: 705case SyntaxKind.FixedStatement: 709case SyntaxKind.CheckedStatement: 710case SyntaxKind.UncheckedStatement: 714case SyntaxKind.UnsafeStatement: 718case SyntaxKind.LockStatement: 725case SyntaxKind.IfStatement: 733case SyntaxKind.SwitchStatement: 740case SyntaxKind.TryStatement: 750case SyntaxKind.GotoStatement: 751case SyntaxKind.GotoCaseStatement: 752case SyntaxKind.GotoDefaultStatement: 753case SyntaxKind.BreakStatement: 754case SyntaxKind.ContinueStatement: 755case SyntaxKind.ReturnStatement: 756case SyntaxKind.YieldReturnStatement: 757case SyntaxKind.YieldBreakStatement: 758case SyntaxKind.ThrowStatement: 759case SyntaxKind.ExpressionStatement: 760case SyntaxKind.EmptyStatement: 771=> token2.IsKind(SyntaxKind.None) || token2.IsMissing ? token1 : token2; 777SyntaxKind.LocalDeclarationStatement or SyntaxKind.EventFieldDeclaration or SyntaxKind.FieldDeclaration => null, 794if (modifiersOpt.Any(SyntaxKind.ConstKeyword)) 854if (variableDeclarator.Initializer == null || modifiers.Any(SyntaxKind.ConstKeyword)) 876if (variableDeclarator.Initializer == null || modifiers.Any(SyntaxKind.ConstKeyword)) 972case SyntaxKind.ArrowExpressionClause: 976case SyntaxKind.SwitchExpressionArm: 980case SyntaxKind.ForStatement: 987case SyntaxKind.ForEachStatement: 988case SyntaxKind.ForEachVariableStatement:
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (382)
76case SyntaxKind.ClassDeclaration: 77case SyntaxKind.StructDeclaration: 89case SyntaxKind.RecordDeclaration: 90case SyntaxKind.RecordStructDeclaration: 98case SyntaxKind.MethodDeclaration: 99case SyntaxKind.ConversionOperatorDeclaration: 100case SyntaxKind.OperatorDeclaration: 101case SyntaxKind.SetAccessorDeclaration: 102case SyntaxKind.InitAccessorDeclaration: 103case SyntaxKind.AddAccessorDeclaration: 104case SyntaxKind.RemoveAccessorDeclaration: 105case SyntaxKind.GetAccessorDeclaration: 106case SyntaxKind.ConstructorDeclaration: 107case SyntaxKind.DestructorDeclaration: 111case SyntaxKind.PropertyDeclaration: 117case SyntaxKind.FieldDeclaration: 118case SyntaxKind.EventFieldDeclaration: 124case SyntaxKind.Parameter: 134case SyntaxKind.VariableDeclarator: 136Debug.Assert(current.Parent.IsKind(SyntaxKind.VariableDeclaration)); 140case SyntaxKind.FieldDeclaration: 141case SyntaxKind.EventFieldDeclaration: 149case SyntaxKind.ArrowExpressionClause: 151if (current.Parent is (kind: SyntaxKind.PropertyDeclaration or SyntaxKind.IndexerDeclaration)) 159case SyntaxKind.GlobalStatement: 160Debug.Assert(current.Parent.IsKind(SyntaxKind.CompilationUnit)); 215case SyntaxKind.Block: 219case SyntaxKind.ForEachStatement: 220case SyntaxKind.ForEachVariableStatement: 225case SyntaxKind.DoStatement: 233case SyntaxKind.PropertyDeclaration: 240case SyntaxKind.VariableDeclaration: 257case SyntaxKind.SwitchExpression: 282case SyntaxKind.SwitchExpressionArm: 420(oldBody.Parent.IsKind(SyntaxKind.LocalFunctionStatement) && newBody.Parent.IsKind(SyntaxKind.LocalFunctionStatement))) 444return parent.IsKind(SyntaxKind.ArrowExpressionClause) && parent.Parent.IsKind(SyntaxKind.LocalFunctionStatement) ? parent.Parent : parent; 505if (oldStatement == oldBody && !newBody.IsKind(SyntaxKind.Block)) 529=> node.IsKind(SyntaxKind.GlobalStatement); 561=> (ushort)SyntaxKind.LineDirectiveTrivia; 583case SyntaxKind.ArrowExpressionClause: 589case SyntaxKind.Block: 593case SyntaxKind.ForEachStatement: 597case SyntaxKind.ForEachVariableStatement: 601case SyntaxKind.DoStatement: 610case SyntaxKind.PropertyDeclaration: 627case SyntaxKind.SwitchExpression: 631case SyntaxKind.SwitchExpressionArm: 642case SyntaxKind.ParameterList when node.Parent is TypeDeclarationSyntax typeDeclaration: 650case SyntaxKind.RecordDeclaration: 651case SyntaxKind.RecordStructDeclaration: 664=> (memberBody, memberBody.IsKind(SyntaxKind.Block) ? (int)BlockPart.OpenBrace : DefaultStatementPart); 686case SyntaxKind.Block: 691case SyntaxKind.ForEachStatement: 692case SyntaxKind.ForEachVariableStatement: 734nodeModifiers.Value.Any(SyntaxKind.StaticKeyword) != fieldOrPropertyModifiers.Value.Any(SyntaxKind.StaticKeyword)) 742case SyntaxKind.Block: 746case SyntaxKind.ForEachStatement: 747case SyntaxKind.ForEachVariableStatement: 766case SyntaxKind.Block: 781case SyntaxKind.ConstructorDeclaration: 785case SyntaxKind.ForEachStatement: 786case SyntaxKind.ForEachVariableStatement: 790case SyntaxKind.IfStatement: 794case SyntaxKind.WhileStatement: 798case SyntaxKind.DoStatement: 802case SyntaxKind.SwitchStatement: 805case SyntaxKind.LockStatement: 808case SyntaxKind.UsingStatement: 882case SyntaxKind.ForEachStatement: return AreEquivalentIgnoringLambdaBodies(((ForEachStatementSyntax)oldNode).Type, ((ForEachStatementSyntax)newNode).Type); 883case SyntaxKind.ForEachVariableStatement: return AreEquivalentIgnoringLambdaBodies(((ForEachVariableStatementSyntax)oldNode).Variable, ((ForEachVariableStatementSyntax)newNode).Variable); 907=> node.IsKind(SyntaxKind.InterfaceDeclaration); 910=> node.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration; 925!fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 970return ctorInitializer is null or { ThisOrBaseKeyword: (kind: SyntaxKind.ThisKeyword), ArgumentList.Arguments: [] }; 975return ctorInitializer is null or (kind: SyntaxKind.BaseConstructorInitializer); 983|| ((BaseTypeDeclarationSyntax)syntaxRefs.Single().GetSyntax()).Modifiers.Any(SyntaxKind.PartialKeyword); 1285if (typeNameSpanChanged && (oldNode.IsKind(SyntaxKind.RecordDeclaration) || newNode.IsKind(SyntaxKind.RecordDeclaration))) 1305if (node.IsKind(SyntaxKind.GetAccessorDeclaration)) 1307Debug.Assert(node.Parent.IsKind(SyntaxKind.AccessorList)); 1329if (node.IsKind(SyntaxKind.TypeParameterConstraintClause)) 1336if (node.IsKind(SyntaxKind.GlobalStatement)) 1344if (node is (kind: SyntaxKind.PrimaryConstructorBaseType or SyntaxKind.BaseList)) 1360if (oldNode.IsKind(SyntaxKind.LocalFunctionStatement)) 1382if (node.Kind() is SyntaxKind.UsingDirective or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration) 1387if (node.IsKind(SyntaxKind.TypeParameterConstraintClause)) 1395if (node.IsKind(SyntaxKind.GlobalStatement)) 1405if (node.IsKind(SyntaxKind.BaseList)) 1446=> node.IsKind(SyntaxKind.LocalFunctionStatement) || 1463=> node.IsKind(SyntaxKind.LocalFunctionStatement); 1498case SyntaxKind.FromClause: 1499case SyntaxKind.LetClause: 1500case SyntaxKind.WhereClause: 1501case SyntaxKind.OrderByClause: 1502case SyntaxKind.JoinClause: 1509case SyntaxKind.AscendingOrdering: 1510case SyntaxKind.DescendingOrdering: 1516case SyntaxKind.SelectClause: 1527case SyntaxKind.GroupClause: 1605internal static TextSpan? TryGetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, EditKind editKind) 1609case SyntaxKind.CompilationUnit: 1625case SyntaxKind.GlobalStatement: 1628case SyntaxKind.ExternAliasDirective: 1629case SyntaxKind.UsingDirective: 1632case SyntaxKind.NamespaceDeclaration: 1633case SyntaxKind.FileScopedNamespaceDeclaration: 1637case SyntaxKind.ClassDeclaration: 1638case SyntaxKind.StructDeclaration: 1639case SyntaxKind.InterfaceDeclaration: 1640case SyntaxKind.RecordDeclaration: 1641case SyntaxKind.RecordStructDeclaration: 1646case SyntaxKind.ExtensionBlockDeclaration: 1650case SyntaxKind.BaseList: 1654case SyntaxKind.EnumDeclaration: 1658case SyntaxKind.DelegateDeclaration: 1662case SyntaxKind.FieldDeclaration: 1666case SyntaxKind.EventFieldDeclaration: 1670case SyntaxKind.VariableDeclaration: 1673case SyntaxKind.VariableDeclarator: 1676case SyntaxKind.MethodDeclaration: 1680case SyntaxKind.ConversionOperatorDeclaration: 1684case SyntaxKind.OperatorDeclaration: 1688case SyntaxKind.ConstructorDeclaration: 1692case SyntaxKind.DestructorDeclaration: 1696case SyntaxKind.PropertyDeclaration: 1700case SyntaxKind.IndexerDeclaration: 1704case SyntaxKind.EventDeclaration: 1708case SyntaxKind.EnumMemberDeclaration: 1711case SyntaxKind.GetAccessorDeclaration: 1712case SyntaxKind.SetAccessorDeclaration: 1713case SyntaxKind.InitAccessorDeclaration: 1714case SyntaxKind.AddAccessorDeclaration: 1715case SyntaxKind.RemoveAccessorDeclaration: 1716case SyntaxKind.UnknownAccessorDeclaration: 1720case SyntaxKind.TypeParameterConstraintClause: 1724case SyntaxKind.TypeParameter: 1728case SyntaxKind.AccessorList: 1729case SyntaxKind.TypeParameterList: 1730case SyntaxKind.ParameterList: 1731case SyntaxKind.BracketedParameterList: 1741case SyntaxKind.Parameter: 1747case SyntaxKind.PrimaryConstructorBaseType: 1748case SyntaxKind.AttributeList: 1749case SyntaxKind.Attribute: 1752case SyntaxKind.ArrowExpressionClause: 1758case SyntaxKind.Block: 1761case SyntaxKind.UsingStatement: 1765case SyntaxKind.FixedStatement: 1769case SyntaxKind.LockStatement: 1773case SyntaxKind.StackAllocArrayCreationExpression: 1776case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 1779case SyntaxKind.TryStatement: 1782case SyntaxKind.CatchClause: 1785case SyntaxKind.CatchDeclaration: 1786case SyntaxKind.CatchFilterClause: 1789case SyntaxKind.FinallyClause: 1792case SyntaxKind.IfStatement: 1796case SyntaxKind.ElseClause: 1799case SyntaxKind.SwitchStatement: 1804case SyntaxKind.SwitchSection: 1807case SyntaxKind.WhileStatement: 1811case SyntaxKind.DoStatement: 1814case SyntaxKind.ForStatement: 1818case SyntaxKind.ForEachStatement: 1819case SyntaxKind.ForEachVariableStatement: 1825case SyntaxKind.LabeledStatement: 1828case SyntaxKind.CheckedStatement: 1829case SyntaxKind.UncheckedStatement: 1832case SyntaxKind.UnsafeStatement: 1835case SyntaxKind.LocalFunctionStatement: 1839case SyntaxKind.YieldBreakStatement: 1840case SyntaxKind.YieldReturnStatement: 1841case SyntaxKind.ReturnStatement: 1842case SyntaxKind.ThrowStatement: 1843case SyntaxKind.ExpressionStatement: 1844case SyntaxKind.EmptyStatement: 1845case SyntaxKind.GotoStatement: 1846case SyntaxKind.GotoCaseStatement: 1847case SyntaxKind.GotoDefaultStatement: 1848case SyntaxKind.BreakStatement: 1849case SyntaxKind.ContinueStatement: 1852case SyntaxKind.LocalDeclarationStatement: 1856case SyntaxKind.AwaitExpression: 1859case SyntaxKind.AnonymousObjectCreationExpression: 1862case SyntaxKind.ParenthesizedLambdaExpression: 1866case SyntaxKind.SimpleLambdaExpression: 1869case SyntaxKind.AnonymousMethodExpression: 1872case SyntaxKind.QueryExpression: 1875case SyntaxKind.QueryBody: 1879case SyntaxKind.QueryContinuation: 1882case SyntaxKind.FromClause: 1885case SyntaxKind.JoinClause: 1888case SyntaxKind.JoinIntoClause: 1891case SyntaxKind.LetClause: 1894case SyntaxKind.WhereClause: 1897case SyntaxKind.OrderByClause: 1900case SyntaxKind.AscendingOrdering: 1901case SyntaxKind.DescendingOrdering: 1904case SyntaxKind.SelectClause: 1907case SyntaxKind.GroupClause: 1910case SyntaxKind.IsPatternExpression: 1911case SyntaxKind.TupleType: 1912case SyntaxKind.TupleExpression: 1913case SyntaxKind.DeclarationExpression: 1914case SyntaxKind.RefType: 1915case SyntaxKind.RefExpression: 1916case SyntaxKind.DeclarationPattern: 1917case SyntaxKind.SimpleAssignmentExpression: 1918case SyntaxKind.WhenClause: 1919case SyntaxKind.SingleVariableDesignation: 1920case SyntaxKind.CasePatternSwitchLabel: 1923case SyntaxKind.SwitchExpression: 1926case SyntaxKind.SwitchExpressionArm: 1946case SyntaxKind.ParenthesizedLambdaExpression: 1949case SyntaxKind.SimpleLambdaExpression: 1953case SyntaxKind.AnonymousMethodExpression: 2002case SyntaxKind.CompilationUnit: 2005case SyntaxKind.GlobalStatement: 2008case SyntaxKind.ExternAliasDirective: 2011case SyntaxKind.UsingDirective: 2016case SyntaxKind.NamespaceDeclaration: 2017case SyntaxKind.FileScopedNamespaceDeclaration: 2020case SyntaxKind.ClassDeclaration: 2023case SyntaxKind.StructDeclaration: 2026case SyntaxKind.InterfaceDeclaration: 2029case SyntaxKind.RecordDeclaration: 2032case SyntaxKind.RecordStructDeclaration: 2035case SyntaxKind.EnumDeclaration: 2038case SyntaxKind.DelegateDeclaration: 2041case SyntaxKind.FieldDeclaration: 2043return declaration.Modifiers.Any(SyntaxKind.ConstKeyword) ? FeaturesResources.const_field : FeaturesResources.field; 2045case SyntaxKind.EventFieldDeclaration: 2048case SyntaxKind.VariableDeclaration: 2049case SyntaxKind.VariableDeclarator: 2052case SyntaxKind.MethodDeclaration: 2055case SyntaxKind.ConversionOperatorDeclaration: 2058case SyntaxKind.OperatorDeclaration: 2061case SyntaxKind.ConstructorDeclaration: 2063return ctor.Modifiers.Any(SyntaxKind.StaticKeyword) ? FeaturesResources.static_constructor : FeaturesResources.constructor; 2065case SyntaxKind.DestructorDeclaration: 2068case SyntaxKind.PropertyDeclaration: 2071case SyntaxKind.IndexerDeclaration: 2074case SyntaxKind.EventDeclaration: 2077case SyntaxKind.EnumMemberDeclaration: 2080case SyntaxKind.GetAccessorDeclaration: 2081if (node.Parent!.Parent!.IsKind(SyntaxKind.PropertyDeclaration)) 2087RoslynDebug.Assert(node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration)); 2091case SyntaxKind.InitAccessorDeclaration: 2092case SyntaxKind.SetAccessorDeclaration: 2093if (node.Parent!.Parent!.IsKind(SyntaxKind.PropertyDeclaration)) 2099RoslynDebug.Assert(node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration)); 2103case SyntaxKind.AddAccessorDeclaration: 2104case SyntaxKind.RemoveAccessorDeclaration: 2107case SyntaxKind.ArrowExpressionClause: 2110SyntaxKind.PropertyDeclaration => CSharpFeaturesResources.property_getter, 2111SyntaxKind.IndexerDeclaration => CSharpFeaturesResources.indexer_getter, 2115case SyntaxKind.TypeParameterConstraintClause: 2118case SyntaxKind.TypeParameterList: 2119case SyntaxKind.TypeParameter: 2122case SyntaxKind.Parameter: 2125case SyntaxKind.ParameterList: 2128case SyntaxKind.AttributeList: 2131case SyntaxKind.Attribute: 2134case SyntaxKind.AttributeTargetSpecifier: 2139case SyntaxKind.TryStatement: 2142case SyntaxKind.CatchClause: 2143case SyntaxKind.CatchDeclaration: 2146case SyntaxKind.CatchFilterClause: 2149case SyntaxKind.FinallyClause: 2152case SyntaxKind.FixedStatement: 2155case SyntaxKind.UsingStatement: 2158case SyntaxKind.LockStatement: 2161case SyntaxKind.ForEachStatement: 2162case SyntaxKind.ForEachVariableStatement: 2165case SyntaxKind.CheckedStatement: 2168case SyntaxKind.UncheckedStatement: 2171case SyntaxKind.YieldBreakStatement: 2174case SyntaxKind.YieldReturnStatement: 2177case SyntaxKind.AwaitExpression: 2180case SyntaxKind.ParenthesizedLambdaExpression: 2181case SyntaxKind.SimpleLambdaExpression: 2184case SyntaxKind.AnonymousMethodExpression: 2187case SyntaxKind.FromClause: 2190case SyntaxKind.JoinClause: 2191case SyntaxKind.JoinIntoClause: 2194case SyntaxKind.LetClause: 2197case SyntaxKind.WhereClause: 2200case SyntaxKind.OrderByClause: 2201case SyntaxKind.AscendingOrdering: 2202case SyntaxKind.DescendingOrdering: 2205case SyntaxKind.SelectClause: 2208case SyntaxKind.GroupClause: 2211case SyntaxKind.QueryBody: 2214case SyntaxKind.QueryContinuation: 2217case SyntaxKind.IsPatternExpression: 2220case SyntaxKind.SimpleAssignmentExpression: 2230case SyntaxKind.TupleType: 2231case SyntaxKind.TupleExpression: 2234case SyntaxKind.LocalFunctionStatement: 2237case SyntaxKind.DeclarationExpression: 2240case SyntaxKind.RefType: 2241case SyntaxKind.RefExpression: 2244case SyntaxKind.SwitchStatement: 2247case SyntaxKind.LocalDeclarationStatement: 2248if (((LocalDeclarationStatementSyntax)node).UsingKeyword.IsKind(SyntaxKind.UsingKeyword)) 2255case SyntaxKind.ExtensionBlockDeclaration: 2267case SyntaxKind.ForEachStatement: 2268Debug.Assert(((CommonForEachStatementSyntax)node).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2271case SyntaxKind.VariableDeclarator: 2272RoslynDebug.Assert(((LocalDeclarationStatementSyntax)node.Parent!.Parent!).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2382if (_newNode.IsKind(SyntaxKind.LocalFunctionStatement)) 2389case SyntaxKind.EnumMemberDeclaration: 2395case SyntaxKind.TypeParameter: 2405case SyntaxKind.ExtensionBlockDeclaration: 2410case SyntaxKind.ExternAliasDirective: 2414case SyntaxKind.Attribute: 2415case SyntaxKind.AttributeList: 2421if (node.IsParentKind(SyntaxKind.CompilationUnit) || node.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 2434case SyntaxKind.ExternAliasDirective: 2440case SyntaxKind.ExtensionBlockDeclaration: 2445case SyntaxKind.AttributeList: 2446case SyntaxKind.Attribute: 2452if (oldNode.IsParentKind(SyntaxKind.CompilationUnit) || oldNode.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 2465case SyntaxKind.ExternAliasDirective: 2469case SyntaxKind.Attribute: 2475if (newNode.IsParentKind(SyntaxKind.CompilationUnit) || newNode.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 2507if (node.Kind() is SyntaxKind.StackAllocArrayCreationExpression or SyntaxKind.ImplicitStackAllocArrayCreationExpression) 2593var kind = current.Kind(); 2597case SyntaxKind.TryStatement: 2605case SyntaxKind.CatchClause: 2606case SyntaxKind.FinallyClause: 2611RoslynDebug.Assert(current.Parent.Kind() == SyntaxKind.TryStatement); 2617case SyntaxKind.ClassDeclaration: 2618case SyntaxKind.StructDeclaration: 2619case SyntaxKind.RecordDeclaration: 2620case SyntaxKind.RecordStructDeclaration: 2659case SyntaxKind.TryStatement: 2665case SyntaxKind.CatchClause: 2666case SyntaxKind.FinallyClause: 2693case SyntaxKind.TryStatement: 2709case SyntaxKind.CatchClause: 2713case SyntaxKind.FinallyClause: 2732if (newNode.IsKind(SyntaxKind.AwaitExpression) && oldNode.IsKind(SyntaxKind.AwaitExpression)) 2759case SyntaxKind.ForStatement: 2760case SyntaxKind.ForEachStatement: 2761case SyntaxKind.IfStatement: 2762case SyntaxKind.WhileStatement: 2763case SyntaxKind.DoStatement: 2764case SyntaxKind.SwitchStatement: 2765case SyntaxKind.LockStatement: 2766case SyntaxKind.UsingStatement: 2767case SyntaxKind.ArrowExpressionClause: 2782Debug.Assert(awaitExpression.IsKind(SyntaxKind.AwaitExpression)); 2792case SyntaxKind.ExpressionStatement: 2793case SyntaxKind.ReturnStatement: 2807case SyntaxKind.VariableDeclaration: 2812case SyntaxKind.LocalDeclarationStatement: 2825case SyntaxKind.ExpressionStatement: 2828case SyntaxKind.ReturnStatement: 2839if (node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 2841return assignment.Left.IsKind(SyntaxKind.IdentifierName) && assignment.Right == awaitExpression; 2877if (!oldActiveStatement.IsKind(SyntaxKind.WhenClause)) 2892Debug.Assert(newActiveStatement.IsKind(SyntaxKind.WhenClause)); 2974case SyntaxKind.CheckedStatement: 2975case SyntaxKind.UncheckedStatement: 3014nodeSelector: static n => n.IsKind(SyntaxKind.LockStatement), 3029nodeSelector: static n => n.IsKind(SyntaxKind.FixedStatement), 3060nodeSelector: static n => n.Kind() is SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement,
EditAndContinue\SyntaxComparer.cs (269)
237=> (int)Classify((SyntaxKind)kind, node, out isLeaf); 239internal Label Classify(SyntaxKind kind, SyntaxNode? node, out bool isLeaf) 247if (node != null && node.Parent.IsKind(SyntaxKind.ForStatement) && node is ExpressionSyntax) 260case SyntaxKind.CompilationUnit: 263case SyntaxKind.TypeParameterList: 266case SyntaxKind.TypeParameterConstraintClause: 269case SyntaxKind.TypeParameter: 273case SyntaxKind.BracketedParameterList: 276case SyntaxKind.ParameterList: 279case SyntaxKind.Parameter: 282case SyntaxKind.ConstructorDeclaration: 295private static Label ClassifyStatementSyntax(SyntaxKind kind, SyntaxNode? node, out bool isLeaf) 323case SyntaxKind.NamespaceDeclaration: 324case SyntaxKind.ClassDeclaration: 325case SyntaxKind.InterfaceDeclaration: 326case SyntaxKind.StructDeclaration: 327case SyntaxKind.RecordDeclaration: 328case SyntaxKind.RecordStructDeclaration: 334case SyntaxKind.LocalDeclarationStatement: 337case SyntaxKind.SingleVariableDesignation: 340case SyntaxKind.LabeledStatement: 343case SyntaxKind.EmptyStatement: 347case SyntaxKind.GotoStatement: 351case SyntaxKind.GotoCaseStatement: 352case SyntaxKind.GotoDefaultStatement: 356case SyntaxKind.BreakStatement: 357case SyntaxKind.ContinueStatement: 361case SyntaxKind.ReturnStatement: 362case SyntaxKind.ThrowStatement: 365case SyntaxKind.ExpressionStatement: 368case SyntaxKind.YieldBreakStatement: 372case SyntaxKind.YieldReturnStatement: 375case SyntaxKind.DoStatement: 378case SyntaxKind.WhileStatement: 381case SyntaxKind.ForStatement: 384case SyntaxKind.ForEachVariableStatement: 385case SyntaxKind.ForEachStatement: 388case SyntaxKind.UsingStatement: 398case SyntaxKind.FixedStatement: 401case SyntaxKind.CheckedStatement: 402case SyntaxKind.UncheckedStatement: 405case SyntaxKind.UnsafeStatement: 408case SyntaxKind.LockStatement: 411case SyntaxKind.IfStatement: 414case SyntaxKind.ElseClause: 417case SyntaxKind.SwitchStatement: 420case SyntaxKind.SwitchSection: 423case SyntaxKind.CaseSwitchLabel: 424case SyntaxKind.DefaultSwitchLabel: 430case SyntaxKind.WhenClause: 433case SyntaxKind.CasePatternSwitchLabel: 436case SyntaxKind.SwitchExpression: 439case SyntaxKind.SwitchExpressionArm: 442case SyntaxKind.TryStatement: 445case SyntaxKind.CatchClause: 448case SyntaxKind.CatchDeclaration: 452case SyntaxKind.CatchFilterClause: 455case SyntaxKind.FinallyClause: 458case SyntaxKind.FromClause: 469if (node == null || node.Parent.IsKind(SyntaxKind.QueryExpression)) 476case SyntaxKind.QueryBody: 479case SyntaxKind.QueryContinuation: 482case SyntaxKind.LetClause: 485case SyntaxKind.WhereClause: 488case SyntaxKind.OrderByClause: 491case SyntaxKind.AscendingOrdering: 492case SyntaxKind.DescendingOrdering: 495case SyntaxKind.SelectClause: 498case SyntaxKind.JoinClause: 501case SyntaxKind.JoinIntoClause: 504case SyntaxKind.GroupClause: 507case SyntaxKind.IdentifierName: 508case SyntaxKind.QualifiedName: 509case SyntaxKind.GenericName: 510case SyntaxKind.TypeArgumentList: 511case SyntaxKind.AliasQualifiedName: 512case SyntaxKind.PredefinedType: 513case SyntaxKind.PointerType: 514case SyntaxKind.NullableType: 515case SyntaxKind.TupleType: 516case SyntaxKind.RefType: 517case SyntaxKind.OmittedTypeArgument: 518case SyntaxKind.NameColon: 519case SyntaxKind.OmittedArraySizeExpression: 520case SyntaxKind.ThisExpression: 521case SyntaxKind.BaseExpression: 522case SyntaxKind.ArgListExpression: 523case SyntaxKind.NumericLiteralExpression: 524case SyntaxKind.StringLiteralExpression: 525case SyntaxKind.CharacterLiteralExpression: 526case SyntaxKind.TrueLiteralExpression: 527case SyntaxKind.FalseLiteralExpression: 528case SyntaxKind.NullLiteralExpression: 529case SyntaxKind.TypeOfExpression: 530case SyntaxKind.SizeOfExpression: 531case SyntaxKind.DefaultExpression: 532case SyntaxKind.ConstantPattern: 533case SyntaxKind.DiscardDesignation: 538case SyntaxKind.AwaitExpression: 541case SyntaxKind.ParenthesizedLambdaExpression: 542case SyntaxKind.SimpleLambdaExpression: 543case SyntaxKind.AnonymousMethodExpression: 544case SyntaxKind.LocalFunctionStatement: 547case SyntaxKind.VariableDeclaration: 550case SyntaxKind.VariableDeclarator: 553case SyntaxKind.Block: 562private static Label ClassifyTopSyntax(SyntaxKind kind, SyntaxNode? node, out bool isLeaf) 574case SyntaxKind.GlobalStatement: 578case SyntaxKind.ExternAliasDirective: 582case SyntaxKind.UsingDirective: 586case SyntaxKind.NamespaceDeclaration: 587case SyntaxKind.FileScopedNamespaceDeclaration: 590case SyntaxKind.ClassDeclaration: 591case SyntaxKind.StructDeclaration: 592case SyntaxKind.InterfaceDeclaration: 593case SyntaxKind.RecordDeclaration: 594case SyntaxKind.RecordStructDeclaration: 597case SyntaxKind.BaseList: 600case SyntaxKind.PrimaryConstructorBaseType: 605case SyntaxKind.MethodDeclaration: 608case SyntaxKind.EnumDeclaration: 611case SyntaxKind.DelegateDeclaration: 614case SyntaxKind.FieldDeclaration: 615case SyntaxKind.EventFieldDeclaration: 618case SyntaxKind.ConversionOperatorDeclaration: 621case SyntaxKind.OperatorDeclaration: 624case SyntaxKind.DestructorDeclaration: 628case SyntaxKind.PropertyDeclaration: 631case SyntaxKind.IndexerDeclaration: 634case SyntaxKind.ArrowExpressionClause: 635if (node?.Parent is (kind: SyntaxKind.PropertyDeclaration or SyntaxKind.IndexerDeclaration)) 640case SyntaxKind.EventDeclaration: 643case SyntaxKind.EnumMemberDeclaration: 647case SyntaxKind.AccessorList: 650case SyntaxKind.GetAccessorDeclaration: 651case SyntaxKind.SetAccessorDeclaration: 652case SyntaxKind.InitAccessorDeclaration: 653case SyntaxKind.AddAccessorDeclaration: 654case SyntaxKind.RemoveAccessorDeclaration: 660case SyntaxKind.VariableDeclaration: 663case SyntaxKind.VariableDeclarator: 668case SyntaxKind.AttributeList: 670if (node is not null && node.IsParentKind(SyntaxKind.CompilationUnit)) 677case SyntaxKind.Attribute: 679if (node is { Parent: { } parent } && parent.IsParentKind(SyntaxKind.CompilationUnit)) 687case SyntaxKind.ExtensionBlockDeclaration: 698internal bool HasLabel(SyntaxKind kind) 713Func<SyntaxKind, bool>? ignoreChildFunction; 717case SyntaxKind.MethodDeclaration: 718case SyntaxKind.ConversionOperatorDeclaration: 719case SyntaxKind.OperatorDeclaration: 720case SyntaxKind.ConstructorDeclaration: 721case SyntaxKind.DestructorDeclaration: 722case SyntaxKind.GetAccessorDeclaration: 723case SyntaxKind.SetAccessorDeclaration: 724case SyntaxKind.InitAccessorDeclaration: 725case SyntaxKind.AddAccessorDeclaration: 726case SyntaxKind.RemoveAccessorDeclaration: 738ignoreChildFunction = childKind => childKind == SyntaxKind.Block || childKind == SyntaxKind.ArrowExpressionClause || HasLabel(childKind); 741case SyntaxKind.SwitchSection: 744case SyntaxKind.ForStatement: 784case SyntaxKind.VariableDeclarator: 790case SyntaxKind.ForStatement: 796case SyntaxKind.ForEachStatement: 797case SyntaxKind.ForEachVariableStatement: 806case SyntaxKind.UsingStatement: 831case SyntaxKind.UsingDirective: 845if (leftUsing.GlobalKeyword.IsKind(SyntaxKind.None) != rightUsing.GlobalKeyword.IsKind(SyntaxKind.None)) 849if (leftUsing.UnsafeKeyword.IsKind(SyntaxKind.None) != rightUsing.UnsafeKeyword.IsKind(SyntaxKind.None)) 855case SyntaxKind.LockStatement: 861case SyntaxKind.FixedStatement: 867case SyntaxKind.WhileStatement: 873case SyntaxKind.DoStatement: 879case SyntaxKind.IfStatement: 885case SyntaxKind.Block: 890case SyntaxKind.CatchClause: 894case SyntaxKind.ParenthesizedLambdaExpression: 895case SyntaxKind.SimpleLambdaExpression: 896case SyntaxKind.AnonymousMethodExpression: 897case SyntaxKind.LocalFunctionStatement: 901case SyntaxKind.SingleVariableDesignation: 905case SyntaxKind.TypeParameterConstraintClause: 909case SyntaxKind.TypeParameter: 913case SyntaxKind.Parameter: 917case SyntaxKind.AttributeList: 921case SyntaxKind.Attribute: 925case SyntaxKind.ExtensionBlockDeclaration: 952if ((leftAsync.Kind() == SyntaxKind.AsyncKeyword) != (rightAsync.Kind() == SyntaxKind.AsyncKeyword)) 985case SyntaxKind.SimpleLambdaExpression: 996case SyntaxKind.ParenthesizedLambdaExpression: 1007case SyntaxKind.AnonymousMethodExpression: 1026case SyntaxKind.LocalFunctionStatement: 1049leftBlock.Parent.IsKind(SyntaxKind.ConstructorDeclaration) || 1050rightBlock.Parent.IsKind(SyntaxKind.ConstructorDeclaration)) 1064case SyntaxKind.IfStatement: 1065case SyntaxKind.ForEachStatement: 1066case SyntaxKind.ForEachVariableStatement: 1067case SyntaxKind.ForStatement: 1068case SyntaxKind.WhileStatement: 1069case SyntaxKind.DoStatement: 1070case SyntaxKind.FixedStatement: 1071case SyntaxKind.LockStatement: 1072case SyntaxKind.UsingStatement: 1073case SyntaxKind.SwitchSection: 1074case SyntaxKind.ParenthesizedLambdaExpression: 1075case SyntaxKind.SimpleLambdaExpression: 1076case SyntaxKind.AnonymousMethodExpression: 1077case SyntaxKind.LocalFunctionStatement: 1082case SyntaxKind.CatchClause: 1102case SyntaxKind.Block: 1103case SyntaxKind.LabeledStatement: 1104case SyntaxKind.GlobalStatement: 1108case SyntaxKind.UnsafeStatement: 1109case SyntaxKind.CheckedStatement: 1110case SyntaxKind.UncheckedStatement: 1111case SyntaxKind.ElseClause: 1112case SyntaxKind.FinallyClause: 1113case SyntaxKind.TryStatement: 1232if (leftStatement.Kind() == SyntaxKind.Block && rightStatement.Kind() == SyntaxKind.Block) 1313case SyntaxKind.ForEachStatement: 1317case SyntaxKind.ForEachVariableStatement: 1331case SyntaxKind.DeclarationExpression: 1337case SyntaxKind.TupleExpression: 1356case SyntaxKind.SingleVariableDesignation: 1360case SyntaxKind.ParenthesizedVariableDesignation: 1369case SyntaxKind.DiscardDesignation: 1424case SyntaxKind.ExternAliasDirective: 1427case SyntaxKind.UsingDirective: 1430case SyntaxKind.NamespaceDeclaration: 1431case SyntaxKind.FileScopedNamespaceDeclaration: 1434case SyntaxKind.ClassDeclaration: 1435case SyntaxKind.StructDeclaration: 1436case SyntaxKind.InterfaceDeclaration: 1437case SyntaxKind.RecordDeclaration: 1438case SyntaxKind.RecordStructDeclaration: 1441case SyntaxKind.EnumDeclaration: 1444case SyntaxKind.DelegateDeclaration: 1447case SyntaxKind.ExtensionBlockDeclaration: 1450case SyntaxKind.FieldDeclaration: 1451case SyntaxKind.EventFieldDeclaration: 1452case SyntaxKind.VariableDeclaration: 1455case SyntaxKind.VariableDeclarator: 1458case SyntaxKind.MethodDeclaration: 1461case SyntaxKind.ConversionOperatorDeclaration: 1464case SyntaxKind.OperatorDeclaration: 1467case SyntaxKind.ConstructorDeclaration: 1470case SyntaxKind.DestructorDeclaration: 1473case SyntaxKind.PropertyDeclaration: 1476case SyntaxKind.IndexerDeclaration: 1479case SyntaxKind.ArrowExpressionClause: 1482case SyntaxKind.EventDeclaration: 1485case SyntaxKind.EnumMemberDeclaration: 1488case SyntaxKind.GetAccessorDeclaration: 1489case SyntaxKind.SetAccessorDeclaration: 1490case SyntaxKind.InitAccessorDeclaration: 1493case SyntaxKind.TypeParameterConstraintClause: 1496case SyntaxKind.TypeParameter: 1499case SyntaxKind.TypeParameterList: 1500case SyntaxKind.ParameterList: 1501case SyntaxKind.BracketedParameterList: 1504case SyntaxKind.Parameter: 1507case SyntaxKind.AttributeList: 1510case SyntaxKind.Attribute:
EditAndContinue\SyntaxUtilities.cs (11)
39ArrowExpressionClauseSyntax { Parent: (kind: SyntaxKind.PropertyDeclaration) or (kind: SyntaxKind.IndexerDeclaration) } arrowExpression 46=> constructorDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword) 56when !fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) 161var firstGetter = accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault(); 193if (property.Modifiers.Any(SyntaxKind.AbstractKeyword) || 194property.Modifiers.Any(SyntaxKind.ExternKeyword)) 211return anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword); 215if (declaration.IsKind(SyntaxKind.ArrowExpressionClause)) 223MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.AsyncKeyword), 224LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword),
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (4)
35if (token.Kind() is not (SyntaxKind.StringLiteralToken or SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)) 64if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken)
EmbeddedLanguages\EmbeddedLanguageUtilities.cs (2)
32return token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken && !token.IsVerbatimStringLiteral()
EncapsulateField\CSharpEncapsulateFieldService.cs (6)
53contextualKind: SyntaxKind.IdentifierName, 71var modifierKinds = new[] { SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PublicKeyword }; 191=> field.DeclaringSyntaxReferences.Any(static d => d.GetSyntax().GetAncestor<FieldDeclarationSyntax>().Modifiers.Any(SyntaxKind.NewKeyword));
ExtractMethod\CSharpMethodExtractor.cs (4)
127Contract.ThrowIfTrue(memberNode.Kind() == SyntaxKind.NamespaceDeclaration); 186if (!leadingTrivia.Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia) || t.GetStructure() is EndIfDirectiveTriviaSyntax) && 187!methodDefinition.FindTokenOnLeftOfPosition(methodDefinition.SpanStart).IsKind(SyntaxKind.OpenBraceToken)) 193if (!originalMethodDefinition.FindTokenOnLeftOfPosition(originalMethodDefinition.SpanStart).TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia))
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
100return SyntaxFactory.EmptyStatement(SyntaxFactory.Token([.. triviaList], SyntaxKind.SemicolonToken, [SyntaxFactory.ElasticMarker]));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (32)
187PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, IdentifierName(FlowControlName)), 264BinaryExpression(SyntaxKind.EqualsExpression, IdentifierName(FlowControlName), LiteralExpression(value)), 345.Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) 389if (!typeDecl.IsKind(SyntaxKind.InterfaceDeclaration)) 396return !memberDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 399private static SyntaxKind GetParameterRefSyntaxKind(ParameterBehavior parameterBehavior) 402? SyntaxKind.RefKeyword 404SyntaxKind.OutKeyword : SyntaxKind.None; 514? LiteralExpression(SyntaxKind.NullLiteralExpression) 515: LiteralExpression(SyntaxKind.DefaultLiteralExpression); 522protected SyntaxKind UnderCheckedExpressionContext() 525protected SyntaxKind UnderCheckedStatementContext() 528protected SyntaxKind UnderCheckedContext<T>() where T : SyntaxNode 534return SyntaxKind.None; 542var kind = UnderCheckedStatementContext(); 543if (kind == SyntaxKind.None) 626SyntaxKind.SimpleAssignmentExpression, IdentifierName(identifier), variableDeclaration.Initializer.Value))); 661result.Add(EmptyStatement(Token([.. triviaList], SyntaxKind.SemicolonToken, [ElasticMarker]))); 700.Where(n => n.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.DeclarationPattern); 706case SyntaxKind.DeclarationExpression: 709if (declaration.Designation.Kind() != SyntaxKind.SingleVariableDesignation) 730case SyntaxKind.DeclarationPattern: 819return statements[index + 1].Kind() == SyntaxKind.ReturnStatement; 827? MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), methodName) 838var modifier = GetParameterRefSyntaxKind(argument.ParameterModifier); 839var refOrOut = modifier == SyntaxKind.None ? default : Token(modifier); 855SyntaxKind.SimpleMemberAccessExpression, 858ArgumentList([Argument(LiteralExpression(SyntaxKind.FalseLiteralExpression))])); 877SyntaxKind.SimpleAssignmentExpression, 924return ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, CreateLeftExpression(), initialValue));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (8)
46expression.Parent.Kind() == SyntaxKind.EqualsValueClause && 48expression.Parent.Parent.Kind() == SyntaxKind.VariableDeclarator) 65case SyntaxKind.IdentifierName: 66case SyntaxKind.GenericName: 69case SyntaxKind.QualifiedName: 72case SyntaxKind.AliasQualifiedName: 106var kind = UnderCheckedExpressionContext(); 107if (kind == SyntaxKind.None)
ExtractMethod\CSharpMethodExtractor.FormattingProvider.cs (4)
41if (previousToken.RawKind == (int)SyntaxKind.OpenBraceToken) 62if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (3)
216if (trivia.Kind() is not SyntaxKind.WhitespaceTrivia and 217not SyntaxKind.EndOfLineTrivia) 277assignment.Expression.Kind() != SyntaxKind.SimpleAssignmentExpression)
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (7)
21: TriviaResult(document, result, (int)SyntaxKind.EndOfLineTrivia, (int)SyntaxKind.WhitespaceTrivia) 135if (tokenPair.PreviousToken.RawKind == (int)SyntaxKind.OpenBraceToken) 145if (tokenPair.PreviousToken.RawKind is ((int)SyntaxKind.OpenBraceToken) or 146((int)SyntaxKind.SemicolonToken)) 156if (tokenPair.PreviousToken.RawKind is ((int)SyntaxKind.OpenBraceToken) or 157((int)SyntaxKind.SemicolonToken))
ExtractMethod\CSharpSelectionResult.cs (2)
128Contract.ThrowIfFalse(last.IsParentKind(SyntaxKind.GlobalStatement)); 129Contract.ThrowIfFalse(last.Parent.IsParentKind(SyntaxKind.CompilationUnit));
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
109if ((!node.IsKind(SyntaxKind.ObjectCreationExpression) && semanticModel.GetMemberGroup(expression, cancellationToken).Length > 0) ||
ExtractMethod\CSharpSelectionResult.StatementResult.cs (2)
31MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.AsyncKeyword), 32LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword),
ExtractMethod\CSharpSelectionValidator.cs (7)
36if (firstTokenInSelection.Kind() == SyntaxKind.None || lastTokenInSelection.Kind() == SyntaxKind.None) 120if (ancestor.Kind() is SyntaxKind.BaseConstructorInitializer or SyntaxKind.ThisConstructorInitializer) 136if (assign.Right.GetLastToken().Kind() == SyntaxKind.None) 303if (tokens.Any(t => t.Kind() == SyntaxKind.YieldKeyword)) 339if (commonNode.Kind() == SyntaxKind.IsPatternExpression)
ExtractMethod\CSharpSyntaxTriviaService.cs (1)
14: base((int)SyntaxKind.EndOfLineTrivia)
ExtractMethod\Extensions.cs (9)
128if (!modifiersGetter(decl).Any(SyntaxKind.ConstKeyword)) 147if (token.Kind() != SyntaxKind.ThrowKeyword) 181case SyntaxKind.RegionDirectiveTrivia: 184case SyntaxKind.EndRegionDirectiveTrivia: 192case SyntaxKind.IfDirectiveTrivia: 195case SyntaxKind.EndIfDirectiveTrivia: 203case SyntaxKind.ElseDirectiveTrivia: 204case SyntaxKind.ElifDirectiveTrivia: 262if (token1.RawKind != (int)SyntaxKind.SemicolonToken || !(token1.Parent is FieldDeclarationSyntax))
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
65var getAccessor = propertyDeclaration.AccessorList?.Accessors.FirstOrDefault(a => a.Kind() == SyntaxKind.GetAccessorDeclaration);
GenerateEqualsAndGetHashCodeFromMembers\CSharpGenerateEqualsAndGetHashCodeService.cs (1)
27wrappedStatements = [SyntaxFactory.CheckedStatement(SyntaxKind.UncheckedStatement,
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (16)
51var contextualKind = SyntaxFacts.GetContextualKeywordKind(token.ValueText); 53return contextualKind is SyntaxKind.FromKeyword or 54SyntaxKind.NameOfKeyword or 55SyntaxKind.AsyncKeyword or 56SyntaxKind.AwaitKeyword or 57SyntaxKind.VarKeyword; 143if (identifierName.IsKind(SyntaxKind.GenericName)) 165return parsedType.IsKind(SyntaxKind.GenericName) && !parsedType.ContainsDiagnostics; 176if (expression.IsParentKind(SyntaxKind.AttributeArgument)) 181if (expression.IsParentKind(SyntaxKind.ConditionalAccessExpression)) 186if (expression.IsParentKind(SyntaxKind.IsPatternExpression)) 191if (expression.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 192expression.Parent.IsParentKind(SyntaxKind.Subpattern)) 197if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 209if (node.IsLeftSideOfAssignExpression() && node.Parent.IsParentKind(SyntaxKind.ExpressionStatement))
GenerateType\CSharpGenerateTypeService.cs (33)
43=> expression.IsParentKind(SyntaxKind.CatchDeclaration); 47return expression.IsParentKind(SyntaxKind.ArrayType) && 48expression.Parent.IsParentKind(SyntaxKind.ArrayCreationExpression); 96SyntaxKind.InterfaceDeclaration or 97SyntaxKind.StructDeclaration or 98SyntaxKind.RecordStructDeclaration; 134if (usingDirectiveSyntax != null && usingDirectiveSyntax.StaticKeyword.Kind() != SyntaxKind.StaticKeyword) 141if (simpleName.IsParentKind(SyntaxKind.NameMemberCref)) 150SyntaxKind.QualifiedName or 151SyntaxKind.IdentifierName or 152SyntaxKind.AliasQualifiedName or 153SyntaxKind.GenericName or 154SyntaxKind.SimpleMemberAccessExpression)) 166nameOrMemberAccessExpression.Parent.IsParentKind(SyntaxKind.BaseList) && 168nameOrMemberAccessExpression.Parent.Parent.IsParentKind(SyntaxKind.EnumDeclaration)) 204if (nameOrMemberAccessExpression == null || !nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression) || !simpleName.IsRightSideOfDot()) 213!token.IsKind(SyntaxKind.DotToken)) 229if (token.IsKind(SyntaxKind.DotToken) && 249nextToken.IsKind(SyntaxKind.DotToken)) 264if (nextToken.IsKind(SyntaxKind.DotToken)) 296if (nextToken.IsKind(SyntaxKind.DotToken)) 317if ((nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression) || (nameOrMemberAccessExpression.Parent != null && nameOrMemberAccessExpression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression))) 322if (nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 328Debug.Assert(nameOrMemberAccessExpression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression)); 332outerMostMemberAccessExpression = outerMostMemberAccessExpression.GetAncestorsOrThis<ExpressionSyntax>().SkipWhile(n => n != null && n.IsKind(SyntaxKind.SimpleMemberAccessExpression)).FirstOrDefault(); 370objectCreationExpressionOpt.ArgumentList.Arguments is [{ Expression: (kind: not SyntaxKind.DeclarationExpression) expression }]) 643if (baseList.Parent.Kind() is SyntaxKind.InterfaceDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration) 674return typeDecl.GetModifiers().Any(SyntaxKind.PublicKeyword) && IsAllContainingTypeDeclsPublic(typeDecl); 687node.GetModifiers().Any(SyntaxKind.PublicKeyword) && 703|| containingTypeDeclarations.All(typedecl => typedecl.GetModifiers().Any(SyntaxKind.PublicKeyword));
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (13)
34case SyntaxKind.ContinueKeyword: 41case SyntaxKind.BreakKeyword: 42if (token.GetPreviousToken().IsKind(SyntaxKind.YieldKeyword)) 44goto case SyntaxKind.YieldKeyword; 53case SyntaxKind.YieldKeyword: 54case SyntaxKind.ReturnKeyword: 72case SyntaxKind.GotoKeyword: 73case SyntaxKind.DefaultKeyword: 74case SyntaxKind.CaseKeyword: 94var kind = node.Kind(); 97SyntaxFacts.GetTypeDeclarationKind(kind) != SyntaxKind.None) 113SyntaxFacts.GetTypeDeclarationKind(node.Kind()) != SyntaxKind.None) 128if (SyntaxFacts.GetTypeDeclarationKind(node.Kind()) != SyntaxKind.None)
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (5)
31=> tokens.Any(static t => t.Kind() is SyntaxKind.AwaitKeyword or SyntaxKind.AsyncKeyword); 78localDeclaration.UsingKeyword.Kind() == SyntaxKind.UsingKeyword && TryAddAsyncOrAwaitKeyword(localDeclaration.AwaitKeyword, spans), 99if (mod.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.AwaitKeyword)
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (3)
29=> tokens.Any(static t => t.Kind() is SyntaxKind.IfKeyword or SyntaxKind.ElseKeyword); 34if (ifStatement.Parent.Kind() != SyntaxKind.ElseClause)
Highlighting\KeywordHighlighters\LoopHighlighter.cs (7)
27is SyntaxKind.DoKeyword 28or SyntaxKind.ForKeyword 29or SyntaxKind.ForEachKeyword 30or SyntaxKind.WhileKeyword 31or SyntaxKind.BreakKeyword 32or SyntaxKind.ContinueKeyword 33or SyntaxKind.SemicolonToken);
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (11)
28is SyntaxKind.SwitchKeyword 29or SyntaxKind.CaseKeyword 30or SyntaxKind.DefaultKeyword 31or SyntaxKind.SemicolonToken 32or SyntaxKind.BreakKeyword 33or SyntaxKind.GotoKeyword 34or SyntaxKind.ColonToken); 72if (gotoStatement.Kind() is SyntaxKind.GotoCaseStatement or SyntaxKind.GotoDefaultStatement || 76var end = !gotoStatement.CaseOrDefaultKeyword.IsKind(SyntaxKind.None) 92var highlightGotosForChild = highlightGotos && !child.IsKind(SyntaxKind.SwitchStatement);
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
137if (span.IsEmpty && token.Kind() == SyntaxKind.OpenParenToken)
InheritanceMargin\CSharpInheritanceMarginService.cs (6)
43SyntaxKind.MethodDeclaration or 44SyntaxKind.PropertyDeclaration or 45SyntaxKind.EventDeclaration or 46SyntaxKind.IndexerDeclaration or 47SyntaxKind.OperatorDeclaration or 48SyntaxKind.ConversionOperatorDeclaration)
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (2)
47if (selectedParameter.Parent is not ParameterListSyntax { Parent: TypeDeclarationSyntax(kind: SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration) typeDeclaration })
InlineHints\CSharpInlineParameterNameHintsService.cs (2)
94PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfix => GetKind(postfix.Operand), 105var keywordKind = SyntaxFacts.GetKeywordKind(parameterName);
InlineHints\CSharpInlineTypeHintsService.cs (1)
80return parameterNode.Parent?.Parent?.Kind() is SyntaxKind.ParenthesizedLambdaExpression
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
107.WithUsingKeyword(Token(declarationStatement.GetLeadingTrivia(), SyntaxKind.UsingKeyword, [Space]));
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
47expressionStatement.Expression.IsKind(SyntaxKind.IdentifierName)) 115SyntaxKind.SimpleAssignmentExpression,
IntroduceVariable\CSharpIntroduceVariableService.cs (11)
51=> expression.GetAncestorOrThis<EqualsValueClauseSyntax>().IsParentKind(SyntaxKind.Parameter); 57=> expression.GetAncestorOrThis<EqualsValueClauseSyntax>().IsParentKind(SyntaxKind.PropertyDeclaration); 66if (node.IsKind(SyntaxKind.Block)) 70else if (node.IsKind(SyntaxKind.ArrowExpressionClause)) 88if (!expression.DepthFirstTraversal().Any(n => n.RawKind == (int)SyntaxKind.ArrayCreationExpression) && 89!expression.DepthFirstTraversal().Any(n => n.RawKind == (int)SyntaxKind.TypeOfExpression)) 94if (!attributeDecl.IsParentKind(SyntaxKind.CompilationUnit)) 111if (expression.WalkUpParentheses().IsParentKind(SyntaxKind.ExpressionStatement)) 117if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 123if (expression.IsKind(SyntaxKind.ThrowExpression)) 143return localFunction != null && localFunction.Modifiers.Any(SyntaxKind.StaticKeyword);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (2)
47? MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ParseName(typeDisplayString), IdentifierName(newNameToken)) 168=> member is FieldDeclarationSyntax field && field.Modifiers.Any(SyntaxKind.ConstKeyword);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (14)
270.WithAccessorList(AccessorList([AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, body)])) 271.TryWithSemicolonToken(Token(SyntaxKind.None)), 275.WithSemicolonToken(Token(SyntaxKind.None)), 279.WithSemicolonToken(Token(SyntaxKind.None)), 283.WithSemicolonToken(Token(SyntaxKind.None)), 303if (localFunction is { Body: not null } && localFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 372if (localFunction != null && !localFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 449var localFunctions = innermostCommonBlock.DescendantNodes().Where(node => node.IsKind(SyntaxKind.LocalFunctionStatement) && matches.Any(match => match.Span.OverlapsWith(node.Span))); 462!invocationExpression.Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression) && 490if (!priorToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && 491!nextStatement.GetLastToken().TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia)) 505var precedingEndOfLine = nextStatementLeading.LastOrDefault(t => t.Kind() == SyntaxKind.EndOfLineTrivia); 519if (nextStatementLeading is [(kind: SyntaxKind.WhitespaceTrivia) indentation]) 524nextStatement.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia) endOfLine] ? endOfLine : ElasticCarriageReturnLineFeed);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (21)
28SyntaxKind, 42=> ifNode?.Parent is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection); 54=> node.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection; 57=> node.Kind() is SyntaxKind.Block or SyntaxKind.EmptyStatement; 101protected override SyntaxKind? GetJumpStatementKind(SyntaxNode node) 105=> SyntaxKind.BreakStatement, 107=> node.ContainsYield() ? SyntaxKind.YieldBreakStatement : SyntaxKind.ReturnStatement, 109=> SyntaxKind.ReturnStatement, 111=> SyntaxKind.ContinueStatement, 115protected override StatementSyntax GetJumpStatement(SyntaxKind kind) 118SyntaxKind.ContinueStatement => ContinueStatement(), 119SyntaxKind.BreakStatement => BreakStatement(), 120SyntaxKind.ReturnStatement => ReturnStatement(), 121SyntaxKind.YieldBreakStatement => YieldStatement(SyntaxKind.YieldBreakStatement), 227return trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia;
InvertLogical\CSharpInvertLogicalCodeRefactoringProvider.cs (5)
16AbstractInvertLogicalCodeRefactoringProvider<SyntaxKind, ExpressionSyntax, BinaryExpressionSyntax> 24protected override string GetOperatorText(SyntaxKind binaryExprKind) 25=> binaryExprKind == SyntaxKind.LogicalAndExpression 26? SyntaxFacts.GetText(SyntaxKind.AmpersandAmpersandToken) 27: SyntaxFacts.GetText(SyntaxKind.BarBarToken);
LanguageServices\CSharpStructuralTypeDisplayService.cs (4)
37members.Add(Keyword(SyntaxFacts.GetText(SyntaxKind.NewKeyword))); 39members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.OpenBraceToken))); 47members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.CommaToken))); 58members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.CloseBraceToken)));
LineSeparators\CSharpLineSeparatorService.cs (10)
78case SyntaxKind.NamespaceDeclaration: 79case SyntaxKind.MethodDeclaration: 80case SyntaxKind.PropertyDeclaration: 81case SyntaxKind.EventDeclaration: 82case SyntaxKind.IndexerDeclaration: 83case SyntaxKind.ConstructorDeclaration: 84case SyntaxKind.DestructorDeclaration: 85case SyntaxKind.OperatorDeclaration: 86case SyntaxKind.ConversionOperatorDeclaration: 304if (lastChild.IsParentKind(SyntaxKind.CompilationUnit))
MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeRefactoringProvider.cs (1)
37if (localFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
MetadataAsSource\CSharpMetadataAsSourceService.cs (3)
140var keyword = enable ? SyntaxKind.EnableKeyword : SyntaxKind.DisableKeyword;
MetadataAsSource\FormattingRule.cs (5)
27if ((previousToken.Kind() != SyntaxKind.SemicolonToken && previousToken.Kind() != SyntaxKind.CloseBraceToken) || 28currentToken.Kind() == SyntaxKind.CloseBraceToken) 38if (previousToken.Kind() == SyntaxKind.SemicolonToken && previousToken.Parent.Kind() == SyntaxKind.UsingDirective)
Organizing\Organizers\MemberDeclarationsOrganizer.Comparer.cs (28)
91var xIsStatic = x.GetModifiers().Any(SyntaxKind.StaticKeyword); 92var yIsStatic = y.GetModifiers().Any(SyntaxKind.StaticKeyword); 122if (xModifiers.Any(SyntaxKind.PublicKeyword)) 126else if (xModifiers.Any(SyntaxKind.ProtectedKeyword) && xModifiers.Any(SyntaxKind.InternalKeyword)) 130else if (xModifiers.Any(SyntaxKind.InternalKeyword)) 134else if (xModifiers.Any(SyntaxKind.ProtectedKeyword)) 148case SyntaxKind.FieldDeclaration: 150case SyntaxKind.EventFieldDeclaration: 152case SyntaxKind.ConstructorDeclaration: 154case SyntaxKind.DestructorDeclaration: 156case SyntaxKind.PropertyDeclaration: 158case SyntaxKind.EventDeclaration: 160case SyntaxKind.IndexerDeclaration: 162case SyntaxKind.OperatorDeclaration: 164case SyntaxKind.ConversionOperatorDeclaration: 166case SyntaxKind.MethodDeclaration: 168case SyntaxKind.ClassDeclaration: 169case SyntaxKind.InterfaceDeclaration: 170case SyntaxKind.StructDeclaration: 171case SyntaxKind.EnumDeclaration: 172case SyntaxKind.DelegateDeclaration: 173case SyntaxKind.RecordDeclaration: 174case SyntaxKind.RecordStructDeclaration: 189case SyntaxKind.ConstructorDeclaration: 190case SyntaxKind.DestructorDeclaration: 191case SyntaxKind.IndexerDeclaration: 192case SyntaxKind.OperatorDeclaration:
Organizing\Organizers\ModifiersOrganizer.Comparer.cs (6)
37[t => t.Kind() == SyntaxKind.PartialKeyword, t => GetOrdering(t)]; 43case SyntaxKind.StaticKeyword: 45case SyntaxKind.PrivateKeyword: 46case SyntaxKind.ProtectedKeyword: 47case SyntaxKind.InternalKeyword: 48case SyntaxKind.PublicKeyword:
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (2)
47=> token.IsKind(SyntaxKind.EndOfDirectiveToken) 67LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) literal
QuickInfo\CSharpSemanticQuickInfoProvider.cs (10)
42if (token.IsKind(SyntaxKind.EqualsGreaterThanToken) 43&& token.Parent is (kind: SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.SimpleLambdaExpression)) 49else if (token.IsKind(SyntaxKind.DelegateKeyword) && token.Parent.IsKind(SyntaxKind.AnonymousMethodExpression)) 62if (token.Kind() is SyntaxKind.CloseBracketToken or SyntaxKind.OpenBracketToken && 63token.Parent?.Parent.IsKind(SyntaxKind.ElementAccessExpression) == true) 75if (token.IsKind(SyntaxKind.DotToken) && 87=> !token.Parent.IsKind(SyntaxKind.XmlCrefAttribute);
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (15)
35case SyntaxKind.CloseBraceToken: 37case SyntaxKind.HashToken: 38case SyntaxKind.EndRegionKeyword: 39case SyntaxKind.EndIfKeyword: 40case SyntaxKind.ElseKeyword: 41case SyntaxKind.ElifKeyword: 42case SyntaxKind.EndOfDirectiveToken: 60var openBrace = parent.ChildNodesAndTokens().FirstOrDefault(n => n.Kind() == SyntaxKind.OpenBraceToken).AsToken(); 61if (openBrace.Kind() != SyntaxKind.OpenBraceToken) 89=> node.IsKind(SyntaxKind.Block) 90&& node.Parent?.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.GlobalStatement; 121else if (trivia.Kind() is not SyntaxKind.WhitespaceTrivia and not SyntaxKind.EndOfLineTrivia)
RawStringLiteral\CSharpRawStringLiteralOnAutoInsertService.cs (12)
63if (token.Kind() is not (SyntaxKind.StringLiteralToken or 64SyntaxKind.InterpolatedStringStartToken or 65SyntaxKind.InterpolatedSingleLineRawStringStartToken or 66SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 115if (token.Kind() is not (SyntaxKind.SingleLineRawStringLiteralToken or 116SyntaxKind.MultiLineRawStringLiteralToken or 117SyntaxKind.InterpolatedSingleLineRawStringStartToken or 118SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 162if (token.Kind() is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken) 169else if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)
RemoveUnusedVariable\CSharpRemoveUnusedVariableCodeFixProvider.cs (4)
37if (node.Kind() == SyntaxKind.SimpleAssignmentExpression) 40if (parent.Kind() == SyntaxKind.ExpressionStatement) 57case SyntaxKind.SimpleAssignmentExpression: 61RemoveNode(editor, node.IsParentKind(SyntaxKind.GlobalStatement) ? node.Parent : node, blockFacts);
Rename\CSharpRenameIssuesService.cs (1)
59if (parent.IsKind(SyntaxKind.IdentifierName))
ReplaceDocCommentTextWithTag\CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (5)
24=> token.Kind() is SyntaxKind.XmlTextLiteralToken or SyntaxKind.XmlTextLiteralNewLineToken; 27=> token.GetRequiredParent().Kind() is SyntaxKind.XmlCrefAttribute or SyntaxKind.XmlNameAttribute or SyntaxKind.XmlTextAttribute;
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (12)
74if (propertyDeclaration.AccessorList is { Accessors: [(kind: SyntaxKind.GetAccessorDeclaration) getAccessor] }) 102AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 138if (setMethodDeclaration?.Modifiers.Any(SyntaxKind.UnsafeKeyword) == true 139&& !property.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 196createReturnStatementForExpression: accessorDeclaration.Kind() == SyntaxKind.GetAccessorDeclaration, 213var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration); 221if (getMethodDeclaration.SemicolonToken.Kind() != SyntaxKind.None) 252var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration); 269if (setMethodDeclaration.SemicolonToken.Kind() != SyntaxKind.None) 322invocation.ArgumentList.Arguments[0].Expression.Kind() == SyntaxKind.DeclarationExpression) 344SyntaxKind.SimpleAssignmentExpression, currentInvocation.Expression, argumentExpression); 359if (nameToken.Kind() != SyntaxKind.IdentifierToken)
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (33)
129if (propertyDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword) 130&& !methodDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 189if (propertyDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword) 190&& !methodDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 246return trivia.Kind() is SyntaxKind.MultiLineDocumentationCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia 333var operatorKind = parent.Kind() switch 335SyntaxKind.AddAssignmentExpression => SyntaxKind.AddExpression, 336SyntaxKind.AndAssignmentExpression => SyntaxKind.BitwiseAndExpression, 337SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.CoalesceExpression, 338SyntaxKind.DivideAssignmentExpression => SyntaxKind.DivideExpression, 339SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.ExclusiveOrExpression, 340SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LeftShiftExpression, 341SyntaxKind.ModuloAssignmentExpression => SyntaxKind.ModuloExpression, 342SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.MultiplyExpression, 343SyntaxKind.OrAssignmentExpression => SyntaxKind.BitwiseOrExpression, 344SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.RightShiftExpression, 345SyntaxKind.SubtractAssignmentExpression => SyntaxKind.SubtractExpression, 346SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.UnsignedRightShiftExpression, 347_ => SyntaxKind.None, 350if (operatorKind is SyntaxKind.None)
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (40)
142if (condition.Kind() is SyntaxKind.LessThanExpression or 143SyntaxKind.LessThanOrEqualExpression) 146equals = condition.Kind() == SyntaxKind.LessThanOrEqualExpression; 151if (condition.Kind() is SyntaxKind.GreaterThanExpression or 152SyntaxKind.GreaterThanOrEqualExpression) 155equals = condition.Kind() == SyntaxKind.GreaterThanOrEqualExpression; 171postfixUnary.Kind() == SyntaxKind.PostIncrementExpression && 178prefixUnary.Kind() == SyntaxKind.PreIncrementExpression && 185assignment.Kind() == SyntaxKind.AddAssignmentExpression && 210if (condition.Kind() == SyntaxKind.GreaterThanOrEqualExpression) 217if (condition.Kind() == SyntaxKind.LessThanOrEqualExpression) 234postfixUnary.Kind() == SyntaxKind.PostDecrementExpression && 241prefixUnary.Kind() == SyntaxKind.PreDecrementExpression && 248assignment.Kind() == SyntaxKind.SubtractAssignmentExpression && 322if ((outerBinary.Kind() == SyntaxKind.SubtractExpression && innerLeft.Kind() == SyntaxKind.AddExpression) || 323(outerBinary.Kind() == SyntaxKind.AddExpression && innerLeft.Kind() == SyntaxKind.SubtractExpression)) 333if (outerBinary.Kind() == SyntaxKind.LessThanOrEqualExpression && 335innerRight.Kind() == SyntaxKind.SubtractExpression && 343if (outerBinary.Kind() == SyntaxKind.GreaterThanOrEqualExpression && 345innerLeft.Kind() == SyntaxKind.SubtractExpression && 365var newOperatorKind = condition.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.LessThanOrEqualExpression 366? SyntaxKind.GreaterThanEqualsToken 367: SyntaxKind.LessThanEqualsToken; 369var newExpressionKind = newOperatorKind == SyntaxKind.GreaterThanEqualsToken 370? SyntaxKind.GreaterThanOrEqualExpression 371: SyntaxKind.LessThanOrEqualExpression; 387var newKind = opToken.Kind() switch 389SyntaxKind.MinusMinusToken => SyntaxKind.PlusPlusToken, 390SyntaxKind.PlusPlusToken => SyntaxKind.MinusMinusToken, 391SyntaxKind.PlusEqualsToken => SyntaxKind.MinusEqualsToken, 392SyntaxKind.MinusEqualsToken => SyntaxKind.PlusEqualsToken,
SignatureHelp\AbstractCSharpSignatureHelpProvider.cs (4)
18protected static SymbolDisplayPart Keyword(SyntaxKind kind) 21protected static SymbolDisplayPart Operator(SyntaxKind kind) 24protected static SymbolDisplayPart Punctuation(SyntaxKind kind) 38Punctuation(SyntaxKind.CommaToken),
SignatureHelp\AbstractGenericNameSignatureHelpProvider.cs (13)
208parts.Add(Keyword(SyntaxKind.WhereKeyword)); 214parts.Add(Punctuation(SyntaxKind.ColonToken)); 222parts.Add(Keyword(SyntaxKind.ClassKeyword)); 232parts.Add(Keyword(SyntaxKind.StructKeyword)); 240parts.Add(Punctuation(SyntaxKind.CommaToken)); 253parts.Add(Punctuation(SyntaxKind.CommaToken)); 257parts.Add(Keyword(SyntaxKind.NewKeyword)); 258parts.Add(Punctuation(SyntaxKind.OpenParenToken)); 259parts.Add(Punctuation(SyntaxKind.CloseParenToken)); 267parts.Add(Punctuation(SyntaxKind.CommaToken)); 271parts.Add(Keyword(SyntaxKind.AllowsKeyword)); 273parts.Add(Keyword(SyntaxKind.RefKeyword)); 275parts.Add(Keyword(SyntaxKind.StructKeyword));
SignatureHelp\AbstractGenericNameSignatureHelpProvider_Method.cs (13)
24result.Add(Punctuation(SyntaxKind.OpenParenToken)); 26result.Add(Punctuation(SyntaxKind.CommaToken)); 28result.Add(Punctuation(SyntaxKind.CloseParenToken)); 33result.Add(Punctuation(SyntaxKind.OpenParenToken)); 35result.Add(Punctuation(SyntaxKind.CloseParenToken)); 40result.Add(Punctuation(SyntaxKind.OpenParenToken)); 42result.Add(Punctuation(SyntaxKind.CloseParenToken)); 52result.Add(Punctuation(SyntaxKind.DotToken)); 56result.Add(Punctuation(SyntaxKind.LessThanToken)); 78Punctuation(SyntaxKind.GreaterThanToken), 79Punctuation(SyntaxKind.OpenParenToken) 87result.Add(Punctuation(SyntaxKind.CommaToken)); 95result.Add(Punctuation(SyntaxKind.CloseParenToken));
SignatureHelp\AbstractGenericNameSignatureHelpProvider_NamedType.cs (2)
16return [.. namedType.ToMinimalDisplayParts(semanticModel, position, MinimallyQualifiedWithoutTypeParametersFormat), Punctuation(SyntaxKind.LessThanToken)]; 20=> [Punctuation(SyntaxKind.GreaterThanToken)];
SignatureHelp\AbstractOrdinaryMethodSignatureHelpProvider.cs (9)
60result.Add(Punctuation(SyntaxKind.OpenParenToken)); 62result.Add(Punctuation(SyntaxKind.CommaToken)); 64result.Add(Punctuation(SyntaxKind.CloseParenToken)); 69result.Add(Punctuation(SyntaxKind.OpenParenToken)); 71result.Add(Punctuation(SyntaxKind.CloseParenToken)); 76result.Add(Punctuation(SyntaxKind.OpenParenToken)); 78result.Add(Punctuation(SyntaxKind.CloseParenToken)); 83result.Add(Punctuation(SyntaxKind.OpenParenToken)); 89=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\AttributeSignatureHelpProvider.cs (5)
58return !token.IsKind(SyntaxKind.None) && 183Punctuation(SyntaxKind.EqualsToken), 206Punctuation(SyntaxKind.ColonToken), 219return [.. method.ContainingType.ToMinimalDisplayParts(semanticModel, position), Punctuation(SyntaxKind.OpenParenToken)]; 223=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (3)
74var type = constructorInitializer.Kind() == SyntaxKind.BaseConstructorInitializer 147return [.. method.ContainingType.ToMinimalDisplayParts(semanticModel, position), Punctuation(SyntaxKind.OpenParenToken)]; 151=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (10)
64expression.IsKind(SyntaxKind.NullableType) && 246result.Add(Keyword(SyntaxKind.RefKeyword)); 251result.Add(Keyword(SyntaxKind.RefKeyword)); 253result.Add(Keyword(SyntaxKind.ReadOnlyKeyword)); 263result.Add(Punctuation(SyntaxKind.DotToken)); 267result.Add(Punctuation(SyntaxKind.OpenBracketToken)); 273=> [Punctuation(SyntaxKind.CloseBracketToken)]; 279return !token.IsKind(SyntaxKind.None) && 328return !token.IsKind(SyntaxKind.None) && 363return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\GenericNameFullyWrittenSignatureHelpProvider.cs (1)
44return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (1)
47=> !token.IsKind(SyntaxKind.None) &&
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_DelegateAndFunctionPointerInvoke.cs (4)
66displayParts.Add(Keyword(SyntaxKind.DelegateKeyword)); 67displayParts.Add(Operator(SyntaxKind.AsteriskToken)); 74displayParts.Add(Punctuation(SyntaxKind.OpenParenToken)); 98=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (4)
60var includeInstance = throughExpression.Kind() is not (SyntaxKind.IdentifierName or SyntaxKind.SimpleMemberAccessExpression or SyntaxKind.PredefinedType) || 65(throughExpression.IsKind(SyntaxKind.IdentifierName) &&
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs (5)
41result.Add(Punctuation(SyntaxKind.OpenParenToken)); 53parts.Add(Punctuation(SyntaxKind.OpenParenToken)); 60parts.Add(Punctuation(SyntaxKind.CommaToken)); 68parts.Add(Punctuation(SyntaxKind.CloseParenToken)); 80=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_NormalType.cs (2)
45result.Add(Punctuation(SyntaxKind.OpenParenToken)); 51=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
145result.Add(Punctuation(SyntaxKind.OpenParenToken)); 151=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\SignatureHelpUtilities.cs (3)
104if (token.IsKind(SyntaxKind.OpenParenToken) && 131if (token.IsKind(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax && token.GetAncestor<TSyntaxNode>() != null) 136return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (1)
226=> token.IsKind(SyntaxKind.OpenParenToken) && token.Parent is ParenthesizedExpressionSyntax;
SimplifyThisOrMe\CSharpSimplifyThisOrMeDiagnosticAnalyzer.cs (1)
20SyntaxKind,
SimplifyTypeNames\SimplifyTypeNamesCodeFixProvider.cs (3)
25: AbstractSimplifyTypeNamesCodeFixProvider<SyntaxKind, CSharpSimplifierOptions>(new CSharpSimplifyTypeNamesDiagnosticAnalyzer()) 52if (annotatedexpressionSyntax.Kind() is SyntaxKind.IsExpression or SyntaxKind.AsExpression)
Snippets\AbstractCSharpForLoopSnippetProvider.cs (2)
35protected abstract SyntaxKind ConditionKind { get; } 37protected abstract SyntaxKind IncrementorKind { get; }
Snippets\AbstractCSharpTypeSnippetProvider.cs (6)
30protected abstract ISet<SyntaxKind> ValidModifiers { get; } 64preferredOrder.TryGetValue((int)SyntaxKind.PublicKeyword, out var publicModifierOrder)) 66while (targetToken.IsPotentialModifier(out var modifierKind)) 79targetPosition = targetToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword) ? targetToken.SpanStart : targetPosition; 81return new TextChange(TextSpan.FromBounds(targetPosition, targetPosition), SyntaxFacts.GetText(SyntaxKind.PublicKeyword) + " "); 106typeDeclaration.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString)));
Snippets\CSharpClassSnippetProvider.cs (14)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.NewKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.ProtectedKeyword, 26SyntaxKind.InternalKeyword, 27SyntaxKind.PrivateKeyword, 28SyntaxKind.AbstractKeyword, 29SyntaxKind.ClosedKeyword, 30SyntaxKind.SealedKeyword, 31SyntaxKind.StaticKeyword, 32SyntaxKind.UnsafeKeyword, 33SyntaxKind.FileKeyword, 40protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
Snippets\CSharpConsoleSnippetProvider.cs (1)
35if (syntaxContext.TargetToken is { RawKind: (int)SyntaxKind.EqualsGreaterThanToken, Parent: LambdaExpressionSyntax lambda })
Snippets\CSharpConstructorSnippetProvider.cs (8)
30private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.PublicKeyword, 33SyntaxKind.PrivateKeyword, 34SyntaxKind.ProtectedKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.StaticKeyword, 46precedingModifiers.Count == 1 && precedingModifiers.Single() == SyntaxKind.StaticKeyword))
Snippets\CSharpEnumSnippetProvider.cs (8)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.InternalKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.ProtectedKeyword, 27SyntaxKind.FileKeyword, 34protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
Snippets\CSharpForEachLoopSnippetProvider.cs (4)
47if (token is { RawKind: (int)SyntaxKind.AwaitKeyword, Parent: ExpressionSyntax { Parent: ExpressionStatementSyntax } } || 48token is { RawKind: (int)SyntaxKind.IdentifierToken, ValueText: "await", Parent: IdentifierNameSyntax { Parent: ExpressionStatementSyntax } }) 70var isAsync = syntaxContext.TargetToken is { RawKind: (int)SyntaxKind.AwaitKeyword } or { RawKind: (int)SyntaxKind.IdentifierToken, ValueText: "await" };
Snippets\CSharpForLoopSnippetProvider.cs (4)
25protected override SyntaxKind ConditionKind => SyntaxKind.LessThanExpression; 27protected override SyntaxKind IncrementorKind => SyntaxKind.PostIncrementExpression;
Snippets\CSharpInterfaceSnippetProvider.cs (9)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.InternalKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.ProtectedKeyword, 27SyntaxKind.UnsafeKeyword, 28SyntaxKind.FileKeyword, 35protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
Snippets\CSharpIntMainSnippetProvider.cs (1)
60var updatedReturnStatement = returnStatement.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString));
Snippets\CSharpPropiSnippetProvider.cs (1)
29=> SyntaxFactory.AccessorDeclaration(SyntaxKind.InitAccessorDeclaration).WithSemicolonToken(SemicolonToken);
Snippets\CSharpProprSnippetProvider.cs (5)
43if (precedingModifiers.IsSupersetOf([SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword])) 47if (precedingModifiers.Any(syntaxKind => syntaxKind is SyntaxKind.PrivateKeyword or SyntaxKind.ProtectedKeyword)) 62return SyntaxFactory.AccessorDeclaration(SyntaxKind.InitAccessorDeclaration).WithSemicolonToken(SemicolonToken);
Snippets\CSharpReversedForLoopSnippetProvider.cs (4)
25protected override SyntaxKind ConditionKind => SyntaxKind.GreaterThanOrEqualExpression; 27protected override SyntaxKind IncrementorKind => SyntaxKind.PostDecrementExpression;
Snippets\CSharpSnippetHelpers.cs (1)
55var updatedBlock = block.WithCloseBraceToken(block.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString)));
Snippets\CSharpStructSnippetProvider.cs (11)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.InternalKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.ProtectedKeyword, 27SyntaxKind.UnsafeKeyword, 28SyntaxKind.RefKeyword, 29SyntaxKind.ReadOnlyKeyword, 30SyntaxKind.FileKeyword, 37protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
SolutionExplorer\CSharpSolutionExplorerSymbolTreeItemProvider.cs (5)
202var isExtension = methodDeclaration.IsParentKind(SyntaxKind.ExtensionBlockDeclaration) || 203(methodDeclaration.ParameterList is { Parameters: [var parameter, ..] } && parameter.Modifiers.Any(SyntaxKind.ThisKeyword)); 227var isConst = fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 274nameBuilder.Append(operatorDeclaration.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword 294if (declaration.Kind() == SyntaxKind.DestructorDeclaration)
SpellCheck\CSharpSpellcheckCodeFixProvider.cs (1)
60=> token.GetNextToken().Kind() == SyntaxKind.LessThanToken;
SplitOrMergeIfStatements\CSharpIfLikeStatementGenerator.cs (1)
171if (statement.IsKind(SyntaxKind.IfStatement))
SplitStringLiteral\InterpolatedStringSplitter.cs (3)
34=> _interpolatedStringExpression.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken; 75SyntaxKind.AddExpression, 87kind: SyntaxKind.InterpolatedStringTextToken,
SplitStringLiteral\SimpleStringSplitter.cs (5)
33return _token.IsKind(SyntaxKind.Utf8StringLiteralToken) && CursorPosition >= _token.Span.End - "u8".Length; 46var firstTokenSuffix = _token.Kind() == SyntaxKind.Utf8StringLiteralToken 64var leftExpression = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, firstToken); 65var rightExpression = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, secondToken); 68SyntaxKind.AddExpression,
SplitStringLiteral\StringSplitter.cs (7)
28SyntaxKind.PlusToken, 42if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken) 61if (token.Kind() is SyntaxKind.InterpolatedStringTextToken or SyntaxKind.InterpolatedStringEndToken || 72return token.Kind() == SyntaxKind.OpenBraceToken && 73token.Parent.IsKind(SyntaxKind.Interpolation) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiers.cs (9)
33if (name.Kind() == SyntaxKind.None) 86case SyntaxKind.CompilationUnit: 87case SyntaxKind.FileScopedNamespaceDeclaration: 88case SyntaxKind.NamespaceDeclaration: 92case SyntaxKind.ClassDeclaration: 93case SyntaxKind.RecordDeclaration: 94case SyntaxKind.StructDeclaration: 95case SyntaxKind.RecordStructDeclaration: 99case SyntaxKind.InterfaceDeclaration:
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (23)
33SyntaxKind.IfStatement, 34SyntaxKind.ElseClause, 35SyntaxKind.ForStatement, 36SyntaxKind.ForEachStatement, 37SyntaxKind.ForEachVariableStatement, 38SyntaxKind.WhileStatement, 39SyntaxKind.DoStatement, 40SyntaxKind.UsingStatement, 41SyntaxKind.LockStatement, 42SyntaxKind.FixedStatement); 62case SyntaxKind.Block: 66case SyntaxKind.IfStatement when statement.Kind() == SyntaxKind.ElseClause: 77case SyntaxKind.LockStatement: 78case SyntaxKind.UsingStatement: 79case SyntaxKind.FixedStatement: 238if (statement.Kind() is not (SyntaxKind.IfStatement or SyntaxKind.ElseClause)) 267if (ifStatementOrElseClause.IsKind(SyntaxKind.ElseClause)) 273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement)); 277while (result.IsParentKind(SyntaxKind.ElseClause)) 292if (statement.Statement.IsKind(SyntaxKind.Block)) 296if (elseStatement.IsKind(SyntaxKind.Block))
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (26)
18ExpressionSyntax, ExpressionSyntax, SyntaxKind>(CSharpExpressionPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = 22SyntaxKind.AddExpression, 23SyntaxKind.SubtractExpression, 24SyntaxKind.MultiplyExpression, 25SyntaxKind.DivideExpression, 26SyntaxKind.ModuloExpression, 27SyntaxKind.LeftShiftExpression, 28SyntaxKind.RightShiftExpression, 29SyntaxKind.LogicalOrExpression, 30SyntaxKind.LogicalAndExpression, 31SyntaxKind.BitwiseOrExpression, 32SyntaxKind.BitwiseAndExpression, 33SyntaxKind.ExclusiveOrExpression, 34SyntaxKind.EqualsExpression, 35SyntaxKind.NotEqualsExpression, 36SyntaxKind.LessThanExpression, 37SyntaxKind.LessThanOrEqualExpression, 38SyntaxKind.GreaterThanExpression, 39SyntaxKind.GreaterThanOrEqualExpression, 40SyntaxKind.IsExpression, 41SyntaxKind.AsExpression, 42SyntaxKind.CoalesceExpression, 43SyntaxKind.IsPatternExpression, 46protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds() 81=> node.Kind() == SyntaxKind.AsExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (5)
18PatternSyntax, BinaryPatternSyntax, SyntaxKind>(CSharpPatternPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = [SyntaxKind.AndPattern, SyntaxKind.OrPattern]; 22protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds()
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.FileScopedNamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.NamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
66var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (5)
58if (!methodDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword) || 132if (member.Modifiers.Any(m => m.Kind() is SyntaxKind.PublicKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.InternalKeyword)) 135if (!member.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
38context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
44context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (33)
20private sealed class Analyzer : CSharpSyntaxVisitor<SyntaxKind> 31public static (SyntaxKind nodeToGenerate, VariableDeclaratorSyntax? declaratorToRemoveOpt) Analyze( 37var nodeToGenerate = analyzer.AnalyzeSwitchStatement(node, out shouldRemoveNextStatement); 39if (nodeToGenerate == SyntaxKind.SimpleAssignmentExpression && 84if (!_assignmentTargetOpt.IsKind(SyntaxKind.IdentifierName)) 104public override SyntaxKind VisitSwitchStatement(SwitchStatementSyntax node) 107private SyntaxKind AnalyzeSwitchStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 126var nextStatement = AnalyzeNextStatement(switchStatement, out shouldRemoveNextStatement); 175private SyntaxKind AnalyzeNextStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 182return SyntaxKind.ThrowStatement; 190private static SyntaxKind Intersect(SyntaxKind left, SyntaxKind right) 192if (left == SyntaxKind.ThrowStatement) 197if (right == SyntaxKind.ThrowStatement) 210private SyntaxKind AnalyzeNextStatement(StatementSyntax? nextStatement) 213return nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement) 218private SyntaxKind AnalyzeSwitchSection(SwitchSectionSyntax section) 223case 2 when section.Statements[1].IsKind(SyntaxKind.BreakStatement) || section.Statements[0].IsKind(SyntaxKind.SwitchStatement): 230private static SyntaxKind Aggregate<T>(SyntaxKind seed, SyntaxList<T> nodes, Func<SyntaxKind, T, SyntaxKind> func) 233var result = seed; 248public override SyntaxKind VisitAssignmentExpression(AssignmentExpressionSyntax node) 268public override SyntaxKind VisitExpressionStatement(ExpressionStatementSyntax node) 271public override SyntaxKind VisitReturnStatement(ReturnStatementSyntax node) 279: SyntaxKind.ReturnStatement; 282public override SyntaxKind VisitThrowStatement(ThrowStatementSyntax node) 286return node.Expression is null ? default : SyntaxKind.ThrowStatement; 289public override SyntaxKind DefaultVisit(SyntaxNode node)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
34context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SwitchStatement);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionHelpers.cs (4)
14if (node.IsKind(SyntaxKind.DefaultSwitchLabel)) 22if (@case.Pattern.IsKind(SyntaxKind.DiscardPattern)) 30varPattern.Designation.Kind() is SyntaxKind.DiscardDesignation or SyntaxKind.SingleVariableDesignation)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
36and not { Type: PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword } };
src\roslyn\src\Analyzers\CSharp\Analyzers\FileHeaders\CSharpFileHeaderHelper.cs (2)
22if (commentTrivia.IsKind(SyntaxKind.SingleLineCommentTrivia)) 26else if (commentTrivia.IsKind(SyntaxKind.MultiLineCommentTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\ForEachCast\CSharpForEachCastDiagnosticAnalyzer.cs (4)
17SyntaxKind, 23protected override ImmutableArray<SyntaxKind> GetSyntaxKinds() 24=> [SyntaxKind.ForEachStatement, SyntaxKind.ForEachVariableStatement];
src\roslyn\src\Analyzers\CSharp\Analyzers\HiddenExplicitCast\CSharpHiddenExplicitCastDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.CastExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (13)
57compilationContext.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 59syntaxContext => AnalyzeSyntaxNode(syntaxContext, expressionType), SyntaxKind.Argument)); 81if (argumentNode.RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) 102if (invocationOrCreation?.Kind() is not SyntaxKind.InvocationExpression and not SyntaxKind.ObjectCreationExpression) 293case SyntaxKind.WhileStatement: 294case SyntaxKind.DoStatement: 295case SyntaxKind.ForStatement: 296case SyntaxKind.ForEachStatement: 297case SyntaxKind.UsingStatement: 298case SyntaxKind.FixedStatement: 299case SyntaxKind.TryStatement: 318return current.IsParentKind(SyntaxKind.Block)
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (7)
35=> context.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IfStatement); 56if (!ifStatement.Condition.IsKind(SyntaxKind.NotEqualsExpression)) 119if (condition.Left.IsKind(SyntaxKind.NullLiteralExpression) || 120condition.Right.IsKind(SyntaxKind.NullLiteralExpression)) 122var expr = condition.Left.IsKind(SyntaxKind.NullLiteralExpression) 309=> left.IsKind(SyntaxKind.IdentifierName) && right.IsKind(SyntaxKind.NullLiteralExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (4)
35context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 46if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeFieldReadonly\CSharpMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
15: AbstractMakeFieldReadonlyDiagnosticAnalyzer<SyntaxKind, ThisExpressionSyntax>
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (2)
32context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.LocalFunctionStatement); 38if (localFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
186property.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
51}, SyntaxKind.ThisExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceDiagnosticAnalyzer.cs (4)
24: AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<SyntaxKind, BaseNamespaceDeclarationSyntax> 36protected override ImmutableArray<SyntaxKind> GetSyntaxKindsToAnalyze() 37=> [SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration];
src\roslyn\src\Analyzers\CSharp\Analyzers\MisplacedUsingDirectives\MisplacedUsingDirectivesDiagnosticAnalyzer.cs (6)
53context.RegisterSyntaxNodeAction(AnalyzeNamespaceNode, SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration); 54context.RegisterSyntaxNodeAction(AnalyzeCompilationUnitNode, SyntaxKind.CompilationUnit); 103t => t.Kind() is not (SyntaxKind.UsingDirective or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration));
src\roslyn\src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (9)
15internal sealed class CSharpNamingStyleDiagnosticAnalyzer : NamingStyleDiagnosticAnalyzerBase<SyntaxKind> 17protected override ImmutableArray<SyntaxKind> SupportedSyntaxKinds { get; } = 19SyntaxKind.VariableDeclarator, 20SyntaxKind.ForEachStatement, 21SyntaxKind.CatchDeclaration, 22SyntaxKind.SingleVariableDesignation, 23SyntaxKind.LocalFunctionStatement, 24SyntaxKind.Parameter, 25SyntaxKind.TypeParameter,
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (5)
101if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 111SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (6)
33=> context.RegisterSyntaxNodeAction(ProcessConditionalExpression, SyntaxKind.ConditionalExpression); 77if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 87SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (3)
98if (!token.IsKind(SyntaxKind.CloseBraceToken)) 102if (!nextToken.IsKind(SyntaxKind.CloseBraceToken)) 127endOfLineTrivia = secondBrace.LeadingTrivia.Last(t => t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
86if (colonToken.TrailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (4)
93var parentIsElseClause = parent.IsKind(SyntaxKind.ElseClause); 99if (statement.IsKind(SyntaxKind.IfStatement) && parentIsElseClause) 111if (parent.IsKind(SyntaxKind.Block)) 133if (trivia.IsKind(SyntaxKind.EndOfLineTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersHelper.cs (3)
21var kind = SyntaxFacts.GetKeywordKind(trimmed); 22return (int)(kind == SyntaxKind.None ? SyntaxFacts.GetContextualKeywordKind(trimmed) : kind); 31parsed[(int)SyntaxKind.PartialKeyword] = int.MaxValue;
src\roslyn\src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (6)
18: AbstractQualifyMemberAccessDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax, SimpleNameSyntax> 24=> node.IsKind(SyntaxKind.ThisExpression); 38if (node.IsKind(SyntaxKind.BaseExpression)) 44if (node.Parent is AssignmentExpressionSyntax { Parent: InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression), Left: var left } && 62=> declarationSyntax.IsKind(SyntaxKind.PropertyDeclaration) && declarationSyntax.Contains(node); 65=> declarationSyntax.GetAncestorsOrThis(n => n.IsKind(SyntaxKind.FieldDeclaration) && n.Contains(node)).Any();
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (3)
26=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.IsExpression, SyntaxKind.IsPatternExpression); 38if (left.Kind() != SyntaxKind.SuppressNullableWarningExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
90if (modifier.Kind() == SyntaxKind.AsyncKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (4)
20: AbstractRemoveUnnecessaryCastDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax> 22protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; } = 23[SyntaxKind.CastExpression, SyntaxKind.AsExpression];
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
40context.RegisterSyntaxNodeAction(AnalyzeDiscardDesignation, SyntaxKind.DiscardDesignation);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (5)
50SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 75if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 83if (wasAwaited != anonymousFunction.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (14)
55if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 96case SyntaxKind.NullableDirectiveTrivia: 107case SyntaxKind.IfDirectiveTrivia or 108SyntaxKind.ElifDirectiveTrivia or 109SyntaxKind.ElseDirectiveTrivia or 110SyntaxKind.EndIfDirectiveTrivia: 120if (!directive.TargetToken.IsKind(SyntaxKind.None)) 128if (directive.TargetToken.IsKind(SyntaxKind.AnnotationsKeyword)) 132else if (directive.TargetToken.IsKind(SyntaxKind.WarningsKeyword)) 141if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 145else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 155if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 159else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 163else if (directive.SettingToken.IsKind(SyntaxKind.RestoreKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (13)
56SyntaxKind.CompilationUnit or 57SyntaxKind.ClassDeclaration or 58SyntaxKind.RecordDeclaration or 59SyntaxKind.StructDeclaration or 60SyntaxKind.RecordStructDeclaration or 61SyntaxKind.InterfaceDeclaration or 62SyntaxKind.DelegateDeclaration or 63SyntaxKind.EnumDeclaration; 135SyntaxKind.IfDirectiveTrivia or 136SyntaxKind.ElifDirectiveTrivia or 137SyntaxKind.ElseDirectiveTrivia) 272if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 293if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (5)
73if (node.IsParentKind(SyntaxKind.UsingDirective)) 79if (node.IsParentKind(SyntaxKind.SimpleBaseType)) 91if (node.IsParentKind(SyntaxKind.NameEquals) && node.Parent.IsParentKind(SyntaxKind.UsingDirective)) 101if (node.IsParentKind(SyntaxKind.Attribute))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedExpressionSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedPatternSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedPattern;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (3)
22case SyntaxKind.AssemblyKeyword: 23case SyntaxKind.ModuleKeyword: 31}, SyntaxKind.AttributeList);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
24=> (typeof(SyntaxKind).Assembly, CompilerDiagnosticAnalyzerNames.CSharpCompilerAnalyzerTypeName); 26=> root.ContainsDirective(SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (1)
26if (node is not PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixUnary)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\UnnecessaryUnsafeModifierUtilities.cs (1)
145if (modifier.Kind() == SyntaxKind.UnsafeKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (2)
64if (currentStatement.IsKind(SyntaxKind.LabeledStatement)) 74if (currentStatement.IsKind(SyntaxKind.LocalFunctionStatement))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
79!blockOperation.Syntax.IsKind(SyntaxKind.Block);
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyBooleanExpression\CSharpSimplifyConditionalDiagnosticAnalyzer.cs (1)
18SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
35context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, enumerableType), SyntaxKind.InvocationExpression); 72if (whereLambda.Body is not BinaryExpressionSyntax(kind: SyntaxKind.IsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (12)
30=> context.RegisterSyntaxNodeAction(AnalyzePropertyDeclaration, SyntaxKind.PropertyDeclaration); 50if (accessor is (SyntaxKind.GetAccessorDeclaration) { Body.Statements: [ReturnStatementSyntax { Expression.RawKind: (int)SyntaxKind.FieldExpression }] } 51or (SyntaxKind.GetAccessorDeclaration) { ExpressionBody.Expression.RawKind: (int)SyntaxKind.FieldExpression }) 57if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { Body.Statements: [ExpressionStatementSyntax { Expression: var innerBlockBodyExpression }] } && 64if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { ExpressionBody.Expression: var innerExpressionBodyExpression } && 73return expression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 75Left.RawKind: (int)SyntaxKind.FieldExpression, 86containingPropertyDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
47context.RegisterSyntaxNodeAction(AnalyzeSubpattern, SyntaxKind.Subpattern);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (10)
21SyntaxKind, 29protected override SyntaxKind PropertyDeclarationKind 30=> SyntaxKind.PropertyDeclaration; 59if (argument.RefKindKeyword.Kind() != SyntaxKind.None) 75if (addressOfExpression.Kind() == SyntaxKind.AddressOfExpression) 155if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) 157Expression: (kind: SyntaxKind.ThisExpression), 158Name: (kind: SyntaxKind.IdentifierName), 163else if (expression.IsKind(SyntaxKind.IdentifierName)) 215if (setExpression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (6)
19SyntaxKind, 25protected override SyntaxKind IfStatementKind 26=> SyntaxKind.IfStatement; 42if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binary) 47else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs (2)
43protected abstract void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType); 67context.RegisterCodeBlockStartAction<SyntaxKind>(context => InitializeWorker(context, expressionType));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (3)
29protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 31context.RegisterSyntaxNodeAction(context => AnalyzeArrayInitializerExpression(context, expressionType), SyntaxKind.ArrayInitializerExpression); 32context.RegisterSyntaxNodeAction(context => AnalyzeArrayCreationExpression(context, expressionType), SyntaxKind.ArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (5)
32protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 33=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression); 110if (invocationExpression.Expression is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccessExpression || 149argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword, Expression: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } } 216identifierName.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (2)
22protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 23=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (2)
23protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 24=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (4)
65protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 66=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression); 221Initializer: null or { RawKind: (int)SyntaxKind.CollectionInitializerExpression } 403if (memberAccess.Kind() != SyntaxKind.SimpleMemberAccessExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (3)
26protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 28context.RegisterSyntaxNodeAction(context => AnalyzeObjectCreationExpression(context, expressionType), SyntaxKind.ObjectCreationExpression); 29context.RegisterSyntaxNodeAction(context => AnalyzeImplicitObjectCreationExpression(context, expressionType), SyntaxKind.ImplicitObjectCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (3)
35protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 37context.RegisterSyntaxNodeAction(context => AnalyzeExplicitStackAllocExpression(context, expressionType), SyntaxKind.StackAllocArrayCreationExpression); 38context.RegisterSyntaxNodeAction(context => AnalyzeImplicitStackAllocExpression(context, expressionType), SyntaxKind.ImplicitStackAllocArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (5)
580siblingArgument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 614if (openBracket.TrailingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), ..]) 617if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia)] trailingTrivia) 886RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, 1041if (objectCreation.Initializer.IsKind(SyntaxKind.ObjectCreationExpression) && objectCreation.Initializer.Expressions.Count > 0)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (4)
37if (expression is InitializerExpressionSyntax(SyntaxKind.ComplexElementInitializerExpression) initializer) 54if (_objectCreationExpression.Initializer is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) 201if (binaryExpression.Kind() != SyntaxKind.AddExpression) 250if (current is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) { Name.Identifier.ValueText: "Length" or "Count" } memberAccess)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
27SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs (10)
15: AbstractUseCompoundAssignmentDiagnosticAnalyzer<SyntaxKind, AssignmentExpressionSyntax, BinaryExpressionSyntax>( 18protected override SyntaxKind GetAnalysisKind() 19=> SyntaxKind.SimpleAssignmentExpression; 21protected override bool IsSupported(SyntaxKind assignmentKind, ParseOptions options) 22=> assignmentKind != SyntaxKind.CoalesceExpression || 25protected override int TryGetIncrementOrDecrement(SyntaxKind opKind, object constantValue) 34SyntaxKind.AddExpression => 1, 35SyntaxKind.SubtractExpression => -1, 45SyntaxKind.AddExpression => -1, 46SyntaxKind.SubtractExpression => 1,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (10)
44context.RegisterSyntaxNodeAction(AnalyzeCoalesceExpression, SyntaxKind.CoalesceExpression); 45context.RegisterSyntaxNodeAction(AnalyzeIfStatement, SyntaxKind.IfStatement); 71if (assignment.Kind() != SyntaxKind.SimpleAssignmentExpression) 108assignment = whenTrue is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignmentTemp } 179if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binaryExpression) 188else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern) 198if (arg0.Kind() == SyntaxKind.NullLiteralExpression || 199arg1.Kind() == SyntaxKind.NullLiteralExpression) 204testedExpression = arg0.Kind() == SyntaxKind.NullLiteralExpression ? arg1 : arg0;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\Utilities.cs (30)
11public static readonly ImmutableArray<(SyntaxKind, SyntaxKind, SyntaxKind)> Kinds = 13(SyntaxKind.AddExpression, SyntaxKind.AddAssignmentExpression), 14(SyntaxKind.SubtractExpression, SyntaxKind.SubtractAssignmentExpression), 15(SyntaxKind.MultiplyExpression, SyntaxKind.MultiplyAssignmentExpression), 16(SyntaxKind.DivideExpression, SyntaxKind.DivideAssignmentExpression), 17(SyntaxKind.ModuloExpression, SyntaxKind.ModuloAssignmentExpression), 18(SyntaxKind.BitwiseAndExpression, SyntaxKind.AndAssignmentExpression), 19(SyntaxKind.ExclusiveOrExpression, SyntaxKind.ExclusiveOrAssignmentExpression), 20(SyntaxKind.BitwiseOrExpression, SyntaxKind.OrAssignmentExpression), 21(SyntaxKind.LeftShiftExpression, SyntaxKind.LeftShiftAssignmentExpression), 22(SyntaxKind.RightShiftExpression, SyntaxKind.RightShiftAssignmentExpression), 23(SyntaxKind.CoalesceExpression, SyntaxKind.CoalesceAssignmentExpression)).SelectAsArray( 26private static SyntaxKind FindOperatorToken(SyntaxKind assignmentExpressionKind) 28for (var current = SyntaxKind.None; current <= SyntaxKind.ThrowExpression; current++)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (3)
39SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement); 233if (element.Identifier.IsKind(SyntaxKind.None))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.DefaultExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (7)
30SyntaxKind.GetAccessorDeclaration, 31SyntaxKind.SetAccessorDeclaration, 32SyntaxKind.InitAccessorDeclaration, 33SyntaxKind.AddAccessorDeclaration, 34SyntaxKind.RemoveAccessorDeclaration, 63return !declaration.GetLeadingTrivia().Any(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 69=> declaration.IsKind(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConstructorsHelper.cs (1)
25[SyntaxKind.ConstructorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConversionOperatorsHelper.cs (1)
25[SyntaxKind.ConversionOperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForIndexersHelper.cs (1)
28[SyntaxKind.IndexerDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (2)
28[SyntaxKind.LocalFunctionStatement]) 56if (statement.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (2)
26[SyntaxKind.MethodDeclaration]) 54if (declaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForOperatorsHelper.cs (1)
27[SyntaxKind.OperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (1)
31[SyntaxKind.PropertyDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper.cs (1)
22public abstract ImmutableArray<SyntaxKind> SyntaxKinds { get; }
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (8)
34ImmutableArray<SyntaxKind> syntaxKinds) : UseExpressionBodyHelper 42public override ImmutableArray<SyntaxKind> SyntaxKinds { get; } = syntaxKinds; 46return accessorList is { Accessors: [{ AttributeLists.Count: 0, RawKind: (int)SyntaxKind.GetAccessorDeclaration } accessor] } 174getAccessor?.GetLeadingTrivia() is not [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace]) 208if (startOfLine && trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 247if (expressionBody.Expression.IsKind(SyntaxKind.ThrowExpression)) 290.Where(t => t.Kind() != SyntaxKind.EndOfLineTrivia) 384var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (4)
20private readonly ImmutableArray<SyntaxKind> _syntaxKinds; 53var nodeKind = context.Node.Kind(); 60if (grandparent.Kind() == SyntaxKind.PropertyDeclaration && 66if (grandparent.Kind() == SyntaxKind.IndexerDeclaration &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (2)
35SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
57if (expressionBodyOpt.IsKind(SyntaxKind.ThrowExpression) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitlyTypedLambdaExpressionDiagnosticAnalyzer.cs (2)
34SyntaxKind.ParenthesizedLambdaExpression); 124var paramsModifierIndex = parameter.Modifiers.IndexOf(SyntaxKind.ParamsKeyword);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (6)
32=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.ObjectCreationExpression); 102else if (objectCreation.Parent.IsKind(SyntaxKind.ArrowExpressionClause)) 106LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)), 107MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 111AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } => (baseProperty.Type, false), 124else if (objectCreation.Parent is InitializerExpressionSyntax(kind: SyntaxKind.ArrayInitializerExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (3)
43HandleVariableDeclaration, SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement, SyntaxKind.DeclarationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
17=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.NameColon, SyntaxKind.NameEquals); 23case SyntaxKind.NameColon: 26case SyntaxKind.NameEquals:
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (4)
41context.RegisterSyntaxNodeAction(n => AnalyzeSyntax(n), SyntaxKind.EqualsExpression, SyntaxKind.NotEqualsExpression); 61var properties = binaryExpression.Kind() == SyntaxKind.EqualsExpression 73right.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer.cs (1)
14internal sealed class CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer : AbstractUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (10)
71context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 73SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression)); 330if (containingStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclaration) && 357if (anonymousFunction?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Parent: ExpressionStatementSyntax expressionStatement } assignment) 359if (assignment.Left.IsKind(SyntaxKind.IdentifierName)) 383SyntaxKind.NullLiteralExpression or 384SyntaxKind.DefaultLiteralExpression or 385SyntaxKind.DefaultExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (2)
42context.RegisterSyntaxNodeAction(AnalyzeAttribute, SyntaxKind.Attribute); 78if (argument.Expression is not LiteralExpressionSyntax(SyntaxKind.StringLiteralExpression) and not InterpolatedStringExpressionSyntax)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (4)
19SyntaxKind, 33protected override SyntaxKind IfStatementSyntaxKind 34=> SyntaxKind.IfStatement; 53if (pattern is UnaryPatternSyntax(SyntaxKind.NotPattern) notPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (2)
54SyntaxKind.SimpleAssignmentExpression, 167if (target.Syntax.DescendantNodesAndSelf().OfType<ArgumentSyntax>().Any(a => a.RefKindKeyword.Kind() is SyntaxKind.RefKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (3)
43SyntaxKind.LogicalAndExpression, 44SyntaxKind.LogicalOrExpression, 45SyntaxKind.LogicalNotExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
48context.RegisterSyntaxNodeAction(context => AnalyzeAsExpression(context), SyntaxKind.AsExpression); 99if (binaryExpression.Kind() is SyntaxKind.EqualsExpression) 109else if (binaryExpression.Kind() is SyntaxKind.NotEqualsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (20)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection); 106var defAssignedWhenTrue = _comparison.Kind() is SyntaxKind.NotEqualsExpression or SyntaxKind.IsExpression; 114case SyntaxKind.LogicalAndExpression when !defAssignedWhenTrue: 115case SyntaxKind.LogicalOrExpression when defAssignedWhenTrue: 126case SyntaxKind.LogicalAndExpression: 127case SyntaxKind.LogicalOrExpression: 130case SyntaxKind.ParenthesizedExpression: 131case SyntaxKind.CastExpression: 135case SyntaxKind.EqualsValueClause: 136case SyntaxKind.VariableDeclarator: 137case SyntaxKind.VariableDeclaration: 140case SyntaxKind.LogicalNotExpression: 145case SyntaxKind.ConditionalExpression: 158case SyntaxKind.ForStatement: 169case SyntaxKind.WhileStatement: 173case SyntaxKind.IfStatement: 282if (_operand.Kind() == SyntaxKind.IdentifierName)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (16)
47=> context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 49SyntaxKind.EqualsExpression, 50SyntaxKind.NotEqualsExpression, 51SyntaxKind.IsExpression, 52SyntaxKind.IsPatternExpression)); 286case SyntaxKind.IdentifierName: 295if (!initializerValue.IsKind(SyntaxKind.AsExpression, out asExpression)) 301case SyntaxKind.SimpleAssignmentExpression: 306if (!assignment.Right.IsKind(SyntaxKind.AsExpression, out asExpression) || 336private static ExpressionSyntax? GetNullCheckOperand(ExpressionSyntax left, SyntaxKind comparisonKind, SyntaxNode right) 338if (left.IsKind(SyntaxKind.NullLiteralExpression)) 345if (right.IsKind(SyntaxKind.NullLiteralExpression)) 353&& predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword) 354&& comparisonKind == SyntaxKind.IsExpression) 361&& constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression) 362&& comparisonKind == SyntaxKind.IsPatternExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (6)
59context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 60blockStartContext.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IsExpression)); 95var ifStatementScope = ifStatement.Parent.IsKind(SyntaxKind.Block) 173if (!isExpression.Parent.IsKind(SyntaxKind.IfStatement, out ifStatement)) 186if (!firstStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclarationStatement)) 197if (!declaratorValue.IsKind(SyntaxKind.CastExpression, out castExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (3)
46context.RegisterSyntaxNodeAction(n => SyntaxNodeAction(n, expressionOfTType), SyntaxKind.LogicalNotExpression); 63if (node is not PrefixUnaryExpressionSyntax(SyntaxKind.LogicalNotExpression) 81BinaryExpressionSyntax(SyntaxKind.IsExpression) { Right: TypeSyntax type } isExpression
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\UsePatternMatchingHelpers.cs (7)
26if (asExpression.Kind() == SyntaxKind.AsExpression) 54if (conditionalAccessExpression.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) parentBinaryExpression1 && 65SyntaxKind.NotEqualsExpression or 66SyntaxKind.GreaterThanExpression or 67SyntaxKind.GreaterThanOrEqualExpression or 68SyntaxKind.LessThanExpression or 69SyntaxKind.LessThanOrEqualExpression) parentBinaryExpression2 &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (5)
363if (constructorDeclaration.Initializer is null or (kind: SyntaxKind.BaseConstructorInitializer)) 377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer); 472if (assignmentExpression.Kind() != SyntaxKind.SimpleAssignmentExpression) 482MemberAccessExpressionSyntax(kind: SyntaxKind.SimpleMemberAccessExpression) { Expression: (kind: SyntaxKind.ThisExpression), Name: IdentifierNameSyntax identifierName } => identifierName,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (3)
74context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.UsingStatement); 222=> priorStatement.Kind() is SyntaxKind.GotoStatement or 223SyntaxKind.LabeledStatement;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
58SyntaxKind.LocalDeclarationStatement); 139if (assignmentStatement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (2)
53SyntaxKind.InvocationExpression); 72if (argument.Kind() != SyntaxKind.OmittedTypeArgument)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
109else if (elements is [{ Syntax.Parent: (kind: SyntaxKind.CollectionInitializerExpression) }, ..])
src\roslyn\src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
16AbstractValidateFormatStringDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (8)
46if (node.Kind() is not SyntaxKind.MethodDeclaration and not SyntaxKind.PropertyDeclaration and not SyntaxKind.VariableDeclarator) 49if (node.IsKind(SyntaxKind.VariableDeclarator) && node is not { Parent.Parent: EventFieldDeclarationSyntax }) 81var xmlSpaceAfterTripleSlash = Token(leading: [DocumentationCommentExterior("///")], SyntaxKind.XmlTextLiteralToken, text: " ", valueText: " ", trailing: default); 85var xmlNewLineToken = Token(leading: default, SyntaxKind.XmlTextLiteralNewLineToken, text: newLine, valueText: newLine, trailing: default); 88kind: SyntaxKind.SingleLineDocumentationCommentTrivia, 107if (finalLeadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
66if (constructorInitializer.IsKind(SyntaxKind.BaseConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
86parenthesizedExpression.GetAncestor<InterpolatedStringExpressionSyntax>()?.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (21)
136if (stringLiteral.Kind() is SyntaxKind.InterpolatedStringTextToken) 138if (stringLiteral.GetRequiredParent() is not InterpolatedStringTextSyntax { Parent: InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString }) 143else if (stringLiteral.Kind() is SyntaxKind.InterpolatedRawStringEndToken) 145if (stringLiteral.GetRequiredParent() is not InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString) 150else if (stringLiteral.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 228if (token.IsKind(SyntaxKind.HashToken) && token.Parent!.Kind() is not (SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia)) 287if (firstBodyToken.Kind() != SyntaxKind.EndOfFileToken 307if (leadingTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..]) 313if (leadingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), (kind: SyntaxKind.EndOfLineTrivia), ..]) 350var originalHadTrailingNewLine = namespaceDeclaration.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia)]; 358if (trailingTrivia is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 367(kind: SyntaxKind.EndOfLineTrivia or SyntaxKind.EndIfDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia), 368(kind: SyntaxKind.EndOfLineTrivia) 388if (openBraceToken.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 400if (!fileScopedNamespace.GetLastToken().GetNextTokenOrEndOfFile().IsKind(SyntaxKind.EndOfFileToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (5)
59var nodeToGenerate = (SyntaxKind)int.Parse(properties[Constants.NodeToGenerateKey]!); 99Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement); 100editor.RemoveNode(nextStatement.IsParentKind(SyntaxKind.GlobalStatement) ? nextStatement.GetRequiredParent() : nextStatement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (17)
41SyntaxKind nodeToGenerate, 52var rewriter = new Rewriter(model, isAllThrowStatements: nodeToGenerate == SyntaxKind.ThrowStatement, cancellationToken); 68SyntaxKind nodeToGenerate, 73case SyntaxKind.ReturnStatement: 75Token(leadingTrivia, SyntaxKind.ReturnKeyword, trailing: default), 78case SyntaxKind.ThrowStatement: 80Token(leadingTrivia, SyntaxKind.ThrowKeyword, trailing: default), 93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia) 151totalPattern = BinaryPattern(SyntaxKind.OrPattern, totalPattern.Parenthesize(), nextPatternPart.Parenthesize()); 162case SyntaxKind.CasePatternSwitchLabel: 167case SyntaxKind.CaseSwitchLabel: 171case SyntaxKind.DefaultSwitchLabel: 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement)); 234if (nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement)) 250Token(leading: default, SyntaxKind.SwitchKeyword, node.CloseParenToken.TrailingTrivia), 251Token(leading: default, SyntaxKind.OpenBraceToken, node.OpenBraceToken.TrailingTrivia),
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (2)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression)); 87if (!methodDeclaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (14)
37if (typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword)) 191SyntaxKind.ThisConstructorInitializer, 201=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.EqualsEqualsToken }); 203=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.ExclamationEqualsToken }); 418? SyntaxKind.RecordDeclaration 419: SyntaxKind.RecordStructDeclaration, 653SyntaxKind.MultiLineDocumentationCommentTrivia, 670SyntaxKind.MultiLineDocumentationCommentTrivia, 704if (docComment.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)) 739if (prevToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 796token.IsKind(SyntaxKind.XmlTextLiteralToken) 801tokens is [(kind: SyntaxKind.XmlTextLiteralNewLineToken), _, ..]) 811tokens is [.., (kind: SyntaxKind.XmlTextLiteralNewLineToken), (kind: SyntaxKind.XmlTextLiteralToken) textLiteral] &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
414? SyntaxKind.NullLiteralExpression 415: SyntaxKind.DefaultLiteralExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
153SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), newNameNode).WithAdditionalAnnotations(Simplifier.Annotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
42var docCommentNodes = leadingTrivia.Where(f => f.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (2)
47=> token.Kind() == SyntaxKind.XmlTextLiteralToken && IsWhitespace(token.Text); 50=> token.Kind() == SyntaxKind.XmlTextLiteralNewLineToken;
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (5)
52if (firstTrivia.Kind() != SyntaxKind.SkippedTokensTrivia) 60return enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword; 85var isEnumConstraint = enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword; 104SyntaxKind.StructConstraint)));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (3)
58=> typeSyntax is PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword }; 144MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 147LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (2)
57typeToGenerateIn = constructorInitializer.IsKind(SyntaxKind.ThisConstructorInitializer) 188constructorDeclarationSyntax.Initializer.IsKind(SyntaxKind.ThisConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
46if (baseList.Parent is TypeDeclarationSyntax(SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration) parentTypeDecl &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\CSharpGenerateEnumMemberService.cs (4)
42is SyntaxKind.InvocationExpression 43or SyntaxKind.ObjectCreationExpression 44or SyntaxKind.GotoStatement 45or SyntaxKind.AliasQualifiedName)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (4)
37is SyntaxKind.IdentifierName 38or SyntaxKind.MethodDeclaration 39or SyntaxKind.InvocationExpression 40or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (3)
46.FirstOrDefault(n => n.Kind() is SyntaxKind.SimpleAssignmentExpression or SyntaxKind.ForEachVariableStatement or SyntaxKind.PositionalPatternClause);
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (4)
56is SyntaxKind.IdentifierName 57or SyntaxKind.MethodDeclaration 58or SyntaxKind.InvocationExpression 59or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (2)
66SyntaxKind.ImplicitKeyword, 92SyntaxKind.ImplicitKeyword,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
109if (simpleNameOrMemberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocationExpressionOpt))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (2)
35=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 137=> State.SimpleNameOpt.Kind() == SyntaxKind.IdentifierName;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (4)
61SyntaxKind.ClassDeclaration or 62SyntaxKind.StructDeclaration or 63SyntaxKind.RecordDeclaration or 64SyntaxKind.RecordStructDeclaration) typeDeclaration)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
96if (ifStatement.Parent.IsKind(SyntaxKind.ElseClause) && 151var expressionTriviaWithoutEndOfLine = expressionTrivia.Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
76SyntaxKind.YieldReturnStatement, 220node = ancestors.FirstOrDefault(n => n.Span.Contains(span) && n != root && n.IsKind(SyntaxKind.ReturnStatement));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
161syntaxEditor.ReplaceNode(name, MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("@this"), name));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberStatic\CSharpMakeMemberStaticCodeFixProvider.cs (1)
31if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax })
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
51return token.Kind() == SyntaxKind.IdentifierToken && token.Text == "await"; 192var partialModifier = modifiers.FirstOrDefault(static m => m.IsKind(SyntaxKind.PartialKeyword));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (3)
97SyntaxKind.ForEachStatement or 98SyntaxKind.ForEachVariableStatement or 99SyntaxKind.UsingStatement))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
77if (otherAccessor.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (4)
50if (enclosingType?.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration && 51!enclosingType.Modifiers.Any(SyntaxKind.AbstractKeyword) && !enclosingType.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
342.SkipWhile(trivia => trivia.All(t => t.IsWhitespaceOrEndOfLine()) && trivia.Last().IsKind(SyntaxKind.EndOfLineTrivia)) 376if (firstMemberTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..])
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
68if (!token.IsKind(SyntaxKind.CloseBraceToken)) 75if (!firstBrace.IsKind(SyntaxKind.CloseBraceToken))
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
105return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (25)
66if (node.IsKind(SyntaxKind.ConditionalAccessExpression)) 116if (node.Parent is (kind: SyntaxKind.ReturnStatement or SyntaxKind.YieldReturnStatement)) 120SyntaxKind.MethodDeclaration or 121SyntaxKind.PropertyDeclaration or 122SyntaxKind.ParenthesizedLambdaExpression or 123SyntaxKind.SimpleLambdaExpression or 124SyntaxKind.LocalFunctionStatement or 125SyntaxKind.AnonymousMethodExpression or 126SyntaxKind.ConstructorDeclaration or 127SyntaxKind.DestructorDeclaration or 128SyntaxKind.OperatorDeclaration or 129SyntaxKind.IndexerDeclaration or 130SyntaxKind.EventDeclaration); 135var onYield = node.IsParentKind(SyntaxKind.YieldReturnStatement); 260if (node.IsParentKind(SyntaxKind.ArrowExpressionClause) && 271if (modifiers.Any(SyntaxKind.AsyncKeyword) || onYield) 316SyntaxKind.NullLiteralExpression or 317SyntaxKind.AsExpression or 318SyntaxKind.DefaultExpression or 319SyntaxKind.DefaultLiteralExpression or 320SyntaxKind.ConditionalExpression or 321SyntaxKind.ConditionalAccessExpression or 322SyntaxKind.PropertyDeclaration or 323SyntaxKind.VariableDeclarator;
src\roslyn\src\Analyzers\CSharp\CodeFixes\PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs (1)
47insertLocation, newArms, SyntaxKind.CommaToken));
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
35var asyncTokenIndex = modifiers.IndexOf(SyntaxKind.AsyncKeyword);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (4)
67Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression); 75n => n.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (1)
53SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (3)
81is not SyntaxKind.Block 82and not SyntaxKind.SwitchSection 83and not SyntaxKind.GlobalStatement)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (12)
48case SyntaxKind.IdentifierName: 52case SyntaxKind.VariableDeclarator: 71case SyntaxKind.SingleVariableDesignation: 76case SyntaxKind.CatchDeclaration: 80case SyntaxKind.VarPattern: 81return node.IsParentKind(SyntaxKind.Subpattern) 93if (newNameNode.IsKind(SyntaxKind.DiscardDesignation)) 212if (originalCompoundAssignment.Parent.IsKind(SyntaxKind.ExpressionStatement)) 214if (!originalCompoundAssignment.IsKind(SyntaxKind.CoalesceAssignmentExpression)) 225BinaryExpression(SyntaxKind.CoalesceExpression, leftOfAssignment, rightOfAssignment)); 231var mappedBinaryExpressionKind = originalCompoundAssignment.Kind().MapCompoundAssignmentKindToBinaryExpressionKind(); 232if (mappedBinaryExpressionKind == SyntaxKind.None)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
44token.IsKind(SyntaxKind.DefaultKeyword) && 45token.Parent is LiteralExpressionSyntax(SyntaxKind.DefaultLiteralExpression) defaultLiteral)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyInterpolation\CSharpSimplifyInterpolationCodeFixProvider.cs (1)
39if (interpolatedString.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (1)
52containingProperty.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
103return MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, outerExpression, innerName);
src\roslyn\src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (4)
45var skippedTriviaIndex = leadingTrivia.IndexOf(SyntaxKind.SkippedTokensTrivia); 54if (classOrStructKeyword.Kind() is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword) 60var trailingTriviaTakeUntil = remainingLeadingTrivia.IndexOf(SyntaxKind.EndOfLineTrivia) is >= 0 and var eolIndex
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (8)
51=> accessor.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration; 122var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration).WithSemicolonToken(SemicolonToken); 129.WithModifiers(TokenList(updatedProperty.Modifiers.Where(token => !token.IsKind(SyntaxKind.ReadOnlyKeyword)))); 154var indentation = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespaceTrivia] 185=> attributeList.WithTarget(AttributeTargetSpecifier(Identifier(SyntaxFacts.GetText(SyntaxKind.FieldKeyword)), ColonToken.WithTrailingTrivia(Space))); 194AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 203(isTrivialGetAccessor && accessor.Kind() is SyntaxKind.GetAccessorDeclaration) ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\SingleLinePropertyFormattingRule.cs (7)
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)) 25if (previousToken.IsKind(SyntaxKind.SemicolonToken) && currentToken.Parent is AccessorDeclarationSyntax)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\UseAutoPropertyRewriter.cs (2)
26if (node.Expression.IsKind(SyntaxKind.ThisExpression)) 47Parent: InitializerExpressionSyntax { RawKind: (int)SyntaxKind.ObjectInitializerExpression }
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (6)
103SyntaxKind.CollectionInitializerExpression, 105[LiteralExpression(SyntaxKind.NullLiteralExpression, NullKeyword.WithAdditionalAnnotations(nullTokenAnnotation))], 129if (nodesAndTokens.Count > 0 && nodesAndTokens.Last().GetTrailingTrivia() is [.., (kind: not SyntaxKind.EndOfLineTrivia)]) 549SyntaxKind.SimpleMemberAccessExpression, 674if (token.LeadingTrivia is not [.., (kind: SyntaxKind.WhitespaceTrivia)]) 925while (index - 1 >= 0 && trivia[index - 1].Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
23SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
80if (addLineBreak && item.GetTrailingTrivia() is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 134SyntaxKind.ComplexElementInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (11)
20: AbstractUseCompoundAssignmentCodeFixProvider<SyntaxKind, AssignmentExpressionSyntax, ExpressionSyntax>(Utilities.Kinds) 22protected override SyntaxToken Token(SyntaxKind kind) 26SyntaxKind assignmentOpKind, ExpressionSyntax left, SyntaxToken syntaxToken, ExpressionSyntax right) 33? Postfix(SyntaxKind.PostIncrementExpression, left) 34: Prefix(SyntaxKind.PreIncrementExpression, left); 38? Postfix(SyntaxKind.PostDecrementExpression, left) 39: Prefix(SyntaxKind.PreDecrementExpression, left); 41private static ExpressionSyntax Postfix(SyntaxKind kind, ExpressionSyntax operand) 44private static ExpressionSyntax Prefix(SyntaxKind kind, ExpressionSyntax operand) 47protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
60SyntaxKind.CoalesceAssignmentExpression, 107SyntaxKind.CoalesceAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\MultiLineConditionalExpressionFormattingRule.cs (2)
34=> token.Kind() is SyntaxKind.QuestionToken or SyntaxKind.ColonToken && token.GetRequiredParent().HasAnnotation(SpecializedFormattingAnnotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
138SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
59SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134a => a.Expression.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.Expression).Type)); 152SyntaxKind.SimpleMemberAccessExpression, 166SyntaxKind.ArrayInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (4)
200case SyntaxKind.SingleVariableDesignation: 206case SyntaxKind.DiscardDesignation: 210case SyntaxKind.ParenthesizedVariableDesignation: 225var separatorBuilder = ArrayBuilder<SyntaxToken>.GetInstance(builder.Count - 1, Token(leading: default, SyntaxKind.CommaToken, trailing: default));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\Helpers.cs (1)
17SyntaxKind.IndexExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
54var newStartToken = SyntaxFactory.Token(oldStartToken.LeadingTrivia, SyntaxKind.InterpolatedVerbatimStringStartToken,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (3)
68if (binary.IsKind(SyntaxKind.EqualsExpression)) 81SyntaxKind.IsExpression, 88=> binary.Right.IsKind(SyntaxKind.NullLiteralExpression)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (3)
25= LiteralExpression(SyntaxKind.NullLiteralExpression); 34=> BinaryExpression(SyntaxKind.EqualsExpression, argument, s_nullLiteralExpression).Parenthesize(); 52SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
26private static readonly ConstantPatternSyntax s_nullConstantPattern = ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
214if (anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
21SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
29SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (3)
28var initializerKind = firstExpression is AssignmentExpressionSyntax 29? SyntaxKind.ObjectInitializerExpression 30: SyntaxKind.CollectionInitializerExpression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (12)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken, 93p.IsDisjunctive ? SyntaxKind.OrPattern : SyntaxKind.AndPattern, 95Token(p.Token.LeadingTrivia, p.IsDisjunctive ? SyntaxKind.OrKeyword : SyntaxKind.AndKeyword, 115if (unwrapped is UnaryPatternSyntax(SyntaxKind.NotPattern) unaryPattern) 129if (expr.IsKind(SyntaxKind.DefaultLiteralExpression)) 133if (expr.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (7)
123if (isPatternExpression.Pattern is UnaryPatternSyntax(kind: SyntaxKind.NotPattern) unaryPattern && 137SyntaxKind.EqualsExpression => ConstantPattern(binaryExpression.Right), 139SyntaxKind.NotEqualsExpression => UnaryPattern(ConstantPattern(binaryExpression.Right)), 142SyntaxKind.GreaterThanExpression or 143SyntaxKind.GreaterThanOrEqualExpression or 144SyntaxKind.LessThanExpression or 145SyntaxKind.LessThanOrEqualExpression => RelationalPattern(binaryExpression.OperatorToken, binaryExpression.Right),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (3)
168if (comparison.Kind() is not (SyntaxKind.EqualsExpression or SyntaxKind.IsPatternExpression)) 179return PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, isPatternExpression.Parenthesize());
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
88newIf = originalIf.IsParentKind(SyntaxKind.ElseClause)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (7)
42Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.EndOfLineTrivia, "first end of line"), 43Matcher.Repeat(Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.WhitespaceTrivia, "whitespace")), 44Matcher.Single<SyntaxTrivia>(t => t.IsKind(SyntaxKind.EndOfLineTrivia), "second end of line")); 265var inKeyword = current.Modifiers.FirstOrDefault(t => t.Kind() == SyntaxKind.InKeyword); 334: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, containingTypeSyntax, currentName); 374=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace] ? whitespace.ToString() : ""; 550=> memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (3)
132var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)] 159SyntaxKind.SingleLineDocumentationCommentTrivia, 220Trivia(DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. allContent])));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
147.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (1)
59SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
63if (current.Arguments.Any(a => a.Kind() != SyntaxKind.OmittedTypeArgument))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
161if (argument.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken) 202SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (38)
74case SyntaxKind.NamespaceDeclaration: 75case SyntaxKind.FileScopedNamespaceDeclaration: 88while (name.Kind() == SyntaxKind.QualifiedName) 98case SyntaxKind.ClassDeclaration: 99case SyntaxKind.StructDeclaration: 100case SyntaxKind.RecordDeclaration: 101case SyntaxKind.RecordStructDeclaration: 121goto case SyntaxKind.InterfaceDeclaration; 123case SyntaxKind.InterfaceDeclaration: 124case SyntaxKind.ExtensionBlockDeclaration: 142case SyntaxKind.EnumDeclaration: 158case SyntaxKind.EnumMemberDeclaration: 170case SyntaxKind.DelegateDeclaration: 184case SyntaxKind.EventDeclaration: 202case SyntaxKind.EventFieldDeclaration: 203case SyntaxKind.FieldDeclaration: 222case SyntaxKind.ArrowExpressionClause: 233case SyntaxKind.PropertyDeclaration: 258case SyntaxKind.IndexerDeclaration: 284case SyntaxKind.AddAccessorDeclaration: 285case SyntaxKind.RemoveAccessorDeclaration: 286case SyntaxKind.GetAccessorDeclaration: 287case SyntaxKind.SetAccessorDeclaration: 288case SyntaxKind.InitAccessorDeclaration: 301case SyntaxKind.ConstructorDeclaration: 302case SyntaxKind.ConversionOperatorDeclaration: 303case SyntaxKind.DestructorDeclaration: 304case SyntaxKind.MethodDeclaration: 305case SyntaxKind.OperatorDeclaration: 336case SyntaxKind.CompilationUnit: 438case SyntaxKind.ArrowExpressionClause: 441case SyntaxKind.MethodDeclaration: 444case SyntaxKind.OperatorDeclaration: 447case SyntaxKind.ConversionOperatorDeclaration: 450case SyntaxKind.PropertyDeclaration: 453case SyntaxKind.IndexerDeclaration: 456case SyntaxKind.ConstructorDeclaration: 459case SyntaxKind.DestructorDeclaration:
src\roslyn\src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (90)
24case SyntaxKind.ParenthesizedLambdaExpression: 25case SyntaxKind.SimpleLambdaExpression: 26case SyntaxKind.AnonymousMethodExpression: 27case SyntaxKind.LetClause: 28case SyntaxKind.WhereClause: 29case SyntaxKind.AscendingOrdering: 30case SyntaxKind.DescendingOrdering: 31case SyntaxKind.JoinClause: 32case SyntaxKind.GroupClause: 33case SyntaxKind.LocalFunctionStatement: 36case SyntaxKind.SelectClause: 40case SyntaxKind.FromClause: 42return !node.Parent.IsKind(SyntaxKind.QueryExpression); 57if (lambda.IsKind(SyntaxKind.ArrowExpressionClause)) 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 79case SyntaxKind.ParenthesizedLambdaExpression: 80case SyntaxKind.SimpleLambdaExpression: 81case SyntaxKind.AnonymousMethodExpression: 84case SyntaxKind.FromClause: 87case SyntaxKind.LetClause: 90case SyntaxKind.WhereClause: 93case SyntaxKind.AscendingOrdering: 94case SyntaxKind.DescendingOrdering: 97case SyntaxKind.SelectClause: 104case SyntaxKind.JoinClause: 110case SyntaxKind.GroupClause: 117case SyntaxKind.LocalFunctionStatement: 151case SyntaxKind.ParenthesizedLambdaExpression: 152case SyntaxKind.SimpleLambdaExpression: 153case SyntaxKind.AnonymousMethodExpression: 157case SyntaxKind.LocalFunctionStatement: 161case SyntaxKind.ArrowExpressionClause: 165case SyntaxKind.FromClause: 169case SyntaxKind.JoinClause: 173case SyntaxKind.LetClause: 177case SyntaxKind.WhereClause: 181case SyntaxKind.AscendingOrdering: 182case SyntaxKind.DescendingOrdering: 186case SyntaxKind.SelectClause: 190case SyntaxKind.GroupClause: 220if (!selectOrGroupExpression.IsKind(SyntaxKind.IdentifierName)) 232if (containingQueryOrContinuation.IsKind(SyntaxKind.QueryExpression)) 250if (selectOrGroupClause.IsKind(SyntaxKind.SelectClause) && containingBody.Clauses.Count == 0) 257if (!clause.IsKind(SyntaxKind.WhereClause) && !clause.IsKind(SyntaxKind.OrderByClause)) 292case SyntaxKind.ParenthesizedLambdaExpression: 293case SyntaxKind.SimpleLambdaExpression: 294case SyntaxKind.AnonymousMethodExpression: 298case SyntaxKind.FromClause: 300if (node.Parent.IsKind(SyntaxKind.QueryExpression)) 308case SyntaxKind.JoinClause: 314case SyntaxKind.LetClause: 318case SyntaxKind.WhereClause: 322case SyntaxKind.AscendingOrdering: 323case SyntaxKind.DescendingOrdering: 327case SyntaxKind.SelectClause: 337case SyntaxKind.GroupClause: 351case SyntaxKind.LocalFunctionStatement: 378return syntax.IsKind(SyntaxKind.GroupClause) || 379syntax.IsKind(SyntaxKind.JoinClause) || 380syntax.IsKind(SyntaxKind.FromClause); 392case SyntaxKind.CompilationUnit: 393case SyntaxKind.Block: 394case SyntaxKind.SwitchStatement: 395case SyntaxKind.ArrowExpressionClause: // expression-bodied member 396case SyntaxKind.CatchClause: 397case SyntaxKind.ForStatement: 398case SyntaxKind.ForEachStatement: 399case SyntaxKind.ForEachVariableStatement: 400case SyntaxKind.UsingStatement: 401case SyntaxKind.TryStatement: 404case SyntaxKind.ConstructorDeclaration: 408case SyntaxKind.DoStatement: 409case SyntaxKind.ExpressionStatement: 410case SyntaxKind.FixedStatement: 411case SyntaxKind.GotoCaseStatement: 412case SyntaxKind.IfStatement: 413case SyntaxKind.LockStatement: 414case SyntaxKind.ReturnStatement: 415case SyntaxKind.ThrowStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.YieldReturnStatement: 420case SyntaxKind.ClassDeclaration: 421case SyntaxKind.StructDeclaration: 422case SyntaxKind.RecordDeclaration: 423case SyntaxKind.RecordStructDeclaration: 432case SyntaxKind.SwitchExpression: 433case SyntaxKind.AwaitExpression: 446case SyntaxKind.EqualsValueClause: 449case SyntaxKind.ForStatement:
src\roslyn\src\Compilers\CSharp\Portable\Syntax\SyntaxBindingUtilities.cs (2)
14=> node.IsKind(SyntaxKind.YieldReturnStatement) || 15node.IsKind(SyntaxKind.AwaitExpression) ||
StringIndentation\CSharpStringIndentationService.cs (3)
43StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken 67if (child.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken)
Structure\CSharpBlockStructureProvider.cs (2)
66builder.Add((int)SyntaxKind.DisabledTextTrivia, [new DisabledTextTriviaStructureProvider()]); 67builder.Add((int)SyntaxKind.MultiLineCommentTrivia, [new MultilineCommentBlockStructureProvider()]);
Structure\CSharpStructureHelpers.cs (13)
66if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) 73else if (!trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 86if (lastToken.Kind() == SyntaxKind.None) 94if (nextToken.Kind() is not SyntaxKind.None and SyntaxKind.SemicolonToken) 187SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia or SyntaxKind.EndOfFileToken)) 236if (startToken.IsKind(SyntaxKind.None) || endToken.IsKind(SyntaxKind.None)) 243var firstComment = startToken.LeadingTrivia.FirstOrNull(t => t.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia); 380if (child.Kind() != SyntaxKind.AttributeList)
Structure\Providers\AnonymousMethodExpressionStructureProvider.cs (1)
30if (lastToken.Kind() == SyntaxKind.None)
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (1)
32autoCollapse: parent.Kind() != SyntaxKind.LocalFunctionStatement));
Structure\Providers\BlockSyntaxStructureProvider.cs (28)
29var parentKind = parent.Kind(); 91else if (parentKind == SyntaxKind.ElseClause || IsNonBlockStatement(parent)) 97if (parentKind == SyntaxKind.LocalFunctionStatement) 101parent.IsParentKind(SyntaxKind.GlobalStatement); 134if (parentKind is SyntaxKind.Block or SyntaxKind.SwitchSection) 152=> node is StatementSyntax(kind: not SyntaxKind.Block); 157if (parent.IsKind(SyntaxKind.IfStatement) && parent.IsParentKind(SyntaxKind.ElseClause)) 170if (previousToken.IsKind(SyntaxKind.None)) 180if (node.Parent.IsKind(SyntaxKind.IfStatement)) 206SyntaxKind.ForStatement => BlockTypes.Loop, 207SyntaxKind.ForEachStatement => BlockTypes.Loop, 208SyntaxKind.ForEachVariableStatement => BlockTypes.Loop, 209SyntaxKind.WhileStatement => BlockTypes.Loop, 210SyntaxKind.DoStatement => BlockTypes.Loop, 211SyntaxKind.TryStatement => BlockTypes.Statement, 212SyntaxKind.CatchClause => BlockTypes.Statement, 213SyntaxKind.FinallyClause => BlockTypes.Statement, 214SyntaxKind.UnsafeStatement => BlockTypes.Statement, 215SyntaxKind.FixedStatement => BlockTypes.Statement, 216SyntaxKind.LockStatement => BlockTypes.Statement, 217SyntaxKind.UsingStatement => BlockTypes.Statement, 218SyntaxKind.IfStatement => BlockTypes.Conditional, 219SyntaxKind.ElseClause => BlockTypes.Conditional, 220SyntaxKind.SwitchSection => BlockTypes.Conditional, 221SyntaxKind.Block => BlockTypes.Statement, 222SyntaxKind.LocalFunctionStatement => BlockTypes.Statement,
Structure\Providers\CollectionExpressionStructureProvider.cs (1)
38var end = nextToken.Kind() == SyntaxKind.CommaToken
Structure\Providers\ConstructorDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConstructorDeclaration));
Structure\Providers\ConversionOperatorDeclarationStructureProvider.cs (1)
40&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConversionOperatorDeclaration));
Structure\Providers\DisabledTextTriviaStructureProvider.cs (7)
48if (!parentTriviaList[indexInParent - 1].IsKind(SyntaxKind.IfDirectiveTrivia) && 49!parentTriviaList[indexInParent - 1].IsKind(SyntaxKind.ElifDirectiveTrivia) && 50!parentTriviaList[indexInParent - 1].IsKind(SyntaxKind.ElseDirectiveTrivia)) 93case SyntaxKind.IfDirectiveTrivia: 99case SyntaxKind.EndIfDirectiveTrivia: 112case SyntaxKind.ElseDirectiveTrivia: 113case SyntaxKind.ElifDirectiveTrivia:
Structure\Providers\EventDeclarationStructureProvider.cs (2)
39&& (!nextSibling.IsNode || nextSibling.Kind() is SyntaxKind.EventDeclaration or SyntaxKind.EventFieldDeclaration);
Structure\Providers\IndexerDeclarationStructureProvider.cs (2)
39&& (!nextSibling.IsNode || nextSibling.Kind() is SyntaxKind.IndexerDeclaration or SyntaxKind.PropertyDeclaration);
Structure\Providers\InitializerExpressionStructureProvider.cs (1)
40var end = nextToken.Kind() == SyntaxKind.CommaToken
Structure\Providers\MethodDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.MethodDeclaration));
Structure\Providers\OperatorDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.OperatorDeclaration));
Structure\Providers\ParenthesizedLambdaExpressionStructureProvider.cs (1)
35if (lastToken.Kind() == SyntaxKind.None)
Structure\Providers\PropertyDeclarationStructureProvider.cs (2)
38&& (!nextSibling.IsNode || nextSibling.Kind() is SyntaxKind.PropertyDeclaration or SyntaxKind.IndexerDeclaration);
Structure\Providers\SimpleLambdaExpressionStructureProvider.cs (1)
35if (lastToken.Kind() == SyntaxKind.None)
Structure\Providers\StringLiteralExpressionStructureProvider.cs (3)
21if (node.IsKind(SyntaxKind.StringLiteralExpression) && !node.ContainsDiagnostics) 43if (node.Token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken)
SyncedSource\FileBasedPrograms\FileLevelDirectiveHelpers.cs (8)
69while (!result.Token.IsKind(SyntaxKind.EndOfFileToken)); 74if (trivia.ContainsDiagnostics && trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 104if (trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 111if (trivia.IsKind(SyntaxKind.ShebangDirectiveTrivia)) 125else if (trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 129var message = trivia.GetStructure() is IgnoredDirectiveTriviaSyntax { Content: { RawKind: (int)SyntaxKind.StringLiteralToken } content } 205if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) 212if (trivia.IsKind(SyntaxKind.WhitespaceTrivia))
SyncNamespaces\CSharpSyncNamespacesService.cs (2)
22CSharpChangeNamespaceToMatchFolderCodeFixProvider codeFixProvider) : AbstractSyncNamespacesService<SyntaxKind, BaseNamespaceDeclarationSyntax> 24public override AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<SyntaxKind, BaseNamespaceDeclarationSyntax> DiagnosticAnalyzer { get; } = diagnosticAnalyzer;
TaskList\CSharpTaskListService.cs (1)
84return trivia.Kind() != SyntaxKind.RegionDirectiveTrivia &&
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (3)
57context.RegisterSyntaxNodeAction(context => SyntaxNodeAction(context, expressionType), SyntaxKind.IsExpression); 184if (node is LocalFunctionStatementSyntax localFunction && localFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 187if (node is AnonymousFunctionExpressionSyntax anonymousFunction && anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (1)
54if (declaration.Kind() == SyntaxKind.SimpleLambdaExpression)
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (132)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CSharpIdentifiersShouldNotContainUnderscores.Fixer.cs (1)
35=> node.IsKind(SyntaxKind.IdentifierName)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CSharpStaticHolderTypes.Fixer.cs (2)
70if (member.Kind() != SyntaxKind.ConstructorDeclaration) 76if (constructor.Modifiers.Any(m => m.IsKind(SyntaxKind.StaticKeyword)))
Microsoft.CodeQuality.Analyzers\Documentation\CSharpAvoidUsingCrefTagsWithAPrefix.cs (1)
23context.RegisterSyntaxNodeAction(AnalyzeXmlAttribute, SyntaxKind.XmlTextAttribute);
Microsoft.CodeQuality.Analyzers\Maintainability\CSharpAvoidUninstantiatedInternalClasses.cs (1)
32}, SyntaxKind.UsingDirective);
Microsoft.CodeQuality.Analyzers\Maintainability\CSharpMakeTypesInternal.Fixer.cs (2)
29var publicKeyword = type.Modifiers.First(m => m.IsKind(SyntaxKind.PublicKeyword)); 30var modifiers = type.Modifiers.Replace(publicKeyword, SyntaxFactory.Token(SyntaxKind.InternalKeyword));
Microsoft.CodeQuality.Analyzers\QualityGuidelines\CSharpDoNotInitializeUnnecessarilyAnalyzer.cs (1)
14=> op.Syntax?.Parent?.RawKind == (int)CodeAnalysis.CSharp.SyntaxKind.SuppressNullableWarningExpression;
Microsoft.CodeQuality.Analyzers\QualityGuidelines\CSharpUseLiteralsWhereAppropriate.Fixer.cs (3)
35return syntaxToken.IsKind(SyntaxKind.StaticKeyword); 40return syntaxToken.IsKind(SyntaxKind.ReadOnlyKeyword); 45return SyntaxFactory.Token(SyntaxKind.ConstKeyword);
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.Fixer.cs (3)
114SyntaxFactory.PrefixUnaryExpression(SyntaxKind.PointerIndirectionExpression, 172SyntaxFactory.PrefixUnaryExpression(SyntaxKind.PointerIndirectionExpression, nonNullPtrIdentifierNode), 178SyntaxFactory.ParenthesizedExpression(SyntaxFactory.PrefixUnaryExpression(SyntaxKind.PointerIndirectionExpression,
Microsoft.NetCore.Analyzers\InteropServices\CSharpDynamicInterfaceCastableImplementation.Fixer.cs (5)
128if (accessor.IsKind(SyntaxKind.InitAccessorDeclaration)) 142SyntaxKind.InitAccessorDeclaration, 145SyntaxFactory.Token(SyntaxKind.InitKeyword), 295SyntaxKind.IdentifierToken, 302return !declaration.IsKind(SyntaxKind.VariableDeclarator);
Microsoft.NetCore.Analyzers\InteropServices\CSharpSpecifyMarshalingForPInvokeStringArguments.Fixer.cs (1)
22return node.IsKind(SyntaxKind.Attribute);
Microsoft.NetCore.Analyzers\Performance\CSharpConstantExpectedAnalyzer.cs (1)
24context.RegisterSyntaxNodeAction(context => OnAttributeNode(context, constantExpectedContext), SyntaxKind.Attribute);
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (6)
172case PostfixUnaryExpressionSyntax { RawKind: (int)SyntaxKind.PostDecrementExpression } post: 174PrefixUnaryExpression(SyntaxKind.PreDecrementExpression, identifierName)). 177case PostfixUnaryExpressionSyntax { RawKind: (int)SyntaxKind.PostIncrementExpression } post: 179PrefixUnaryExpression(SyntaxKind.PreIncrementExpression, identifierName)). 231if (ifStatement.Condition is PrefixUnaryExpressionSyntax unary && unary.IsKind(SyntaxKind.LogicalNotExpression)) 259else if (ifStatement.Condition.IsKind(SyntaxKind.InvocationExpression) && ifStatement.Else is not null)
Microsoft.NetCore.Analyzers\Performance\CSharpPreferHashDataOverComputeHash.Fixer.cs (6)
49SyntaxKind.SimpleMemberAccessExpression, 82SyntaxKind.SimpleMemberAccessExpression, 88SyntaxKind.SimpleMemberAccessExpression, 105SyntaxKind.SimpleMemberAccessExpression, 202return triviaList.Any(t => !t.IsKind(SyntaxKind.WhitespaceTrivia) && !t.IsKind(SyntaxKind.EndOfLineTrivia));
Microsoft.NetCore.Analyzers\Performance\CSharpPreferLengthCountIsEmptyOverAny.Fixer.cs (9)
31SyntaxKind.SimpleMemberAccessExpression, 35if (invocation.Parent.IsKind(SyntaxKind.LogicalNotExpression)) 41SyntaxKind.LogicalNotExpression, 72static BinaryExpressionSyntax GetBinaryExpression(ExpressionSyntax expression, string member, SyntaxKind expressionKind) 77SyntaxKind.SimpleMemberAccessExpression, 82SyntaxKind.NumericLiteralExpression, 88if (invocation.Parent.IsKind(SyntaxKind.LogicalNotExpression)) 90var binaryExpression = GetBinaryExpression(expression, propertyName, SyntaxKind.EqualsExpression); 95return root.ReplaceNode(invocation, GetBinaryExpression(expression, propertyName, SyntaxKind.NotEqualsExpression).WithTriviaFrom(invocation));
Microsoft.NetCore.Analyzers\Performance\CSharpUseSearchValues.cs (7)
73accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 149predefinedType.Keyword.IsKind(SyntaxKind.ByteKeyword)) 154if (expression.IsKind(SyntaxKind.CharacterLiteralExpression) && 195bool isCtor = member.IsKind(SyntaxKind.ConstructorDeclaration); 199if (node.IsKind(SyntaxKind.SimpleAssignmentExpression) && 202if (assignment.Left.IsKind(SyntaxKind.ElementAccessExpression)) 226expression.IsKind(SyntaxKind.IdentifierName) &&
Microsoft.NetCore.Analyzers\Performance\CSharpUseSearchValues.Fixer.cs (8)
136const SyntaxKind Utf8StringLiteralExpression = (SyntaxKind)8756; 137const SyntaxKind Utf8StringLiteralToken = (SyntaxKind)8520; 140isByte ? Utf8StringLiteralExpression : SyntaxKind.StringLiteralExpression, 143kind: isByte ? Utf8StringLiteralToken : SyntaxKind.StringLiteralToken, 157if (trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia)
Microsoft.NetCore.Analyzers\Performance\CSharpUseStartsWithInsteadOfIndexOfComparisonWithZero.Fixer.cs (1)
29SyntaxFactory.InitializerExpression(SyntaxKind.ArrayInitializerExpression, SyntaxFactory.SingletonSeparatedList(argumentSyntax.Expression))
Microsoft.NetCore.Analyzers\Resources\CSharpMarkAssembliesWithNeutralResourcesLanguage.cs (1)
40}, SyntaxKind.Attribute);
Microsoft.NetCore.Analyzers\Runtime\CSharpAvoidRedundantRegexIsMatchBeforeMatch.Fixer.cs (3)
258literal.IsKind(SyntaxKind.NullLiteralExpression) || 259literal.IsKind(SyntaxKind.DefaultLiteralExpression), 487SyntaxFactory.LiteralExpression(SyntaxKind.TrueLiteralExpression)))
Microsoft.NetCore.Analyzers\Runtime\CSharpDoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyFixer.cs (1)
17if (syntaxNode?.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression) == true)
Microsoft.NetCore.Analyzers\Runtime\CSharpDoNotUseStackallocInLoops.cs (13)
20private static readonly ImmutableArray<SyntaxKind> s_stackallocKinds = ImmutableArray.Create(SyntaxKind.StackAllocArrayCreationExpression); 34case SyntaxKind.LocalFunctionStatement: 35case SyntaxKind.ParenthesizedLambdaExpression: 36case SyntaxKind.SimpleLambdaExpression: 37case SyntaxKind.AnonymousMethodExpression: 42case SyntaxKind.ForEachStatement: 43case SyntaxKind.ForEachVariableStatement: 50goto case SyntaxKind.WhileStatement; // fall through 55case SyntaxKind.ForStatement: 62goto case SyntaxKind.WhileStatement; // fall through 64case SyntaxKind.WhileStatement: 65case SyntaxKind.DoStatement:
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocations.Fixer.cs (1)
31var operation = node.Parent.IsKind(SyntaxKind.MemberBindingExpression)
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.cs (3)
179=> IdentifierName(Token(SyntaxKind.GlobalKeyword)); 207default, SyntaxKind.None, "@" + unescaped, unescaped, default); 225var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None;
Microsoft.NetCore.Analyzers\Runtime\CSharpMarkAllNonSerializableFields.Fixer.cs (2)
18while (fieldNode != null && !fieldNode.IsKind(SyntaxKind.FieldDeclaration)) 23return fieldNode.IsKind(SyntaxKind.FieldDeclaration) ? fieldNode : null;
Microsoft.NetCore.Analyzers\Runtime\CSharpPreventNumericIntPtrUIntPtrBehavioralChanges.cs (2)
29return expression.IsKind(SyntaxKind.CheckedExpression); 31return statement.IsKind(SyntaxKind.CheckedStatement);
Microsoft.NetCore.Analyzers\Runtime\CSharpSpecifyCultureForToLowerAndToUpper.cs (1)
18Debug.Assert(node.IsKind(SyntaxKind.InvocationExpression));
Microsoft.NetCore.Analyzers\Runtime\CSharpSpecifyCultureForToLowerAndToUpper.Fixer.cs (5)
23return node.IsKind(SyntaxKind.IdentifierName) && 24(node.Parent?.IsKind(SyntaxKind.SimpleMemberAccessExpression) == true || node.Parent?.IsKind(SyntaxKind.MemberBindingExpression) == true); 29if (node.IsKind(SyntaxKind.IdentifierName) && node.Parent?.FirstAncestorOrSelf<InvocationExpressionSyntax>() is InvocationExpressionSyntax invocation) 46if (node.IsKind(SyntaxKind.IdentifierName))
Microsoft.NetCore.Analyzers\Runtime\CSharpTestForEmptyStringsUsingStringLength.Fixer.cs (3)
25return node.IsKind(SyntaxKind.EqualsExpression); 29return node.IsKind(SyntaxKind.NotEqualsExpression); 49return node.IsKind(SyntaxKind.InvocationExpression);
Microsoft.NetCore.Analyzers\Runtime\CSharpTestForNaNCorrectly.Fixer.cs (2)
26return node.IsKind(SyntaxKind.EqualsExpression); 31return node.IsKind(SyntaxKind.NotEqualsExpression);
Microsoft.NetCore.Analyzers\Runtime\CSharpUseOrdinalStringComparison.cs (3)
18Debug.Assert(invocationNode.IsKind(SyntaxKind.InvocationExpression)); 21if (invocation.Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 25else if (invocation.Expression.IsKind(SyntaxKind.ConditionalAccessExpression))
Microsoft.NetCore.Analyzers\Runtime\CSharpUseOrdinalStringComparison.Fixer.cs (3)
24return node.IsKind(SyntaxKind.Argument) && 25((ArgumentSyntax)node).Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression); 46return node.IsKind(SyntaxKind.IdentifierName) &&
Microsoft.NetCore.Analyzers\Usage\CSharpDoNotCompareSpanToNull.Fixer.cs (6)
39ExpressionSyntax memberAccess = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, GetComparatorExpression(binaryExpression), SyntaxFactory.IdentifierName(IsEmpty)); 40if (binaryExpression.IsKind(SyntaxKind.NotEqualsExpression)) 42return SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, memberAccess); 50return binaryExpression.Left.IsKind(SyntaxKind.NullLiteralExpression) 51|| binaryExpression.Left.IsKind(SyntaxKind.DefaultLiteralExpression) 52|| binaryExpression.Left.IsKind(SyntaxKind.DefaultExpression)
Microsoft.NetCore.Analyzers\Usage\CSharpMissingShebangInFileBasedProgram.cs (3)
38if (root.GetLeadingTrivia().Any(SyntaxKind.ShebangDirectiveTrivia)) 65var content = structure.ChildTokens().FirstOrDefault(static token => token.IsKind(SyntaxKind.StringLiteralToken)); 66if (!content.IsKind(SyntaxKind.StringLiteralToken))
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler.CSharp\Extensions\SyntaxGeneratorExtensions.cs (5)
18public static SyntaxNode CreateBinaryExpression(this SyntaxGenerator generator, SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right) 22=> generator.CreateBinaryExpression(SyntaxKind.ExclusiveOrExpression, left, right); 25=> generator.CreateBinaryExpression(SyntaxKind.LeftShiftExpression, left, right); 28=> generator.CreateBinaryExpression(SyntaxKind.RightShiftExpression, left, right); 34if (!Enum.IsDefined(typeof(SyntaxKind), SyntaxKindEx.UnsignedRightShiftExpression))
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler.CSharp\Extensions\SyntaxNodeExtensions.cs (7)
19while (current.IsKind(SyntaxKind.ParenthesizedExpression) && current.ChildNodes().FirstOrDefault() is SyntaxNode expression) 39if (expression.IsKind(SyntaxKind.RefExpression)) 53if (expression.IsKind(SyntaxKind.ThrowExpression)) 71SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 73SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 85SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 87SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler.CSharp\Lightup\SyntaxKindEx.cs (10)
11public const SyntaxKind Utf8StringLiteralToken = (SyntaxKind)8520; 12public const SyntaxKind UnsignedRightShiftExpression = (SyntaxKind)8692; 13public const SyntaxKind Utf8StringLiteralExpression = (SyntaxKind)8756; 14public const SyntaxKind CollectionExpression = (SyntaxKind)9076; 15public const SyntaxKind ExtensionBlockDeclaration = (SyntaxKind)9079;
Microsoft.CodeAnalysis.CSharp.Workspaces (3868)
Classification\ClassificationHelpers.cs (147)
36else if (SyntaxFacts.IsKeywordKind(token.Kind()) || token.IsKind(SyntaxKind.DiscardDesignation)) 45else if (token.Kind() == SyntaxKind.IdentifierToken) 55else if (token.Kind() == SyntaxKind.NumericLiteralToken) 68public static bool IsControlKeywordKind(SyntaxKind kind) 72case SyntaxKind.AwaitKeyword: 73case SyntaxKind.BreakKeyword: 74case SyntaxKind.CaseKeyword: 75case SyntaxKind.CatchKeyword: 76case SyntaxKind.ContinueKeyword: 77case SyntaxKind.DefaultKeyword: // Include DefaultKeyword as it can be part of a DefaultSwitchLabel 78case SyntaxKind.DoKeyword: 79case SyntaxKind.ElseKeyword: 80case SyntaxKind.FinallyKeyword: 81case SyntaxKind.ForEachKeyword: 82case SyntaxKind.ForKeyword: 83case SyntaxKind.GotoKeyword: 84case SyntaxKind.IfKeyword: 85case SyntaxKind.InKeyword: // Include InKeyword as it can be part of an ForEachStatement 86case SyntaxKind.ReturnKeyword: 87case SyntaxKind.SwitchKeyword: 88case SyntaxKind.ThrowKeyword: 89case SyntaxKind.TryKeyword: 90case SyntaxKind.WhenKeyword: // Include WhenKeyword as it can be part of a CatchFilterClause or a pattern WhenClause 91case SyntaxKind.WhileKeyword: 92case SyntaxKind.YieldKeyword: 99public static bool IsControlStatementKind(SyntaxKind kind) 104case SyntaxKind.BreakStatement: 105case SyntaxKind.ContinueStatement: 106case SyntaxKind.DoStatement: 107case SyntaxKind.ForEachStatement: 108case SyntaxKind.ForEachVariableStatement: 109case SyntaxKind.ForStatement: 110case SyntaxKind.GotoCaseStatement: 111case SyntaxKind.GotoDefaultStatement: 112case SyntaxKind.GotoStatement: 113case SyntaxKind.ReturnStatement: 114case SyntaxKind.ThrowStatement: 115case SyntaxKind.WhileStatement: 116case SyntaxKind.YieldBreakStatement: 117case SyntaxKind.YieldReturnStatement: 119case SyntaxKind.AwaitExpression: 120case SyntaxKind.CasePatternSwitchLabel: 121case SyntaxKind.CaseSwitchLabel: 122case SyntaxKind.CatchClause: 123case SyntaxKind.CatchFilterClause: 124case SyntaxKind.DefaultSwitchLabel: 125case SyntaxKind.ElseClause: 126case SyntaxKind.FinallyClause: 127case SyntaxKind.IfStatement: 128case SyntaxKind.SwitchExpression: 129case SyntaxKind.SwitchSection: 130case SyntaxKind.SwitchStatement: 131case SyntaxKind.ThrowExpression: 132case SyntaxKind.TryStatement: 133case SyntaxKind.WhenClause: 143is SyntaxKind.StringLiteralToken 144or SyntaxKind.Utf8StringLiteralToken 145or SyntaxKind.CharacterLiteralToken 146or SyntaxKind.InterpolatedStringStartToken 147or SyntaxKind.InterpolatedVerbatimStringStartToken 148or SyntaxKind.InterpolatedStringTextToken 149or SyntaxKind.InterpolatedStringEndToken 150or SyntaxKind.InterpolatedRawStringEndToken 151or SyntaxKind.InterpolatedSingleLineRawStringStartToken 152or SyntaxKind.InterpolatedMultiLineRawStringStartToken 153or SyntaxKind.SingleLineRawStringLiteralToken 154or SyntaxKind.Utf8SingleLineRawStringLiteralToken 155or SyntaxKind.MultiLineRawStringLiteralToken 156or SyntaxKind.Utf8MultiLineRawStringLiteralToken; 168case SyntaxKind.InterpolatedVerbatimStringStartToken: 170case SyntaxKind.InterpolatedStringStartToken: 173case SyntaxKind.InterpolatedStringEndToken: 176&& interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); 179case SyntaxKind.InterpolatedStringTextToken: 187&& interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); 210if (methodDeclaration.ParameterList.Parameters is [var parameter, ..] && parameter.Modifiers.Any(SyntaxKind.ThisKeyword)) 247FieldDeclarationSyntax fieldDeclaration => fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) ? ClassificationTypeNames.ConstantName : ClassificationTypeNames.FieldName, 294SyntaxKind.ClassDeclaration => ClassificationTypeNames.ClassName, 295SyntaxKind.InterfaceDeclaration => ClassificationTypeNames.InterfaceName, 296SyntaxKind.RecordDeclaration => ClassificationTypeNames.RecordClassName, 297SyntaxKind.RecordStructDeclaration => ClassificationTypeNames.RecordStructName, 298SyntaxKind.StructDeclaration => ClassificationTypeNames.StructName, 301SyntaxKind.UnionDeclaration => ClassificationTypeNames.StructName, 319if (parentNode.IsKind(SyntaxKind.EnumMemberDeclaration)) 326else if (parentNode.IsKind(SyntaxKind.VariableDeclarator)) 333if (parentNode.GetModifiers().Any(SyntaxKind.ConstKeyword)) 339return parentNode.GetModifiers().Any(SyntaxKind.StaticKeyword); 345SyntaxKind.ClassDeclaration => ClassificationTypeNames.ClassName, 346SyntaxKind.EnumDeclaration => ClassificationTypeNames.EnumName, 347SyntaxKind.StructDeclaration => ClassificationTypeNames.StructName, 348SyntaxKind.UnionDeclaration => ClassificationTypeNames.StructName, 349SyntaxKind.InterfaceDeclaration => ClassificationTypeNames.InterfaceName, 350SyntaxKind.RecordDeclaration => ClassificationTypeNames.RecordClassName, 351SyntaxKind.RecordStructDeclaration => ClassificationTypeNames.RecordStructName, 362case SyntaxKind.LessThanToken: 363case SyntaxKind.GreaterThanToken: 368if (token.Parent.Kind() is SyntaxKind.TypeParameterList or 369SyntaxKind.TypeArgumentList or 370SyntaxKind.FunctionPointerParameterList) 377case SyntaxKind.ColonToken: 382if (token.Parent.Kind() != SyntaxKind.ConditionalExpression) 399private static bool IsOperator(this SyntaxKind kind) 403case SyntaxKind.TildeToken: 404case SyntaxKind.ExclamationToken: 405case SyntaxKind.PercentToken: 406case SyntaxKind.CaretToken: 407case SyntaxKind.AmpersandToken: 408case SyntaxKind.AsteriskToken: 409case SyntaxKind.MinusToken: 410case SyntaxKind.PlusToken: 411case SyntaxKind.EqualsToken: 412case SyntaxKind.BarToken: 413case SyntaxKind.ColonToken: 414case SyntaxKind.LessThanToken: 415case SyntaxKind.GreaterThanToken: 416case SyntaxKind.DotToken: 417case SyntaxKind.QuestionToken: 418case SyntaxKind.SlashToken: 419case SyntaxKind.BarBarToken: 420case SyntaxKind.AmpersandAmpersandToken: 421case SyntaxKind.MinusMinusToken: 422case SyntaxKind.PlusPlusToken: 423case SyntaxKind.ColonColonToken: 424case SyntaxKind.QuestionQuestionToken: 425case SyntaxKind.MinusGreaterThanToken: 426case SyntaxKind.ExclamationEqualsToken: 427case SyntaxKind.EqualsEqualsToken: 428case SyntaxKind.EqualsGreaterThanToken: 429case SyntaxKind.LessThanEqualsToken: 430case SyntaxKind.LessThanLessThanToken: 431case SyntaxKind.LessThanLessThanEqualsToken: 432case SyntaxKind.GreaterThanEqualsToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 435case SyntaxKind.GreaterThanGreaterThanEqualsToken: 436case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 437case SyntaxKind.SlashEqualsToken: 438case SyntaxKind.AsteriskEqualsToken: 439case SyntaxKind.BarEqualsToken: 440case SyntaxKind.AmpersandEqualsToken: 441case SyntaxKind.PlusEqualsToken: 442case SyntaxKind.MinusEqualsToken: 443case SyntaxKind.CaretEqualsToken: 444case SyntaxKind.PercentEqualsToken: 445case SyntaxKind.QuestionQuestionEqualsToken: 549|| (wasKeyword && SyntaxFacts.GetContextualKeywordKind(text) != SyntaxKind.None) 552var isIdentifier = token.Kind() == SyntaxKind.IdentifierToken;
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (2)
28if (syntax.Kind() is SyntaxKind.DiscardDesignation or SyntaxKind.DiscardPattern)
Classification\SyntaxClassification\DocCommentCodeBlockClassifier.cs (4)
89else if (current.Kind() is SyntaxKind.XmlEntityLiteralToken or SyntaxKind.XmlTextLiteralToken or SyntaxKind.XmlTextLiteralNewLineToken) 179if (token.Kind() == SyntaxKind.XmlEntityLiteralToken)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (4)
42=> node.IsParentKind(SyntaxKind.Attribute); 137name.Identifier.IsKind(SyntaxKind.GlobalKeyword); 173if ((name.IsUnmanaged || name.IsNotNull) && name.Parent.IsKind(SyntaxKind.TypeConstraint)) 291name.Identifier.HasMatchingText(SyntaxKind.FromKeyword) &&
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (1)
35if (syntax.IsKind(SyntaxKind.SimpleAssignmentExpression))
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (3)
22public override ImmutableArray<int> SyntaxTokenKinds { get; } = [(int)SyntaxKind.LessThanToken]; 68if (identifierName.IsParentKind(SyntaxKind.MemberBindingExpression)) 78if (identifier.Parent.IsParentKind(SyntaxKind.ConditionalAccessExpression))
Classification\Worker.cs (34)
128SyntaxKind.Utf8StringLiteralToken or 129SyntaxKind.Utf8SingleLineRawStringLiteralToken or 130SyntaxKind.Utf8MultiLineRawStringLiteralToken && 142if (token.Kind() == SyntaxKind.IdentifierToken && 207case SyntaxKind.SingleLineCommentTrivia: 208case SyntaxKind.MultiLineCommentTrivia: 209case SyntaxKind.ShebangDirectiveTrivia: 213case SyntaxKind.DisabledTextTrivia: 217case SyntaxKind.SkippedTokensTrivia: 221case SyntaxKind.SingleLineDocumentationCommentTrivia: 222case SyntaxKind.MultiLineDocumentationCommentTrivia: 226case SyntaxKind.DocumentationCommentExteriorTrivia: 230case SyntaxKind.ConflictMarkerTrivia: 234case SyntaxKind.IfDirectiveTrivia: 235case SyntaxKind.ElifDirectiveTrivia: 236case SyntaxKind.ElseDirectiveTrivia: 237case SyntaxKind.EndIfDirectiveTrivia: 238case SyntaxKind.RegionDirectiveTrivia: 239case SyntaxKind.EndRegionDirectiveTrivia: 240case SyntaxKind.DefineDirectiveTrivia: 241case SyntaxKind.UndefDirectiveTrivia: 242case SyntaxKind.ErrorDirectiveTrivia: 243case SyntaxKind.WarningDirectiveTrivia: 244case SyntaxKind.LineDirectiveTrivia: 245case SyntaxKind.LineSpanDirectiveTrivia: 246case SyntaxKind.PragmaWarningDirectiveTrivia: 247case SyntaxKind.PragmaChecksumDirectiveTrivia: 248case SyntaxKind.ReferenceDirectiveTrivia: 249case SyntaxKind.LoadDirectiveTrivia: 250case SyntaxKind.IgnoredDirectiveTrivia: 251case SyntaxKind.NullableDirectiveTrivia: 252case SyntaxKind.BadDirectiveTrivia: 279triviaList[index - 1].Kind() == SyntaxKind.EndOfLineTrivia && 280triviaList[index - 2].Kind() == SyntaxKind.ConflictMarkerTrivia)
Classification\Worker_DocumentationComments.cs (21)
45case SyntaxKind.XmlElement: 48case SyntaxKind.XmlEmptyElement: 51case SyntaxKind.XmlText: 54case SyntaxKind.XmlComment: 57case SyntaxKind.XmlCDataSection: 60case SyntaxKind.XmlProcessingInstruction: 72case SyntaxKind.DocumentationCommentExteriorTrivia: 76case SyntaxKind.SkippedTokensTrivia: 159if (token.Kind() == SyntaxKind.XmlEntityLiteralToken) 163else if (token.Kind() != SyntaxKind.XmlTextLiteralNewLineToken) 168case SyntaxKind.XmlText: 171case SyntaxKind.XmlTextAttribute: 174case SyntaxKind.XmlComment: 177case SyntaxKind.XmlCDataSection: 180case SyntaxKind.XmlProcessingInstruction: 262case SyntaxKind.XmlTextAttribute: 271case SyntaxKind.XmlCrefAttribute: 274case SyntaxKind.XmlNameAttribute: 309var kind = SyntaxFacts.GetKeywordKind(token.Text); 310if (kind is SyntaxKind.None) 313if (kind is SyntaxKind.None)
Classification\Worker_Preprocesser.cs (25)
23case SyntaxKind.IfDirectiveTrivia: 26case SyntaxKind.ElifDirectiveTrivia: 29case SyntaxKind.ElseDirectiveTrivia: 32case SyntaxKind.EndIfDirectiveTrivia: 35case SyntaxKind.RegionDirectiveTrivia: 38case SyntaxKind.EndRegionDirectiveTrivia: 41case SyntaxKind.ErrorDirectiveTrivia: 44case SyntaxKind.WarningDirectiveTrivia: 47case SyntaxKind.BadDirectiveTrivia: 50case SyntaxKind.DefineDirectiveTrivia: 53case SyntaxKind.UndefDirectiveTrivia: 56case SyntaxKind.LineDirectiveTrivia: 59case SyntaxKind.LineSpanDirectiveTrivia: 62case SyntaxKind.PragmaChecksumDirectiveTrivia: 65case SyntaxKind.PragmaWarningDirectiveTrivia: 68case SyntaxKind.ReferenceDirectiveTrivia: 71case SyntaxKind.LoadDirectiveTrivia: 74case SyntaxKind.IgnoredDirectiveTrivia: 77case SyntaxKind.NullableDirectiveTrivia: 90if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 106if (allowComments && trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 243case SyntaxKind.HiddenKeyword: 244case SyntaxKind.DefaultKeyword: 247case SyntaxKind.NumericLiteralToken: 270if (token.Kind() != SyntaxKind.None)
CodeGeneration\CSharpSyntaxGenerator.cs (326)
55? SyntaxFactory.Token(default, SyntaxKind.InterpolatedVerbatimStringStartToken, InterpolatedVerbatimText, InterpolatedVerbatimText, default) 78SyntaxKind.MultiLineDocumentationCommentTrivia, 136case SyntaxKind.NamespaceDeclaration: 137case SyntaxKind.FileScopedNamespaceDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.StructDeclaration: 140case SyntaxKind.InterfaceDeclaration: 141case SyntaxKind.EnumDeclaration: 142case SyntaxKind.DelegateDeclaration: 143case SyntaxKind.RecordDeclaration: 144case SyntaxKind.RecordStructDeclaration: 178AsModifierList(accessibility, modifiers, SyntaxKind.FieldDeclaration), 239modifiers: AsModifierList(accessibility, modifiers, SyntaxKind.MethodDeclaration), 270var modifierList = AsModifierList(accessibility, modifiers, SyntaxKind.OperatorDeclaration); 296private static SyntaxKind GetOperatorSyntaxKind(string operatorName) 298var operatorKind = CSharp.SyntaxFacts.GetOperatorKind(operatorName); 299if (operatorKind == SyntaxKind.None) 368AsModifierList(accessibility, modifiers, SyntaxKind.ConstructorDeclaration), 371baseConstructorArguments != null ? SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, SyntaxFactory.ArgumentList([.. baseConstructorArguments.Select(AsArgument)])) : null, 390getAccessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, modifiers.IsAbstract ? null : getAccessorStatements); 393setAccessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, modifiers.IsAbstract ? null : setAccessorStatements); 417AsModifierList(accessibility, actualModifiers, SyntaxKind.PropertyDeclaration), 425=> AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, accessibility, statements); 428=> AccessorDeclaration(isInitOnly ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration, accessibility, statements); 431SyntaxKind kind, Accessibility accessibility, IEnumerable<SyntaxNode>? statements) 436AsModifierList(accessibility, DeclarationModifiers.None, SyntaxKind.PropertyDeclaration)); 497accessors.Add(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, getAccessorStatements)); 502accessors.Add(AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, setAccessorStatements)); 509AsModifierList(accessibility, actualModifiers, SyntaxKind.IndexerDeclaration), 523private static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, IEnumerable<SyntaxNode>? statements) 545AsModifierList(accessibility, modifiers, SyntaxKind.EventFieldDeclaration), 572accessors.Add(AccessorDeclaration(SyntaxKind.AddAccessorDeclaration, addAccessorStatements)); 573accessors.Add(AccessorDeclaration(SyntaxKind.RemoveAccessorDeclaration, removeAccessorStatements)); 577AsModifierList(accessibility, modifiers, SyntaxKind.EventDeclaration), 633SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 634SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 635SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 636SyntaxKind.ConversionOperatorDeclaration => ((ConversionOperatorDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 637SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 638SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 654case SyntaxKind.MethodDeclaration: 655case SyntaxKind.ConversionOperatorDeclaration: 656case SyntaxKind.OperatorDeclaration: 660case SyntaxKind.PropertyDeclaration: 664case SyntaxKind.IndexerDeclaration: 668case SyntaxKind.EventDeclaration: 712var kind = isRecord ? SyntaxKind.RecordDeclaration : SyntaxKind.ClassDeclaration; 735case SyntaxKind.ConstructorDeclaration: 739case SyntaxKind.VariableDeclaration: 740case SyntaxKind.VariableDeclarator: 759var kind = isRecord ? SyntaxKind.RecordStructDeclaration : SyntaxKind.StructDeclaration; 811case SyntaxKind.MethodDeclaration: 818case SyntaxKind.OperatorDeclaration: 821x.Kind() == SyntaxKind.AbstractKeyword 822|| x.Kind() == SyntaxKind.VirtualKeyword 823|| x.Kind() == SyntaxKind.PublicKeyword); 831case SyntaxKind.PropertyDeclaration: 837case SyntaxKind.IndexerDeclaration: 844case SyntaxKind.EventDeclaration: 852case SyntaxKind.EventFieldDeclaration: 857case SyntaxKind.FieldDeclaration: 883AsModifierList(accessibility, modifiers, SyntaxKind.EnumDeclaration), 901case SyntaxKind.IdentifierName: 905case SyntaxKind.FieldDeclaration: 932AsModifierList(accessibility, modifiers, SyntaxKind.DelegateDeclaration), 1019=> list.Target?.Identifier.IsKind(SyntaxKind.ReturnKeyword) ?? false; 1049case SyntaxKind.MethodDeclaration: 1050case SyntaxKind.OperatorDeclaration: 1051case SyntaxKind.ConversionOperatorDeclaration: 1052case SyntaxKind.DelegateDeclaration: 1093if (!declaration.IsKind(SyntaxKind.CompilationUnit)) 1105case SyntaxKind.AttributeList: 1113case SyntaxKind.Attribute: 1153case SyntaxKind.AttributeList: 1161case SyntaxKind.Attribute: 1173case SyntaxKind.AttributeList: 1181case SyntaxKind.Attribute: 1266case SyntaxKind.FieldDeclaration: 1270case SyntaxKind.EventFieldDeclaration: 1274case SyntaxKind.LocalDeclarationStatement: 1278case SyntaxKind.VariableDeclaration: 1282case SyntaxKind.AttributeList: 1319SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration.Variables.Count, 1320SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration.Variables.Count, 1321SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables.Count, 1322SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).Variables.Count, 1323SyntaxKind.AttributeList => ((AttributeListSyntax)declaration).Attributes.Count, 1419if (modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration) && accessibility != Accessibility.NotApplicable) 1538private static DeclarationModifiers GetAllowedModifiers(SyntaxKind kind) 1542case SyntaxKind.RecordDeclaration: 1544case SyntaxKind.ClassDeclaration: 1547case SyntaxKind.EnumDeclaration: 1550case SyntaxKind.DelegateDeclaration: 1553case SyntaxKind.InterfaceDeclaration: 1556case SyntaxKind.StructDeclaration: 1557case SyntaxKind.RecordStructDeclaration: 1560case SyntaxKind.MethodDeclaration: 1561case SyntaxKind.OperatorDeclaration: 1562case SyntaxKind.ConversionOperatorDeclaration: 1565case SyntaxKind.ConstructorDeclaration: 1568case SyntaxKind.DestructorDeclaration: 1571case SyntaxKind.FieldDeclaration: 1574case SyntaxKind.PropertyDeclaration: 1577case SyntaxKind.IndexerDeclaration: 1580case SyntaxKind.EventFieldDeclaration: 1581case SyntaxKind.EventDeclaration: 1584case SyntaxKind.GetAccessorDeclaration: 1585case SyntaxKind.SetAccessorDeclaration: 1588case SyntaxKind.AddAccessorDeclaration: 1589case SyntaxKind.RemoveAccessorDeclaration: 1592case SyntaxKind.LocalFunctionStatement: 1594case SyntaxKind.ParenthesizedLambdaExpression: 1595case SyntaxKind.SimpleLambdaExpression: 1596case SyntaxKind.AnonymousMethodExpression: 1599case SyntaxKind.EnumMemberDeclaration: 1600case SyntaxKind.Parameter: 1601case SyntaxKind.LocalDeclarationStatement: 1634(modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration))) 1670SyntaxKind kind, 1851constraints = constraints.Insert(0, SyntaxFactory.ClassOrStructConstraint(isReferenceType ? SyntaxKind.ClassConstraint : SyntaxKind.StructConstraint)); 1885case SyntaxKind.ClassDeclaration: 1886case SyntaxKind.RecordDeclaration: 1888case SyntaxKind.StructDeclaration: 1889case SyntaxKind.RecordStructDeclaration: 1891case SyntaxKind.InterfaceDeclaration: 1893case SyntaxKind.EnumDeclaration: 1895case SyntaxKind.DelegateDeclaration: 1898case SyntaxKind.MethodDeclaration: 1900case SyntaxKind.OperatorDeclaration: 1902case SyntaxKind.ConversionOperatorDeclaration: 1904case SyntaxKind.ConstructorDeclaration: 1906case SyntaxKind.DestructorDeclaration: 1909case SyntaxKind.PropertyDeclaration: 1911case SyntaxKind.IndexerDeclaration: 1913case SyntaxKind.EventDeclaration: 1915case SyntaxKind.EnumMemberDeclaration: 1917case SyntaxKind.CompilationUnit: 1919case SyntaxKind.NamespaceDeclaration: 1920case SyntaxKind.FileScopedNamespaceDeclaration: 1922case SyntaxKind.UsingDirective: 1924case SyntaxKind.Parameter: 1927case SyntaxKind.ParenthesizedLambdaExpression: 1928case SyntaxKind.SimpleLambdaExpression: 1931case SyntaxKind.FieldDeclaration: 1943case SyntaxKind.EventFieldDeclaration: 1955case SyntaxKind.LocalDeclarationStatement: 1967case SyntaxKind.VariableDeclaration: 1981case SyntaxKind.VariableDeclarator: 2005case SyntaxKind.AttributeList: 2014case SyntaxKind.Attribute: 2022case SyntaxKind.GetAccessorDeclaration: 2024case SyntaxKind.SetAccessorDeclaration: 2025case SyntaxKind.InitAccessorDeclaration: 2027case SyntaxKind.AddAccessorDeclaration: 2029case SyntaxKind.RemoveAccessorDeclaration: 2037=> node?.Parent.IsKind(SyntaxKind.FieldDeclaration) ?? false; 2040=> node?.Parent.IsKind(SyntaxKind.EventFieldDeclaration) ?? false; 2043=> node?.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) ?? false; 2111case SyntaxKind.DelegateDeclaration: 2113case SyntaxKind.MethodDeclaration: 2115case SyntaxKind.FieldDeclaration: 2117case SyntaxKind.PropertyDeclaration: 2119case SyntaxKind.IndexerDeclaration: 2121case SyntaxKind.EventFieldDeclaration: 2123case SyntaxKind.EventDeclaration: 2125case SyntaxKind.Parameter: 2127case SyntaxKind.LocalDeclarationStatement: 2129case SyntaxKind.VariableDeclaration: 2131case SyntaxKind.VariableDeclarator: 2144=> type is PredefinedTypeSyntax pd && pd.Keyword.IsKind(SyntaxKind.VoidKeyword) ? null : type; 2152SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2153SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2154SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(((FieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2155SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2156SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2157SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(((EventFieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2158SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2159SyntaxKind.Parameter => ((ParameterSyntax)declaration).WithType((TypeSyntax)type), 2160SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(((LocalDeclarationStatementSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2161SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2172case SyntaxKind.VariableDeclaration: 2181case SyntaxKind.VariableDeclarator: 2190case SyntaxKind.Attribute: 2218SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration, 2219SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration, 2220SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration, 2227SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(variables), 2228SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(variables), 2229SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(variables), 2237case SyntaxKind.VariableDeclaration: 2251case SyntaxKind.VariableDeclarator: 2252case SyntaxKind.Attribute: 2304currentList ??= declaration.IsKind(SyntaxKind.IndexerDeclaration) 2372case SyntaxKind.DelegateDeclaration: 2374case SyntaxKind.MethodDeclaration: 2376case SyntaxKind.OperatorDeclaration: 2378case SyntaxKind.ConversionOperatorDeclaration: 2380case SyntaxKind.ConstructorDeclaration: 2382case SyntaxKind.DestructorDeclaration: 2384case SyntaxKind.IndexerDeclaration: 2386case SyntaxKind.LocalFunctionStatement: 2388case SyntaxKind.ParenthesizedLambdaExpression: 2390case SyntaxKind.SimpleLambdaExpression: 2403case SyntaxKind.RecordDeclaration: 2404case SyntaxKind.RecordStructDeclaration: 2405case SyntaxKind.ClassDeclaration: 2406case SyntaxKind.StructDeclaration: 2407case SyntaxKind.InterfaceDeclaration: 2418case SyntaxKind.ParenthesizedLambdaExpression: 2420case SyntaxKind.SimpleLambdaExpression: 2423case SyntaxKind.PropertyDeclaration: 2432case SyntaxKind.IndexerDeclaration: 2441case SyntaxKind.MethodDeclaration: 2450case SyntaxKind.LocalFunctionStatement: 2473case SyntaxKind.ParenthesizedLambdaExpression: 2476case SyntaxKind.SimpleLambdaExpression: 2479case SyntaxKind.PropertyDeclaration: 2488case SyntaxKind.IndexerDeclaration: 2497case SyntaxKind.MethodDeclaration: 2506case SyntaxKind.LocalFunctionStatement: 2544case SyntaxKind.FieldDeclaration: 2552case SyntaxKind.PropertyDeclaration: 2555case SyntaxKind.LocalDeclarationStatement: 2563case SyntaxKind.VariableDeclaration: 2571case SyntaxKind.VariableDeclarator: 2573case SyntaxKind.Parameter: 2584case SyntaxKind.FieldDeclaration: 2592case SyntaxKind.PropertyDeclaration: 2595case SyntaxKind.LocalDeclarationStatement: 2603case SyntaxKind.VariableDeclaration: 2611case SyntaxKind.VariableDeclarator: 2613case SyntaxKind.Parameter: 2624SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).Body?.Statements, 2625SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).Body?.Statements, 2626SyntaxKind.ConversionOperatorDeclaration => ((ConversionOperatorDeclarationSyntax)declaration).Body?.Statements, 2627SyntaxKind.ConstructorDeclaration => ((ConstructorDeclarationSyntax)declaration).Body?.Statements, 2628SyntaxKind.DestructorDeclaration => ((DestructorDeclarationSyntax)declaration).Body?.Statements, 2629SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).Body?.Statements, 2630SyntaxKind.AnonymousMethodExpression => (((AnonymousMethodExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2631SyntaxKind.ParenthesizedLambdaExpression => (((ParenthesizedLambdaExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2632SyntaxKind.SimpleLambdaExpression => (((SimpleLambdaExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2633SyntaxKind.GetAccessorDeclaration or 2634SyntaxKind.SetAccessorDeclaration or 2635SyntaxKind.AddAccessorDeclaration or 2636SyntaxKind.RemoveAccessorDeclaration => ((AccessorDeclarationSyntax)declaration).Body?.Statements, 2700SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).ExpressionBody == null, 2701SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).ExpressionBody == null, 2702SyntaxKind.EventDeclaration => true, 2713private static AccessorListSyntax AsAccessorList(IEnumerable<SyntaxNode> nodes, SyntaxKind parentKind) 2716private static AccessorDeclarationSyntax? AsAccessor(SyntaxNode node, SyntaxKind parentKind) 2720case SyntaxKind.PropertyDeclaration: 2721case SyntaxKind.IndexerDeclaration: 2724case SyntaxKind.GetAccessorDeclaration: 2725case SyntaxKind.SetAccessorDeclaration: 2730case SyntaxKind.EventDeclaration: 2733case SyntaxKind.AddAccessorDeclaration: 2734case SyntaxKind.RemoveAccessorDeclaration: 2744private static AccessorDeclarationSyntax? GetAccessor(SyntaxNode declaration, SyntaxKind kind) 2750private SyntaxNode WithAccessor(SyntaxNode declaration, SyntaxKind kind, AccessorDeclarationSyntax accessor) 2753private SyntaxNode WithAccessor(SyntaxNode declaration, AccessorListSyntax? accessorList, SyntaxKind kind, AccessorDeclarationSyntax? accessor) 2773var accessor = GetAccessor(declaration, SyntaxKind.GetAccessorDeclaration); 2779var accessor = GetAccessor(declaration, SyntaxKind.SetAccessorDeclaration); 2784=> this.WithAccessorStatements(declaration, SyntaxKind.GetAccessorDeclaration, statements); 2787=> this.WithAccessorStatements(declaration, SyntaxKind.SetAccessorDeclaration, statements); 2789private SyntaxNode WithAccessorStatements(SyntaxNode declaration, SyntaxKind kind, IEnumerable<SyntaxNode> statements) 2916var kind = decl1.Kind(); 2921case SyntaxKind.Attribute: 2922case SyntaxKind.VariableDeclarator: 2942var kind = decl1.Kind(); 2947case SyntaxKind.FieldDeclaration: 2953case SyntaxKind.EventFieldDeclaration: 2959case SyntaxKind.LocalDeclarationStatement: 2964case SyntaxKind.AttributeList: 2968case SyntaxKind.VariableDeclaration: 3011if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 3050if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 3106SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration.Variables, 3107SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration.Variables, 3108SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables, 3109SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).Variables, 3110SyntaxKind.AttributeList => ((AttributeListSyntax)declaration).Attributes, 3121if (node.Parent.IsKind(SyntaxKind.GlobalStatement)) 3144case SyntaxKind.Attribute: 3154case SyntaxKind.AttributeArgument: 3163case SyntaxKind.VariableDeclarator: 3173case SyntaxKind.SimpleBaseType: 3188case SyntaxKind.SimpleBaseType: 3227=> SyntaxFactory.AssignmentExpression(SyntaxKind.AddAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)ParenthesizeNonSimple(handler)); 3230=> SyntaxFactory.AssignmentExpression(SyntaxKind.SubtractAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)ParenthesizeNonSimple(handler)); 3325var initializer = SyntaxFactory.InitializerExpression(SyntaxKind.ArrayInitializerExpression, AsExpressionList(elements)); 3360=> SyntaxFactory.BinaryExpression(SyntaxKind.IsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3366=> SyntaxFactory.BinaryExpression(SyntaxKind.AsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3369=> SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, (ExpressionSyntax)left, (ExpressionSyntax)ParenthesizeNonSimple(right)); 3371private static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right) 3375=> CreateBinaryExpression(SyntaxKind.EqualsExpression, left, right); 3378=> CreateBinaryExpression(SyntaxKind.EqualsExpression, left, right); 3381=> CreateBinaryExpression(SyntaxKind.NotEqualsExpression, left, right); 3384=> CreateBinaryExpression(SyntaxKind.NotEqualsExpression, left, right); 3387=> CreateBinaryExpression(SyntaxKind.LessThanExpression, left, right); 3390=> CreateBinaryExpression(SyntaxKind.LessThanOrEqualExpression, left, right); 3393=> CreateBinaryExpression(SyntaxKind.GreaterThanExpression, left, right); 3396=> CreateBinaryExpression(SyntaxKind.GreaterThanOrEqualExpression, left, right); 3399=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression)); 3402=> CreateBinaryExpression(SyntaxKind.AddExpression, left, right); 3405=> CreateBinaryExpression(SyntaxKind.SubtractExpression, left, right); 3408=> CreateBinaryExpression(SyntaxKind.MultiplyExpression, left, right); 3411=> CreateBinaryExpression(SyntaxKind.DivideExpression, left, right); 3414=> CreateBinaryExpression(SyntaxKind.ModuloExpression, left, right); 3417=> CreateBinaryExpression(SyntaxKind.BitwiseAndExpression, left, right); 3420=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.BitwiseNotExpression, (ExpressionSyntax)ParenthesizeNonSimple(operand)); 3423=> CreateBinaryExpression(SyntaxKind.LogicalAndExpression, left, right); 3426=> CreateBinaryExpression(SyntaxKind.LogicalOrExpression, left, right); 3430SyntaxKind.LogicalNotExpression, 3437=> CreateBinaryExpression(SyntaxKind.CoalesceExpression, left, right); 3462case SyntaxKind.IdentifierName: 3466case SyntaxKind.GenericName: 3470case SyntaxKind.QualifiedName: 3474case SyntaxKind.AliasQualifiedName: 3478case SyntaxKind.SimpleMemberAccessExpression: 3479case SyntaxKind.PointerMemberAccessExpression:
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (40)
210if (typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) && 220if (typeDeclaration.Kind() == SyntaxKind.ExtensionBlockDeclaration) 229typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword), 251enumDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword), 271case SyntaxKind.ConstructorDeclaration: 279ctorDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 287case SyntaxKind.DelegateDeclaration: 295delegateDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 302case SyntaxKind.EnumMemberDeclaration: 309enumMember.Modifiers.Any(SyntaxKind.PartialKeyword), 316case SyntaxKind.EventDeclaration: 323eventDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 330case SyntaxKind.IndexerDeclaration: 337indexerDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 344case SyntaxKind.MethodDeclaration: 352method.Modifiers.Any(SyntaxKind.PartialKeyword), 361case SyntaxKind.PropertyDeclaration: 368property.Modifiers.Any(SyntaxKind.PartialKeyword), 375case SyntaxKind.FieldDeclaration: 376case SyntaxKind.EventFieldDeclaration: 382: fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) 391fieldDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword), 486=> constructor.Modifiers.Any(SyntaxKind.StaticKeyword) 611=> method.ParameterList.Parameters is [var parameter, ..] && parameter.Modifiers.Any(SyntaxKind.ThisKeyword); 709var kind = predefinedTypeNode.Keyword.Kind(); 712SyntaxKind.BoolKeyword => "Boolean", 713SyntaxKind.ByteKeyword => "Byte", 714SyntaxKind.SByteKeyword => "SByte", 715SyntaxKind.ShortKeyword => "Int16", 716SyntaxKind.UShortKeyword => "UInt16", 717SyntaxKind.IntKeyword => "Int32", 718SyntaxKind.UIntKeyword => "UInt32", 719SyntaxKind.LongKeyword => "Int64", 720SyntaxKind.ULongKeyword => "UInt64", 721SyntaxKind.DoubleKeyword => "Double", 722SyntaxKind.FloatKeyword => "Single", 723SyntaxKind.DecimalKeyword => "Decimal", 724SyntaxKind.StringKeyword => "String", 725SyntaxKind.CharKeyword => "Char", 726SyntaxKind.ObjectKeyword => "Object",
FindSymbols\FindSymbolsUtilities.cs (17)
19case SyntaxKind.PublicKeyword: return Accessibility.Public; 20case SyntaxKind.PrivateKeyword: return Accessibility.Private; 21case SyntaxKind.ProtectedKeyword: return Accessibility.Protected; 22case SyntaxKind.InternalKeyword: 34case SyntaxKind.ClassDeclaration: 35case SyntaxKind.ExtensionBlockDeclaration: 36case SyntaxKind.RecordDeclaration: 37case SyntaxKind.StructDeclaration: 38case SyntaxKind.RecordStructDeclaration: 41case SyntaxKind.InterfaceDeclaration: 44case SyntaxKind.CompilationUnit: 61SyntaxKind.ClassDeclaration => DeclaredSymbolInfoKind.Class, 62SyntaxKind.InterfaceDeclaration => DeclaredSymbolInfoKind.Interface, 63SyntaxKind.StructDeclaration => DeclaredSymbolInfoKind.Struct, 64SyntaxKind.RecordDeclaration => DeclaredSymbolInfoKind.Record, 65SyntaxKind.RecordStructDeclaration => DeclaredSymbolInfoKind.RecordStruct, 66SyntaxKind.UnionDeclaration => DeclaredSymbolInfoKind.Union,
ReassignedVariable\CSharpReassignedVariableService.cs (1)
44if (current is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword })
Recommendations\CSharpRecommendationServiceRunner.cs (19)
142MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess 152MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess 154MemberAccessExpressionSyntax(SyntaxKind.PointerMemberAccessExpression) memberAccess 167if (node is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression)) 171if (current.Kind() == SyntaxKind.ConstantPattern) 174if (current.Kind() == SyntaxKind.ParenthesizedExpression) 177if (current.Kind() == SyntaxKind.SimpleMemberAccessExpression) 188if (current is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 194if (current.Kind() == SyntaxKind.QualifiedName) 197if (current.Kind() == SyntaxKind.AliasQualifiedName) 305.Kind() is SyntaxKind.LabeledStatement or SyntaxKind.DefaultSwitchLabel); 524AnonymousFunctionExpressionSyntax anonymousFunction => anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword), 525LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.StaticKeyword), 582return new RecommendedSymbols(usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword) 776var originalExpressionKind = originalExpression.Kind(); 780if (originalExpressionKind is SyntaxKind.ParenthesizedExpression && 788originalExpressionKind is SyntaxKind.IdentifierName or SyntaxKind.GenericName)
Rename\CSharpRenameRewriterLanguageService.cs (35)
222if (newToken.Parent.IsKind(SyntaxKind.XmlName)) 258=> token.IsKind(SyntaxKind.GetKeyword) 262=> token.IsKind(SyntaxKind.SetKeyword) 266=> token.IsKind(SyntaxKind.InitKeyword) 277token.IsKind(SyntaxKind.IdentifierToken) && 278token.Parent.IsKind(SyntaxKind.DestructorDeclaration); 379if (!isRenameLocation && symbol is INamespaceSymbol && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword)) 398if (isRenameLocation && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword)) 441case SyntaxKind.IdentifierName: 442case SyntaxKind.GenericName: 446case SyntaxKind.SimpleMemberAccessExpression: 450case SyntaxKind.QualifiedName: 454case SyntaxKind.AliasQualifiedName: 458case SyntaxKind.ParenthesizedExpression: 537!token.IsKind(SyntaxKind.GlobalKeyword) && 538token.Parent.Parent is (kind: SyntaxKind.AliasQualifiedName or SyntaxKind.QualifiedCref or SyntaxKind.QualifiedName)) 595var kind = SyntaxFacts.GetKeywordKind(currentNewIdentifier); 596if (kind != SyntaxKind.None) 615: newToken.CopyAnnotationsTo(SyntaxFactory.Identifier(newToken.LeadingTrivia, SyntaxKind.IdentifierToken, currentNewIdentifier, valueText, newToken.TrailingTrivia)); 689if (newToken.IsKind(SyntaxKind.StringLiteralToken)) 693else if (newToken.IsKind(SyntaxKind.InterpolatedStringTextToken)) 696SyntaxFactory.Token(newToken.LeadingTrivia, SyntaxKind.InterpolatedStringTextToken, text, value, newToken.TrailingTrivia)); 702if (newToken.IsKind(SyntaxKind.XmlTextLiteralToken)) 706else if (newToken.IsKind(SyntaxKind.IdentifierToken) && newToken.Parent.IsKind(SyntaxKind.XmlName) && newToken.ValueText == _originalText) 744if (token.Parent is ExpressionSyntax(SyntaxKind.IdentifierName) expression && 745token.Parent.IsParentKind(SyntaxKind.InvocationExpression) && 746token.GetPreviousToken().Kind() != SyntaxKind.DotToken && 747token.GetNextToken().Kind() != SyntaxKind.DotToken) 975case SyntaxKind.ForEachKeyword: 977case SyntaxKind.AwaitKeyword: 1087var kind = SyntaxFacts.GetKeywordKind(replacementText); 1088if (kind != SyntaxKind.None)
Rename\LocalConflictVisitor.cs (4)
166case SyntaxKind.FromClause: 171case SyntaxKind.LetClause: 187foreach (var child in body.ChildNodes().Where(c => c.Kind() != SyntaxKind.QueryContinuation)) 207var statements = node.ChildNodes().Where(x => x.IsKind(SyntaxKind.SwitchSection)).SelectMany(x => x.ChildNodes());
Simplification\CSharpSimplificationService.cs (9)
103if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 108if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 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 (40)
33private static readonly SyntaxTrivia s_oneWhitespaceSeparator = SyntaxTrivia(SyntaxKind.WhitespaceTrivia, " "); 79argument.IsParentKind(SyntaxKind.ArgumentList) && 274node.Expression.Kind() != SyntaxKind.DeclarationExpression && 275node.RefOrOutKeyword.Kind() == SyntaxKind.None) 362if ((node.Kind() == SyntaxKind.GreaterThanExpression || node.Kind() == SyntaxKind.RightShiftExpression) && !node.IsParentKind(SyntaxKind.ParenthesizedExpression)) 374if (result.Expression != null && !result.Expression.IsKind(SyntaxKind.ParenthesizedExpression)) 408else if (rewrittenname.Kind() == SyntaxKind.AliasQualifiedName) 493case SyntaxKind.AliasQualifiedName: 509case SyntaxKind.QualifiedName: 517case SyntaxKind.IdentifierName: 611case SyntaxKind.IdentifierName: 612case SyntaxKind.GenericName: 626(parent is MemberAccessExpressionSyntax && parent.Kind() != SyntaxKind.SimpleMemberAccessExpression) || 627((parent.Kind() == SyntaxKind.SimpleMemberAccessExpression || parent.Kind() == SyntaxKind.NameMemberCref) && originalSimpleName.IsRightSideOfDot()) || 628(parent.Kind() == SyntaxKind.QualifiedName && originalSimpleName.IsRightSideOfQualifiedName()) || 629(parent.Kind() == SyntaxKind.AliasQualifiedName) || 630(parent.Kind() == SyntaxKind.NameColon)) 640if (symbol.IsConstructor() && (parent.Kind() == SyntaxKind.ObjectCreationExpression || parent.Kind() == SyntaxKind.NameMemberCref)) 666originalSimpleName.IsParentKind(SyntaxKind.NameMemberCref) || 699SyntaxKind.SimpleMemberAccessExpression, 722if (candidateToken.Kind() is SyntaxKind.LessThanToken or SyntaxKind.GreaterThanToken) 737if (newNode.Kind() == SyntaxKind.IdentifierName && 865if (parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 867return currentNode.Kind() == SyntaxKind.SimpleAssignmentExpression && 894Debug.Assert(!replaceNode || rewrittenNode.Kind() == SyntaxKind.IdentifierName); 948case SyntaxKind.QualifiedName: 956case SyntaxKind.SimpleMemberAccessExpression: 959SyntaxKind.SimpleMemberAccessExpression, 982SyntaxKind.SimpleMemberAccessExpression, 999if (oldToken.Kind() == SyntaxKind.LessThanToken) 1001return Token(oldToken.LeadingTrivia, SyntaxKind.LessThanToken, "{", "{", oldToken.TrailingTrivia); 1004if (oldToken.Kind() == SyntaxKind.GreaterThanToken) 1006return Token(oldToken.LeadingTrivia, SyntaxKind.GreaterThanToken, "}", "}", oldToken.TrailingTrivia); 1043if (originalNode.Expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess)
Simplification\CSharpSimplificationService.NodesAndTokensToReduceComputer.cs (1)
106if (_simplifyAllDescendants && !_insideSpeculatedNode && !token.IsKind(SyntaxKind.None))
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\CSharpDefaultExpressionReducer.Rewriter.cs (1)
37return SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression)
Simplification\Reducers\CSharpEscapingReducer.cs (19)
43if (SyntaxFacts.GetKeywordKind(unescapedIdentifier) != SyntaxKind.None && enclosingXmlNameAttr == null) 53if (SyntaxFacts.GetContextualKeywordKind(unescapedIdentifier) == SyntaxKind.AwaitKeyword) 60if (enclosingMethodBlock != null && enclosingMethodBlock.Modifiers.Any(SyntaxKind.AsyncKeyword)) 69case SyntaxKind.FromKeyword: 70case SyntaxKind.WhereKeyword: 71case SyntaxKind.SelectKeyword: 72case SyntaxKind.GroupKeyword: 73case SyntaxKind.IntoKeyword: 74case SyntaxKind.OrderByKeyword: 75case SyntaxKind.JoinKeyword: 76case SyntaxKind.LetKeyword: 77case SyntaxKind.InKeyword: 78case SyntaxKind.OnKeyword: 79case SyntaxKind.EqualsKeyword: 80case SyntaxKind.ByKeyword: 81case SyntaxKind.AscendingKeyword: 82case SyntaxKind.DescendingKeyword: 87var result = token.Kind() == SyntaxKind.IdentifierToken ? CreateNewIdentifierTokenFromToken(token, escape: false) : token; 122: originalToken.CopyAnnotationsTo(SyntaxFactory.Identifier(originalToken.LeadingTrivia, SyntaxKind.IdentifierToken, unescapedText, originalToken.ValueText, originalToken.TrailingTrivia));
Simplification\Reducers\CSharpExtensionMethodReducer.cs (7)
40if (node.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression) 75if (node.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression) 78SyntaxKind.SimpleMemberAccessExpression, expression, 82else if (node.Expression.Kind() == SyntaxKind.IdentifierName) 85SyntaxKind.SimpleMemberAccessExpression, expression, 88else if (node.Expression.Kind() == SyntaxKind.GenericName) 91SyntaxKind.SimpleMemberAccessExpression, expression,
Simplification\Reducers\CSharpInferredMemberNameReducer.Rewriter.cs (1)
55if (node.Parent.IsKind(SyntaxKind.TupleExpression))
Simplification\Reducers\CSharpMiscellaneousReducer.cs (14)
40if (parameterSyntax.IsParentKind(SyntaxKind.ParameterList) && 41parameterSyntax.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 142if (!node.Parent.IsKind(SyntaxKind.IfStatement)) 148if (node.Parent?.Parent is (kind: SyntaxKind.IfStatement or SyntaxKind.ElseClause)) 182case SyntaxKind.IfStatement: 183case SyntaxKind.ElseClause: 184case SyntaxKind.ForStatement: 185case SyntaxKind.ForEachStatement: 186case SyntaxKind.ForEachVariableStatement: 187case SyntaxKind.WhileStatement: 188case SyntaxKind.DoStatement: 189case SyntaxKind.UsingStatement: 190case SyntaxKind.LockStatement:
Simplification\Reducers\CSharpNameReducer.Rewriter.cs (2)
206var isOrAsNode = node.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression;
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (26)
39var kind = specialType switch 41SpecialType.System_Boolean => SyntaxKind.BoolKeyword, 42SpecialType.System_Byte => SyntaxKind.ByteKeyword, 43SpecialType.System_SByte => SyntaxKind.SByteKeyword, 44SpecialType.System_Int32 => SyntaxKind.IntKeyword, 45SpecialType.System_UInt32 => SyntaxKind.UIntKeyword, 46SpecialType.System_Int16 => SyntaxKind.ShortKeyword, 47SpecialType.System_UInt16 => SyntaxKind.UShortKeyword, 48SpecialType.System_Int64 => SyntaxKind.LongKeyword, 49SpecialType.System_UInt64 => SyntaxKind.ULongKeyword, 50SpecialType.System_Single => SyntaxKind.FloatKeyword, 51SpecialType.System_Double => SyntaxKind.DoubleKeyword, 52SpecialType.System_Decimal => SyntaxKind.DecimalKeyword, 53SpecialType.System_String => SyntaxKind.StringKeyword, 54SpecialType.System_Char => SyntaxKind.CharKeyword, 55SpecialType.System_Object => SyntaxKind.ObjectKeyword, 56SpecialType.System_Void => SyntaxKind.VoidKeyword, 57_ => SyntaxKind.None, 60if (kind != SyntaxKind.None) 133if (node.Kind() == SyntaxKind.IdentifierName && 186while (current is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) currentMember) 192return current.Kind() is SyntaxKind.AliasQualifiedName or SyntaxKind.IdentifierName or SyntaxKind.GenericName or SyntaxKind.QualifiedName; 373TypeSyntax node = token.Kind() == SyntaxKind.IdentifierToken
Simplification\Simplifiers\ExpressionSimplifier.cs (7)
77if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 155SyntaxKind.IdentifierToken, 199if (!memberAccess.Expression.IsKind(SyntaxKind.BaseExpression)) 283case MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess: 345if (memberAccess.Expression.Kind() == SyntaxKind.BaseExpression) 395if (constructor == null || constructor.GetRequiredParent().Kind() is not (SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration))
Simplification\Simplifiers\MemberAccessExpressionSimplifier.cs (8)
45if (parent.IsParentKind(SyntaxKind.SimpleMemberAccessExpression)) 51if (!parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 74if ((nextToken.Kind() is SyntaxKind.TildeToken or SyntaxKind.ExclamationToken or SyntaxKind.OpenParenToken) || 75(CSharp.SyntaxFacts.IsKeywordKind(nextToken.Kind()) && nextToken.Kind() is not SyntaxKind.AsKeyword and not SyntaxKind.IsKeyword)) 89return node is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess
Simplification\Simplifiers\NameSimplifier.cs (21)
85if (symbol.Kind == SymbolKind.Method && name.Kind() == SyntaxKind.GenericName) 130SyntaxKind.IdentifierToken, 170if (name.Kind() == SyntaxKind.QualifiedName) 241if (!name.Parent.IsKind(SyntaxKind.QualifiedName) && (inDeclarationContext || inMemberAccessContext)) 278if (name.Kind() == SyntaxKind.QualifiedName) 288if (oldType.Kind() == SyntaxKind.OmittedTypeArgument) 311case SyntaxKind.AliasQualifiedName: 326case SyntaxKind.QualifiedName: 332case SyntaxKind.IdentifierName: 341case SyntaxKind.GenericName: 496if (name.Parent.Kind() == SyntaxKind.Attribute || name.IsRightSideOfDotOrColonColon()) 506if (SyntaxFacts.GetKeywordKind(newAttributeName) != SyntaxKind.None) 559case SyntaxKind.IdentifierName: 560case SyntaxKind.QualifiedName: 565case SyntaxKind.NamespaceDeclaration: 566case SyntaxKind.FileScopedNamespaceDeclaration: 629if (nullableType.ElementType.Kind() == SyntaxKind.OmittedTypeArgument) 641if (simplifiedNode.Kind() == SyntaxKind.NullableType && 653expression.IsParentKind(SyntaxKind.UsingDirective) && 668if (!reparsedCastExpression.IsKind(SyntaxKind.CastExpression)) 711aliasName.Alias.Identifier.IsKind(SyntaxKind.GlobalKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (97)
11public static readonly SyntaxToken AbstractKeyword = Token(SyntaxKind.AbstractKeyword); 12public static readonly SyntaxToken AsKeyword = Token(SyntaxKind.AsKeyword); 13public static readonly SyntaxToken AssemblyKeyword = Token(SyntaxKind.AssemblyKeyword); 14public static readonly SyntaxToken AsyncKeyword = Token(SyntaxKind.AsyncKeyword); 15public static readonly SyntaxToken AwaitKeyword = Token(SyntaxKind.AwaitKeyword); 16public static readonly SyntaxToken BoolKeyword = Token(SyntaxKind.BoolKeyword); 17public static readonly SyntaxToken BreakKeyword = Token(SyntaxKind.BreakKeyword); 18public static readonly SyntaxToken ByteKeyword = Token(SyntaxKind.ByteKeyword); 19public static readonly SyntaxToken CaseKeyword = Token(SyntaxKind.CaseKeyword); 20public static readonly SyntaxToken CharKeyword = Token(SyntaxKind.CharKeyword); 21public static readonly SyntaxToken CheckedKeyword = Token(SyntaxKind.CheckedKeyword); 22public static readonly SyntaxToken CloseBraceToken = Token(SyntaxKind.CloseBraceToken); 23public static readonly SyntaxToken CloseBracketToken = Token(SyntaxKind.CloseBracketToken); 25public static readonly SyntaxToken ClosedKeyword = Token(SyntaxKind.ClosedKeyword); 27public static readonly SyntaxToken CloseParenToken = Token(SyntaxKind.CloseParenToken); 28public static readonly SyntaxToken ColonToken = Token(SyntaxKind.ColonToken); 29public static readonly SyntaxToken CommaToken = Token(SyntaxKind.CommaToken); 30public static readonly SyntaxToken ConstKeyword = Token(SyntaxKind.ConstKeyword); 31public static readonly SyntaxToken ContinueKeyword = Token(SyntaxKind.ContinueKeyword); 32public static readonly SyntaxToken DecimalKeyword = Token(SyntaxKind.DecimalKeyword); 33public static readonly SyntaxToken DisableKeyword = Token(SyntaxKind.DisableKeyword); 34public static readonly SyntaxToken DotDotToken = Token(SyntaxKind.DotDotToken); 35public static readonly SyntaxToken DoubleKeyword = Token(SyntaxKind.DoubleKeyword); 36public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken); 37public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken); 38public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword); 40public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword); 42public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword); 43public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword); 44public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword); 45public static readonly SyntaxToken FloatKeyword = Token(SyntaxKind.FloatKeyword); 46public static readonly SyntaxToken ForEachKeyword = Token(SyntaxKind.ForEachKeyword); 47public static readonly SyntaxToken FromKeyword = Token(SyntaxKind.FromKeyword); 48public static readonly SyntaxToken GlobalKeyword = Token(SyntaxKind.GlobalKeyword); 49public static readonly SyntaxToken GreaterThanEqualsToken = Token(SyntaxKind.GreaterThanEqualsToken); 50public static readonly SyntaxToken GreaterThanToken = Token(SyntaxKind.GreaterThanToken); 51public static readonly SyntaxToken IfKeyword = Token(SyntaxKind.IfKeyword); 52public static readonly SyntaxToken ImplicitKeyword = Token(SyntaxKind.ImplicitKeyword); 53public static readonly SyntaxToken InKeyword = Token(SyntaxKind.InKeyword); 54public static readonly SyntaxToken InterfaceKeyword = Token(SyntaxKind.InterfaceKeyword); 55public static readonly SyntaxToken InternalKeyword = Token(SyntaxKind.InternalKeyword); 56public static readonly SyntaxToken InterpolatedStringEndToken = Token(SyntaxKind.InterpolatedStringEndToken); 57public static readonly SyntaxToken InterpolatedStringStartToken = Token(SyntaxKind.InterpolatedStringStartToken); 58public static readonly SyntaxToken IntKeyword = Token(SyntaxKind.IntKeyword); 59public static readonly SyntaxToken IsKeyword = Token(SyntaxKind.IsKeyword); 60public static readonly SyntaxToken LessThanEqualsToken = Token(SyntaxKind.LessThanEqualsToken); 61public static readonly SyntaxToken LessThanToken = Token(SyntaxKind.LessThanToken); 62public static readonly SyntaxToken LetKeyword = Token(SyntaxKind.LetKeyword); 63public static readonly SyntaxToken LongKeyword = Token(SyntaxKind.LongKeyword); 64public static readonly SyntaxToken MethodKeyword = Token(SyntaxKind.MethodKeyword); 65public static readonly SyntaxToken NewKeyword = Token(SyntaxKind.NewKeyword); 66public static readonly SyntaxToken NotKeyword = Token(SyntaxKind.NotKeyword); 67public static readonly SyntaxToken NullKeyword = Token(SyntaxKind.NullKeyword); 68public static readonly SyntaxToken ObjectKeyword = Token(SyntaxKind.ObjectKeyword); 69public static readonly SyntaxToken OpenBraceToken = Token(SyntaxKind.OpenBraceToken); 70public static readonly SyntaxToken OpenBracketToken = Token(SyntaxKind.OpenBracketToken); 71public static readonly SyntaxToken OpenParenToken = Token(SyntaxKind.OpenParenToken); 72public static readonly SyntaxToken OperatorKeyword = Token(SyntaxKind.OperatorKeyword); 73public static readonly SyntaxToken OutKeyword = Token(SyntaxKind.OutKeyword); 74public static readonly SyntaxToken OverrideKeyword = Token(SyntaxKind.OverrideKeyword); 75public static readonly SyntaxToken ParamsKeyword = Token(SyntaxKind.ParamsKeyword); 76public static readonly SyntaxToken PartialKeyword = Token(SyntaxKind.PartialKeyword); 77public static readonly SyntaxToken PlusToken = Token(SyntaxKind.PlusToken); 78public static readonly SyntaxToken PrivateKeyword = Token(SyntaxKind.PrivateKeyword); 79public static readonly SyntaxToken PropertyKeyword = Token(SyntaxKind.PropertyKeyword); 80public static readonly SyntaxToken ProtectedKeyword = Token(SyntaxKind.ProtectedKeyword); 81public static readonly SyntaxToken PublicKeyword = Token(SyntaxKind.PublicKeyword); 82public static readonly SyntaxToken QuestionQuestionEqualsToken = Token(SyntaxKind.QuestionQuestionEqualsToken); 83public static readonly SyntaxToken QuestionToken = Token(SyntaxKind.QuestionToken); 84public static readonly SyntaxToken ReadOnlyKeyword = Token(SyntaxKind.ReadOnlyKeyword); 85public static readonly SyntaxToken RecordKeyword = Token(SyntaxKind.RecordKeyword); 86public static readonly SyntaxToken RefKeyword = Token(SyntaxKind.RefKeyword); 87public static readonly SyntaxToken RequiredKeyword = Token(SyntaxKind.RequiredKeyword); 88public static readonly SyntaxToken RestoreKeyword = Token(SyntaxKind.RestoreKeyword); 89public static readonly SyntaxToken ReturnKeyword = Token(SyntaxKind.ReturnKeyword); 90public static readonly SyntaxToken SByteKeyword = Token(SyntaxKind.SByteKeyword); 91public static readonly SyntaxToken ScopedKeyword = Token(SyntaxKind.ScopedKeyword); 92public static readonly SyntaxToken SealedKeyword = Token(SyntaxKind.SealedKeyword); 93public static readonly SyntaxToken SemicolonToken = Token(SyntaxKind.SemicolonToken); 94public static readonly SyntaxToken ShortKeyword = Token(SyntaxKind.ShortKeyword); 95public static readonly SyntaxToken SlashGreaterThanToken = Token(SyntaxKind.SlashGreaterThanToken); 96public static readonly SyntaxToken StaticKeyword = Token(SyntaxKind.StaticKeyword); 97public static readonly SyntaxToken StringKeyword = Token(SyntaxKind.StringKeyword); 98public static readonly SyntaxToken StructKeyword = Token(SyntaxKind.StructKeyword); 99public static readonly SyntaxToken SwitchKeyword = Token(SyntaxKind.SwitchKeyword); 100public static readonly SyntaxToken ThisKeyword = Token(SyntaxKind.ThisKeyword); 101public static readonly SyntaxToken TildeToken = Token(SyntaxKind.TildeToken); 102public static readonly SyntaxToken UIntKeyword = Token(SyntaxKind.UIntKeyword); 103public static readonly SyntaxToken ULongKeyword = Token(SyntaxKind.ULongKeyword); 104public static readonly SyntaxToken UnmanagedKeyword = Token(SyntaxKind.UnmanagedKeyword); 105public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.UnsafeKeyword); 106public static readonly SyntaxToken UShortKeyword = Token(SyntaxKind.UShortKeyword); 107public static readonly SyntaxToken UsingKeyword = Token(SyntaxKind.UsingKeyword); 108public static readonly SyntaxToken VirtualKeyword = Token(SyntaxKind.VirtualKeyword); 109public static readonly SyntaxToken VoidKeyword = Token(SyntaxKind.VoidKeyword); 110public static readonly SyntaxToken VolatileKeyword = Token(SyntaxKind.VolatileKeyword); 111public static readonly SyntaxToken WhereKeyword = Token(SyntaxKind.WhereKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (19)
157private static readonly ImmutableArray<SyntaxKind> s_preferredModifierOrderDefault = 159SyntaxKind.PublicKeyword, 160SyntaxKind.PrivateKeyword, 161SyntaxKind.ProtectedKeyword, 162SyntaxKind.InternalKeyword, 163SyntaxKind.FileKeyword, 164SyntaxKind.StaticKeyword, 165SyntaxKind.ExternKeyword, 166SyntaxKind.NewKeyword, 167SyntaxKind.VirtualKeyword, 168SyntaxKind.AbstractKeyword, 170SyntaxKind.ClosedKeyword, 172SyntaxKind.SealedKeyword, 173SyntaxKind.OverrideKeyword, 174SyntaxKind.ReadOnlyKeyword, 175SyntaxKind.UnsafeKeyword, 176SyntaxKind.RequiredKeyword, 177SyntaxKind.VolatileKeyword, 178SyntaxKind.AsyncKeyword,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (7)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 79if (initializerExpression.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ArrayCreationExpression && 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 87if (initializerExpression.Kind() is SyntaxKind.CastExpression or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (18)
35if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 38if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 63case SyntaxKind.CharacterLiteralToken: 66case SyntaxKind.StringLiteralToken: 71case SyntaxKind.Utf8StringLiteralToken: 76case SyntaxKind.SingleLineRawStringLiteralToken: 77case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 80case SyntaxKind.MultiLineRawStringLiteralToken: 81case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 86case SyntaxKind.InterpolatedStringTextToken: 97SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 98SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 100SyntaxKind.InterpolatedMultiLineRawStringStartToken 138if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 144if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (5)
27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 81if (argument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 87if (argument.RefOrOutKeyword.Kind() == SyntaxKind.RefKeyword &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\AssignmentExpressionSyntaxExtensions.cs (4)
16return assignment.Kind() == SyntaxKind.SimpleAssignmentExpression && 17assignment.OperatorToken.Kind() == SyntaxKind.EqualsToken && 18(left.Kind() == SyntaxKind.TupleExpression || left.Kind() == SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (15)
27Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.IfDirectiveTrivia), nameof(IfDirectiveTriviaSyntax)), 29Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElifDirectiveTrivia), nameof(ElifDirectiveTriviaSyntax))), 30Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElseDirectiveTrivia), nameof(ElseDirectiveTriviaSyntax)), 31Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.EndIfDirectiveTrivia), nameof(EndIfDirectiveTriviaSyntax))); 78if (leadingDirectives.Any(t => t.Kind() == SyntaxKind.EndIfDirectiveTrivia)) 113if (nextTrivia.Kind() == SyntaxKind.DisabledTextTrivia) 137SyntaxKind declarationKind, 157if (parent.Kind() == SyntaxKind.GetAccessorDeclaration) 175private static bool IsSupportedInCSharp6(SyntaxKind declarationKind) 179case SyntaxKind.ConstructorDeclaration: 180case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.AddAccessorDeclaration: 182case SyntaxKind.RemoveAccessorDeclaration: 183case SyntaxKind.GetAccessorDeclaration: 184case SyntaxKind.SetAccessorDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression); 69if (equalsValueClause.IsParentKind(SyntaxKind.VariableDeclarator) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DirectiveSyntaxExtensions.cs (6)
63=> directive?.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia; 67is SyntaxKind.IfDirectiveTrivia 68or SyntaxKind.ElifDirectiveTrivia 69or SyntaxKind.ElseDirectiveTrivia 70or SyntaxKind.EndIfDirectiveTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (138)
38while (expression is PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixExpression) 48=> expression?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == expression; 84return firstToken.Kind() != SyntaxKind.None 85&& firstToken.GetPreviousToken().Kind() == SyntaxKind.CloseParenToken; 98=> (expression?.Parent) is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && 109=> name.IsParentKind(SyntaxKind.ExplicitInterfaceSpecifier); 130if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 187if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 197=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 209while (expression?.Parent is ParenthesizedExpressionSyntax or PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression)) 213ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 224=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 275if (!expr.IsParentKind(SyntaxKind.Argument)) 290case SyntaxKind.Argument: 291if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 298case SyntaxKind.SimpleAssignmentExpression: 305case SyntaxKind.ForEachVariableStatement: 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 400return nameEquals.IsParentKind(SyntaxKind.AttributeArgument); 409case SyntaxKind.PostIncrementExpression: 410case SyntaxKind.PreIncrementExpression: 411case SyntaxKind.PostDecrementExpression: 412case SyntaxKind.PreDecrementExpression: 428name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 476is SyntaxKind.BaseExpression 477or SyntaxKind.CollectionInitializerExpression 478or SyntaxKind.ObjectInitializerExpression 479or SyntaxKind.ComplexElementInitializerExpression) 485if (expression is LiteralExpressionSyntax && !expression.IsParentKind(SyntaxKind.UnaryMinusExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 517return expression is { Parent.RawKind: not (int)SyntaxKind.ConditionalAccessExpression }; 525case SyntaxKind.InvocationExpression: 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 552case SyntaxKind.ConditionalAccessExpression: 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression); 557case SyntaxKind.IsExpression: 558case SyntaxKind.AsExpression: 562case SyntaxKind.EqualsValueClause: 563case SyntaxKind.ExpressionStatement: 564case SyntaxKind.ArrayInitializerExpression: 565case SyntaxKind.CollectionInitializerExpression: 566case SyntaxKind.Argument: 567case SyntaxKind.AttributeArgument: 568case SyntaxKind.AnonymousObjectMemberDeclarator: 569case SyntaxKind.ArrowExpressionClause: 570case SyntaxKind.AwaitExpression: 571case SyntaxKind.ReturnStatement: 572case SyntaxKind.YieldReturnStatement: 573case SyntaxKind.ParenthesizedLambdaExpression: 574case SyntaxKind.SimpleLambdaExpression: 575case SyntaxKind.ParenthesizedExpression: 576case SyntaxKind.ArrayRankSpecifier: 577case SyntaxKind.ConditionalExpression: 578case SyntaxKind.IfStatement: 579case SyntaxKind.CatchFilterClause: 580case SyntaxKind.WhileStatement: 581case SyntaxKind.DoStatement: 582case SyntaxKind.ThrowStatement: 583case SyntaxKind.SwitchStatement: 584case SyntaxKind.InterpolatedStringExpression: 585case SyntaxKind.ComplexElementInitializerExpression: 586case SyntaxKind.Interpolation: 587case SyntaxKind.RefExpression: 588case SyntaxKind.LockStatement: 589case SyntaxKind.ElementAccessExpression: 590case SyntaxKind.SwitchExpressionArm: 591case SyntaxKind.WhenClause: 598if (!(expression is LiteralExpressionSyntax && expression.IsParentKind(SyntaxKind.UnaryMinusExpression))) 639if ((expression.IsParentKind(SyntaxKind.NameEquals) && expression.Parent.IsParentKind(SyntaxKind.AttributeArgument)) || 655identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.NameOfKeyword); 697case SyntaxKind.SimpleMemberAccessExpression: 698case SyntaxKind.ConditionalAccessExpression: 699case SyntaxKind.InvocationExpression: 700case SyntaxKind.ElementAccessExpression: 701case SyntaxKind.PostIncrementExpression: 702case SyntaxKind.PostDecrementExpression: 703case SyntaxKind.ObjectCreationExpression: 704case SyntaxKind.ImplicitObjectCreationExpression: 705case SyntaxKind.TypeOfExpression: 706case SyntaxKind.DefaultExpression: 707case SyntaxKind.CheckedExpression: 708case SyntaxKind.UncheckedExpression: 709case SyntaxKind.AnonymousMethodExpression: 710case SyntaxKind.SuppressNullableWarningExpression: 712case SyntaxKind.SizeOfExpression: 713case SyntaxKind.PointerMemberAccessExpression: 719case SyntaxKind.UnaryPlusExpression: 720case SyntaxKind.UnaryMinusExpression: 721case SyntaxKind.LogicalNotExpression: 722case SyntaxKind.BitwiseNotExpression: 723case SyntaxKind.PreIncrementExpression: 724case SyntaxKind.PreDecrementExpression: 725case SyntaxKind.CastExpression: 726case SyntaxKind.AwaitExpression: 728case SyntaxKind.PointerIndirectionExpression: 729case SyntaxKind.AddressOfExpression: 736case SyntaxKind.RangeExpression: 742case SyntaxKind.MultiplyExpression: 743case SyntaxKind.DivideExpression: 744case SyntaxKind.ModuloExpression: 750case SyntaxKind.AddExpression: 751case SyntaxKind.SubtractExpression: 757case SyntaxKind.LeftShiftExpression: 758case SyntaxKind.RightShiftExpression: 764case SyntaxKind.LessThanExpression: 765case SyntaxKind.GreaterThanExpression: 766case SyntaxKind.LessThanOrEqualExpression: 767case SyntaxKind.GreaterThanOrEqualExpression: 768case SyntaxKind.IsExpression: 769case SyntaxKind.AsExpression: 770case SyntaxKind.IsPatternExpression: 776case SyntaxKind.EqualsExpression: 777case SyntaxKind.NotEqualsExpression: 783case SyntaxKind.BitwiseAndExpression: 789case SyntaxKind.ExclusiveOrExpression: 795case SyntaxKind.BitwiseOrExpression: 801case SyntaxKind.LogicalAndExpression: 807case SyntaxKind.LogicalOrExpression: 813case SyntaxKind.CoalesceExpression: 819case SyntaxKind.ConditionalExpression: 825case SyntaxKind.SimpleAssignmentExpression: 826case SyntaxKind.MultiplyAssignmentExpression: 827case SyntaxKind.DivideAssignmentExpression: 828case SyntaxKind.ModuloAssignmentExpression: 829case SyntaxKind.AddAssignmentExpression: 830case SyntaxKind.SubtractAssignmentExpression: 831case SyntaxKind.LeftShiftAssignmentExpression: 832case SyntaxKind.RightShiftAssignmentExpression: 833case SyntaxKind.AndAssignmentExpression: 834case SyntaxKind.ExclusiveOrAssignmentExpression: 835case SyntaxKind.OrAssignmentExpression: 836case SyntaxKind.SimpleLambdaExpression: 837case SyntaxKind.ParenthesizedLambdaExpression: 843case SyntaxKind.SwitchExpression: 1091return binaryExpression.Kind() == SyntaxKind.CoalesceExpression && binaryExpression.Right == expression && HasType(binaryExpression.Left, out var leftType) ? leftType : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (50)
32case SyntaxKind.EnumDeclaration: 34case SyntaxKind.ClassDeclaration: 36case SyntaxKind.ExtensionBlockDeclaration: 37case SyntaxKind.UnionDeclaration: 39case SyntaxKind.InterfaceDeclaration: 40case SyntaxKind.RecordDeclaration: 41case SyntaxKind.RecordStructDeclaration: 42case SyntaxKind.StructDeclaration: 44case SyntaxKind.DelegateDeclaration: 46case SyntaxKind.FieldDeclaration: 48case SyntaxKind.EventFieldDeclaration: 50case SyntaxKind.PropertyDeclaration: 52case SyntaxKind.EventDeclaration: 54case SyntaxKind.MethodDeclaration: 56case SyntaxKind.ConstructorDeclaration: 58case SyntaxKind.DestructorDeclaration: 60case SyntaxKind.IndexerDeclaration: 62case SyntaxKind.OperatorDeclaration: 77case SyntaxKind.ClassDeclaration: 79case SyntaxKind.ExtensionBlockDeclaration: 80case SyntaxKind.UnionDeclaration: 82case SyntaxKind.InterfaceDeclaration: 83case SyntaxKind.RecordDeclaration: 84case SyntaxKind.RecordStructDeclaration: 85case SyntaxKind.StructDeclaration: 87case SyntaxKind.DelegateDeclaration: 89case SyntaxKind.MethodDeclaration: 105case SyntaxKind.ClassDeclaration: 107case SyntaxKind.ExtensionBlockDeclaration: 108case SyntaxKind.UnionDeclaration: 110case SyntaxKind.InterfaceDeclaration: 111case SyntaxKind.RecordDeclaration: 112case SyntaxKind.RecordStructDeclaration: 113case SyntaxKind.StructDeclaration: 115case SyntaxKind.DelegateDeclaration: 117case SyntaxKind.MethodDeclaration: 135case SyntaxKind.DelegateDeclaration: 137case SyntaxKind.MethodDeclaration: 139case SyntaxKind.ConstructorDeclaration: 141case SyntaxKind.IndexerDeclaration: 143case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.DelegateDeclaration: 161case SyntaxKind.MethodDeclaration: 163case SyntaxKind.OperatorDeclaration: 165case SyntaxKind.PropertyDeclaration: 167case SyntaxKind.IndexerDeclaration: 169case SyntaxKind.EventDeclaration: 171case SyntaxKind.EventFieldDeclaration: 173case SyntaxKind.FieldDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.DeclarationFinder.cs (1)
32if (syntaxToken.Kind() == SyntaxKind.IdentifierToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (75)
38var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 57if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 58parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 84if (expression.Kind() is SyntaxKind.GreaterThanExpression or SyntaxKind.LessThanExpression && 87var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 93if (expression.IsKind(SyntaxKind.ThrowExpression)) 97if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 101if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 105if (nodeParent.Kind() is SyntaxKind.CheckedExpression or SyntaxKind.UncheckedExpression) 109if (expression.IsKind(SyntaxKind.TupleExpression)) 117if (tokenAfterParen.Kind() == SyntaxKind.OpenBracketToken) 170(nodeParent is YieldStatementSyntax(SyntaxKind.YieldReturnStatement) yieldStatement && yieldStatement.Expression == node) || 195if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 205if (nodeParent.IsKind(SyntaxKind.Interpolation)) 210if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 257if (expression.IsKind(SyntaxKind.ThisExpression)) 271if (expression.IsKind(SyntaxKind.ThrowExpression) && 272nodeParent is BinaryExpressionSyntax(SyntaxKind.CoalesceExpression) binary && 279if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 283if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 284nodeParent.IsParentKind(SyntaxKind.CasePatternSwitchLabel)) 290if (nodeParent.IsKind(SyntaxKind.WhenClause)) 318if (parentExpression.IsKind(SyntaxKind.CastExpression) && 319expression.Kind() is SyntaxKind.PreIncrementExpression or SyntaxKind.PreDecrementExpression) 326if (expression.IsKind(SyntaxKind.ConditionalExpression) && 337if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 389if (ancestor.IsKind(SyntaxKind.ParenthesizedExpression)) 392if (ancestor.IsKind(SyntaxKind.Interpolation, out interpolation)) 414if (!childNode.IsKind(SyntaxKind.ParenthesizedExpression)) 419if (nodeOrToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.ColonColonToken) 488if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 510private static bool IsAssociative(SyntaxKind kind) 514case SyntaxKind.AddExpression: 515case SyntaxKind.MultiplyExpression: 516case SyntaxKind.BitwiseOrExpression: 517case SyntaxKind.ExclusiveOrExpression: 518case SyntaxKind.LogicalOrExpression: 519case SyntaxKind.BitwiseAndExpression: 520case SyntaxKind.LogicalAndExpression: 551SyntaxKind.PredefinedType or 552SyntaxKind.ArrayType or 553SyntaxKind.PointerType or 554SyntaxKind.NullableType) 567SyntaxKind.UnaryMinusExpression or 568SyntaxKind.UnaryPlusExpression or 569SyntaxKind.PointerIndirectionExpression or 570SyntaxKind.AddressOfExpression) 581if (name.IsKind(SyntaxKind.AliasQualifiedName)) 607binaryExpression.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.GreaterThanExpression && 608(binaryExpression.IsParentKind(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax)) 610if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 623else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 626binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 638else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 645else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 681previousExpression is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) lessThanExpression) 687|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 716nextExpression is not BinaryExpressionSyntax(SyntaxKind.GreaterThanExpression) greaterThanExpression) 722&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression; 726=> expression.Kind() is SyntaxKind.IdentifierName or SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression; 818if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 821if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (31)
63case SyntaxKind.SimpleMemberAccessExpression: 64case SyntaxKind.PointerMemberAccessExpression: 70case SyntaxKind.QualifiedName: 76case SyntaxKind.AliasQualifiedName: 82case SyntaxKind.GenericName: 88case SyntaxKind.IdentifierName: 153case SyntaxKind.CommaToken: 154case SyntaxKind.DelegateKeyword: 225variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 232if (type.IsParentKind(SyntaxKind.ObjectCreationExpression) && 233type.Parent.IsParentKind(SyntaxKind.EqualsValueClause) && 234type.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclarator) && 235type.Parent.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 236variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 252is SyntaxKind.DelegateDeclaration 253or SyntaxKind.MethodDeclaration 254or SyntaxKind.PropertyDeclaration 255or SyntaxKind.EventDeclaration 256or SyntaxKind.IndexerDeclaration 257or SyntaxKind.OperatorDeclaration) 273if (type.IsParentKind(SyntaxKind.Parameter) && type.Parent.IsParentKind(SyntaxKind.ParameterList)) 276is SyntaxKind.DelegateDeclaration 277or SyntaxKind.MethodDeclaration 278or SyntaxKind.IndexerDeclaration 279or SyntaxKind.OperatorDeclaration) 285if (type.Parent.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration)) 296if (type.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 297variableDeclaration.IsParentKind(SyntaxKind.EventFieldDeclaration)) 307if (type.IsParentKind(SyntaxKind.TypeConstraint)) 447if (SyntaxFacts.GetContextualKeywordKind(parameter.Name) is not SyntaxKind.UnderscoreToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SymbolDisplayPartExtensions.cs (1)
21if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (29)
14/// Determine if the given <see cref="SyntaxKind"/> array contains the given kind. 22public static bool Contains(this SyntaxKind[] kinds, SyntaxKind kind) 24foreach (var k in kinds) 35public static SyntaxKind MapCompoundAssignmentKindToBinaryExpressionKind(this SyntaxKind syntaxKind) 39case SyntaxKind.AddAssignmentExpression: 40return SyntaxKind.AddExpression; 42case SyntaxKind.SubtractAssignmentExpression: 43return SyntaxKind.SubtractExpression; 45case SyntaxKind.MultiplyAssignmentExpression: 46return SyntaxKind.MultiplyExpression; 48case SyntaxKind.DivideAssignmentExpression: 49return SyntaxKind.DivideExpression; 51case SyntaxKind.ModuloAssignmentExpression: 52return SyntaxKind.ModuloExpression; 54case SyntaxKind.AndAssignmentExpression: 55return SyntaxKind.BitwiseAndExpression; 57case SyntaxKind.ExclusiveOrAssignmentExpression: 58return SyntaxKind.ExclusiveOrExpression; 60case SyntaxKind.OrAssignmentExpression: 61return SyntaxKind.BitwiseOrExpression; 63case SyntaxKind.LeftShiftAssignmentExpression: 64return SyntaxKind.LeftShiftExpression; 66case SyntaxKind.RightShiftAssignmentExpression: 67return SyntaxKind.RightShiftExpression; 69case SyntaxKind.CoalesceAssignmentExpression: 70return SyntaxKind.CoalesceExpression; 74return SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (57)
28public static void Deconstruct(this SyntaxNode node, out SyntaxKind kind) 31public static bool IsKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 44public static bool IsParentKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 47public static bool IsParentKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 75if (prevToken.Kind() == SyntaxKind.None) 93is SyntaxKind.ArgumentList 94or SyntaxKind.AttributeArgumentList 95or SyntaxKind.BracketedArgumentList 96or SyntaxKind.TypeArgumentList; 186if ((current?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == current) || 196SyntaxKind.InvocationExpression or 197SyntaxKind.ElementAccessExpression or 198SyntaxKind.SimpleMemberAccessExpression or 199SyntaxKind.MemberBindingExpression or 200SyntaxKind.ElementBindingExpression or 202SyntaxKind.SuppressNullableWarningExpression) && 285=> node is AssignmentExpressionSyntax(kind: not SyntaxKind.SimpleAssignmentExpression); 288=> node?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment && 332m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword)); 345case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 348case AnonymousFunctionExpressionSyntax anonymousFunction when anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 352return current.GetModifiers().Any(SyntaxKind.StaticKeyword); 355return property.Modifiers.Any(SyntaxKind.StaticKeyword) || 360return !current.Parent.IsKind(SyntaxKind.CompilationUnit); 399case SyntaxKind.DoStatement: 400case SyntaxKind.WhileStatement: 401case SyntaxKind.SwitchStatement: 402case SyntaxKind.ForStatement: 403case SyntaxKind.ForEachStatement: 404case SyntaxKind.ForEachVariableStatement: 415case SyntaxKind.DoStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.ForStatement: 418case SyntaxKind.ForEachStatement: 419case SyntaxKind.ForEachVariableStatement: 430case SyntaxKind.AnonymousMethodExpression: 431case SyntaxKind.SimpleLambdaExpression: 432case SyntaxKind.ParenthesizedLambdaExpression: 433case SyntaxKind.LocalFunctionStatement: 434case SyntaxKind.MethodDeclaration: 435case SyntaxKind.ConstructorDeclaration: 436case SyntaxKind.DestructorDeclaration: 437case SyntaxKind.GetAccessorDeclaration: 438case SyntaxKind.SetAccessorDeclaration: 439case SyntaxKind.InitAccessorDeclaration: 440case SyntaxKind.OperatorDeclaration: 441case SyntaxKind.ConversionOperatorDeclaration: 442case SyntaxKind.AddAccessorDeclaration: 443case SyntaxKind.RemoveAccessorDeclaration: 454=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 556if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 570else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 898while (finalTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
60if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (88)
20public static void Deconstruct(this SyntaxToken token, out SyntaxKind kind) 39public static bool IsKindOrHasMatchingText(this SyntaxToken token, SyntaxKind kind) 42public static bool HasMatchingText(this SyntaxToken token, SyntaxKind kind) 46=> token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList); 64if (token.Kind() == SyntaxKind.IdentifierToken) 69SyntaxFacts.GetContextualKeywordKind(simpleNameText) != SyntaxKind.None; 75public static bool IsPotentialModifier(this SyntaxToken token, out SyntaxKind modifierKind) 77var tokenKind = token.Kind(); 78modifierKind = SyntaxKind.None; 82case SyntaxKind.PublicKeyword: 83case SyntaxKind.InternalKeyword: 84case SyntaxKind.ProtectedKeyword: 85case SyntaxKind.PrivateKeyword: 86case SyntaxKind.SealedKeyword: 87case SyntaxKind.AbstractKeyword: 89case SyntaxKind.ClosedKeyword: 91case SyntaxKind.StaticKeyword: 92case SyntaxKind.VirtualKeyword: 93case SyntaxKind.ExternKeyword: 94case SyntaxKind.NewKeyword: 95case SyntaxKind.OverrideKeyword: 96case SyntaxKind.ReadOnlyKeyword: 97case SyntaxKind.VolatileKeyword: 98case SyntaxKind.UnsafeKeyword: 99case SyntaxKind.AsyncKeyword: 100case SyntaxKind.RefKeyword: 101case SyntaxKind.OutKeyword: 102case SyntaxKind.InKeyword: 103case SyntaxKind.RequiredKeyword: 104case SyntaxKind.FileKeyword: 105case SyntaxKind.PartialKeyword: 108case SyntaxKind.IdentifierToken: 109if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 111modifierKind = SyntaxKind.AsyncKeyword; 113if (token.HasMatchingText(SyntaxKind.FileKeyword)) 115modifierKind = SyntaxKind.FileKeyword; 118if (token.HasMatchingText(SyntaxKind.ClosedKeyword)) 120modifierKind = SyntaxKind.ClosedKeyword; 123if (token.HasMatchingText(SyntaxKind.PartialKeyword)) 125modifierKind = SyntaxKind.PartialKeyword; 127return modifierKind != SyntaxKind.None; 137case SyntaxKind.CharacterLiteralToken: 138case SyntaxKind.FalseKeyword: 139case SyntaxKind.NumericLiteralToken: 140case SyntaxKind.StringLiteralToken: 141case SyntaxKind.TrueKeyword: 171if (previousToken.Kind() == SyntaxKind.None) 204=> token.Kind() == SyntaxKind.StringLiteralToken && !token.IsVerbatimStringLiteral(); 210case SyntaxKind.AssemblyKeyword: 211case SyntaxKind.ModuleKeyword: 212case SyntaxKind.FieldKeyword: 213case SyntaxKind.EventKeyword: 214case SyntaxKind.MethodKeyword: 215case SyntaxKind.ParamKeyword: 216case SyntaxKind.PropertyKeyword: 217case SyntaxKind.ReturnKeyword: 218case SyntaxKind.TypeKeyword: 242if (genericIdentifier.GetNextToken(includeSkipped: true).Kind() == SyntaxKind.LessThanToken) 266Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 270Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken); 279if (next.Kind() == SyntaxKind.None) 287if (token.Kind() == SyntaxKind.GreaterThanToken) 302case SyntaxKind.LessThanLessThanToken: 304goto case SyntaxKind.LessThanToken; 307case SyntaxKind.LessThanToken: 311case SyntaxKind.AsteriskToken: // for int* 312case SyntaxKind.QuestionToken: // for int? 313case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 314case SyntaxKind.ColonColonToken: // for global:: 315case SyntaxKind.CloseBracketToken: 316case SyntaxKind.OpenBracketToken: 317case SyntaxKind.DotToken: 318case SyntaxKind.IdentifierToken: 319case SyntaxKind.CommaToken: 323case SyntaxKind.ClassKeyword: 324case SyntaxKind.StructKeyword: 325case SyntaxKind.InterfaceKeyword: 326case SyntaxKind.DelegateKeyword: 327case SyntaxKind.EnumKeyword: 328case SyntaxKind.PrivateKeyword: 329case SyntaxKind.PublicKeyword: 330case SyntaxKind.InternalKeyword: 331case SyntaxKind.ProtectedKeyword: 332case SyntaxKind.VoidKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (54)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 20public static ISet<SyntaxKind> GetPrecedingModifiers( 30var result = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 31while (token.IsPotentialModifier(out var modifierKind)) 87private static readonly Func<SyntaxKind, bool> s_isDot = k => k is SyntaxKind.DotToken; 88private static readonly Func<SyntaxKind, bool> s_isDotOrArrow = k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken; 89private static readonly Func<SyntaxKind, bool> s_isDotOrArrowOrColonColon = 90k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken or SyntaxKind.ColonColonToken; 95(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken) 111if (token.Kind() == SyntaxKind.None) 122return token.Kind() == SyntaxKind.NumericLiteralToken; 125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken) 202var endsWithNewLine = trivia.GetStructure()!.GetLastToken(includeSkipped: true).Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 263if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 269return trivia.Kind() == SyntaxKind.ConflictMarkerTrivia; 277if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 303if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 324var kind = token.Kind(); 326SyntaxKind.StringLiteralToken or 327SyntaxKind.CharacterLiteralToken or 328SyntaxKind.SingleLineRawStringLiteralToken or 329SyntaxKind.MultiLineRawStringLiteralToken or 330SyntaxKind.Utf8StringLiteralToken or 331SyntaxKind.Utf8SingleLineRawStringLiteralToken or 332SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 339SyntaxKind.Utf8StringLiteralToken or 340SyntaxKind.Utf8SingleLineRawStringLiteralToken or 341SyntaxKind.Utf8MultiLineRawStringLiteralToken) 349if (kind is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 399if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 404SyntaxKind.StringLiteralToken or 405SyntaxKind.SingleLineRawStringLiteralToken or 406SyntaxKind.MultiLineRawStringLiteralToken or 407SyntaxKind.Utf8StringLiteralToken or 408SyntaxKind.Utf8SingleLineRawStringLiteralToken or 409SyntaxKind.Utf8MultiLineRawStringLiteralToken) 421SyntaxKind.InterpolatedStringStartToken or 422SyntaxKind.InterpolatedStringEndToken or 423SyntaxKind.InterpolatedRawStringEndToken or 424SyntaxKind.InterpolatedSingleLineRawStringStartToken or 425SyntaxKind.InterpolatedMultiLineRawStringStartToken) 430if (token.Kind() is SyntaxKind.InterpolatedStringTextToken) 455if (token.Kind() == SyntaxKind.CharacterLiteralToken) 497if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 503if (token.Kind() == SyntaxKind.EndOfFileToken) 553if (token.IsKind(SyntaxKind.HashToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (15)
21public static void Deconstruct(this SyntaxTrivia trivia, out SyntaxKind kind) 25=> trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia; 37=> trivia.Kind() == SyntaxKind.SingleLineCommentTrivia; 40=> trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 43=> trivia.Kind() == SyntaxKind.ShebangDirectiveTrivia; 47if (trivia.Kind() != SyntaxKind.MultiLineCommentTrivia) 58=> trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia; 61=> trivia.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia; 66if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 75else if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 148=> trivia.Kind() == SyntaxKind.EndOfLineTrivia; 151=> trivia.Kind() == SyntaxKind.WhitespaceTrivia; 203if (trivia.IsKind(SyntaxKind.PragmaWarningDirectiveTrivia)) 206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (8)
21.Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 38.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.WhitespaceTrivia)) 43=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia); 52if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 55t.Kind() is SyntaxKind.EndOfLineTrivia or 56SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\DefaultOperationProvider.cs (1)
45var space = currentToken.Kind() == SyntaxKind.EndOfFileToken ? 0 : 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (16)
37=> trivia.RawKind == (int)SyntaxKind.WhitespaceTrivia; 40=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 69if (trivia2.IsKind(SyntaxKind.None)) 90if (trivia2.IsKind(SyntaxKind.BadDirectiveTrivia) && existingWhitespaceBetween.Lines == 0 && !implicitLineBreak) 97var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 99if (trivia2.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia) 110if (previous.IsKind(SyntaxKind.DisabledTextTrivia)) 114else if (previous.IsKind(SyntaxKind.EndIfDirectiveTrivia)) 178if (trivia2.IsKind(SyntaxKind.SkippedTokensTrivia)) 198structuredTrivia.GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia); 210var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0); 220if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 334if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 363if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (9)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);) 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 101if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 105else if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 113else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 117else if (trivia.Kind() is SyntaxKind.DisabledTextTrivia or 118SyntaxKind.PreprocessingMessageTrivia) 122else if (trivia.Kind() == SyntaxKind.ConflictMarkerTrivia) 155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (18)
36Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 37Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia); 46if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 63if (trivia.Kind() == SyntaxKind.RegionDirectiveTrivia || 64trivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia || 78if (trivia.Kind() is SyntaxKind.SkippedTokensTrivia or 79SyntaxKind.PreprocessingMessageTrivia) 125if (trivia.Kind() != SyntaxKind.WhitespaceTrivia) 154if (trivia.Kind() != SyntaxKind.EndOfLineTrivia) 213if (trivia.Kind() is not SyntaxKind.SkippedTokensTrivia and 214not SyntaxKind.PreprocessingMessageTrivia) 224if (trivia.Kind() is not SyntaxKind.RegionDirectiveTrivia and 225not SyntaxKind.EndRegionDirectiveTrivia) 269trivia.Kind() == SyntaxKind.WhitespaceTrivia || 270trivia.Kind() == SyntaxKind.EndOfLineTrivia) 309if (trivia.IsKind(SyntaxKind.DisabledTextTrivia)) 332if (xmlTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (2)
53var formatSpanEnd = commonToken2.Kind() == SyntaxKind.None ? commonToken1.Span.End : commonToken2.Span.Start; 81var firstTriviaInTree = this.Token1.Kind() == SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
119if (trivia.Kind() == SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (95)
57if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 59bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 64if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 66return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 69if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 71return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 78=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.ConversionOperatorDeclaration); 81=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.OperatorDeclaration); 84=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 87=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 91return token.Kind() == SyntaxKind.OpenParenToken && 97return token.Kind() == SyntaxKind.CloseParenToken && 104if (token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList)) 110if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 120=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 123=> token.Kind() == SyntaxKind.CommaToken && (token.Parent.IsAnyArgumentList() || token.Parent?.Kind() is SyntaxKind.ParameterList or SyntaxKind.FunctionPointerParameterList); 126=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 130if (node.Kind() != SyntaxKind.Block) 135return node.Parent?.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression; 140if (node.Kind() != SyntaxKind.Block) 145return node.IsParentKind(SyntaxKind.AnonymousMethodExpression); 151token.Kind() == SyntaxKind.SemicolonToken && 158if (token.Kind() != SyntaxKind.SemicolonToken) 174if (token.Kind() != SyntaxKind.CloseBraceToken) 179return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 184if (token.Kind() != SyntaxKind.CloseBraceToken) 210return token.Kind() == SyntaxKind.CommaToken && 211token.Parent.IsKind(SyntaxKind.EnumDeclaration); 216return token.Kind() == SyntaxKind.CommaToken && 222return token.Kind() == SyntaxKind.CommaToken && 223token.Parent.IsKind(SyntaxKind.VariableDeclaration); 237case SyntaxKind.SizeOfExpression: 241case SyntaxKind.TypeOfExpression: 245case SyntaxKind.CheckedExpression: 246case SyntaxKind.UncheckedExpression: 250case SyntaxKind.DefaultExpression: 254case SyntaxKind.MakeRefExpression: 258case SyntaxKind.RefTypeExpression: 262case SyntaxKind.RefValueExpression: 266case SyntaxKind.ArgumentList: 270case SyntaxKind.AttributeArgumentList: 280return token.IsKind(SyntaxKind.EqualsToken) && 281token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 282token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 308=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 317return token.Kind() == SyntaxKind.DotToken 323if (token.Kind() == SyntaxKind.GreaterThanToken) 324return token.Parent is (kind: SyntaxKind.TypeParameterList or SyntaxKind.TypeArgumentList); 331return token.Kind() == SyntaxKind.CommaToken && 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent is CasePatternSwitchLabelSyntax; 340=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 346=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 350return token.Kind() == SyntaxKind.IdentifierToken && 360return token.Kind() == SyntaxKind.ColonToken && 377=> token.Kind() == SyntaxKind.InKeyword && token.Parent is FromClauseSyntax { Expression: QueryExpressionSyntax }; 381return token.Kind() == SyntaxKind.FromKeyword && 404if (expression.Kind() == SyntaxKind.SimpleAssignmentExpression) 432parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 451parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 466return (token1.Kind() == SyntaxKind.OpenParenToken && token2.Kind() == SyntaxKind.CloseParenToken) || 467(token1.Kind() == SyntaxKind.OpenBracketToken && token2.Kind() == SyntaxKind.CloseBracketToken); 472if (token.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 511if (token.Kind() is not SyntaxKind.PlusToken and not SyntaxKind.MinusToken) 520=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 527return currentToken.Kind() == SyntaxKind.OpenParenToken && currentToken is { Parent: ParenthesizedVariableDesignationSyntax, Parent.Parent: DeclarationExpressionSyntax }; 535return currentToken.IsKind(SyntaxKind.CommaToken) && 536currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 541return currentToken.IsKind(SyntaxKind.CommaToken) && 542currentToken.Parent.IsKind(SyntaxKind.TupleType); 547return currentToken.IsKind(SyntaxKind.CommaToken) && 548currentToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation); 552=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression); 559return !previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && !currentToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (3)
20if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression) 26if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (15)
24if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 37if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 51if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 65if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 80if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 116if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 126if (anchorToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 172else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (62)
115currentToken.IsKind(SyntaxKind.WhereKeyword) && 116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 130firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 142currentToken.IsKind(SyntaxKind.OpenBraceToken) && 143currentToken.Parent.IsParentKind(SyntaxKind.IfStatement)) 176if (previousToken.Kind() != SyntaxKind.SemicolonToken) 179if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 182if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 216if (previousMember.Kind() is SyntaxKind.FieldDeclaration or 217SyntaxKind.EventFieldDeclaration) 293if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 310if (currentToken.Kind() == SyntaxKind.None) 317case SyntaxKind.None: 320case SyntaxKind.OpenBraceToken: 321case SyntaxKind.FinallyKeyword: 324case SyntaxKind.CloseBraceToken: 327case SyntaxKind.CloseParenToken: 329|| currentToken.Kind() == SyntaxKind.OpenBraceToken) ? 1 : 0; 331case SyntaxKind.CloseBracketToken: 337(parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.AssemblyKeyword) || 338parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.ModuleKeyword))) 340if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax)) 355case SyntaxKind.SemicolonToken: 358case SyntaxKind.CommaToken: 361case SyntaxKind.ElseKeyword: 362return currentToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 364case SyntaxKind.ColonToken: 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))) 387case SyntaxKind.OpenBraceToken: 388case SyntaxKind.CloseBraceToken: 389case SyntaxKind.ElseKeyword: 390case SyntaxKind.FinallyKeyword: 393case SyntaxKind.OpenBracketToken: 399parent.Target.Identifier.Kind() is SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword && 416case SyntaxKind.WhereKeyword: 425if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 430nextToken.Kind() is SyntaxKind.CatchKeyword or 431SyntaxKind.FinallyKeyword or 432SyntaxKind.ElseKeyword) 437nextToken.Kind() == SyntaxKind.WhileKeyword && 438nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 442else if (nextToken.Kind() == SyntaxKind.EndOfFileToken) 458else if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 482return trivia.Kind() is SyntaxKind.WhitespaceTrivia 483or SyntaxKind.EndOfLineTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\EndOfFileTokenFormattingRule.cs (2)
17if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 29if (currentToken.Kind() == SyntaxKind.EndOfFileToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (7)
95var firstStatementIsBlock = section.Statements is [(kind: SyntaxKind.Block), ..]; 222if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock() || node.Kind() is SyntaxKind.PropertyPatternClause or SyntaxKind.SwitchExpression) 228if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression)) 262if (node.Parent != null && node.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (79)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 53case SyntaxKind.IfStatement: 54case SyntaxKind.ElseClause: 55case SyntaxKind.WhileStatement: 56case SyntaxKind.DoStatement: 57case SyntaxKind.ForEachStatement: 58case SyntaxKind.ForEachVariableStatement: 59case SyntaxKind.UsingStatement: 60case SyntaxKind.ForStatement: 61case SyntaxKind.TryStatement: 62case SyntaxKind.CatchClause: 63case SyntaxKind.FinallyClause: 64case SyntaxKind.LockStatement: 65case SyntaxKind.CheckedStatement: 66case SyntaxKind.UncheckedStatement: 67case SyntaxKind.SwitchSection: 68case SyntaxKind.FixedStatement: 69case SyntaxKind.UnsafeStatement: 83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken)) 132if (currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression 133or SyntaxKind.CollectionInitializerExpression 134or SyntaxKind.ArrayInitializerExpression 135or SyntaxKind.ImplicitArrayCreationExpression 136or SyntaxKind.WithInitializerExpression) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 153var isFirstTokenOfSwitchArm = currentToken.Parent.IsParentKind(SyntaxKind.RecursivePattern, out RecursivePatternSyntax? recursivePattern) 154&& recursivePattern.IsParentKind(SyntaxKind.SwitchExpressionArm, out SwitchExpressionArmSyntax? switchExpressionArm) 170if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 183if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 192if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 201if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 210if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 211currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 220if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 229if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 249if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 263if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 277if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 291if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 304if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 317if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 330if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 346if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 347currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression or SyntaxKind.WithInitializerExpression or SyntaxKind.PropertyPatternClause) 363if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 364currentToken.Parent.Kind() is SyntaxKind.ArrayInitializerExpression or SyntaxKind.ImplicitArrayCreationExpression) 374if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 418if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 431if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 432currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 445if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 458if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 473if (previousToken.IsKind(SyntaxKind.SemicolonToken) 474&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\QueryExpressionFormattingRule.cs (7)
169case SyntaxKind.FromKeyword: 170case SyntaxKind.WhereKeyword: 171case SyntaxKind.LetKeyword: 172case SyntaxKind.JoinKeyword: 173case SyntaxKind.OrderByKeyword: 174case SyntaxKind.GroupKeyword: 175case SyntaxKind.SelectKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (165)
47var previousKind = previousToken.Kind(); 48var currentKind = currentToken.Kind(); 49var previousParentKind = previousToken.Parent.Kind(); 50var currentParentKind = currentToken.Parent.Kind(); 53if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.IdentifierToken) 65if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.GreaterThanToken) 68if (currentToken.IsOpenParenInParameterListOfParenthesizedLambdaExpression() && previousParentKind == SyntaxKind.TypeArgumentList) 73if (previousParentKind == SyntaxKind.TypeParameterList) 85if ((previousToken.IsKeyword() || previousToken.Kind() is SyntaxKind.QuestionToken or SyntaxKind.AsteriskToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseParenToken or SyntaxKind.GreaterThanToken) 92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 137if (currentKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 142if (previousKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(previousParentKind)) 147if (currentKind == SyntaxKind.CloseParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 153if (currentKind == SyntaxKind.OpenParenToken && 154(previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || 155previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || 156previousKind == SyntaxKind.UsingKeyword || previousKind == SyntaxKind.WhenKeyword || previousKind == SyntaxKind.LockKeyword || 157previousKind == SyntaxKind.FixedKeyword)) 163if ((previousToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && previousKind == SyntaxKind.OpenParenToken) || 164(currentToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && currentKind == SyntaxKind.CloseParenToken)) 170if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || 171(currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) 177if (previousParentKind == SyntaxKind.ForStatement 180if (currentKind == SyntaxKind.SemicolonToken 181&& (previousKind != SyntaxKind.SemicolonToken 191if (previousKind == SyntaxKind.OpenParenToken && IsControlFlowLikeKeywordStatementKind(previousParentKind)) 196if (currentKind == SyntaxKind.CloseParenToken && IsControlFlowLikeKeywordStatementKind(currentParentKind)) 202if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) 208if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression) 211if (previousKind == SyntaxKind.CommaToken) 217if (previousKind is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken)) 224if (currentKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(currentToken) && !previousToken.IsOpenBraceOrCommaOfObjectInitializer()) 230if (((currentKind == SyntaxKind.CloseBracketToken && previousKind == SyntaxKind.OpenBracketToken) 231|| currentKind == SyntaxKind.OmittedArraySizeExpressionToken) 238if (previousKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(previousToken)) 243if (currentKind == SyntaxKind.CloseBracketToken && previousKind != SyntaxKind.OmittedArraySizeExpressionToken && HasFormattableBracketParent(currentToken)) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 252if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 259if (currentToken.IsKind(SyntaxKind.EndOfFileToken)) 292bool IsCommaWithCustomSpacing(SyntaxToken previousToken, SyntaxToken currentToken, SyntaxKind currentKind, SyntaxKind previousKind, bool checkPreviousToken) 295var tokenKind = checkPreviousToken ? previousKind : currentKind; 296var otherKind = checkPreviousToken ? currentKind : previousKind; 298return (token.IsCommaInArgumentOrParameterList() && otherKind != SyntaxKind.OmittedTypeArgumentToken) 304|| (tokenKind == SyntaxKind.CommaToken 305&& otherKind != SyntaxKind.OmittedArraySizeExpressionToken 322if (previousToken.IsSemicolonInForStatement() && currentKind != SyntaxKind.CloseParenToken) 338currentToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern || 339previousToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern) 346if (currentKind == SyntaxKind.IsKeyword || 347currentKind == SyntaxKind.AsKeyword || 348currentKind == SyntaxKind.AndKeyword || 349currentKind == SyntaxKind.OrKeyword || 350previousKind == SyntaxKind.IsKeyword || 351previousKind == SyntaxKind.AsKeyword || 352previousKind == SyntaxKind.AndKeyword || 353previousKind == SyntaxKind.OrKeyword) 371if (previousParentKind == SyntaxKind.FunctionPointerType) 374if (currentKind == SyntaxKind.AsteriskToken && previousKind == SyntaxKind.DelegateKeyword) 380if (previousKind == SyntaxKind.AsteriskToken && currentParentKind == SyntaxKind.FunctionPointerCallingConvention) 384case SyntaxKind.IdentifierToken: 385case SyntaxKind.ManagedKeyword: 386case SyntaxKind.UnmanagedKeyword: 392if (currentParentKind == SyntaxKind.FunctionPointerParameterList && currentKind == SyntaxKind.LessThanToken) 397case SyntaxKind.AsteriskToken: 400case SyntaxKind.ManagedKeyword: 401case SyntaxKind.UnmanagedKeyword: 404case SyntaxKind.CloseBracketToken when previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList: 411if (previousParentKind == SyntaxKind.FunctionPointerCallingConvention && currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && currentKind == SyntaxKind.OpenBracketToken) 417if (currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList) 419if (currentKind == SyntaxKind.IdentifierToken) 423if (previousKind == SyntaxKind.OpenBracketToken) 429else if (previousKind == SyntaxKind.CommaToken) 437if (currentKind == SyntaxKind.CommaToken) 444if (currentKind == SyntaxKind.CloseBracketToken) 452if (previousKind == SyntaxKind.LessThanToken && previousParentKind == SyntaxKind.FunctionPointerParameterList) 459if (currentKind == SyntaxKind.GreaterThanToken && currentParentKind == SyntaxKind.FunctionPointerParameterList) 465if (previousToken.Parent.IsKind(SyntaxKind.NotPattern)) 472if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.SlicePattern) 478if (previousKind is SyntaxKind.InterpolatedStringStartToken or 479SyntaxKind.InterpolatedVerbatimStringStartToken or 480SyntaxKind.InterpolatedSingleLineRawStringStartToken or 481SyntaxKind.InterpolatedMultiLineRawStringStartToken) 487if (currentKind is SyntaxKind.InterpolatedStringEndToken or 488SyntaxKind.InterpolatedRawStringEndToken) 494if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || 495(previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) 501if (previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) 507if (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax interpolation) 518if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is InterpolationAlignmentClauseSyntax) || 519(currentKind == SyntaxKind.CommaToken && currentToken.Parent is InterpolationAlignmentClauseSyntax)) 525if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is InterpolationFormatClauseSyntax) || 526(currentKind == SyntaxKind.ColonToken && currentToken.Parent is InterpolationFormatClauseSyntax)) 538if (previousKind == SyntaxKind.CaretToken && previousParentKind == SyntaxKind.IndexExpression) 544if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.RangeExpression) 555if (currentKind == SyntaxKind.DotDotToken && currentParentKind == SyntaxKind.RangeExpression) 581is SyntaxKind.FieldDeclaration 582or SyntaxKind.EventDeclaration 583or SyntaxKind.EventFieldDeclaration 584or SyntaxKind.LocalDeclarationStatement 585or SyntaxKind.EnumMemberDeclaration) 610=> token.Parent is (kind: SyntaxKind.ArrayRankSpecifier or SyntaxKind.BracketedArgumentList or SyntaxKind.BracketedParameterList or SyntaxKind.ImplicitArrayCreationExpression or SyntaxKind.ListPattern or SyntaxKind.CollectionExpression); 612private static bool IsFunctionLikeKeywordExpressionKind(SyntaxKind syntaxKind) 613=> (syntaxKind is SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression); 615private static bool IsControlFlowLikeKeywordStatementKind(SyntaxKind syntaxKind) 617return syntaxKind is SyntaxKind.IfStatement or SyntaxKind.WhileStatement or SyntaxKind.SwitchStatement or 618SyntaxKind.ForStatement or SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement or 619SyntaxKind.DoStatement or 620SyntaxKind.CatchDeclaration or SyntaxKind.UsingStatement or SyntaxKind.LockStatement or 621SyntaxKind.FixedStatement or SyntaxKind.CatchFilterClause;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\StructuredTriviaFormattingRule.cs (8)
31((previousToken.Kind() == SyntaxKind.HashToken && currentToken.Kind() == SyntaxKind.ColonToken) || 32(previousToken.Kind() == SyntaxKind.ColonToken && currentToken.Kind() == SyntaxKind.StringLiteralToken))) 38if (previousToken.Kind() == SyntaxKind.HashToken && SyntaxFacts.IsPreprocessorKeyword(currentToken.Kind())) 43if (previousToken.Kind() == SyntaxKind.RegionKeyword && currentToken.Kind() == SyntaxKind.EndOfDirectiveToken) 48if (currentToken.Kind() == SyntaxKind.EndOfDirectiveToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (8)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression)) 257if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 314if (!IsFormatDirective(pragmaWarningDirectiveTrivia, SyntaxKind.DisableKeyword)) 321var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword)); 326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 332private static bool IsFormatDirective(DirectiveTriviaSyntax? trivia, SyntaxKind disableOrRestoreKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (101)
52case SyntaxKind.OpenBraceToken: 61case SyntaxKind.CloseBraceToken: 69if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword) 77case SyntaxKind.CloseBraceToken: 83if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 103case SyntaxKind.OpenBraceToken: 144if (previousToken.Kind() == SyntaxKind.ElseKeyword) 146var isElseIfOnSameLine = currentToken.Kind() == SyntaxKind.IfKeyword && FormattingHelpers.AreOnSameLine(previousToken, currentToken); 165if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 170if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 182if (previousToken.Kind() == SyntaxKind.SemicolonToken && 183(currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword)) 189if (previousToken.Kind() == SyntaxKind.SemicolonToken) 194if (currentToken.Kind() == SyntaxKind.SemicolonToken && 203if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 301if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) 315if (currentToken.Kind() == SyntaxKind.SemicolonToken) 318if (previousToken.Kind() == SyntaxKind.SemicolonToken) 322if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 330if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 331previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken || 332currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 333currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken) 338if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 339previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 340previousToken.Parent.IsParentKind(SyntaxKind.Parameter)) 342if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 358if (currentToken.Kind() == SyntaxKind.OpenParenToken && 359previousToken.Kind() == SyntaxKind.ThisKeyword) 364if (previousToken.Kind() == SyntaxKind.NewKeyword) 369SyntaxKind.ConstructorConstraint or 370SyntaxKind.ImplicitObjectCreationExpression or 371SyntaxKind.ImplicitArrayCreationExpression) ? 0 : 1; 376if (currentToken.Kind() == SyntaxKind.OpenParenToken) 379is SyntaxKind.IdentifierToken 380or SyntaxKind.DefaultKeyword 381or SyntaxKind.BaseKeyword 382or SyntaxKind.ThisKeyword 384or SyntaxKind.ExtensionKeyword 401if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax) 407if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 420case SyntaxKind.CloseParenToken: 421case SyntaxKind.CloseBracketToken: 422case SyntaxKind.CommaToken: 423case SyntaxKind.DotToken: 424case SyntaxKind.MinusGreaterThanToken: 429if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 430currentToken.Parent?.Kind() is not SyntaxKind.CollectionExpression and not SyntaxKind.AttributeList && 448if (currentToken.IsKind(SyntaxKind.ColonToken) && 450SyntaxKind.AttributeTargetSpecifier or 451SyntaxKind.CaseSwitchLabel or 452SyntaxKind.CasePatternSwitchLabel or 453SyntaxKind.DefaultSwitchLabel or 454SyntaxKind.ExpressionColon or 458SyntaxKind.LabeledStatement or 459SyntaxKind.NameColon or 460SyntaxKind.SwitchExpressionArm)) 467previousToken.Kind() == SyntaxKind.CloseParenToken) 473if (previousToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList or SyntaxKind.FunctionPointerType)) 476if (previousToken.Kind() == SyntaxKind.LessThanToken) 482if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken) 489if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) && 490currentToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList)) 496if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) && 503if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) && 510if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 516if (currentToken.Kind() == SyntaxKind.QuestionToken && 517currentToken.Parent is (kind: SyntaxKind.NullableType or SyntaxKind.ClassConstraint)) 523if (currentToken.IsKind(SyntaxKind.QuestionToken) && 524previousToken.Parent?.IsParentKind(SyntaxKind.ArrayType) == true) 530if (currentToken.Kind() == SyntaxKind.ExclamationToken && 531currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 537if (currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) 543if (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax) 551case SyntaxKind.OpenParenToken: 552case SyntaxKind.OpenBracketToken: 553case SyntaxKind.DotToken: 554case SyntaxKind.MinusGreaterThanToken: 557case SyntaxKind.CloseParenToken: 558case SyntaxKind.CloseBracketToken: 577if (previousToken.Kind() == SyntaxKind.ExclamationToken 578&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 584if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax or DestructorDeclarationSyntax)) 590if (previousToken.Kind() == SyntaxKind.AmpersandToken && 597if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (9)
70if (embeddedStatement.IsKind(SyntaxKind.Block)) 91if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 99if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 112if (!(node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block)) 121if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None)) 179if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (14)
47Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 48Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 71return endToken.IsKind(SyntaxKind.CloseBraceToken) && 72endToken.Parent.IsKind(SyntaxKind.Block) && 73endToken.Parent.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.DoStatement; 78Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 82if (previousToken.Kind() == SyntaxKind.None) 93if (token.IsKind(SyntaxKind.OpenBraceToken) && 98if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 107if (token.IsKind(SyntaxKind.OpenBraceToken) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (13)
245modifiers.Any(SyntaxKind.PartialKeyword)) 286AssignmentExpressionSyntax _ when token.Kind() == SyntaxKind.EqualsToken => GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(), 287ForEachVariableStatementSyntax _ when token.Kind() == SyntaxKind.InKeyword => GetDeconstructionForEachMethods(semanticModel, node).As<ISymbol>(), 310if (token.Kind() == SyntaxKind.CommaToken) 320if (ordering.AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 324else if (orderByClauseSyntax.Orderings[0].AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 343return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 369if (token.IsKind(SyntaxKind.CommaToken)) 479SyntaxKind.IfDirectiveTrivia or 480SyntaxKind.ElifDirectiveTrivia or 481SyntaxKind.DefineDirectiveTrivia or 482SyntaxKind.UndefDirectiveTrivia); 501if (!token.IsKind(SyntaxKind.IdentifierToken) ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (53)
24case SyntaxKind.ClassDeclaration: 25case SyntaxKind.RecordDeclaration: 26case SyntaxKind.StructDeclaration: 27case SyntaxKind.RecordStructDeclaration: 28case SyntaxKind.InterfaceDeclaration: 29case SyntaxKind.EnumDeclaration: 30case SyntaxKind.DelegateDeclaration: 31return ignoreDeclarationModifiers || !((MemberDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.FileKeyword); 33case SyntaxKind.FieldDeclaration: 34case SyntaxKind.EventFieldDeclaration: 35case SyntaxKind.GetAccessorDeclaration: 36case SyntaxKind.SetAccessorDeclaration: 37case SyntaxKind.InitAccessorDeclaration: 38case SyntaxKind.AddAccessorDeclaration: 39case SyntaxKind.RemoveAccessorDeclaration: 42case SyntaxKind.VariableDeclaration: 45case SyntaxKind.VariableDeclarator: 48case SyntaxKind.ConstructorDeclaration: 50return ignoreDeclarationModifiers || !((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword); 52case SyntaxKind.PropertyDeclaration: 55case SyntaxKind.IndexerDeclaration: 58case SyntaxKind.OperatorDeclaration: 61case SyntaxKind.ConversionOperatorDeclaration: 64case SyntaxKind.MethodDeclaration: 72if (method.Modifiers.Any(SyntaxKind.PartialKeyword)) 80case SyntaxKind.EventDeclaration: 108(SyntaxKind.PublicKeyword, _) => Accessibility.Public, 110(SyntaxKind.PrivateKeyword, Accessibility.Protected) => Accessibility.ProtectedAndInternal, 111(SyntaxKind.PrivateKeyword, _) => Accessibility.Private, 113(SyntaxKind.InternalKeyword, Accessibility.Protected) => Accessibility.ProtectedOrInternal, 114(SyntaxKind.InternalKeyword, _) => Accessibility.Internal, 116(SyntaxKind.ProtectedKeyword, Accessibility.Private) => Accessibility.ProtectedAndInternal, 117(SyntaxKind.ProtectedKeyword, Accessibility.Internal) => Accessibility.ProtectedOrInternal, 118(SyntaxKind.ProtectedKeyword, _) => Accessibility.Protected, 125SyntaxKind.AbstractKeyword => Modifiers.Abstract, 126SyntaxKind.NewKeyword => Modifiers.New, 127SyntaxKind.OverrideKeyword => Modifiers.Override, 128SyntaxKind.VirtualKeyword => Modifiers.Virtual, 129SyntaxKind.StaticKeyword => Modifiers.Static, 130SyntaxKind.AsyncKeyword => Modifiers.Async, 131SyntaxKind.ConstKeyword => Modifiers.Const, 132SyntaxKind.ReadOnlyKeyword => Modifiers.ReadOnly, 133SyntaxKind.SealedKeyword => Modifiers.Sealed, 134SyntaxKind.UnsafeKeyword => Modifiers.Unsafe, 135SyntaxKind.PartialKeyword => Modifiers.Partial, 136SyntaxKind.RefKeyword => Modifiers.Ref, 137SyntaxKind.VolatileKeyword => Modifiers.Volatile, 138SyntaxKind.ExternKeyword => Modifiers.Extern, 139SyntaxKind.FileKeyword => Modifiers.File, 141SyntaxKind.ClosedKeyword => Modifiers.Closed, 143SyntaxKind.RequiredKeyword => Modifiers.Required, 144SyntaxKind.FixedKeyword => Modifiers.Fixed, 148isDefault |= token.Kind() == SyntaxKind.DefaultKeyword;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (4)
22=> node.IsKind(SyntaxKind.Block); 25=> node is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.CompilationUnit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (4)
22=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (175)
101var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 110var kind = token.Kind(); 149if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword) 154else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken && 201=> node is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList); 222=> node is LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not (int)SyntaxKind.None }; 268=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.ThisConstructorInitializer) constructorInit && 272=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.BaseConstructorInitializer) constructorInit && 282case SyntaxKind.FromKeyword: 283case SyntaxKind.JoinKeyword: 284case SyntaxKind.LetKeyword: 285case SyntaxKind.OrderByKeyword: 286case SyntaxKind.WhereKeyword: 287case SyntaxKind.OnKeyword: 288case SyntaxKind.EqualsKeyword: 289case SyntaxKind.InKeyword: 291case SyntaxKind.ByKeyword: 292case SyntaxKind.GroupKeyword: 293case SyntaxKind.SelectKeyword: 295case SyntaxKind.AscendingKeyword: 296case SyntaxKind.DescendingKeyword: 298case SyntaxKind.IntoKeyword: 299return token.Parent is (kind: SyntaxKind.JoinIntoClause or SyntaxKind.QueryContinuation); 326SyntaxKind.BoolKeyword => PredefinedType.Boolean, 327SyntaxKind.ByteKeyword => PredefinedType.Byte, 328SyntaxKind.SByteKeyword => PredefinedType.SByte, 329SyntaxKind.IntKeyword => PredefinedType.Int32, 330SyntaxKind.UIntKeyword => PredefinedType.UInt32, 331SyntaxKind.ShortKeyword => PredefinedType.Int16, 332SyntaxKind.UShortKeyword => PredefinedType.UInt16, 333SyntaxKind.LongKeyword => PredefinedType.Int64, 334SyntaxKind.ULongKeyword => PredefinedType.UInt64, 335SyntaxKind.FloatKeyword => PredefinedType.Single, 336SyntaxKind.DoubleKeyword => PredefinedType.Double, 337SyntaxKind.DecimalKeyword => PredefinedType.Decimal, 338SyntaxKind.StringKeyword => PredefinedType.String, 339SyntaxKind.CharKeyword => PredefinedType.Char, 340SyntaxKind.ObjectKeyword => PredefinedType.Object, 341SyntaxKind.VoidKeyword => PredefinedType.Void, 342SyntaxKind.IdentifierToken => token.Text switch 365switch ((SyntaxKind)token.RawKind) 367case SyntaxKind.PlusToken: 368case SyntaxKind.PlusEqualsToken: 371case SyntaxKind.MinusToken: 372case SyntaxKind.MinusEqualsToken: 375case SyntaxKind.AmpersandAmpersandToken: // overridden bitwise & can be accessed through && 376case SyntaxKind.AmpersandToken: 377case SyntaxKind.AmpersandEqualsToken: 380case SyntaxKind.BarBarToken: // overridden bitwise | can be accessed through || 381case SyntaxKind.BarToken: 382case SyntaxKind.BarEqualsToken: 385case SyntaxKind.MinusMinusToken: 388case SyntaxKind.PlusPlusToken: 391case SyntaxKind.SlashToken: 392case SyntaxKind.SlashEqualsToken: 395case SyntaxKind.EqualsEqualsToken: 398case SyntaxKind.CaretToken: 399case SyntaxKind.CaretEqualsToken: 402case SyntaxKind.GreaterThanToken: 405case SyntaxKind.GreaterThanEqualsToken: 408case SyntaxKind.ExclamationEqualsToken: 411case SyntaxKind.LessThanLessThanToken: 412case SyntaxKind.LessThanLessThanEqualsToken: 415case SyntaxKind.LessThanToken: 418case SyntaxKind.LessThanEqualsToken: 421case SyntaxKind.AsteriskToken: 422case SyntaxKind.AsteriskEqualsToken: 425case SyntaxKind.PercentToken: 426case SyntaxKind.PercentEqualsToken: 429case SyntaxKind.ExclamationToken: 430case SyntaxKind.TildeToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanEqualsToken: 437case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 438case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 446=> SyntaxFacts.GetText((SyntaxKind)kind); 478case SyntaxKind.NumericLiteralToken: 479case SyntaxKind.CharacterLiteralToken: 480case SyntaxKind.StringLiteralToken: 481case SyntaxKind.Utf8StringLiteralToken: 482case SyntaxKind.SingleLineRawStringLiteralToken: 483case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 484case SyntaxKind.MultiLineRawStringLiteralToken: 485case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 486case SyntaxKind.NullKeyword: 487case SyntaxKind.TrueKeyword: 488case SyntaxKind.FalseKeyword: 489case SyntaxKind.InterpolatedStringStartToken: 490case SyntaxKind.InterpolatedStringEndToken: 491case SyntaxKind.InterpolatedRawStringEndToken: 492case SyntaxKind.InterpolatedVerbatimStringStartToken: 493case SyntaxKind.InterpolatedStringTextToken: 494case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 495case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 503=> token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken; 511case SyntaxKind.DelegateKeyword: 512case SyntaxKind.VoidKeyword: 520if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 523if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken) 525if (token.Parent.IsKind(SyntaxKind.CollectionExpression)) 545=> (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression; 555=> simpleName.IsKind(SyntaxKind.GenericName) || 556simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken; 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 607argument.RefOrOutKeyword.Kind() == SyntaxKind.None && 635=> node.IsKind(SyntaxKind.IdentifierName) && 636node.IsParentKind(SyntaxKind.NameColon) && 637node.Parent.IsParentKind(SyntaxKind.Subpattern); 640=> node.Kind() == SyntaxKind.PropertyPatternClause; 649if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression)) 655else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression)) 663else if (objectInitializer?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 694=> node.IsKind(SyntaxKind.ElementAccessExpression); 724var kind = node.Kind(); 725if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is TMemberDeclarationSyntax)) 816case SyntaxKind.CompilationUnit: 818case SyntaxKind.IdentifierName: 821case SyntaxKind.IncompleteMember: 823case SyntaxKind.NamespaceDeclaration: 824case SyntaxKind.FileScopedNamespaceDeclaration: 826case SyntaxKind.QualifiedName: 840if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration) 865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 1016if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1022if (token.Kind() == SyntaxKind.EndOfFileToken) 1091=> node?.Parent?.Kind() is SyntaxKind.PostIncrementExpression or SyntaxKind.PreIncrementExpression; 1094=> node?.Parent?.Kind() is SyntaxKind.PostDecrementExpression or SyntaxKind.PreDecrementExpression; 1107SyntaxKind.SingleLineRawStringLiteralToken or 1108SyntaxKind.MultiLineRawStringLiteralToken or 1109SyntaxKind.Utf8SingleLineRawStringLiteralToken or 1110SyntaxKind.Utf8MultiLineRawStringLiteralToken; 1113=> token.Kind() == SyntaxKind.NumericLiteralToken; 1139=> trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia; 1145=> node?.Kind() is SyntaxKind.UsingDirective or SyntaxKind.ExternAliasDirective; 1148=> IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword); 1151=> IsGlobalAttribute(node, SyntaxKind.ModuleKeyword); 1153private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget) 1154=> node.IsKind(SyntaxKind.Attribute) && 1183case SyntaxKind.VariableDeclarator: 1184return node.Parent?.Parent?.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration; 1186case SyntaxKind.FieldDeclaration: 1187case SyntaxKind.MethodDeclaration: 1188case SyntaxKind.PropertyDeclaration: 1189case SyntaxKind.GetAccessorDeclaration: 1190case SyntaxKind.SetAccessorDeclaration: 1191case SyntaxKind.EventDeclaration: 1192case SyntaxKind.EventFieldDeclaration: 1193case SyntaxKind.AddAccessorDeclaration: 1194case SyntaxKind.RemoveAccessorDeclaration: 1195case SyntaxKind.IndexerDeclaration: 1196case SyntaxKind.OperatorDeclaration: 1197case SyntaxKind.ConversionOperatorDeclaration: 1198case SyntaxKind.ConstructorDeclaration: 1199case SyntaxKind.DestructorDeclaration: 1211=> node is ExpressionStatementSyntax { Expression: (kind: SyntaxKind.SimpleAssignmentExpression) }; 1332if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member) 1440=> node is InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedVerbatimStringStartToken) }; 1482=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: IdentifierNameSyntax }; 1485=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: ImplicitElementAccessSyntax }; 1488=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression); 1491=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression); 1687=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) initExpr ? initExpr.Expressions : default; 1690=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression) initExpr ? initExpr.Expressions : default;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (151)
19=> (TSyntaxKind)(object)(SyntaxKind)kind; 23=> (int)(SyntaxKind)(object)kind; 25public int ConflictMarkerTrivia => (int)SyntaxKind.ConflictMarkerTrivia; 26public int DisabledTextTrivia => (int)SyntaxKind.DisabledTextTrivia; 27public int EndOfLineTrivia => (int)SyntaxKind.EndOfLineTrivia; 28public int SkippedTokensTrivia => (int)SyntaxKind.SkippedTokensTrivia; 29public int WhitespaceTrivia => (int)SyntaxKind.WhitespaceTrivia; 30public int SingleLineCommentTrivia => (int)SyntaxKind.SingleLineCommentTrivia; 31public int? MultiLineCommentTrivia => (int)SyntaxKind.MultiLineCommentTrivia; 32public int SingleLineDocCommentTrivia => (int)SyntaxKind.SingleLineDocumentationCommentTrivia; 33public int? MultiLineDocCommentTrivia => (int)SyntaxKind.MultiLineDocumentationCommentTrivia; 35public int IfDirectiveTrivia => (int)SyntaxKind.IfDirectiveTrivia; 36public int ElifDirectiveTrivia => (int)SyntaxKind.ElifDirectiveTrivia; 37public int ElseDirectiveTrivia => (int)SyntaxKind.ElseDirectiveTrivia; 38public int EndIfDirectiveTrivia => (int)SyntaxKind.EndIfDirectiveTrivia; 39public int RegionDirectiveTrivia => (int)SyntaxKind.RegionDirectiveTrivia; 40public int EndRegionDirectiveTrivia => (int)SyntaxKind.EndRegionDirectiveTrivia; 41public int? ShebangDirectiveTrivia => (int)SyntaxKind.ShebangDirectiveTrivia; 42public int DefineDirectiveTrivia => (int)SyntaxKind.DefineDirectiveTrivia; 43public int? UndefDirectiveTrivia => (int)SyntaxKind.UndefDirectiveTrivia; 45public int CloseBraceToken => (int)SyntaxKind.CloseBraceToken; 46public int? CloseBracketToken => (int)SyntaxKind.CloseBracketToken; 47public int CloseParenToken => (int)SyntaxKind.CloseParenToken; 48public int CommaToken => (int)SyntaxKind.CommaToken; 49public int ColonToken => (int)SyntaxKind.ColonToken; 50public int CharacterLiteralToken => (int)SyntaxKind.CharacterLiteralToken; 51public int DotToken => (int)SyntaxKind.DotToken; 52public int GreaterThanToken => (int)SyntaxKind.GreaterThanToken; 53public int InterpolatedStringTextToken => (int)SyntaxKind.InterpolatedStringTextToken; 54public int LessThanToken => (int)SyntaxKind.LessThanToken; 55public int LessThanSlashToken => (int)SyntaxKind.LessThanSlashToken; 56public int OpenBraceToken => (int)SyntaxKind.OpenBraceToken; 57public int? OpenBracketToken => (int)SyntaxKind.OpenBracketToken; 58public int OpenParenToken => (int)SyntaxKind.OpenParenToken; 59public int QuestionToken => (int)SyntaxKind.QuestionToken; 60public int StringLiteralToken => (int)SyntaxKind.StringLiteralToken; 61public int? SingleLineRawStringLiteralToken => (int)SyntaxKind.SingleLineRawStringLiteralToken; 62public int? MultiLineRawStringLiteralToken => (int)SyntaxKind.MultiLineRawStringLiteralToken; 63public int? Utf8StringLiteralToken => (int)SyntaxKind.Utf8StringLiteralToken; 64public int? Utf8SingleLineRawStringLiteralToken => (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken; 65public int? Utf8MultiLineRawStringLiteralToken => (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 67public int XmlCrefAttribute => (int)SyntaxKind.XmlCrefAttribute; 68public int XmlTextLiteralToken => (int)SyntaxKind.XmlTextLiteralToken; 70public int DelegateKeyword => (int)SyntaxKind.DelegateKeyword; 71public int FalseKeyword => (int)SyntaxKind.FalseKeyword; 72public int IfKeyword => (int)SyntaxKind.IfKeyword; 73public int NewKeyword => (int)SyntaxKind.NewKeyword; 74public int PartialKeyword => (int)SyntaxKind.PartialKeyword; 75public int TrueKeyword => (int)SyntaxKind.TrueKeyword; 76public int UsingKeyword => (int)SyntaxKind.UsingKeyword; 78public int? AliasQualifiedName => (int)SyntaxKind.AliasQualifiedName; 79public int GenericName => (int)SyntaxKind.GenericName; 80public int IdentifierName => (int)SyntaxKind.IdentifierName; 81public int QualifiedName => (int)SyntaxKind.QualifiedName; 83public int TupleType => (int)SyntaxKind.TupleType; 85public int CharacterLiteralExpression => (int)SyntaxKind.CharacterLiteralExpression; 86public int DefaultLiteralExpression => (int)SyntaxKind.DefaultLiteralExpression; 87public int FalseLiteralExpression => (int)SyntaxKind.FalseLiteralExpression; 88public int NullLiteralExpression => (int)SyntaxKind.NullLiteralExpression; 89public int NumericLiteralExpression => (int)SyntaxKind.NumericLiteralExpression; 90public int StringLiteralExpression => (int)SyntaxKind.StringLiteralExpression; 91public int TrueLiteralExpression => (int)SyntaxKind.TrueLiteralExpression; 93public int AddExpression => (int)SyntaxKind.AddExpression; 94public int AddressOfExpression => (int)SyntaxKind.AddressOfExpression; 95public int AnonymousObjectCreationExpression => (int)SyntaxKind.AnonymousObjectCreationExpression; 96public int ArrayCreationExpression => (int)SyntaxKind.ArrayCreationExpression; 97public int AwaitExpression => (int)SyntaxKind.AwaitExpression; 98public int BaseExpression => (int)SyntaxKind.BaseExpression; 99public int? CollectionExpression => (int)SyntaxKind.CollectionExpression; 100public int CollectionInitializerExpression => (int)SyntaxKind.CollectionInitializerExpression; 101public int ConditionalAccessExpression => (int)SyntaxKind.ConditionalAccessExpression; 102public int ConditionalExpression => (int)SyntaxKind.ConditionalExpression; 103public int? FieldExpression => (int)SyntaxKind.FieldExpression; 104public int? ImplicitArrayCreationExpression => (int)SyntaxKind.ImplicitArrayCreationExpression; 105public int? ImplicitObjectCreationExpression => (int)SyntaxKind.ImplicitObjectCreationExpression; 106public int? IndexExpression => (int)SyntaxKind.IndexExpression; 107public int InvocationExpression => (int)SyntaxKind.InvocationExpression; 108public int? IsPatternExpression => (int)SyntaxKind.IsPatternExpression; 109public int IsTypeExpression => (int)SyntaxKind.IsExpression; 111public int LogicalAndExpression => (int)SyntaxKind.LogicalAndExpression; 112public int LogicalOrExpression => (int)SyntaxKind.LogicalOrExpression; 113public int LogicalNotExpression => (int)SyntaxKind.LogicalNotExpression; 114public int ObjectCreationExpression => (int)SyntaxKind.ObjectCreationExpression; 115public int ParenthesizedExpression => (int)SyntaxKind.ParenthesizedExpression; 116public int QueryExpression => (int)SyntaxKind.QueryExpression; 117public int? RangeExpression => (int)SyntaxKind.RangeExpression; 118public int? RefExpression => (int)SyntaxKind.RefExpression; 119public int ReferenceEqualsExpression => (int)SyntaxKind.EqualsExpression; 120public int ReferenceNotEqualsExpression => (int)SyntaxKind.NotEqualsExpression; 121public int SimpleAssignmentExpression => (int)SyntaxKind.SimpleAssignmentExpression; 122public int SimpleMemberAccessExpression => (int)SyntaxKind.SimpleMemberAccessExpression; 123public int? SizeOfExpression => (int)SyntaxKind.SizeOfExpression; 124public int? SuppressNullableWarningExpression => (int)SyntaxKind.SuppressNullableWarningExpression; 125public int TernaryConditionalExpression => (int)SyntaxKind.ConditionalExpression; 126public int ThisExpression => (int)SyntaxKind.ThisExpression; 127public int? ThrowExpression => (int)SyntaxKind.ThrowExpression; 128public int TupleExpression => (int)SyntaxKind.TupleExpression; 129public int TypeOfExpression => (int)SyntaxKind.TypeOfExpression; 131public int? AndPattern => (int)SyntaxKind.AndPattern; 132public int? ConstantPattern => (int)SyntaxKind.ConstantPattern; 133public int? DeclarationPattern => (int)SyntaxKind.DeclarationPattern; 134public int? ListPattern => (int)SyntaxKind.ListPattern; 135public int? NotPattern => (int)SyntaxKind.NotPattern; 136public int? OrPattern => (int)SyntaxKind.OrPattern; 137public int? ParenthesizedPattern => (int)SyntaxKind.ParenthesizedPattern; 138public int? RecursivePattern => (int)SyntaxKind.RecursivePattern; 139public int? RelationalPattern => (int)SyntaxKind.RelationalPattern; 140public int? TypePattern => (int)SyntaxKind.TypePattern; 141public int? VarPattern => (int)SyntaxKind.VarPattern; 143public int EndOfFileToken => (int)SyntaxKind.EndOfFileToken; 144public int AwaitKeyword => (int)SyntaxKind.AwaitKeyword; 145public int AsyncKeyword => (int)SyntaxKind.AsyncKeyword; 146public int IdentifierToken => (int)SyntaxKind.IdentifierToken; 147public int GlobalKeyword => (int)SyntaxKind.GlobalKeyword; 148public int IncompleteMember => (int)SyntaxKind.IncompleteMember; 149public int HashToken => (int)SyntaxKind.HashToken; 151public int ExpressionStatement => (int)SyntaxKind.ExpressionStatement; 152public int ForEachStatement => (int)SyntaxKind.ForEachStatement; 153public int ForStatement => (int)SyntaxKind.ForStatement; 154public int IfStatement => (int)SyntaxKind.IfStatement; 155public int LocalDeclarationStatement => (int)SyntaxKind.LocalDeclarationStatement; 156public int? LocalFunctionStatement => (int)SyntaxKind.LocalFunctionStatement; 157public int LockStatement => (int)SyntaxKind.LockStatement; 158public int ReturnStatement => (int)SyntaxKind.ReturnStatement; 159public int ThrowStatement => (int)SyntaxKind.ThrowStatement; 160public int UsingStatement => (int)SyntaxKind.UsingStatement; 161public int WhileStatement => (int)SyntaxKind.WhileStatement; 162public int YieldReturnStatement => (int)SyntaxKind.YieldReturnStatement; 163public int Attribute => (int)SyntaxKind.Attribute; 164public int ClassDeclaration => (int)SyntaxKind.ClassDeclaration; 165public int ConstructorDeclaration => (int)SyntaxKind.ConstructorDeclaration; 166public int EnumDeclaration => (int)SyntaxKind.EnumDeclaration; 167public int InterfaceDeclaration => (int)SyntaxKind.InterfaceDeclaration; 168public int? StructDeclaration => (int)SyntaxKind.StructDeclaration; 169public int Parameter => (int)SyntaxKind.Parameter; 170public int TypeConstraint => (int)SyntaxKind.TypeConstraint; 171public int VariableDeclarator => (int)SyntaxKind.VariableDeclarator; 172public int FieldDeclaration => (int)SyntaxKind.FieldDeclaration; 173public int PropertyDeclaration => (int)SyntaxKind.PropertyDeclaration; 174public int ParameterList => (int)SyntaxKind.ParameterList; 175public int TypeArgumentList => (int)SyntaxKind.TypeArgumentList; 176public int? GlobalStatement => (int)SyntaxKind.GlobalStatement; 178public int ElseClause => (int)SyntaxKind.ElseClause; 179public int EqualsValueClause => (int)SyntaxKind.EqualsValueClause; 181public int? ExpressionElement => (int)SyntaxKind.ExpressionElement; 182public int? ImplicitElementAccess => (int)SyntaxKind.ImplicitElementAccess; 183public int Interpolation => (int)SyntaxKind.Interpolation; 184public int InterpolatedStringExpression => (int)SyntaxKind.InterpolatedStringExpression; 185public int InterpolatedStringText => (int)SyntaxKind.InterpolatedStringText; 186public int? IndexerMemberCref => (int)SyntaxKind.IndexerMemberCref; 187public int? PrimaryConstructorBaseType => (int)SyntaxKind.PrimaryConstructorBaseType;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
14if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (21)
56return cast.Kind() == SyntaxKind.AsExpression && 126if (leftOrRightChild.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) binary) 160if (castExpression.WalkUpParentheses().Parent is PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression) parent && 187var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 231if (castSyntax.WalkUpParentheses().GetRequiredParent().Kind() is SyntaxKind.BitwiseOrExpression or SyntaxKind.OrAssignmentExpression) 334var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 504if (castNode.WalkUpParentheses().Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) isExpression && 570if (castNode.IsParentKind(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object) 815if (parent is not PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression)) 820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 947if (armExpression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 998if (castExpression.Expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 1063is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) parentBinary) 1151=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.CastExpression or SyntaxKind.AsExpression; 1188if (otherSide.WalkDownParentheses().Kind() == SyntaxKind.NullLiteralExpression) 1257else if (castNode.Parent is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 1365if (!haveHitArgumentNode && currentOld.Kind() != SyntaxKind.Argument)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (46)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None); 40while (currentToken.Kind() != SyntaxKind.CloseBraceToken && previousToken.Kind() == SyntaxKind.OpenBraceToken) 43if (closeBrace.Kind() == SyntaxKind.None || !AreTwoTokensOnSameLine(previousToken, closeBrace)) 60case SyntaxKind.CloseBraceToken: 63case SyntaxKind.SemicolonToken: 66case SyntaxKind.ColonToken: 76if (endToken.Kind() == SyntaxKind.SkippedTokensTrivia) 88if (parent.Kind() is SyntaxKind.StringLiteralExpression or SyntaxKind.CharacterLiteralExpression) 100if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 152if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 252if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 259if (endToken.Kind() == SyntaxKind.ColonToken && parent is LabeledStatementSyntax) 268return previousToken.Kind() == SyntaxKind.None ? token : previousToken; 290if (previousToken.Kind() == SyntaxKind.None) 327return previousToken.IsKind(SyntaxKind.OpenBraceToken) && 328(previousToken.Parent.IsKind(SyntaxKind.Block) || 336node.Kind() is SyntaxKind.IfStatement or 337SyntaxKind.ElseClause or 338SyntaxKind.WhileStatement or 339SyntaxKind.ForStatement or 340SyntaxKind.ForEachStatement or 341SyntaxKind.ForEachVariableStatement or 342SyntaxKind.UsingStatement or 343SyntaxKind.DoStatement or 344SyntaxKind.TryStatement or 345SyntaxKind.CatchClause or 346SyntaxKind.FinallyClause or 347SyntaxKind.LabeledStatement or 348SyntaxKind.LockStatement or 349SyntaxKind.FixedStatement or 350SyntaxKind.UncheckedStatement or 351SyntaxKind.CheckedStatement or 352SyntaxKind.GetAccessorDeclaration or 353SyntaxKind.SetAccessorDeclaration or 354SyntaxKind.InitAccessorDeclaration or 355SyntaxKind.AddAccessorDeclaration or 356SyntaxKind.RemoveAccessorDeclaration; 388return token.Kind() == SyntaxKind.ColonToken && 395if (previousToken.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 400if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 417if (token.Kind() == SyntaxKind.CloseBraceToken) 419if (token.Parent.Kind() is SyntaxKind.Block or 420SyntaxKind.AccessorList)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (4)
84case SyntaxKind.QualifiedName: 89case SyntaxKind.AliasQualifiedName: 94case SyntaxKind.IdentifierName: 97case SyntaxKind.GenericName:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (57)
69=> expression.Kind() is SyntaxKind.ThisExpression or SyntaxKind.BaseExpression; 82if (node.Kind() is not SyntaxKind.PrimaryConstructorBaseType || 83previousNode.Kind() is SyntaxKind.ArgumentList) 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 97node.Kind() is SyntaxKind.Attribute or 98SyntaxKind.ThisConstructorInitializer or 99SyntaxKind.BaseConstructorInitializer or 100SyntaxKind.EqualsValueClause or 101SyntaxKind.ArrowExpressionClause or 102SyntaxKind.PrimaryConstructorBaseType; 109node => node.Kind() is SyntaxKind.UnknownAccessorDeclaration or SyntaxKind.IncompleteMember or SyntaxKind.BracketedArgumentList), 158case SyntaxKind.Attribute: 162case SyntaxKind.BaseConstructorInitializer: 163case SyntaxKind.ThisConstructorInitializer: 167case SyntaxKind.EqualsValueClause: 171case SyntaxKind.ArrowExpressionClause: 175case SyntaxKind.PrimaryConstructorBaseType: 201case SyntaxKind.ParenthesizedLambdaExpression: 235case SyntaxKind.SimpleLambdaExpression: 300if (currentOriginalNode.Kind() is SyntaxKind.CaseSwitchLabel or SyntaxKind.ConstantPattern) 303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 315else if (currentOriginalNode.Kind() == SyntaxKind.LogicalNotExpression) 319else if (currentOriginalNode.Kind() == SyntaxKind.ConditionalAccessExpression) 336else if (currentOriginalNode.Kind() == SyntaxKind.VariableDeclarator) 467if (previousReplacedExpression.WalkDownParentheses().Kind() is SyntaxKind.NullLiteralExpression or SyntaxKind.DefaultLiteralExpression) 515else if (currentOriginalNode.Kind() == SyntaxKind.CollectionInitializerExpression) 520else if (currentOriginalNode.Kind() == SyntaxKind.ImplicitArrayCreationExpression) 529else if (currentOriginalNode.Kind() == SyntaxKind.DefaultExpression) 582SyntaxKind.InvocationExpression or 583SyntaxKind.ElementAccessExpression or 584SyntaxKind.SimpleMemberAccessExpression or 585SyntaxKind.ImplicitElementAccess or 586SyntaxKind.ObjectCreationExpression; 602SyntaxKind.InvocationExpression => ((InvocationExpressionSyntax)expression).ArgumentList, 603SyntaxKind.ObjectCreationExpression => ((ObjectCreationExpressionSyntax)expression).ArgumentList, 604SyntaxKind.ElementAccessExpression => ((ElementAccessExpressionSyntax)expression).ArgumentList, 615case SyntaxKind.SimpleMemberAccessExpression: 618case SyntaxKind.InvocationExpression: 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 629case SyntaxKind.ElementAccessExpression: 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 673if (binaryExpression.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression && 720assignmentExpression.Kind() != SyntaxKind.LeftShiftAssignmentExpression && 721assignmentExpression.Kind() != SyntaxKind.RightShiftAssignmentExpression && 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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (4)
23x.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword && 24y.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (9)
38if (typeName?.FirstAncestorOrSelf<SyntaxNode>(a => a.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement) is not { } declaration) 61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression); 84SyntaxKind.LocalDeclarationStatement or 85SyntaxKind.ForStatement or 86SyntaxKind.UsingStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
104/// to var. <see cref="SyntaxFacts.IsPredefinedType(SyntaxKind)"/> considers string
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (4)
66declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation)) 78if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
104if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) }) 117if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType) && 248if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 252if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (3)
47case SyntaxKind.ArrayType: 50case SyntaxKind.PointerType: 53case SyntaxKind.NullableType:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (5)
29.Select(n => n.GetTrailingTrivia().FirstOrNull(t => t.Kind() == SyntaxKind.EndOfLineTrivia)) 71var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 72var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 170if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 188=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (3)
95var kind = CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(constructor) != null 96? SyntaxKind.ThisConstructorInitializer 97: SyntaxKind.BaseConstructorInitializer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (12)
95if (t1.Kind() == SyntaxKind.MultiLineCommentTrivia) 100return SyntaxTrivia(SyntaxKind.MultiLineCommentTrivia, text + MultiLineCommentTerminator); 103else if (t1.Kind() == SyntaxKind.SkippedTokensTrivia) 196=> declaration.ChildTokens().Where(t => t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken && t.IsMissing).Any(); 233SyntaxKind.ClassDeclaration => CodeGenerationDestination.ClassType, 234SyntaxKind.CompilationUnit => CodeGenerationDestination.CompilationUnit, 235SyntaxKind.EnumDeclaration => CodeGenerationDestination.EnumType, 236SyntaxKind.InterfaceDeclaration => CodeGenerationDestination.InterfaceType, 237SyntaxKind.FileScopedNamespaceDeclaration => CodeGenerationDestination.Namespace, 238SyntaxKind.NamespaceDeclaration => CodeGenerationDestination.Namespace, 239SyntaxKind.StructDeclaration => CodeGenerationDestination.StructType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (20)
457ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); 463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); 511var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1; 515else if (destinationMember is StatementSyntax statement && statement.IsParentKind(SyntaxKind.GlobalStatement)) 786case SyntaxKind.DelegateDeclaration: 794case SyntaxKind.MethodDeclaration: 802case SyntaxKind.OperatorDeclaration: 810case SyntaxKind.ConversionOperatorDeclaration: 818case SyntaxKind.PropertyDeclaration: 826case SyntaxKind.EventDeclaration: 834case SyntaxKind.IndexerDeclaration: 842case SyntaxKind.Parameter: 856case SyntaxKind.IncompleteMember: 870case SyntaxKind.ArrayType: 878case SyntaxKind.PointerType: 886case SyntaxKind.VariableDeclaration: 894case SyntaxKind.CatchDeclaration: 918case SyntaxKind.CompilationUnit: 919case SyntaxKind.NamespaceDeclaration: 920case SyntaxKind.FileScopedNamespaceDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (78)
15private static readonly Dictionary<SyntaxKind, int> s_kindPrecedenceMap = new(SyntaxFacts.EqualityComparer) 17{ SyntaxKind.FieldDeclaration, 0 }, 18{ SyntaxKind.ConstructorDeclaration, 1 }, 19{ SyntaxKind.DestructorDeclaration, 2 }, 20{ SyntaxKind.IndexerDeclaration, 3 }, 21{ SyntaxKind.PropertyDeclaration, 4 }, 22{ SyntaxKind.EventFieldDeclaration, 5 }, 23{ SyntaxKind.EventDeclaration, 6 }, 24{ SyntaxKind.MethodDeclaration, 7 }, 25{ SyntaxKind.OperatorDeclaration, 8 }, 26{ SyntaxKind.ConversionOperatorDeclaration, 9 }, 27{ SyntaxKind.EnumDeclaration, 10 }, 28{ SyntaxKind.InterfaceDeclaration, 11 }, 29{ SyntaxKind.StructDeclaration, 12 }, 30{ SyntaxKind.ClassDeclaration, 13 }, 31{ SyntaxKind.RecordDeclaration, 14 }, 32{ SyntaxKind.RecordStructDeclaration, 15 }, 33{ SyntaxKind.DelegateDeclaration, 16 } 36private static readonly Dictionary<SyntaxKind, int> s_operatorPrecedenceMap = new(SyntaxFacts.EqualityComparer) 38{ SyntaxKind.PlusToken, 0 }, 39{ SyntaxKind.MinusToken, 1 }, 40{ SyntaxKind.ExclamationToken, 2 }, 41{ SyntaxKind.TildeToken, 3 }, 42{ SyntaxKind.PlusPlusToken, 4 }, 43{ SyntaxKind.MinusMinusToken, 5 }, 44{ SyntaxKind.AsteriskToken, 6 }, 45{ SyntaxKind.SlashToken, 7 }, 46{ SyntaxKind.PercentToken, 8 }, 47{ SyntaxKind.AmpersandToken, 9 }, 48{ SyntaxKind.BarToken, 10 }, 49{ SyntaxKind.CaretToken, 11 }, 50{ SyntaxKind.LessThanLessThanToken, 12 }, 51{ SyntaxKind.GreaterThanGreaterThanToken, 13 }, 52{ SyntaxKind.EqualsEqualsToken, 14 }, 53{ SyntaxKind.ExclamationEqualsToken, 15 }, 54{ SyntaxKind.LessThanToken, 16 }, 55{ SyntaxKind.GreaterThanToken, 17 }, 56{ SyntaxKind.LessThanEqualsToken, 18 }, 57{ SyntaxKind.GreaterThanEqualsToken, 19 }, 58{ SyntaxKind.TrueKeyword, 20 }, 59{ SyntaxKind.FalseKeyword, 21 }, 60{ SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 22 }, 103case SyntaxKind.DelegateDeclaration: 106case SyntaxKind.FieldDeclaration: 107case SyntaxKind.EventFieldDeclaration: 110case SyntaxKind.ConstructorDeclaration: 113case SyntaxKind.DestructorDeclaration: 117case SyntaxKind.MethodDeclaration: 120case SyntaxKind.OperatorDeclaration: 123case SyntaxKind.EventDeclaration: 126case SyntaxKind.IndexerDeclaration: 129case SyntaxKind.PropertyDeclaration: 132case SyntaxKind.EnumDeclaration: 135case SyntaxKind.InterfaceDeclaration: 136case SyntaxKind.StructDeclaration: 137case SyntaxKind.RecordStructDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.RecordDeclaration: 142case SyntaxKind.ConversionOperatorDeclaration: 145case SyntaxKind.IncompleteMember: 148case SyntaxKind.GlobalStatement: 217return x.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword ? -1 : 1; 301private static bool ContainsToken(SyntaxTokenList list, SyntaxKind kind) 316if (ContainsToken(modifiers, SyntaxKind.PublicKeyword)) 320else if (ContainsToken(modifiers, SyntaxKind.ProtectedKeyword)) 322if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 327if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 334else if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 338else if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 347if (node.Kind() == SyntaxKind.InterfaceDeclaration) 352else if (node.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration) 362private static bool BothHaveModifier(SyntaxTokenList x, SyntaxTokenList y, SyntaxKind modifierKind, out int comparisonResult) 378=> BothHaveModifier(x, y, SyntaxKind.StaticKeyword, out comparisonResult); 381=> BothHaveModifier(x, y, SyntaxKind.ConstKeyword, out comparisonResult); 384=> BothHaveModifier(x, y, SyntaxKind.ReadOnlyKeyword, out comparisonResult);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (9)
34else if (members.LastOrDefault().Kind() == SyntaxKind.CommaToken) 118if (lastExpression.Kind() == SyntaxKind.LeftShiftExpression && 122if (binaryExpression.Left.Kind() == SyntaxKind.NumericLiteralExpression) 132SyntaxKind.LeftShiftExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)), 134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(shiftValue.ToString(), shiftValue))); 138else if (lastExpression is LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) numericLiteral) 146return LiteralExpression(SyntaxKind.NumericLiteralExpression, 151return LiteralExpression(SyntaxKind.NumericLiteralExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (7)
28if (eventDeclaration.Kind() == SyntaxKind.EventFieldDeclaration) 36if (eventDeclaration.Kind() == SyntaxKind.EventDeclaration) 53if (eventDeclaration.Kind() == SyntaxKind.FieldDeclaration) 164GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 165GenerateAccessorDeclaration(@event, @event.RemoveMethod, SyntaxKind.RemoveAccessorDeclaration, destination, info), 174SyntaxKind kind, 186SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (18)
42InitializerExpression(SyntaxKind.ArrayInitializerExpression, 51=> LiteralExpression(SyntaxKind.NullLiteralExpression); 108? SyntaxKind.TrueLiteralExpression 109: SyntaxKind.FalseLiteralExpression); 116SyntaxKind.StringLiteralExpression, Literal(valueString, val)); 123SyntaxKind.CharacterLiteralExpression, Literal(literal, val)); 186return BinaryExpression(SyntaxKind.DivideExpression, 192return BinaryExpression(SyntaxKind.DivideExpression, 198return BinaryExpression(SyntaxKind.DivideExpression, 199PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateDoubleLiteralExpression(null, 1.0, false)), 215return BinaryExpression(SyntaxKind.DivideExpression, 221return BinaryExpression(SyntaxKind.DivideExpression, 227return BinaryExpression(SyntaxKind.DivideExpression, 228PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateSingleLiteralExpression(null, 1.0F, false)), 279SyntaxKind.NumericLiteralExpression, tokenFactory(stringValue, nonNegativeValue)); 282? PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, literal) 299var result = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccess, IdentifierName(constant.Value)); 315: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, result, name);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (6)
28.Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)) 33if (fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword)) 39.Where(f => f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) 43.Where(f => !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) && !f.Modifiers.Any(SyntaxKind.ConstKeyword)) 48return fieldDeclaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
26private static readonly TypeParameterConstraintSyntax s_classConstraint = ClassOrStructConstraint(SyntaxKind.ClassConstraint); 27private static readonly TypeParameterConstraintSyntax s_structConstraint = ClassOrStructConstraint(SyntaxKind.StructConstraint);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
168case SyntaxKind.EnumDeclaration: 171case SyntaxKind.StructDeclaration: 172case SyntaxKind.RecordStructDeclaration: 173case SyntaxKind.InterfaceDeclaration: 174case SyntaxKind.ClassDeclaration: 175case SyntaxKind.RecordDeclaration: 201var declarationKind = isRecordClass ? SyntaxKind.RecordDeclaration : SyntaxKind.RecordStructDeclaration; 202var classOrStructKeyword = Token(isRecordClass ? default : SyntaxKind.StructKeyword); 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (2)
82var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); 83if (operatorSyntaxKind == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (8)
185if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 282GenerateAccessorDeclaration(property, property.GetMethod, SyntaxKind.GetAccessorDeclaration, destination, info, cancellationToken), 294SyntaxKind kind, 308SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (7)
164case SyntaxKind.IdentifierName: 165case SyntaxKind.GenericName: 169case SyntaxKind.SimpleMemberAccessExpression: 170case SyntaxKind.PointerMemberAccessExpression: 174case SyntaxKind.SimpleLambdaExpression: 175case SyntaxKind.ParenthesizedLambdaExpression: 176case SyntaxKind.AnonymousMethodExpression:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (4)
21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 22case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).SemicolonToken; 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 40case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).WithSemicolonToken(semicolonToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (4)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None)); 131if (!endOfLine.IsKind(SyntaxKind.None)) 150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (42)
48public readonly ISet<SyntaxKind> PrecedingModifiers; 111ISet<SyntaxKind> precedingModifiers, 213targetToken.IsKind(SyntaxKind.TildeToken) && 214targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) && 215targetToken.Parent.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration); 224var isOnArgumentListBracketOrComma = targetToken.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier); 246isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 263isTaskLikeTypeContext: precedingModifiers.Contains(SyntaxKind.AsyncKeyword), 312if (token.Kind() == SyntaxKind.OpenBracketToken && 313token.Parent.IsKind(SyntaxKind.AttributeList) && 324ISet<SyntaxKind>? validModifiers = null, 325ISet<SyntaxKind>? validTypeDeclarations = null, 332public bool IsRecordDeclarationContext(ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) 336if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 346ISet<SyntaxKind> validTypeDeclarations, bool includingRecordParameters, CancellationToken cancellationToken) 352if (token.Kind() == SyntaxKind.OpenBracketToken && 353token.Parent.IsKind(SyntaxKind.AttributeList)) 376if (token.Kind() == SyntaxKind.OpenBracketToken && 377token.Parent.IsKind(SyntaxKind.AttributeList) && 392if (token.Kind() == SyntaxKind.OpenBracketToken && 393token.Parent.IsKind(SyntaxKind.AttributeList) && 403ISet<SyntaxKind>? validModifiers = null, 404ISet<SyntaxKind>? validTypeDeclarations = null, 439if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 450&& targetToken.IsKind(SyntaxKind.IdentifierToken) 451&& targetToken.HasMatchingText(SyntaxKind.AwaitKeyword)) 483if (node.IsKind(SyntaxKind.QueryExpression)) 487if (targetToken.IsKind(SyntaxKind.InKeyword)) 534SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword => AttributeTargets.Assembly | AttributeTargets.Module, 535SyntaxKind.TypeKeyword => AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, 536SyntaxKind.MethodKeyword => AttributeTargets.Method, 537SyntaxKind.FieldKeyword => AttributeTargets.Field, 538SyntaxKind.PropertyKeyword => AttributeTargets.Property, 539SyntaxKind.EventKeyword => AttributeTargets.Event, 540SyntaxKind.ParamKeyword => AttributeTargets.Parameter, 541SyntaxKind.ReturnKeyword => AttributeTargets.ReturnValue, 542SyntaxKind.TypeVarKeyword => AttributeTargets.GenericParameter, 558RecordDeclarationSyntax record => record.ClassOrStructKeyword.IsKind(SyntaxKind.StructKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (114)
19token.Kind() is SyntaxKind.UsingKeyword or 20SyntaxKind.ExternKeyword; 25if (token.IsKind(SyntaxKind.UsingKeyword)) 41if (token is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 47if (token.IsKind(SyntaxKind.UnsafeKeyword) && 48token.GetPreviousToken() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 118case SyntaxKind.SemicolonToken: 120return statement != null && !statement.IsParentKind(SyntaxKind.GlobalStatement) && 123case SyntaxKind.CloseBraceToken: 124if (token.Parent.IsKind(SyntaxKind.Block)) 135if (token.Parent.Parent.Kind() is not SyntaxKind.TryStatement and not SyntaxKind.DoStatement) 139is SyntaxKind.ElseClause 140or SyntaxKind.FinallyClause 141or SyntaxKind.CatchClause 142or SyntaxKind.SwitchSection) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 155case SyntaxKind.ColonToken: 156return token.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel or SyntaxKind.LabeledStatement); 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 161case SyntaxKind.CloseParenToken: 164is SyntaxKind.ForStatement 165or SyntaxKind.ForEachStatement 166or SyntaxKind.ForEachVariableStatement 167or SyntaxKind.WhileStatement 168or SyntaxKind.IfStatement 169or SyntaxKind.LockStatement 170or SyntaxKind.UsingStatement 171or SyntaxKind.FixedStatement; 173case SyntaxKind.ElseKeyword: 174return token.Parent.IsKind(SyntaxKind.ElseClause); 176case SyntaxKind.CloseBracketToken: 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 207if (token.Kind() == SyntaxKind.CloseBraceToken) 211memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 217if (token.Kind() == SyntaxKind.SemicolonToken) 230memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 250if (token.Kind() == SyntaxKind.CloseBracketToken) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 272if (token.Kind() == SyntaxKind.CloseParenToken) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 300if (token.Kind() == SyntaxKind.IdentifierToken && 301token.GetPreviousToken(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword) 326if (targetToken.Kind() is SyntaxKind.IfKeyword or 327SyntaxKind.ElifKeyword) 333if (targetToken.Kind() == SyntaxKind.OpenParenToken && 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 363if (targetToken.Kind() is not (SyntaxKind.IdentifierToken or SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken)) 395if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 401if (targetToken.Kind() == SyntaxKind.ColonToken) 403if (targetToken.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel)) 409if (targetToken.Kind() is SyntaxKind.SemicolonToken or 410SyntaxKind.CloseBraceToken) 430return targetToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken && 431targetToken.Parent is (kind: SyntaxKind.CrefBracketedParameterList or SyntaxKind.CrefParameterList); 449if (targetToken.Kind() == SyntaxKind.ColonToken && 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 456is SyntaxKind.InvocationExpression 457or SyntaxKind.ObjectCreationExpression 458or SyntaxKind.BaseConstructorInitializer 459or SyntaxKind.ThisConstructorInitializer) 465if (targetToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 467if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 470is SyntaxKind.ObjectCreationExpression 471or SyntaxKind.BaseConstructorInitializer 472or SyntaxKind.ThisConstructorInitializer) 480if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression()) 492if (targetToken.Kind() == SyntaxKind.OperatorKeyword && 504targetToken.GetAncestors<StatementSyntax>().Any(s => s.IsKind(SyntaxKind.UnsafeStatement)) || 505targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword) || 506targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) || 507targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.UnsafeKeyword)); 515return targetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword); 518public static bool IsAnyAccessorDeclarationContext(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 525public static bool IsAccessorDeclarationContext<TMemberNode>(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 545if (existingAccessor.Kind() != SyntaxKind.None) 569while (targetToken.Kind() is SyntaxKind.InternalKeyword or 570SyntaxKind.PublicKeyword or 571SyntaxKind.ProtectedKeyword or 572SyntaxKind.PrivateKeyword or 573SyntaxKind.ReadOnlyKeyword) 580if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 581targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 588if (targetToken.Kind() == SyntaxKind.CloseBraceToken && 589targetToken.Parent.IsKind(SyntaxKind.Block) && 596if (targetToken.Kind() == SyntaxKind.SemicolonToken && 603if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 604targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 615if (node.IsKind(SyntaxKind.TypeParameterList)) 617if (node?.Parent is TypeDeclarationSyntax(SyntaxKind.InterfaceDeclaration) typeDecl) 636if (targetToken.Kind() == SyntaxKind.LessThanToken && 642if (targetToken.Kind() == SyntaxKind.CommaToken && 648if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 649targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 650targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) && 661if (token.Kind() == SyntaxKind.CommaToken && token.Parent is BaseArgumentListSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (444)
21private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.ExternKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.AsyncKeyword, 26SyntaxKind.UnsafeKeyword, 36if (token.IsKind(SyntaxKind.OpenBracketToken) && 37token.Parent.IsKind(SyntaxKind.AttributeList)) 44if (token.IsKind(SyntaxKind.CommaToken) && 45token.Parent.IsKind(SyntaxKind.AttributeList)) 52if (token.IsKind(SyntaxKind.ColonToken) && 53token.Parent.IsKind(SyntaxKind.AttributeTargetSpecifier)) 60if (token.Parent.IsKind(SyntaxKind.QualifiedName) && 61token.Parent.IsParentKind(SyntaxKind.Attribute)) 68if (token.Parent.IsKind(SyntaxKind.AliasQualifiedName) && 69token.Parent.IsParentKind(SyntaxKind.Attribute)) 80ISet<SyntaxKind> validModifiers, 95if (token.IsKind(SyntaxKind.CloseBracketToken) 115if (parent.IsKind(SyntaxKind.CompilationUnit) || 116(parent is MemberDeclarationSyntax && parent.IsParentKind(SyntaxKind.CompilationUnit))) 129return kind is ((int)SyntaxKind.AssemblyKeyword) 130or ((int)SyntaxKind.ModuleKeyword); 166if (token.IsKind(SyntaxKind.OpenBraceToken)) 177if (token.IsKind(SyntaxKind.SemicolonToken)) 194if (token.IsKind(SyntaxKind.CloseBraceToken)) 208token.Parent.IsKind(SyntaxKind.Block) && 220if (token.IsKind(SyntaxKind.CloseBracketToken) && 221token.Parent.IsKind(SyntaxKind.AttributeList)) 243ISet<SyntaxKind>? validModifiers, 244ISet<SyntaxKind>? validTypeDeclarations, 257validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 285token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 294validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 299if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 322SyntaxKind otherModifier, 330return modifierTokens.Contains(otherModifier) && IsLambdaDeclarationContext(syntaxTree, position, SyntaxKind.None, cancellationToken); 342ISet<SyntaxKind> validModifiers, 359if (token.Kind() == SyntaxKind.CloseBracketToken && token.Parent is AttributeListSyntax) 420(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 426if (token.IsKind(SyntaxKind.None)) 440if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 455if (token.IsKind(SyntaxKind.SemicolonToken)) 457if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 477if (token.IsKind(SyntaxKind.CloseBraceToken)) 483else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 492token.Parent.IsKind(SyntaxKind.Block) && 507if (token.IsKind(SyntaxKind.CloseBracketToken) && 508token.Parent.IsKind(SyntaxKind.AttributeList)) 511if (token.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 532ISet<SyntaxKind>? validModifiers, 533ISet<SyntaxKind>? validTypeDeclarations, 543validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 576token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 591validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 602return incompleteMember.Type.IsKind(SyntaxKind.RefType); 609if (modifierTokens.Contains(SyntaxKind.FileKeyword)) 612if (modifierTokens.Contains(SyntaxKind.ClosedKeyword)) 638if (token.IsKind(SyntaxKind.ColonColonToken) && 639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 651if (token.IsKind(SyntaxKind.UsingKeyword)) 656if (token.GetNextToken(includeSkipped: true).Kind() != SyntaxKind.EqualsToken && 701is SyntaxKind.ClassKeyword 702or SyntaxKind.StructKeyword 703or SyntaxKind.InterfaceKeyword && 704token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 737syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 738syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || 739syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || 740syntaxTree.IsAfterKeyword(position, SyntaxKind.CaseKeyword, cancellationToken) || 741syntaxTree.IsAfterKeyword(position, SyntaxKind.EventKeyword, cancellationToken) || 742syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) || 785if (token.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken && 801if (token.IsKind(SyntaxKind.EqualsToken) && 831if (token.IsKind(SyntaxKind.WhereKeyword) && 832token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 837if (token.IsKind(SyntaxKind.IdentifierToken) && 838token.HasMatchingText(SyntaxKind.WhereKeyword) && 839token.Parent.IsKind(SyntaxKind.IdentifierName) && 840token.Parent.IsParentKind(SyntaxKind.SimpleBaseType) && 841token.Parent.Parent.IsParentKind(SyntaxKind.BaseList)) 858if (token.IsKind(SyntaxKind.ColonToken) && 859token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 860token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 884if (token.IsKind(SyntaxKind.CommaToken) && 903if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 915if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 928if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 947case SyntaxKind.LessThanToken: 948case SyntaxKind.CommaToken: 949return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955{ Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } => true, 957{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 963=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 964targetToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken; 980if (token.Kind() is not SyntaxKind.LessThanToken and not SyntaxKind.CommaToken) 1015if (name.IsParentKind(SyntaxKind.LessThanExpression) && 1017conditional.IsParentKind(SyntaxKind.ExpressionStatement) && 1018conditional.Parent.IsParentKind(SyntaxKind.GlobalStatement)) 1060out SyntaxKind previousModifier) 1069previousModifier = SyntaxKind.None; 1071if (token.IsKind(SyntaxKind.OpenParenToken) && 1079if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1085if (token.IsKind(SyntaxKind.CommaToken) && 1095if (token.IsKind(SyntaxKind.CommaToken) && 1104if (token.IsKind(SyntaxKind.CloseBracketToken) && 1105token.Parent.IsKind(SyntaxKind.AttributeList) && 1115if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.OutKeyword or SyntaxKind.ThisKeyword or SyntaxKind.ParamsKeyword or SyntaxKind.ScopedKeyword) 1120else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName }) 1123previousModifier = SyntaxKind.ScopedKeyword; 1150if (syntaxTree.IsParameterModifierContext(position, tokenOnLeftOfPosition, includeOperators: false, out _, out var previousModifier) && 1151previousModifier == SyntaxKind.None) 1164if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken) 1166return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1178if (token.IsKind(SyntaxKind.DelegateKeyword) && 1179token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1193if (token.IsKind(SyntaxKind.OperatorKeyword) && 1194token.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 1210if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 1211token.Parent is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList)) 1225typeDecl.IsKind(SyntaxKind.ClassDeclaration) && 1226method.Modifiers.Any(SyntaxKind.StaticKeyword) && 1227typeDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 1236if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1238if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1239token.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 1255if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 1269if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1273else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1277else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName } && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1286return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1295if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 1328if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1331SyntaxKind.ParenthesizedExpression or 1332SyntaxKind.TupleExpression or 1333SyntaxKind.TupleType)) 1345if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1356if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1357leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1358leftToken.Parent.Parent is (kind: SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression)) 1374if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1384if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1392if (leftToken.Kind() is SyntaxKind.CaseKeyword or SyntaxKind.IsKeyword) 1399if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1406if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1413if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1420if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1428if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1429leftToken.Parent.IsParentKind(SyntaxKind.Subpattern)) 1439if (leftToken.IsKindOrHasMatchingText(SyntaxKind.AndKeyword) || leftToken.IsKindOrHasMatchingText(SyntaxKind.OrKeyword)) 1446if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1455if (leftToken.Kind() is SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken or SyntaxKind.LessThanToken or SyntaxKind.LessThanEqualsToken && 1456leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1472if (leftToken.IsKind(SyntaxKind.DotToken) || 1473leftToken.IsKind(SyntaxKind.MinusGreaterThanToken)) 1492return leftToken.Kind() is not (SyntaxKind.OrKeyword 1493or SyntaxKind.AndKeyword 1494or SyntaxKind.NotKeyword 1495or SyntaxKind.OpenParenToken 1496or SyntaxKind.ColonColonToken 1497or SyntaxKind.DotDotToken 1498or SyntaxKind.OpenBraceToken); 1534binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1576if (possibleCommaOrParen.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 1582SyntaxKind.ParenthesizedExpression or 1583SyntaxKind.TupleExpression or 1584SyntaxKind.TupleType or 1585SyntaxKind.CastExpression)) 1591if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1616if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation) || 1617leftToken.Parent.IsParentKind(SyntaxKind.ParenthesizedVariableDesignation)) 1637if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1647if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.TupleExpression)) 1657if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1681if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1687if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1699if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 1700leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1793if (token.IsKind(SyntaxKind.ConstKeyword) && 1794token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1803if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword) 1806if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement)) 1808if (parent.IsParentKind(SyntaxKind.VariableDeclaration) && 1810SyntaxKind.LocalDeclarationStatement or 1811SyntaxKind.ForStatement or 1812SyntaxKind.ForEachVariableStatement)) 1817if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement)) 1825if (token.IsKind(SyntaxKind.OutKeyword) && 1837if (token.IsKind(SyntaxKind.OpenParenToken)) 1840if (previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword or SyntaxKind.UsingKeyword) 1846if (token.IsKind(SyntaxKind.UsingKeyword) && 1854if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) && 1861if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1873if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1879if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax or ScopedTypeSyntax) 1896if (token.IsKind(SyntaxKind.OpenParenToken) && 1897token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1913if (token.IsKind(SyntaxKind.OpenParenToken) && 1914token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1927if (token.Kind() is SyntaxKind.IsKeyword or SyntaxKind.AsKeyword) 1938if (token.IsKind(SyntaxKind.NewKeyword)) 1992if (token.IsKind(SyntaxKind.None)) 2042if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2056if (token.IsKind(SyntaxKind.OpenParenToken) && 2057token.Parent.IsKind(SyntaxKind.CastExpression)) 2076if (token.IsKind(SyntaxKind.CaseKeyword) && 2077token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2082if (token.IsKind(SyntaxKind.EqualsToken) && 2085if (equalsValue.IsParentKind(SyntaxKind.VariableDeclarator) && 2086equalsValue.Parent.IsParentKind(SyntaxKind.VariableDeclaration)) 2092return fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2099return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2104if (equalsValue.IsParentKind(SyntaxKind.EnumMemberDeclaration)) 2110if (equalsValue.IsParentKind(SyntaxKind.Parameter)) 2118if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2119token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken) 2125if (token.IsKind(SyntaxKind.ColonToken) && 2126token.Parent.IsKind(SyntaxKind.NameColon) && 2127token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2133if (token.IsKind(SyntaxKind.EqualsToken) && 2134token.Parent.IsKind(SyntaxKind.NameEquals) && 2135token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2205is SyntaxKind.DotToken 2206or SyntaxKind.ColonColonToken 2207or SyntaxKind.MinusGreaterThanToken) 2214if (token.IsKind(SyntaxKind.EqualsToken)) 2216if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2217token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2237is SyntaxKind.EqualsToken 2238or SyntaxKind.MinusEqualsToken 2239or SyntaxKind.AsteriskEqualsToken 2240or SyntaxKind.PlusEqualsToken 2241or SyntaxKind.SlashEqualsToken 2242or SyntaxKind.ExclamationEqualsToken 2243or SyntaxKind.CaretEqualsToken 2244or SyntaxKind.AmpersandEqualsToken 2245or SyntaxKind.BarEqualsToken 2246or SyntaxKind.PercentEqualsToken 2247or SyntaxKind.LessThanLessThanEqualsToken 2248or SyntaxKind.GreaterThanGreaterThanEqualsToken 2249or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2250or SyntaxKind.QuestionQuestionEqualsToken) 2256if (token.IsKind(SyntaxKind.OpenParenToken)) 2258if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2331if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2348tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2351if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2352previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2355if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2374if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2375token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2382if (token.IsKind(SyntaxKind.DotDotToken) && 2383token.Parent.IsKind(SyntaxKind.RangeExpression) && 2390if (token.IsKind(SyntaxKind.QuestionToken) && 2399if (token.IsKind(SyntaxKind.ColonToken) && 2400token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2408if (token.IsKind(SyntaxKind.OpenParenToken)) 2410if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2419if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2430if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2431token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2440if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2442if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2453if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2455if (token.Parent.IsKind(SyntaxKind.Argument)) 2459else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2463if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2473if (token.IsKind(SyntaxKind.ColonToken) && 2474token.Parent.IsKind(SyntaxKind.NameColon) && 2475token.Parent.IsParentKind(SyntaxKind.Argument)) 2481if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2488if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2494if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2497if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2524if (token.IsKind(SyntaxKind.SemicolonToken) && 2535if (token.IsKind(SyntaxKind.OpenParenToken) && 2544if (token.IsKind(SyntaxKind.CommaToken) && 2545token.Parent.IsKind(SyntaxKind.ForStatement)) 2554if (token.IsKind(SyntaxKind.InKeyword)) 2557SyntaxKind.ForEachStatement or 2558SyntaxKind.ForEachVariableStatement or 2559SyntaxKind.FromClause or 2560SyntaxKind.JoinClause)) 2568if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2569token.Parent.IsKind(SyntaxKind.JoinClause)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2576token.Parent.IsKind(SyntaxKind.WhereClause)) 2583if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2584token.Parent.IsKind(SyntaxKind.OrderByClause)) 2590if (token.IsKind(SyntaxKind.SelectKeyword) && 2591token.Parent.IsKind(SyntaxKind.SelectClause)) 2598if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2599token.Parent.IsKind(SyntaxKind.GroupClause)) 2607if (token.IsKind(SyntaxKind.ReturnKeyword)) 2609if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2616if (token.IsKind(SyntaxKind.ThrowKeyword)) 2622if (token.IsKind(SyntaxKind.OpenParenToken) && 2623token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2632if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2673if (token.IsKind(SyntaxKind.OpenParenToken) && 2674token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2680if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2697if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2698token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2706if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2707token.Parent.IsKind(SyntaxKind.ListPattern)) 2715if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2716token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2724if (token.Kind() is SyntaxKind.DotDotToken && 2725token.Parent.IsKind(SyntaxKind.SpreadElement)) 2736if (token.IsKind(SyntaxKind.OpenBraceToken)) 2757if (token.IsKind(SyntaxKind.DotToken)) 2760if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2763while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2768if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2776if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2779while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2784if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2795if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2829if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2859if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2874if (token.IsKind(SyntaxKind.IdentifierToken) && 2875token.Parent.IsKind(SyntaxKind.IdentifierName) && 2876token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2882if (token.Kind() is SyntaxKind.IdentifierToken && 2883token.Parent.IsKind(SyntaxKind.IdentifierName)) 2885if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2889if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2907if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2925case SyntaxKind.QualifiedName: 2927case SyntaxKind.AliasQualifiedName: 2929case SyntaxKind.SimpleMemberAccessExpression: 2958if (token.IsKind(SyntaxKind.CloseBraceToken)) 2964block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2984if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2989if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2990token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3007targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3018targetToken.IsKind(SyntaxKind.ColonToken) && 3019targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3020targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3029if (!token.IsKind(SyntaxKind.DotToken)) 3035if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3041token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3080return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3081targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
30if (expression.IsKind(SyntaxKind.RefExpression)) 42if (expression.IsKind(SyntaxKind.ThrowExpression)) 58Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 60Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 72Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 74Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (2)
43constraints.Add(ClassOrStructConstraint(SyntaxKind.ClassConstraint)); 51constraints.Add(ClassOrStructConstraint(SyntaxKind.StructConstraint));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
97if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
111SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\NameSyntaxExtensions.cs (4)
36is SyntaxKind.AliasQualifiedName 37or SyntaxKind.NameColon 38or SyntaxKind.NameEquals 39or SyntaxKind.TypeParameterConstraintClause)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (4)
12this SeparatedSyntaxList<T> separatedList, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken) 19this SeparatedSyntaxList<T> separatedList, int index, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (2)
23var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 47default, SyntaxKind.None, "@" + unescaped, unescaped, default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenListExtensions.cs (1)
12public static IEnumerable<SyntaxToken> SkipKinds(this SyntaxTokenList tokenList, params SyntaxKind[] kinds)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs (17)
58if (token.Kind() == SyntaxKind.None) 74case SyntaxKind.LessThanToken: 81if (token.Kind() == SyntaxKind.None) 92if (token.Kind() == SyntaxKind.IdentifierToken) 113case SyntaxKind.GreaterThanToken: 114case SyntaxKind.GreaterThanGreaterThanToken: 115case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 127case SyntaxKind.AsteriskToken: // for int* 128case SyntaxKind.QuestionToken: // for int? 129case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 130case SyntaxKind.ColonColonToken: // for global:: 131case SyntaxKind.CloseBracketToken: 132case SyntaxKind.OpenBracketToken: 133case SyntaxKind.DotToken: 134case SyntaxKind.IdentifierToken: 137case SyntaxKind.CommaToken: 162if (token.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (6)
74if (typeNode.Modifiers.Any(SyntaxKind.PartialKeyword)) 97private static SyntaxToken EnsureToken(SyntaxToken token, SyntaxKind kind, bool prependNewLineIfMissing = false, bool appendNewLineIfMissing = false) 99if (token.IsMissing || token.IsKind(SyntaxKind.None)) 111var openBrace = EnsureToken(typeDeclaration.OpenBraceToken, SyntaxKind.OpenBraceToken); 112var closeBrace = EnsureToken(typeDeclaration.CloseBraceToken, SyntaxKind.CloseBraceToken, appendNewLineIfMissing: true); 117if (addedBraces && typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (26)
50token.Kind() is SyntaxKind.EndOfFileToken or SyntaxKind.None || 58if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 63if (token.IsKind(SyntaxKind.ColonToken) && !token.Parent.IsKind(SyntaxKind.LabeledStatement) && token.Parent is not SwitchLabelSyntax) 67if (token.IsKind(SyntaxKind.OpenBraceToken) && !token.IsFirstTokenOnLine(documentSyntax.Text)) 129(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 130(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 151if (token.Kind() != SyntaxKind.ElseKeyword || 199if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 289if (tokenBeforeCaret.Kind() is SyntaxKind.CloseBraceToken or 290SyntaxKind.EndOfFileToken) 301internal static bool ValidSingleOrMultiCharactersTokenKind(char typedChar, SyntaxKind kind) 304'n' => kind is SyntaxKind.RegionKeyword or SyntaxKind.EndRegionKeyword, 305't' => kind is SyntaxKind.SelectKeyword, 306'e' => kind is SyntaxKind.WhereKeyword or SyntaxKind.ElseKeyword, 317is SyntaxKind.None 318or SyntaxKind.EndOfDirectiveToken 319or SyntaxKind.EndOfFileToken; 354if (currentToken.Kind() == SyntaxKind.OpenBraceToken && 356currentTokenParentParent.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
104while (node != null && node.Kind() != SyntaxKind.CompilationUnit)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (8)
79if (token.IsKind(SyntaxKind.None) || 89if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing) 109return token.Kind() is SyntaxKind.None or SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken; 125node.IsKind(SyntaxKind.Interpolation)) 132!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) && 141constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (22)
74Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 81if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 120if (token.Kind() is SyntaxKind.InterpolatedMultiLineRawStringStartToken or SyntaxKind.InterpolatedStringTextToken 121|| token is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax }) 125if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 139if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 175token.Kind() is SyntaxKind.InterpolatedVerbatimStringStartToken or SyntaxKind.InterpolatedStringTextToken || 176(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 240case SyntaxKind.SemicolonToken: 251case SyntaxKind.CloseBraceToken: 253if (token.Parent.IsKind(SyntaxKind.AccessorList) && 254token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 265case SyntaxKind.OpenBraceToken: 270case SyntaxKind.ColonToken: 283case SyntaxKind.CloseBracketToken: 297case SyntaxKind.XmlTextLiteralToken: 302case SyntaxKind.CommaToken: 307case SyntaxKind.CloseParenToken: 309if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
103=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63(i == 0 && currentUsing.IsParentKind(SyntaxKind.FileScopedNamespaceDeclaration)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
85if (braces.openBrace.Kind() == SyntaxKind.None && 86braces.closeBrace.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (19)
67.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 109=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 126SyntaxKind.InterpolatedStringTextToken, 139SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 216=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 242=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 270return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 276return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 289SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 313SyntaxKind.SimpleMemberAccessExpression, 325is SyntaxKind.ThisExpression 326or SyntaxKind.BaseExpression 327or SyntaxKind.ParenthesizedExpression 328or SyntaxKind.SimpleMemberAccessExpression 329or SyntaxKind.InvocationExpression 330or SyntaxKind.ElementAccessExpression 331or SyntaxKind.MemberBindingExpression) 340=> CreateBinaryExpression(SyntaxKind.BitwiseOrExpression, left, right); 342public static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (81)
327if (argument.Parent.IsParentKind(SyntaxKind.ImplicitElementAccess) && 328argument.Parent.Parent.IsParentKind(SyntaxKind.SimpleAssignmentExpression) && 329argument.Parent.Parent.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression) && 350if (previousToken.IsKind(SyntaxKind.CommaToken)) 431if (previousToken.Kind() == SyntaxKind.NewKeyword && 432previousToken.GetPreviousToken().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 518if (previousToken != argumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 548if (previousToken != attributeArgumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 822if (previousToken.HasValue && previousToken.Value.GetPreviousToken().Kind() == SyntaxKind.EqualsToken) 897if (previousToken != bracketedArgumentList.OpenBracketToken && previousToken.Kind() != SyntaxKind.CommaToken) 954if (binop.Kind() == SyntaxKind.CoalesceExpression) 962case SyntaxKind.LessThanLessThanToken: 963case SyntaxKind.GreaterThanGreaterThanToken: 964case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 965case SyntaxKind.LessThanLessThanEqualsToken: 966case SyntaxKind.GreaterThanGreaterThanEqualsToken: 967case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 979if (operatorToken.Kind() is SyntaxKind.AmpersandAmpersandToken or 980SyntaxKind.BarBarToken) 986if (binop.Kind() == SyntaxKind.SimpleAssignmentExpression && 1015if (operatorToken.Kind() is SyntaxKind.AmpersandToken or 1016SyntaxKind.AmpersandEqualsToken or 1017SyntaxKind.BarToken or 1018SyntaxKind.BarEqualsToken or 1019SyntaxKind.CaretToken or 1020SyntaxKind.CaretEqualsToken) 1031if (operatorToken.Kind() == SyntaxKind.PlusToken) 1046case SyntaxKind.BarToken: 1047case SyntaxKind.CaretToken: 1048case SyntaxKind.AmpersandToken: 1049case SyntaxKind.LessThanToken: 1050case SyntaxKind.LessThanEqualsToken: 1051case SyntaxKind.GreaterThanToken: 1052case SyntaxKind.GreaterThanEqualsToken: 1053case SyntaxKind.PlusToken: 1054case SyntaxKind.MinusToken: 1055case SyntaxKind.AsteriskToken: 1056case SyntaxKind.SlashToken: 1057case SyntaxKind.PercentToken: 1058case SyntaxKind.CaretEqualsToken: 1059case SyntaxKind.PlusEqualsToken: 1060case SyntaxKind.MinusEqualsToken: 1061case SyntaxKind.AsteriskEqualsToken: 1062case SyntaxKind.SlashEqualsToken: 1063case SyntaxKind.PercentEqualsToken: 1064case SyntaxKind.LessThanLessThanToken: 1065case SyntaxKind.GreaterThanGreaterThanToken: 1066case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1067case SyntaxKind.LessThanLessThanEqualsToken: 1068case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1069case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1072case SyntaxKind.BarEqualsToken: 1073case SyntaxKind.AmpersandEqualsToken: 1224if (equalsValue.IsParentKind(SyntaxKind.Parameter) && 1381if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1401else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression)) 1423foreach (var sibling in initializerExpression.Expressions.Where(e => e.Kind() != SyntaxKind.ComplexElementInitializerExpression)) 1492else if (initializerExpression.IsParentKind(SyntaxKind.SimpleAssignmentExpression)) 1582if (identifier.HasMatchingText(SyntaxKind.OrKeyword) || 1583identifier.HasMatchingText(SyntaxKind.AndKeyword)) 1703var isAsync = anonymousFunction.AsyncKeyword.Kind() != SyntaxKind.None; 1807memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) 1831if (ienumerableType != null && memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocation)) 1973case SyntaxKind.PostDecrementExpression: 1974case SyntaxKind.PostIncrementExpression: 1988case SyntaxKind.PreDecrementExpression: 1989case SyntaxKind.PreIncrementExpression: 1990case SyntaxKind.UnaryPlusExpression: 1991case SyntaxKind.UnaryMinusExpression: 1995case SyntaxKind.BitwiseNotExpression: 2007case SyntaxKind.LogicalNotExpression: 2011case SyntaxKind.AddressOfExpression: 2062if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))) 2180if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2192switchLabel.Kind() != SyntaxKind.CaseSwitchLabel) 2211.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2270if (variableDeclaration.IsParentKind(SyntaxKind.UsingStatement)) 2274if (variableDeclaration.IsParentKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
276.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (5)
23if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 28if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 34if (parentOfToken is SimpleNameSyntax && parent.Kind() == SyntaxKind.XmlNameAttribute) 41if (parent.Kind() == SyntaxKind.AliasQualifiedName &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NameSyntaxIterator.cs (1)
27if (currentNode.Kind() == SyntaxKind.QualifiedName)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (101)
11public static readonly ISet<SyntaxKind> AllTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 13SyntaxKind.AbstractKeyword, 15SyntaxKind.ClosedKeyword, 17SyntaxKind.FileKeyword, 18SyntaxKind.InternalKeyword, 19SyntaxKind.NewKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.RefKeyword 30public static readonly ISet<SyntaxKind> AllMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.AbstractKeyword, 33SyntaxKind.AsyncKeyword, 34SyntaxKind.ExternKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.NewKeyword, 37SyntaxKind.OverrideKeyword, 38SyntaxKind.PublicKeyword, 39SyntaxKind.PrivateKeyword, 40SyntaxKind.ProtectedKeyword, 41SyntaxKind.ReadOnlyKeyword, 42SyntaxKind.RequiredKeyword, 43SyntaxKind.SealedKeyword, 44SyntaxKind.StaticKeyword, 45SyntaxKind.UnsafeKeyword, 46SyntaxKind.VirtualKeyword, 47SyntaxKind.VolatileKeyword, 50public static readonly ISet<SyntaxKind> AllGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 52SyntaxKind.ExternKeyword, 53SyntaxKind.InternalKeyword, 54SyntaxKind.NewKeyword, 55SyntaxKind.OverrideKeyword, 56SyntaxKind.PublicKeyword, 57SyntaxKind.PrivateKeyword, 58SyntaxKind.ReadOnlyKeyword, 59SyntaxKind.StaticKeyword, 60SyntaxKind.UnsafeKeyword, 61SyntaxKind.VolatileKeyword, 64public static readonly ISet<SyntaxKind> AccessibilityModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 66SyntaxKind.PublicKeyword, 67SyntaxKind.PrivateKeyword, 68SyntaxKind.ProtectedKeyword, 69SyntaxKind.InternalKeyword, 72public static readonly ISet<SyntaxKind> AllTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 74SyntaxKind.InterfaceDeclaration, 75SyntaxKind.ClassDeclaration, 76SyntaxKind.RecordDeclaration, 77SyntaxKind.StructDeclaration, 78SyntaxKind.RecordStructDeclaration, 80SyntaxKind.UnionDeclaration, 82SyntaxKind.EnumDeclaration, 85public static readonly ISet<SyntaxKind> ClassInterfaceStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 87SyntaxKind.InterfaceDeclaration, 88SyntaxKind.ClassDeclaration, 89SyntaxKind.RecordDeclaration, 90SyntaxKind.StructDeclaration, 91SyntaxKind.RecordStructDeclaration, 93SyntaxKind.UnionDeclaration, 97public static readonly ISet<SyntaxKind> NonEnumTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 99SyntaxKind.ClassDeclaration, 101SyntaxKind.ExtensionBlockDeclaration, 102SyntaxKind.UnionDeclaration, 104SyntaxKind.InterfaceDeclaration, 105SyntaxKind.RecordDeclaration, 106SyntaxKind.RecordStructDeclaration, 107SyntaxKind.StructDeclaration, 110public static readonly ISet<SyntaxKind> ClassInterfaceRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 112SyntaxKind.InterfaceDeclaration, 113SyntaxKind.ClassDeclaration, 114SyntaxKind.RecordDeclaration, 117public static readonly ISet<SyntaxKind> ClassRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 119SyntaxKind.ClassDeclaration, 120SyntaxKind.RecordDeclaration, 123public static readonly ISet<SyntaxKind> ClassStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 125SyntaxKind.ClassDeclaration, 126SyntaxKind.RecordDeclaration, 127SyntaxKind.StructDeclaration, 128SyntaxKind.RecordStructDeclaration, 130SyntaxKind.UnionDeclaration, 134public static readonly ISet<SyntaxKind> StructOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 136SyntaxKind.StructDeclaration, 137SyntaxKind.RecordStructDeclaration, 139SyntaxKind.UnionDeclaration, 143public static readonly ISet<SyntaxKind> InterfaceOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 145SyntaxKind.InterfaceDeclaration,
Microsoft.CodeAnalysis.Razor.Compiler (214)
CSharp\GlobalQualifiedTypeNameRewriter.cs (1)
98return SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(SyntaxFactory.Token(CSharp.SyntaxKind.GlobalKeyword)), node);
Language\CodeGeneration\CodeWriterExtensions.cs (2)
596return CodeAnalysis.CSharp.SyntaxFacts.GetKeywordKind(identifier) != CodeAnalysis.CSharp.SyntaxKind.None || 597CodeAnalysis.CSharp.SyntaxFacts.GetContextualKeywordKind(identifier) != CodeAnalysis.CSharp.SyntaxKind.None;
Language\Intermediate\CommonModifiers.cs (26)
6using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 12private static string GetText(CSharpSyntaxKind kind) 16GetText(CSharpSyntaxKind.InternalKeyword)]; 19GetText(CSharpSyntaxKind.InternalKeyword), 20GetText(CSharpSyntaxKind.SealedKeyword)]; 23GetText(CSharpSyntaxKind.InternalKeyword), 24GetText(CSharpSyntaxKind.StaticKeyword)]; 27GetText(CSharpSyntaxKind.PrivateKeyword)]; 30GetText(CSharpSyntaxKind.PrivateKeyword), 31GetText(CSharpSyntaxKind.ReadOnlyKeyword)]; 34GetText(CSharpSyntaxKind.PrivateKeyword), 35GetText(CSharpSyntaxKind.SealedKeyword)]; 38GetText(CSharpSyntaxKind.FileKeyword), 39GetText(CSharpSyntaxKind.SealedKeyword)]; 42GetText(CSharpSyntaxKind.ProtectedKeyword)]; 45GetText(CSharpSyntaxKind.ProtectedKeyword), 46GetText(CSharpSyntaxKind.OverrideKeyword)]; 49GetText(CSharpSyntaxKind.PublicKeyword)]; 52GetText(CSharpSyntaxKind.PublicKeyword), 53GetText(CSharpSyntaxKind.AsyncKeyword), 54GetText(CSharpSyntaxKind.OverrideKeyword)]; 57GetText(CSharpSyntaxKind.PublicKeyword), 58GetText(CSharpSyntaxKind.OverrideKeyword), 59GetText(CSharpSyntaxKind.AsyncKeyword)]; 62GetText(CSharpSyntaxKind.PublicKeyword), 63GetText(CSharpSyntaxKind.PartialKeyword)];
Language\Legacy\CSharpCodeParser.cs (57)
15using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 79private static readonly CSharpSyntaxKind[] s_conditionalBlockKeywordKinds = [ 80CSharpSyntaxKind.ForKeyword, 81CSharpSyntaxKind.ForEachKeyword, 82CSharpSyntaxKind.WhileKeyword, 83CSharpSyntaxKind.SwitchKeyword, 84CSharpSyntaxKind.LockKeyword]; 86private static readonly CSharpSyntaxKind[] s_caseStatementKeywordKinds = [ 87CSharpSyntaxKind.CaseKeyword, 88CSharpSyntaxKind.DefaultKeyword]; 90private static readonly CSharpSyntaxKind[] s_ifStatementKeywordKinds = [ 91CSharpSyntaxKind.IfKeyword]; 93private static readonly CSharpSyntaxKind[] s_tryStatementKeywordKinds = [ 94CSharpSyntaxKind.TryKeyword]; 96private static readonly CSharpSyntaxKind[] s_doStatementKeywordKinds = [ 97CSharpSyntaxKind.DoKeyword]; 99private static readonly CSharpSyntaxKind[] s_usingKeywordKinds = [ 100CSharpSyntaxKind.UsingKeyword]; 115private readonly Dictionary<CSharpSyntaxKind, Action<SyntaxListBuilder<RazorSyntaxNode>, CSharpTransitionSyntax?>> _keywordParserMap; 154var keywordParserMap = new Dictionary<CSharpSyntaxKind, Action<SyntaxListBuilder<RazorSyntaxNode>, CSharpTransitionSyntax?>>(capacity: s_initialKeywordCount + 1); 182CSharpSyntaxKind[] keywords) 184foreach (var keyword in keywords) 197keywordParserMap.Add(CSharpSyntaxKind.AwaitKeyword, ParseAwaitExpression); 1724string.Equals(CurrentToken.Content, CSharpSyntaxFacts.GetText(CSharpSyntaxKind.WhereKeyword), StringComparison.Ordinal)) 1769CSharpSyntaxFacts.GetText(CSharpSyntaxKind.WhereKeyword))); 2108return _tokenizer.Tokenizer.GetTokenKeyword(CurrentToken) is CSharpSyntaxKind.TrueKeyword or CSharpSyntaxKind.FalseKeyword; 2114Assert(CSharpSyntaxKind.AwaitKeyword); 2133if (At(CSharpSyntaxKind.ForEachKeyword)) 2260Debug.Assert(result is CSharpSyntaxKind.CaseKeyword or CSharpSyntaxKind.DefaultKeyword); 2282Assert(CSharpSyntaxKind.IfKeyword); 2299if (At(CSharpSyntaxKind.ElseKeyword)) 2302Assert(CSharpSyntaxKind.ElseKeyword); 2316if (!At(CSharpSyntaxKind.ElseKeyword)) 2324if (At(CSharpSyntaxKind.IfKeyword)) 2340Assert(CSharpSyntaxKind.TryKeyword); 2362if (At(CSharpSyntaxKind.CatchKeyword)) 2365Assert(CSharpSyntaxKind.CatchKeyword); 2369else if (At(CSharpSyntaxKind.FinallyKeyword)) 2372Assert(CSharpSyntaxKind.FinallyKeyword); 2386Assert(CSharpSyntaxKind.CatchKeyword); 2399if (At(CSharpSyntaxKind.WhenKeyword)) 2421Assert(CSharpSyntaxKind.DoKeyword); 2442if (At(CSharpSyntaxKind.WhileKeyword)) 2445Assert(CSharpSyntaxKind.WhileKeyword); 2462Assert(CSharpSyntaxKind.UsingKeyword); 2470var atStaticOrGlobal = At(CSharpSyntaxKind.StaticKeyword, CSharpSyntaxKind.GlobalKeyword); 2532Assert(CSharpSyntaxKind.UsingKeyword); 2559Assert(CSharpSyntaxKind.UsingKeyword); 2565if (At(SyntaxKind.Identifier) || At(CSharpSyntaxKind.GlobalKeyword)) 2590else if (At(CSharpSyntaxKind.StaticKeyword)) 3068internal void Assert(CSharpSyntaxKind expectedKeyword) 3076protected internal bool At(params ReadOnlySpan<CSharpSyntaxKind> keywords) 3084foreach (var search in keywords) 3098if (result is not CSharpSyntaxKind.None and { } value && token.Kind == SyntaxKind.Keyword)
Language\Legacy\CSharpTokenizer.cs (2)
5using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 15internal abstract CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token);
Language\Legacy\NativeCSharpTokenizer.cs (84)
14using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 26private static readonly FrozenDictionary<string, CSharpSyntaxKind> _keywords = (new[] { 27CSharpSyntaxKind.AwaitKeyword, 28CSharpSyntaxKind.AbstractKeyword, 29CSharpSyntaxKind.ByteKeyword, 30CSharpSyntaxKind.ClassKeyword, 31CSharpSyntaxKind.DelegateKeyword, 32CSharpSyntaxKind.EventKeyword, 33CSharpSyntaxKind.FixedKeyword, 34CSharpSyntaxKind.IfKeyword, 35CSharpSyntaxKind.InternalKeyword, 36CSharpSyntaxKind.NewKeyword, 37CSharpSyntaxKind.OverrideKeyword, 38CSharpSyntaxKind.ReadOnlyKeyword, 39CSharpSyntaxKind.ShortKeyword, 40CSharpSyntaxKind.StructKeyword, 41CSharpSyntaxKind.TryKeyword, 42CSharpSyntaxKind.UnsafeKeyword, 43CSharpSyntaxKind.VolatileKeyword, 44CSharpSyntaxKind.AsKeyword, 45CSharpSyntaxKind.DoKeyword, 46CSharpSyntaxKind.IsKeyword, 47CSharpSyntaxKind.ParamsKeyword, 48CSharpSyntaxKind.RefKeyword, 49CSharpSyntaxKind.SwitchKeyword, 50CSharpSyntaxKind.UShortKeyword, 51CSharpSyntaxKind.WhileKeyword, 52CSharpSyntaxKind.CaseKeyword, 53CSharpSyntaxKind.ConstKeyword, 54CSharpSyntaxKind.ExplicitKeyword, 55CSharpSyntaxKind.FloatKeyword, 56CSharpSyntaxKind.NullKeyword, 57CSharpSyntaxKind.SizeOfKeyword, 58CSharpSyntaxKind.TypeOfKeyword, 59CSharpSyntaxKind.ImplicitKeyword, 60CSharpSyntaxKind.PrivateKeyword, 61CSharpSyntaxKind.ThisKeyword, 62CSharpSyntaxKind.UsingKeyword, 63CSharpSyntaxKind.ExternKeyword, 64CSharpSyntaxKind.ReturnKeyword, 65CSharpSyntaxKind.StackAllocKeyword, 66CSharpSyntaxKind.UIntKeyword, 67CSharpSyntaxKind.BaseKeyword, 68CSharpSyntaxKind.CatchKeyword, 69CSharpSyntaxKind.ContinueKeyword, 70CSharpSyntaxKind.DoubleKeyword, 71CSharpSyntaxKind.ForKeyword, 72CSharpSyntaxKind.InKeyword, 73CSharpSyntaxKind.LockKeyword, 74CSharpSyntaxKind.ObjectKeyword, 75CSharpSyntaxKind.ProtectedKeyword, 76CSharpSyntaxKind.StaticKeyword, 77CSharpSyntaxKind.FalseKeyword, 78CSharpSyntaxKind.PublicKeyword, 79CSharpSyntaxKind.SByteKeyword, 80CSharpSyntaxKind.ThrowKeyword, 81CSharpSyntaxKind.VirtualKeyword, 82CSharpSyntaxKind.DecimalKeyword, 83CSharpSyntaxKind.ElseKeyword, 84CSharpSyntaxKind.OperatorKeyword, 85CSharpSyntaxKind.StringKeyword, 86CSharpSyntaxKind.ULongKeyword, 87CSharpSyntaxKind.BoolKeyword, 88CSharpSyntaxKind.CharKeyword, 89CSharpSyntaxKind.DefaultKeyword, 90CSharpSyntaxKind.ForEachKeyword, 91CSharpSyntaxKind.LongKeyword, 92CSharpSyntaxKind.VoidKeyword, 93CSharpSyntaxKind.EnumKeyword, 94CSharpSyntaxKind.FinallyKeyword, 95CSharpSyntaxKind.IntKeyword, 96CSharpSyntaxKind.OutKeyword, 97CSharpSyntaxKind.SealedKeyword, 98CSharpSyntaxKind.TrueKeyword, 99CSharpSyntaxKind.GotoKeyword, 100CSharpSyntaxKind.UncheckedKeyword, 101CSharpSyntaxKind.InterfaceKeyword, 102CSharpSyntaxKind.BreakKeyword, 103CSharpSyntaxKind.CheckedKeyword, 104CSharpSyntaxKind.NamespaceKeyword, 105CSharpSyntaxKind.WhenKeyword, 106CSharpSyntaxKind.WhereKeyword }).ToFrozenDictionary(keySelector: k => SyntaxFacts.GetText(k)); 768internal override CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token) 770if (token != null && _keywords.TryGetValue(token.Content, out var keyword))
Language\Legacy\RoslynCSharpTokenizer.cs (42)
15using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 220Debug.Assert(leadingTriviaResult.ContextualKind == CSharpSyntaxKind.None); 221Debug.Assert(leadingTriviaResult.Token.IsKind(CSharpSyntaxKind.None)); 315Debug.Assert(nextResult.Token.IsKind(CSharpSyntaxKind.None)); 329(int)CSharpSyntaxKind.ExclamationToken => SyntaxKind.Not, 330(int)CSharpSyntaxKind.OpenParenToken => SyntaxKind.LeftParenthesis, 331(int)CSharpSyntaxKind.CloseParenToken => SyntaxKind.RightParenthesis, 332(int)CSharpSyntaxKind.CommaToken => SyntaxKind.Comma, 333(int)CSharpSyntaxKind.DotToken => SyntaxKind.Dot, 334(int)CSharpSyntaxKind.ColonColonToken => SyntaxKind.DoubleColon, 335(int)CSharpSyntaxKind.ColonToken => SyntaxKind.Colon, 336(int)CSharpSyntaxKind.OpenBraceToken => SyntaxKind.LeftBrace, 337(int)CSharpSyntaxKind.CloseBraceToken => SyntaxKind.RightBrace, 338(int)CSharpSyntaxKind.LessThanToken => SyntaxKind.LessThan, 339(int)CSharpSyntaxKind.GreaterThanToken => SyntaxKind.GreaterThan, 340(int)CSharpSyntaxKind.EqualsToken => SyntaxKind.Assign, 341(int)CSharpSyntaxKind.OpenBracketToken => SyntaxKind.LeftBracket, 342(int)CSharpSyntaxKind.CloseBracketToken => SyntaxKind.RightBracket, 343(int)CSharpSyntaxKind.QuestionToken => SyntaxKind.QuestionMark, 344(int)CSharpSyntaxKind.SemicolonToken => SyntaxKind.Semicolon, 345<= (int)CSharpSyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken and >= (int)CSharpSyntaxKind.TildeToken => SyntaxKind.CSharpOperator, 481if (trivia.IsKind(CSharpSyntaxKind.MultiLineCommentTrivia) && triviaString.StartsWith("@*", StringComparison.Ordinal)) 495&& trivia.Kind() is CSharpSyntaxKind.MultiLineCommentTrivia or CSharpSyntaxKind.MultiLineDocumentationCommentTrivia 506case CSharpSyntaxKind.WhitespaceTrivia: 509case CSharpSyntaxKind.EndOfLineTrivia: 513case CSharpSyntaxKind.SkippedTokensTrivia: 532case CSharpSyntaxKind.SingleLineCommentTrivia or 533CSharpSyntaxKind.MultiLineCommentTrivia or 534CSharpSyntaxKind.MultiLineDocumentationCommentTrivia or 535CSharpSyntaxKind.SingleLineDocumentationCommentTrivia: 559_isOnlyWhitespaceOnLine = directiveTrivia.EndOfDirectiveToken.TrailingTrivia is [.., { RawKind: (int)CSharpSyntaxKind.EndOfLineTrivia }]; 561case CSharpSyntaxKind.DisabledTextTrivia: 634case CSharpSyntaxKind.ConflictMarkerTrivia: 675if (!csharpToken.IsKind(CSharpSyntaxKind.IdentifierToken) || result.ContextualKind is not (CSharpSyntaxKind.None or CSharpSyntaxKind.IdentifierToken)) 708internal override CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token) 712return CSharpSyntaxKind.None; 716return SyntaxFacts.GetKeywordKind(content) is var kind and not CSharpSyntaxKind.None 746if (!nextResult.Token.IsKind(CSharpSyntaxKind.None))
Microsoft.Diagnostics.DataContractReader.DataGenerator (1)
Parser.cs (1)
77isPartial = cds.Modifiers.Any(m => m.IsKind(Microsoft.CodeAnalysis.CSharp.SyntaxKind.PartialKeyword));
Microsoft.DotNet.CodeAnalysis (7)
Analyzers\AppContextDefaultsAnalyzer.cs (6)
57context.RegisterSyntaxNodeAction(AnalyzeCodeBlock, SyntaxKind.InvocationExpression); 74if (args.Expression.Kind() != SyntaxKind.TrueLiteralExpression) 80var containingIfStatement = call.Ancestors().FirstOrDefault(n => n.IsKind(SyntaxKind.IfStatement)) as IfStatementSyntax; 88if (!(containingIfStatement.Parent.IsKind(SyntaxKind.SwitchSection) || 89containingIfStatement.Parent.Parent.IsKind(SyntaxKind.SwitchSection))) 96if (containingIfStatement.Condition.Kind() != SyntaxKind.LessThanOrEqualExpression)
Analyzers\ResourceUsageAnalyzer.cs (1)
30context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.InvocationExpression);
Microsoft.DotNet.ProjectTools (8)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\FileLevelDirectiveHelpers.cs (8)
69while (!result.Token.IsKind(SyntaxKind.EndOfFileToken)); 74if (trivia.ContainsDiagnostics && trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 104if (trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 111if (trivia.IsKind(SyntaxKind.ShebangDirectiveTrivia)) 125else if (trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 129var message = trivia.GetStructure() is IgnoredDirectiveTriviaSyntax { Content: { RawKind: (int)SyntaxKind.StringLiteralToken } content } 202if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) 213if (trivia.IsKind(SyntaxKind.WhitespaceTrivia))
Microsoft.Extensions.Logging.Generators (6)
LoggerMessageGenerator.Parser.cs (6)
298if (mod.IsKind(SyntaxKind.PartialKeyword)) 302else if (mod.IsKind(SyntaxKind.StaticKeyword)) 590static bool IsAllowedKind(SyntaxKind kind) => 591kind == SyntaxKind.ClassDeclaration || 592kind == SyntaxKind.StructDeclaration || 593kind == SyntaxKind.RecordDeclaration;
Microsoft.Extensions.Options.SourceGeneration (9)
Parser.cs (8)
161private static bool IsAllowedKind(SyntaxKind kind) => 162kind == SyntaxKind.ClassDeclaration || 163kind == SyntaxKind.StructDeclaration || 164kind == SyntaxKind.RecordStructDeclaration || 165kind == SyntaxKind.RecordDeclaration; 180SyntaxKind.ClassDeclaration => "class", 181SyntaxKind.RecordDeclaration => "record class", 182SyntaxKind.RecordStructDeclaration => "record struct",
ParserUtilities.cs (1)
33internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.BuildMetadata (2)
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.ComplianceReports (2)
Parser.cs (1)
39foreach (TypeDeclarationSyntax typeSyntax in typeForSyntaxTree.Where(n => !n.IsKind(SyntaxKind.InterfaceDeclaration)))
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.ContextualOptions (4)
Parser.cs (3)
31.Where(modifier => modifier.IsKind(SyntaxKind.StaticKeyword)) 45.Where(modifier => modifier.IsKind(SyntaxKind.RefKeyword)) 54if (!type.Definitions.Any(def => def.Modifiers.Any(static token => token.IsKind(SyntaxKind.PartialKeyword))))
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
EmitterTests.cs (1)
39mod => mod.IsKind(SyntaxKind.ReadOnlyKeyword));
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (5)
332static bool IsAllowedKind(SyntaxKind kind) => 333kind == SyntaxKind.ClassDeclaration || 334kind == SyntaxKind.StructDeclaration || 335kind == SyntaxKind.RecordDeclaration; 460if (trivia.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia))
Parsing\Parser.LogProperties.cs (1)
241if (ParserUtilities.PropertyHasModifier(property, SyntaxKind.NewKeyword, _cancellationToken))
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.Logging.Unit.Tests (8)
ParserUtilitiesTests.cs (8)
22SyntaxFactory.Token(SyntaxKind.PublicKeyword), 23SyntaxFactory.Token(SyntaxKind.StaticKeyword), 24SyntaxFactory.Token(SyntaxKind.PartialKeyword)), 33SyntaxFactory.Token(SyntaxKind.ProtectedKeyword), 34SyntaxFactory.Token(SyntaxKind.VirtualKeyword)), 53var result = ParserUtilities.PropertyHasModifier(symbolMock.Object, SyntaxKind.ProtectedKeyword, CancellationToken.None); 62SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PartialKeyword)), 74var result = ParserUtilities.PropertyHasModifier(symbolMock.Object, SyntaxKind.ProtectedKeyword, CancellationToken.None);
Microsoft.Gen.MetadataExtractor (9)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (1)
39foreach (TypeDeclarationSyntax typeSyntax in typeForSyntaxTree.Where(n => !n.IsKind(SyntaxKind.InterfaceDeclaration)))
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
82foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 150static bool IsAllowedKind(SyntaxKind kind) => 151kind is SyntaxKind.ClassDeclaration or 152SyntaxKind.StructDeclaration or 153SyntaxKind.RecordDeclaration; 193if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.Metrics (8)
Parser.cs (6)
82foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 150static bool IsAllowedKind(SyntaxKind kind) => 151kind is SyntaxKind.ClassDeclaration or 152SyntaxKind.StructDeclaration or 153SyntaxKind.RecordDeclaration; 193if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.MetricsReports (8)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
82foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 150static bool IsAllowedKind(SyntaxKind kind) => 151kind is SyntaxKind.ClassDeclaration or 152SyntaxKind.StructDeclaration or 153SyntaxKind.RecordDeclaration; 193if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Interop.ComInterfaceGenerator (51)
Analyzers\AddMarshalAsToElementFixer.cs (1)
58if (node.IsKind(SyntaxKind.MethodDeclaration))
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (2)
215if (expression.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 220if (expression.IsKind(SyntaxKind.GenericName))
Analyzers\VtableIndexStubDiagnosticsAnalyzer.cs (3)
113|| methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) 114|| methodSyntax.Modifiers.Any(SyntaxKind.SealedKeyword)) 122if (!typeDecl.Modifiers.Any(SyntaxKind.PartialKeyword))
ComInterfaceGenerator.cs (5)
366new SyntaxTokenList(syntax.Modifiers.Where(static m => !m.IsKind(SyntaxKind.NewKeyword) && !m.IsKind(SyntaxKind.PartialKeyword) && !m.IsKind(SyntaxKind.VirtualKeyword))).StripAccessibilityModifiers(), 367SyntaxKind.MethodDeclaration, 620writer.WriteLine($"{string.Join(" ", syntax.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword))} {syntax.TypeKind.GetDeclarationKeyword()} {syntax.Identifier}{syntax.TypeParameters}");
ComInterfaceGeneratorHelpers.cs (1)
46literals[i] = ExpressionElement(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(bytes[i])));
ComMethodInfo.cs (2)
72|| comMethodDeclaringSyntax.Modifiers.Any(SyntaxKind.SealedKeyword)) 151bool shadowsBaseMethod = comMethodDeclaringSyntax.Modifiers.Any(SyntaxKind.NewKeyword);
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (2)
51AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 54MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshallers\IidParameterIndexMarshallerResolver.cs (22)
53VariableDeclaration(PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword)))) 59PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))), 62SyntaxKind.SimpleMemberAccessExpression, 70SyntaxKind.NotEqualsExpression, 72LiteralExpression(SyntaxKind.NullLiteralExpression)), 80LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))))), 82VariableDeclaration(PredefinedType(Token(SyntaxKind.IntKeyword))) 89SyntaxKind.SimpleMemberAccessExpression, 94Argument(iidExpression).WithRefKindKeyword(Token(SyntaxKind.InKeyword)), 95Argument(IdentifierName(queriedInterfaceIdentifier)).WithRefKindKeyword(Token(SyntaxKind.OutKeyword))))))), 99SyntaxKind.SimpleMemberAccessExpression, 106SyntaxKind.LessThanExpression, 108LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0))), 112SyntaxKind.NotEqualsExpression, 114LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0))), 118SyntaxKind.SimpleMemberAccessExpression, 125SyntaxKind.SimpleAssignmentExpression, 127LiteralExpression(SyntaxKind.NullLiteralExpression))), 139SyntaxKind.SimpleAssignmentExpression, 142PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))), 148SyntaxKind.SimpleAssignmentExpression, 150LiteralExpression(SyntaxKind.NullLiteralExpression))))));
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (3)
87SyntaxKind.SimpleAssignmentExpression, 90SyntaxKind.NumericLiteralExpression, 95SyntaxKind.SemicolonToken,
VirtualMethodPointerStubGenerator.cs (7)
75Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(methodStub.VtableIndexData.Index)))), 110FunctionPointerCallingConvention(Token(SyntaxKind.UnmanagedKeyword), callConv.IsEmpty ? null : FunctionPointerUnmanagedCallingConventionList(SeparatedList(callConv))), 145MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 159InitializerExpression(SyntaxKind.CollectionInitializerExpression, 167.WithModifiers(TokenList(Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword))) 254FunctionPointerCallingConvention(Token(SyntaxKind.UnmanagedKeyword), callConv.IsEmpty ? null : FunctionPointerUnmanagedCallingConventionList(SeparatedList(callConv))),
VtableIndexStubGenerator.cs (3)
347var methodSyntaxTemplate = new ContainingSyntax(new SyntaxTokenList(syntax.Modifiers.Where(static m => !m.IsKind(SyntaxKind.PartialKeyword) && !m.IsKind(SyntaxKind.VirtualKeyword))).StripAccessibilityModifiers(), SyntaxKind.MethodDeclaration, syntax.Identifier, syntax.TypeParameterList);
Microsoft.Interop.JavaScript.JSImportGenerator (90)
Analyzers\JSImportExportDiagnosticsAnalyzer.cs (2)
157bool isPartial = methodSyntax.Modifiers.Any(SyntaxKind.PartialKeyword); 163|| !methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword)
JSExportGenerator.cs (34)
120MemberDeclarationSyntax wrappperMethod = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(wrapperName)) 121.WithModifiers(TokenList(new[] { Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword), Token(SyntaxKind.UnsafeKeyword) })) 178var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 208FieldDeclarationSyntax field = FieldDeclaration(VariableDeclaration(PredefinedType(Token(SyntaxKind.BoolKeyword))) 211.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 215MemberDeclarationSyntax method = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(initializerName)) 217.WithModifiers(TokenList(new[] { Token(SyntaxKind.StaticKeyword) })) 221MemberDeclarationSyntax initializerMethod = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(trimmingPreserveName)) 229Token(SyntaxKind.CommaToken), 238SyntaxKind.BitwiseOrExpression, 240SyntaxKind.SimpleMemberAccessExpression, 244SyntaxKind.SimpleMemberAccessExpression, 247Token(SyntaxKind.CommaToken), 249LiteralExpression(SyntaxKind.StringLiteralExpression, Literal($"{generatedNamespace}.{initializerClass}")) 251Token(SyntaxKind.CommaToken), 253LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(assemblyName)) 257Token(SyntaxKind.StaticKeyword), 258Token(SyntaxKind.InternalKeyword) 267Token(SyntaxKind.UnsafeKeyword)})) 280BinaryExpression(SyntaxKind.LogicalOrExpression, 282BinaryExpression(SyntaxKind.NotEqualsExpression, 287AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 289LiteralExpression(SyntaxKind.TrueLiteralExpression))), 348AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(wrapperName))), 349AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(incrementalContext.SignatureContext.StubTypeFullName))), 350AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(incrementalContext.SignatureContext.AssemblyName))), 377LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(nativeArg.NativeIndex + 2)))))))); 387SyntaxKind.AddExpression, 389LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))); 413Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(context.QualifiedMethodName))), 414Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(context.TypesHash))), 418return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
JSImportGenerator.cs (11)
102.AddModifiers(Token(SyntaxKind.StaticKeyword)); 161var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 265Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(jsImportData.FunctionName))), 268? LiteralExpression(SyntaxKind.NullLiteralExpression) 269: LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(jsImportData.ModuleName))), 273return IfStatement(BinaryExpression(SyntaxKind.EqualsExpression, IdentifierName(signatureContext.BindingName), LiteralExpression(SyntaxKind.NullLiteralExpression)), 275ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 277InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 310LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))))) 324hasReturn ? jsMarshalerArgument : PredefinedType(Token(SyntaxKind.VoidKeyword)),
JSManagedTypeInfo.cs (12)
22Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)) 27Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.BoolKeyword)) 32Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ByteKeyword)) 37Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.CharKeyword)) 42Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ShortKeyword)) 47Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword)) 52Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.LongKeyword)) 57Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.FloatKeyword)) 62Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.DoubleKeyword)) 88Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ObjectKeyword)) 93Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.StringKeyword)) 119return new JSTaskTypeInfo(new JSSimpleTypeInfo(KnownManagedType.Void, SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword))));
Marshaling\BaseJSGenerator.cs (1)
49.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword))))
Marshaling\FuncJSGenerator.cs (11)
53List<ArgumentSyntax> arguments = [source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword))]; 67return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 88return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 94.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 97.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 102InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 109.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 112.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 115.WithModifiers(TokenList(Token(SyntaxKind.OutKeyword))) 118InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 121Argument(IdentifierName("__delegate_arg"+(i+1))).WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)),
Marshaling\ImplicitArgumentGenerator.cs (2)
26.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))), 31MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshaling\PrimitiveJSGenerator.cs (3)
39return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 41.WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))))); 46return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshaling\TaskJSGenerator.cs (14)
56return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 58.WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))))); 63return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 70return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 73source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)), 75.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 78.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 81.WithModifiers(TokenList(Token(SyntaxKind.OutKeyword))) 84InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 87Argument(IdentifierName("__task_result")).WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)), 93return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 98.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 101.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 106InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Microsoft.Interop.LibraryImportGenerator (35)
Analyzers\ConvertToLibraryImportFixer.cs (14)
334else if (invocation.Parent.IsKind(SyntaxKind.ExpressionStatement)) 345SyntaxKind.UnderscoreToken, 349.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 354else if (invocation.Parent.IsKind(SyntaxKind.EqualsValueClause)) 357if (declaration.IsKind(SyntaxKind.FieldDeclaration) || declaration.IsKind(SyntaxKind.EventFieldDeclaration)) 382.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 387else if (invocation.Parent.IsKind(SyntaxKind.SimpleAssignmentExpression) && invocation.Parent.Parent.IsKind(SyntaxKind.ExpressionStatement)) 397.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 521if (attrArg.Expression.IsKind(SyntaxKind.StringLiteralExpression)) 528SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, 538SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, 540SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (2)
324|| !methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) 325|| !methodSyntax.Modifiers.Any(SyntaxKind.PartialKeyword))
LibraryImportGenerator.cs (19)
107InitializerExpressionSyntax callConvs = InitializerExpression(SyntaxKind.ArrayInitializerExpression); 131LiteralExpression(SyntaxKind.NumericLiteralExpression, 268var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 352modifiers = modifiers.AddToModifiers(SyntaxKind.ExternKeyword); 357.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 381SyntaxKind.StringLiteralExpression, 387SyntaxKind.StringLiteralExpression, 392LiteralExpression(SyntaxKind.TrueLiteralExpression)) 410Token(SyntaxKind.StaticKeyword), 411Token(SyntaxKind.ExternKeyword), 412Token(SyntaxKind.UnsafeKeyword)) 413.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 424localDllImport = localDllImport.AddAttributeLists(returnTypeAttributes.WithTarget(AttributeTargetSpecifier(Token(SyntaxKind.ReturnKeyword)))); 434SyntaxKind.StringLiteralExpression, 443LiteralExpression(SyntaxKind.TrueLiteralExpression)) 470? SyntaxKind.TrueLiteralExpression 471: SyntaxKind.FalseLiteralExpression); 477SyntaxKind.StringLiteralExpression, 485SyntaxKind.SimpleMemberAccessExpression,
Microsoft.Interop.LibraryImportGenerator.Downlevel (20)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (2)
328|| !methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) 329|| !methodSyntax.Modifiers.Any(SyntaxKind.PartialKeyword))
DownlevelLibraryImportGenerator.cs (18)
121LiteralExpression(SyntaxKind.NumericLiteralExpression, 229var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 300modifiers = modifiers.AddToModifiers(SyntaxKind.ExternKeyword); 305.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 326SyntaxKind.StringLiteralExpression, 332SyntaxKind.StringLiteralExpression, 337LiteralExpression(SyntaxKind.TrueLiteralExpression)) 355Token(SyntaxKind.StaticKeyword), 356Token(SyntaxKind.ExternKeyword), 357Token(SyntaxKind.UnsafeKeyword)) 358.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 369localDllImport = localDllImport.AddAttributeLists(returnTypeAttributes.WithTarget(AttributeTargetSpecifier(Token(SyntaxKind.ReturnKeyword)))); 379SyntaxKind.StringLiteralExpression, 388LiteralExpression(SyntaxKind.TrueLiteralExpression)) 415? SyntaxKind.TrueLiteralExpression 416: SyntaxKind.FalseLiteralExpression); 422SyntaxKind.StringLiteralExpression, 430SyntaxKind.SimpleMemberAccessExpression,
Microsoft.Interop.SourceGeneration (169)
ContainingSyntaxContext.cs (5)
16public readonly struct ContainingSyntax(SyntaxTokenList modifiers, SyntaxKind typeKind, SyntaxToken identifier, TypeParameterListSyntax? typeParameters) : IEquatable<ContainingSyntax> 22public SyntaxKind TypeKind { get; init; } = typeKind; 113type = type.WithModifiers(type.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword)); 139type = type.WithModifiers(type.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword)); 172writer.WriteLine($"{string.Join(" ", syntax.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword))} {syntax.TypeKind.GetDeclarationKeyword()} {syntax.Identifier}{syntax.TypeParameters}");
GeneratedStatements.cs (2)
119SyntaxKind.SimpleAssignmentExpression, 147SyntaxKind.SimpleAssignmentExpression,
IndentedTextWriterExtensions.cs (2)
18if (leadingTrivia.IsKind(SyntaxKind.EndOfLineTrivia)) 31if (trailingTrivia.IsKind(SyntaxKind.EndOfLineTrivia))
ManagedToNativeStubGenerator.cs (4)
121PredefinedType(Token(SyntaxKind.IntKeyword)), 128setupStatements.Add(Declare(PredefinedType(Token(SyntaxKind.BoolKeyword)), InvokeSucceededIdentifier, initializeToDefault: true)); 157tryStatements.Add(ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 159LiteralExpression(SyntaxKind.TrueLiteralExpression))));
MarshalAsParser.cs (8)
50LiteralExpression(SyntaxKind.NumericLiteralExpression, 75LiteralExpression(SyntaxKind.NumericLiteralExpression, 85LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(paramIndex)))); 112LiteralExpression(SyntaxKind.NumericLiteralExpression, 122LiteralExpression(SyntaxKind.NumericLiteralExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, 141LiteralExpression(SyntaxKind.NumericLiteralExpression, 304&& parameterSyntax.Modifiers.IndexOf(SyntaxKind.OutKeyword) >= 0;
Marshalling\BlittableMarshaller.cs (3)
54PrefixUnaryExpression(SyntaxKind.AddressOfExpression, 76SyntaxKind.SimpleAssignmentExpression, 87SyntaxKind.SimpleAssignmentExpression,
Marshalling\BoolMarshaller.cs (8)
64SyntaxKind.SimpleAssignmentExpression, 70LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(_trueValue)), 71LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(_falseValue))))))); 81(SyntaxKind binaryOp, int comparand) = _compareToTrue ? (SyntaxKind.EqualsExpression, _trueValue) : (SyntaxKind.NotEqualsExpression, _falseValue); 85SyntaxKind.SimpleAssignmentExpression, 90LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(comparand)))));
Marshalling\CharMarshaller.cs (5)
58PointerType(PredefinedType(Token(SyntaxKind.CharKeyword))), 63SyntaxKind.AddressOfExpression, 97SyntaxKind.SimpleAssignmentExpression, 109SyntaxKind.SimpleAssignmentExpression, 113Token(SyntaxKind.CharKeyword)),
Marshalling\DelegateMarshaller.cs (6)
46SyntaxKind.NotEqualsExpression, 48LiteralExpression(SyntaxKind.NullLiteralExpression) 54LiteralExpression(SyntaxKind.DefaultLiteralExpression))); 65SyntaxKind.NotEqualsExpression, 67LiteralExpression(SyntaxKind.DefaultLiteralExpression)), 76LiteralExpression(SyntaxKind.NullLiteralExpression)));
Marshalling\ElementsMarshalling.cs (22)
68SizeAndParamIndexInfo(int size, TypePositionInfo param) => CheckedExpression(SyntaxKind.CheckedExpression, 69BinaryExpression(SyntaxKind.AddExpression, 78if (numElementsExpression.IsKind(SyntaxKind.CheckedExpression)) 82numElementsExpression = CheckedExpression(SyntaxKind.CheckedExpression, 84PredefinedType(Token(SyntaxKind.IntKeyword)), 92return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(size)); 118SyntaxKind.SimpleAssignmentExpression, 121SyntaxKind.SimpleMemberAccessExpression, 132SyntaxKind.SimpleAssignmentExpression, 135SyntaxKind.SimpleMemberAccessExpression, 162MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 198MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 206SyntaxKind.SimpleMemberAccessExpression, 285MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 312MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 359MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 372indexConstraintName = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 386if (contentsCleanupStatements.IsKind(SyntaxKind.EmptyStatement)) 465MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 581PrefixUnaryExpression(SyntaxKind.PreIncrementExpression, 616PredefinedType(Token(SyntaxKind.IntKeyword)), 621EqualsValueClause(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))))))
Marshalling\MarshallerHelpers.cs (17)
49Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(errorCode)))); 244.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))); 251LiteralExpression(SyntaxKind.DefaultLiteralExpression, Token(SyntaxKind.DefaultKeyword))); 260LiteralExpression(SyntaxKind.DefaultLiteralExpression, Token(SyntaxKind.DefaultKeyword))); 392tokens = tokens.Add(Token(SyntaxKind.ScopedKeyword)); 400tokens = tokens.Add(Token(SyntaxKind.InKeyword)); 403tokens = tokens.Add(Token(SyntaxKind.RefKeyword)); 407tokens = tokens.Add(Token(SyntaxKind.OutKeyword)); 410tokens = tokens.Add(Token(SyntaxKind.RefKeyword)); 411tokens = tokens.Add(Token(SyntaxKind.ReadOnlyKeyword)); 420tokens = tokens.Add(Token(SyntaxKind.ThisKeyword)); 431RefKind.In => Token(SyntaxKind.InKeyword), 432RefKind.Ref => Token(SyntaxKind.RefKeyword), 433RefKind.Out => Token(SyntaxKind.OutKeyword), 434RefKind.RefReadOnlyParameter => Token(SyntaxKind.InKeyword),
Marshalling\MarshallingGeneratorExtensions.cs (2)
148ValueBoundaryBehavior.AddressOfNativeIdentifier => Argument(PrefixUnaryExpression(SyntaxKind.AddressOfExpression, IdentifierName(nativeIdentifier))), 169return RefExpression(PrefixUnaryExpression(SyntaxKind.PointerIndirectionExpression, IdentifierName(paramIdentifier)));
Marshalling\StatefulMarshallingStrategy.cs (5)
142declaration = declaration.AddModifiers(Token(SyntaxKind.ScopedKeyword)); 220MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 333if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 347if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 402PredefinedType(Token(SyntaxKind.IntKeyword)),
Marshalling\StatelessMarshallingStrategy.cs (37)
41SyntaxKind.SimpleAssignmentExpression, 44MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 60MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 82assignment = AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 90SyntaxKind.SimpleAssignmentExpression, 113SyntaxKind.SimpleAssignmentExpression, 116MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 183MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 197SyntaxKind.SimpleAssignmentExpression, 200MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 208.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)) 222SyntaxKind.SimpleAssignmentExpression, 225MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 269MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 288MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 329SyntaxKind.SimpleAssignmentExpression, 350SyntaxKind.SimpleAssignmentExpression, 365SyntaxKind.SimpleAssignmentExpression, 372SyntaxKind.SimpleAssignmentExpression, 375MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 400SyntaxKind.SimpleAssignmentExpression, 403MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 410.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)) 424PredefinedType(Token(SyntaxKind.IntKeyword)), 453SyntaxKind.SimpleAssignmentExpression, 460SyntaxKind.SimpleAssignmentExpression, 463MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 490SyntaxKind.SimpleMemberAccessExpression, 506SyntaxKind.SimpleMemberAccessExpression, 521SyntaxKind.SimpleMemberAccessExpression, 538SyntaxKind.SimpleMemberAccessExpression, 574if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 590SyntaxKind.SimpleAssignmentExpression, 592LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))); 599SyntaxKind.SimpleAssignmentExpression, 624if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 633SyntaxKind.SimpleAssignmentExpression,
Marshalling\StaticPinnableManagedValueMarshaller.cs (4)
31&& predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword)) 81PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))), 85PrefixUnaryExpression(SyntaxKind.AddressOfExpression, 87MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (4)
43AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 45LiteralExpression(SyntaxKind.TrueLiteralExpression))); 62PredefinedType(Token(SyntaxKind.BoolKeyword)), 68LiteralExpression(SyntaxKind.FalseLiteralExpression))))));
SignatureContext.cs (2)
78AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(generatorName))), 79AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(generatorVersion)))
SyntaxExtensions.cs (12)
18if (fixedStatement.Statement.IsKind(SyntaxKind.EmptyStatement)) 24if (fixedStatement.Statement.IsKind(SyntaxKind.Block)) 37if (childStatement.IsKind(SyntaxKind.Block)) 66if (statement.IsKind(SyntaxKind.Block)) 89if (tokenList[i].Kind() is SyntaxKind.PublicKeyword or SyntaxKind.InternalKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.PrivateKeyword) 98public static SyntaxTokenList AddToModifiers(this SyntaxTokenList modifiers, SyntaxKind modifierToAdd) 106int idxPartial = modifiers.IndexOf(SyntaxKind.PartialKeyword); 107int idxRef = modifiers.IndexOf(SyntaxKind.RefKeyword); 124if (!typeDecl.Modifiers.Any(SyntaxKind.PartialKeyword))
SyntaxKindExtensions.cs (6)
10public static string GetDeclarationKeyword(this SyntaxKind syntaxKind) => syntaxKind switch 12SyntaxKind.ClassDeclaration => "class", 13SyntaxKind.StructDeclaration => "struct", 14SyntaxKind.InterfaceDeclaration => "interface", 15SyntaxKind.RecordDeclaration => "record", 16SyntaxKind.RecordStructDeclaration => "record struct",
TypeNames.cs (1)
46public static TypeSyntax VoidStar { get; } = PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword)));
TypePositionInfo.cs (1)
94IsExplicitThis = ((ParameterSyntax?)paramSymbol.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax())?.Modifiers.Any(SyntaxKind.ThisKeyword) ?? false
Utils\SyntaxFactoryExtensions.cs (13)
20return Declare(typeSyntax, identifier, initializeToDefault ? LiteralExpression(SyntaxKind.DefaultLiteralExpression) : null); 50SyntaxKind.SimpleMemberAccessExpression, 58SyntaxKind.SimpleMemberAccessExpression, 72=> Argument(null, Token(SyntaxKind.RefKeyword), expression); 75=> Argument(null, Token(SyntaxKind.InKeyword), expression); 78=> Argument(null, Token(SyntaxKind.OutKeyword), expression); 88SyntaxKind.SimpleMemberAccessExpression, 97public static LiteralExpressionSyntax IntLiteral(int number) => LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(number)); 105=> ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, left, right)); 122Token(SyntaxKind.IntKeyword))) 130SyntaxKind.NumericLiteralExpression, 134SyntaxKind.LessThanExpression, 140SyntaxKind.PreIncrementExpression,
Microsoft.Maui.Controls.BindingSourceGen (3)
BindingSourceGenerator.cs (2)
181 if (!lambda.Modifiers.Any(SyntaxKind.StaticKeyword)) 254 BinaryExpressionSyntax binary when binary.Kind() == SyntaxKind.AsExpression => binary.Left,
PathParser.cs (1)
29 BinaryExpressionSyntax asExpression when asExpression.Kind() == SyntaxKind.AsExpression => HandleBinaryExpression(asExpression),
Microsoft.Maui.Controls.SourceGen (2)
CodeBehindGenerator.cs (2)
98 var kind = SyntaxFacts.GetKeywordKind(identifier); 99 return kind == SyntaxKind.None
Microsoft.ML.AutoML (2)
Utils\Entity.cs (2)
148if (exp.Kind() == SyntaxKind.AddExpression) 156else if (exp.Kind() == SyntaxKind.MultiplyExpression)
Microsoft.ML.InternalCodeAnalyzer (40)
BestFriendAnalyzer.cs (3)
66foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes(n => !n.IsKind(SyntaxKind.UsingDirective))) 71case SyntaxKind.BaseConstructorInitializer: 72case SyntaxKind.IdentifierName:
ContractsCheckAnalyzer.cs (9)
93context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); 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 (7)
50Debug.Assert(nameArg.Parent.Parent.IsKind(SyntaxKind.InvocationExpression)); 74.Select(p => p.Parent).Where(n => n.IsKind(SyntaxKind.IdentifierName)); 78var pk = node.Parent.Kind(); 79if (pk == SyntaxKind.SimpleMemberAccessExpression) 84else if (pk == SyntaxKind.QualifiedName) 108while (temp != null && !temp.IsKind(SyntaxKind.MethodDeclaration) && !temp.IsKind(SyntaxKind.ConstructorDeclaration))
InstanceInitializerAnalyzer.cs (1)
72if (!syntax.ChildNodes().Any(s => s.IsKind(SyntaxKind.EqualsValueClause)))
NameAnalyzer.cs (15)
79context.RegisterSyntaxNodeAction(AnalyzeField, SyntaxKind.FieldDeclaration); 80context.RegisterSyntaxNodeAction(AnalyzeField, SyntaxKind.EventFieldDeclaration); 81context.RegisterSyntaxNodeAction(AnalyzeClass, SyntaxKind.ClassDeclaration); 82context.RegisterSyntaxNodeAction(AnalyzeEnum, SyntaxKind.EnumDeclaration); 83context.RegisterSyntaxNodeAction(AnalyzeEnumMember, SyntaxKind.EnumMemberDeclaration); 84context.RegisterSyntaxNodeAction(AnalyzeEvent, SyntaxKind.EventDeclaration); 85context.RegisterSyntaxNodeAction(AnalyzeMethod, SyntaxKind.MethodDeclaration); 86context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.NamespaceDeclaration); 87context.RegisterSyntaxNodeAction(AnalyzeProperty, SyntaxKind.PropertyDeclaration); 88context.RegisterSyntaxNodeAction(AnalyzeStruct, SyntaxKind.StructDeclaration); 131return modifiers.Any(token => token.IsKind(SyntaxKind.ExternKeyword)); 151if (mod.IsKind(SyntaxKind.ConstKeyword)) 153else if (mod.IsKind(SyntaxKind.PublicKeyword) || mod.IsKind(SyntaxKind.ProtectedKeyword) || mod.IsKind(SyntaxKind.InternalKeyword))
ParameterVariableNameAnalyzer.cs (2)
37context.RegisterSyntaxNodeAction(AnalyzeParameter, SyntaxKind.Parameter); 38context.RegisterSyntaxNodeAction(AnalyzeLocal, SyntaxKind.LocalDeclarationStatement);
SingleVariableDeclarationAnalyzer.cs (2)
37context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.VariableDeclaration); 44if (vars.Count <= 1 || node.Parent.IsKind(SyntaxKind.ForStatement))
TypeParamNameAnalyzer.cs (1)
36context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.TypeParameter);
QuarantineTools.Tests (10)
ActiveIssueTests.cs (5)
431SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(issueUrl))))); 440var indentation = SyntaxFactory.TriviaList(last.GetLeadingTrivia().Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia))); 441bool lastEndsWithNewline = last.GetTrailingTrivia().Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia)); 474SyntaxFactory.Token(SyntaxKind.UsingKeyword) 477SyntaxFactory.Token(SyntaxKind.SemicolonToken)
QuarantineScriptTests.cs (5)
375SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(issueUrl))))); 384var indentation = SyntaxFactory.TriviaList(last.GetLeadingTrivia().Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia))); 385bool lastEndsWithNewline = last.GetTrailingTrivia().Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia)); 422SyntaxFactory.Token(SyntaxKind.UsingKeyword) 425SyntaxFactory.Token(SyntaxKind.SemicolonToken)
Roslyn.Diagnostics.CSharp.Analyzers (3047)
CSharpAvoidOptSuffixForNullableEnableCode.cs (3)
52}, SyntaxKind.Parameter); 58}, SyntaxKind.VariableDeclarator); 64}, SyntaxKind.PropertyDeclaration);
CSharpExposeMemberForTesting.cs (2)
40var refKeyword = SyntaxFactory.Token(SyntaxKind.RefKeyword); 44RefKind.RefReadOnly => SyntaxFactory.Token(SyntaxKind.ReadOnlyKeyword),
CSharpSpecializedEnumerableCreationAnalyzer.cs (11)
23context.RegisterCodeBlockStartAction<SyntaxKind>(new CodeBlockStartedAnalyzer(genericEnumerableSymbol, genericEmptyEnumerableSymbol).Initialize); 26private sealed class CodeBlockStartedAnalyzer : AbstractCodeBlockStartedAnalyzer<SyntaxKind> 33protected override void GetSyntaxAnalyzer(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol genericEnumerableSymbol, IMethodSymbol genericEmptyEnumerableSymbol) 35context.RegisterSyntaxNodeAction(new SyntaxAnalyzer(genericEnumerableSymbol, genericEmptyEnumerableSymbol).AnalyzeNode, SyntaxKind.ReturnStatement); 54case SyntaxKind.ArrayCreationExpression: 57case SyntaxKind.ImplicitArrayCreationExpression: 60case SyntaxKind.SimpleMemberAccessExpression: 71SyntaxKind.ArrayCreationExpression 72or SyntaxKind.ImplicitArrayCreationExpression => ShouldAnalyzeArrayCreationExpression(expression, semanticModel, cancellationToken), 73SyntaxKind.SimpleMemberAccessExpression => true, 86.FirstOrDefault(n => n.IsKind(SyntaxKind.NumericLiteralExpression)) is LiteralExpressionSyntax literalRankSpecifier)
CSharpSymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (3)
19public class CSharpSymbolDeclaredEventAnalyzer : SymbolDeclaredEventAnalyzer<SyntaxKind> 40protected override SyntaxKind InvocationExpressionSyntaxKind => SyntaxKind.InvocationExpression;
NumberCommentsRefactoring.cs (1)
41if (literal.Kind() == SyntaxKind.StringLiteralExpression &&
PreferNullLiteralCodeFixProvider.cs (3)
53ExpressionSyntax newSyntax = SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 57if (!type.IsKind(SyntaxKind.NullableType) && !type.IsKind(SyntaxKind.PointerType))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (97)
11public static readonly SyntaxToken AbstractKeyword = Token(SyntaxKind.AbstractKeyword); 12public static readonly SyntaxToken AsKeyword = Token(SyntaxKind.AsKeyword); 13public static readonly SyntaxToken AssemblyKeyword = Token(SyntaxKind.AssemblyKeyword); 14public static readonly SyntaxToken AsyncKeyword = Token(SyntaxKind.AsyncKeyword); 15public static readonly SyntaxToken AwaitKeyword = Token(SyntaxKind.AwaitKeyword); 16public static readonly SyntaxToken BoolKeyword = Token(SyntaxKind.BoolKeyword); 17public static readonly SyntaxToken BreakKeyword = Token(SyntaxKind.BreakKeyword); 18public static readonly SyntaxToken ByteKeyword = Token(SyntaxKind.ByteKeyword); 19public static readonly SyntaxToken CaseKeyword = Token(SyntaxKind.CaseKeyword); 20public static readonly SyntaxToken CharKeyword = Token(SyntaxKind.CharKeyword); 21public static readonly SyntaxToken CheckedKeyword = Token(SyntaxKind.CheckedKeyword); 22public static readonly SyntaxToken CloseBraceToken = Token(SyntaxKind.CloseBraceToken); 23public static readonly SyntaxToken CloseBracketToken = Token(SyntaxKind.CloseBracketToken); 25public static readonly SyntaxToken ClosedKeyword = Token(SyntaxKind.ClosedKeyword); 27public static readonly SyntaxToken CloseParenToken = Token(SyntaxKind.CloseParenToken); 28public static readonly SyntaxToken ColonToken = Token(SyntaxKind.ColonToken); 29public static readonly SyntaxToken CommaToken = Token(SyntaxKind.CommaToken); 30public static readonly SyntaxToken ConstKeyword = Token(SyntaxKind.ConstKeyword); 31public static readonly SyntaxToken ContinueKeyword = Token(SyntaxKind.ContinueKeyword); 32public static readonly SyntaxToken DecimalKeyword = Token(SyntaxKind.DecimalKeyword); 33public static readonly SyntaxToken DisableKeyword = Token(SyntaxKind.DisableKeyword); 34public static readonly SyntaxToken DotDotToken = Token(SyntaxKind.DotDotToken); 35public static readonly SyntaxToken DoubleKeyword = Token(SyntaxKind.DoubleKeyword); 36public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken); 37public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken); 38public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword); 40public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword); 42public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword); 43public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword); 44public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword); 45public static readonly SyntaxToken FloatKeyword = Token(SyntaxKind.FloatKeyword); 46public static readonly SyntaxToken ForEachKeyword = Token(SyntaxKind.ForEachKeyword); 47public static readonly SyntaxToken FromKeyword = Token(SyntaxKind.FromKeyword); 48public static readonly SyntaxToken GlobalKeyword = Token(SyntaxKind.GlobalKeyword); 49public static readonly SyntaxToken GreaterThanEqualsToken = Token(SyntaxKind.GreaterThanEqualsToken); 50public static readonly SyntaxToken GreaterThanToken = Token(SyntaxKind.GreaterThanToken); 51public static readonly SyntaxToken IfKeyword = Token(SyntaxKind.IfKeyword); 52public static readonly SyntaxToken ImplicitKeyword = Token(SyntaxKind.ImplicitKeyword); 53public static readonly SyntaxToken InKeyword = Token(SyntaxKind.InKeyword); 54public static readonly SyntaxToken InterfaceKeyword = Token(SyntaxKind.InterfaceKeyword); 55public static readonly SyntaxToken InternalKeyword = Token(SyntaxKind.InternalKeyword); 56public static readonly SyntaxToken InterpolatedStringEndToken = Token(SyntaxKind.InterpolatedStringEndToken); 57public static readonly SyntaxToken InterpolatedStringStartToken = Token(SyntaxKind.InterpolatedStringStartToken); 58public static readonly SyntaxToken IntKeyword = Token(SyntaxKind.IntKeyword); 59public static readonly SyntaxToken IsKeyword = Token(SyntaxKind.IsKeyword); 60public static readonly SyntaxToken LessThanEqualsToken = Token(SyntaxKind.LessThanEqualsToken); 61public static readonly SyntaxToken LessThanToken = Token(SyntaxKind.LessThanToken); 62public static readonly SyntaxToken LetKeyword = Token(SyntaxKind.LetKeyword); 63public static readonly SyntaxToken LongKeyword = Token(SyntaxKind.LongKeyword); 64public static readonly SyntaxToken MethodKeyword = Token(SyntaxKind.MethodKeyword); 65public static readonly SyntaxToken NewKeyword = Token(SyntaxKind.NewKeyword); 66public static readonly SyntaxToken NotKeyword = Token(SyntaxKind.NotKeyword); 67public static readonly SyntaxToken NullKeyword = Token(SyntaxKind.NullKeyword); 68public static readonly SyntaxToken ObjectKeyword = Token(SyntaxKind.ObjectKeyword); 69public static readonly SyntaxToken OpenBraceToken = Token(SyntaxKind.OpenBraceToken); 70public static readonly SyntaxToken OpenBracketToken = Token(SyntaxKind.OpenBracketToken); 71public static readonly SyntaxToken OpenParenToken = Token(SyntaxKind.OpenParenToken); 72public static readonly SyntaxToken OperatorKeyword = Token(SyntaxKind.OperatorKeyword); 73public static readonly SyntaxToken OutKeyword = Token(SyntaxKind.OutKeyword); 74public static readonly SyntaxToken OverrideKeyword = Token(SyntaxKind.OverrideKeyword); 75public static readonly SyntaxToken ParamsKeyword = Token(SyntaxKind.ParamsKeyword); 76public static readonly SyntaxToken PartialKeyword = Token(SyntaxKind.PartialKeyword); 77public static readonly SyntaxToken PlusToken = Token(SyntaxKind.PlusToken); 78public static readonly SyntaxToken PrivateKeyword = Token(SyntaxKind.PrivateKeyword); 79public static readonly SyntaxToken PropertyKeyword = Token(SyntaxKind.PropertyKeyword); 80public static readonly SyntaxToken ProtectedKeyword = Token(SyntaxKind.ProtectedKeyword); 81public static readonly SyntaxToken PublicKeyword = Token(SyntaxKind.PublicKeyword); 82public static readonly SyntaxToken QuestionQuestionEqualsToken = Token(SyntaxKind.QuestionQuestionEqualsToken); 83public static readonly SyntaxToken QuestionToken = Token(SyntaxKind.QuestionToken); 84public static readonly SyntaxToken ReadOnlyKeyword = Token(SyntaxKind.ReadOnlyKeyword); 85public static readonly SyntaxToken RecordKeyword = Token(SyntaxKind.RecordKeyword); 86public static readonly SyntaxToken RefKeyword = Token(SyntaxKind.RefKeyword); 87public static readonly SyntaxToken RequiredKeyword = Token(SyntaxKind.RequiredKeyword); 88public static readonly SyntaxToken RestoreKeyword = Token(SyntaxKind.RestoreKeyword); 89public static readonly SyntaxToken ReturnKeyword = Token(SyntaxKind.ReturnKeyword); 90public static readonly SyntaxToken SByteKeyword = Token(SyntaxKind.SByteKeyword); 91public static readonly SyntaxToken ScopedKeyword = Token(SyntaxKind.ScopedKeyword); 92public static readonly SyntaxToken SealedKeyword = Token(SyntaxKind.SealedKeyword); 93public static readonly SyntaxToken SemicolonToken = Token(SyntaxKind.SemicolonToken); 94public static readonly SyntaxToken ShortKeyword = Token(SyntaxKind.ShortKeyword); 95public static readonly SyntaxToken SlashGreaterThanToken = Token(SyntaxKind.SlashGreaterThanToken); 96public static readonly SyntaxToken StaticKeyword = Token(SyntaxKind.StaticKeyword); 97public static readonly SyntaxToken StringKeyword = Token(SyntaxKind.StringKeyword); 98public static readonly SyntaxToken StructKeyword = Token(SyntaxKind.StructKeyword); 99public static readonly SyntaxToken SwitchKeyword = Token(SyntaxKind.SwitchKeyword); 100public static readonly SyntaxToken ThisKeyword = Token(SyntaxKind.ThisKeyword); 101public static readonly SyntaxToken TildeToken = Token(SyntaxKind.TildeToken); 102public static readonly SyntaxToken UIntKeyword = Token(SyntaxKind.UIntKeyword); 103public static readonly SyntaxToken ULongKeyword = Token(SyntaxKind.ULongKeyword); 104public static readonly SyntaxToken UnmanagedKeyword = Token(SyntaxKind.UnmanagedKeyword); 105public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.UnsafeKeyword); 106public static readonly SyntaxToken UShortKeyword = Token(SyntaxKind.UShortKeyword); 107public static readonly SyntaxToken UsingKeyword = Token(SyntaxKind.UsingKeyword); 108public static readonly SyntaxToken VirtualKeyword = Token(SyntaxKind.VirtualKeyword); 109public static readonly SyntaxToken VoidKeyword = Token(SyntaxKind.VoidKeyword); 110public static readonly SyntaxToken VolatileKeyword = Token(SyntaxKind.VolatileKeyword); 111public static readonly SyntaxToken WhereKeyword = Token(SyntaxKind.WhereKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (19)
157private static readonly ImmutableArray<SyntaxKind> s_preferredModifierOrderDefault = 159SyntaxKind.PublicKeyword, 160SyntaxKind.PrivateKeyword, 161SyntaxKind.ProtectedKeyword, 162SyntaxKind.InternalKeyword, 163SyntaxKind.FileKeyword, 164SyntaxKind.StaticKeyword, 165SyntaxKind.ExternKeyword, 166SyntaxKind.NewKeyword, 167SyntaxKind.VirtualKeyword, 168SyntaxKind.AbstractKeyword, 170SyntaxKind.ClosedKeyword, 172SyntaxKind.SealedKeyword, 173SyntaxKind.OverrideKeyword, 174SyntaxKind.ReadOnlyKeyword, 175SyntaxKind.UnsafeKeyword, 176SyntaxKind.RequiredKeyword, 177SyntaxKind.VolatileKeyword, 178SyntaxKind.AsyncKeyword,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (7)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 79if (initializerExpression.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ArrayCreationExpression && 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 87if (initializerExpression.Kind() is SyntaxKind.CastExpression or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (18)
35if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 38if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 63case SyntaxKind.CharacterLiteralToken: 66case SyntaxKind.StringLiteralToken: 71case SyntaxKind.Utf8StringLiteralToken: 76case SyntaxKind.SingleLineRawStringLiteralToken: 77case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 80case SyntaxKind.MultiLineRawStringLiteralToken: 81case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 86case SyntaxKind.InterpolatedStringTextToken: 97SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 98SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 100SyntaxKind.InterpolatedMultiLineRawStringStartToken 138if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 144if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (5)
27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 81if (argument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 87if (argument.RefOrOutKeyword.Kind() == SyntaxKind.RefKeyword &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\AssignmentExpressionSyntaxExtensions.cs (4)
16return assignment.Kind() == SyntaxKind.SimpleAssignmentExpression && 17assignment.OperatorToken.Kind() == SyntaxKind.EqualsToken && 18(left.Kind() == SyntaxKind.TupleExpression || left.Kind() == SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (15)
27Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.IfDirectiveTrivia), nameof(IfDirectiveTriviaSyntax)), 29Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElifDirectiveTrivia), nameof(ElifDirectiveTriviaSyntax))), 30Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElseDirectiveTrivia), nameof(ElseDirectiveTriviaSyntax)), 31Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.EndIfDirectiveTrivia), nameof(EndIfDirectiveTriviaSyntax))); 78if (leadingDirectives.Any(t => t.Kind() == SyntaxKind.EndIfDirectiveTrivia)) 113if (nextTrivia.Kind() == SyntaxKind.DisabledTextTrivia) 137SyntaxKind declarationKind, 157if (parent.Kind() == SyntaxKind.GetAccessorDeclaration) 175private static bool IsSupportedInCSharp6(SyntaxKind declarationKind) 179case SyntaxKind.ConstructorDeclaration: 180case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.AddAccessorDeclaration: 182case SyntaxKind.RemoveAccessorDeclaration: 183case SyntaxKind.GetAccessorDeclaration: 184case SyntaxKind.SetAccessorDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression); 69if (equalsValueClause.IsParentKind(SyntaxKind.VariableDeclarator) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DirectiveSyntaxExtensions.cs (6)
63=> directive?.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia; 67is SyntaxKind.IfDirectiveTrivia 68or SyntaxKind.ElifDirectiveTrivia 69or SyntaxKind.ElseDirectiveTrivia 70or SyntaxKind.EndIfDirectiveTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (138)
38while (expression is PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixExpression) 48=> expression?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == expression; 84return firstToken.Kind() != SyntaxKind.None 85&& firstToken.GetPreviousToken().Kind() == SyntaxKind.CloseParenToken; 98=> (expression?.Parent) is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && 109=> name.IsParentKind(SyntaxKind.ExplicitInterfaceSpecifier); 130if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 187if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 197=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 209while (expression?.Parent is ParenthesizedExpressionSyntax or PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression)) 213ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 224=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 275if (!expr.IsParentKind(SyntaxKind.Argument)) 290case SyntaxKind.Argument: 291if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 298case SyntaxKind.SimpleAssignmentExpression: 305case SyntaxKind.ForEachVariableStatement: 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 400return nameEquals.IsParentKind(SyntaxKind.AttributeArgument); 409case SyntaxKind.PostIncrementExpression: 410case SyntaxKind.PreIncrementExpression: 411case SyntaxKind.PostDecrementExpression: 412case SyntaxKind.PreDecrementExpression: 428name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 476is SyntaxKind.BaseExpression 477or SyntaxKind.CollectionInitializerExpression 478or SyntaxKind.ObjectInitializerExpression 479or SyntaxKind.ComplexElementInitializerExpression) 485if (expression is LiteralExpressionSyntax && !expression.IsParentKind(SyntaxKind.UnaryMinusExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 517return expression is { Parent.RawKind: not (int)SyntaxKind.ConditionalAccessExpression }; 525case SyntaxKind.InvocationExpression: 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 552case SyntaxKind.ConditionalAccessExpression: 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression); 557case SyntaxKind.IsExpression: 558case SyntaxKind.AsExpression: 562case SyntaxKind.EqualsValueClause: 563case SyntaxKind.ExpressionStatement: 564case SyntaxKind.ArrayInitializerExpression: 565case SyntaxKind.CollectionInitializerExpression: 566case SyntaxKind.Argument: 567case SyntaxKind.AttributeArgument: 568case SyntaxKind.AnonymousObjectMemberDeclarator: 569case SyntaxKind.ArrowExpressionClause: 570case SyntaxKind.AwaitExpression: 571case SyntaxKind.ReturnStatement: 572case SyntaxKind.YieldReturnStatement: 573case SyntaxKind.ParenthesizedLambdaExpression: 574case SyntaxKind.SimpleLambdaExpression: 575case SyntaxKind.ParenthesizedExpression: 576case SyntaxKind.ArrayRankSpecifier: 577case SyntaxKind.ConditionalExpression: 578case SyntaxKind.IfStatement: 579case SyntaxKind.CatchFilterClause: 580case SyntaxKind.WhileStatement: 581case SyntaxKind.DoStatement: 582case SyntaxKind.ThrowStatement: 583case SyntaxKind.SwitchStatement: 584case SyntaxKind.InterpolatedStringExpression: 585case SyntaxKind.ComplexElementInitializerExpression: 586case SyntaxKind.Interpolation: 587case SyntaxKind.RefExpression: 588case SyntaxKind.LockStatement: 589case SyntaxKind.ElementAccessExpression: 590case SyntaxKind.SwitchExpressionArm: 591case SyntaxKind.WhenClause: 598if (!(expression is LiteralExpressionSyntax && expression.IsParentKind(SyntaxKind.UnaryMinusExpression))) 639if ((expression.IsParentKind(SyntaxKind.NameEquals) && expression.Parent.IsParentKind(SyntaxKind.AttributeArgument)) || 655identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.NameOfKeyword); 697case SyntaxKind.SimpleMemberAccessExpression: 698case SyntaxKind.ConditionalAccessExpression: 699case SyntaxKind.InvocationExpression: 700case SyntaxKind.ElementAccessExpression: 701case SyntaxKind.PostIncrementExpression: 702case SyntaxKind.PostDecrementExpression: 703case SyntaxKind.ObjectCreationExpression: 704case SyntaxKind.ImplicitObjectCreationExpression: 705case SyntaxKind.TypeOfExpression: 706case SyntaxKind.DefaultExpression: 707case SyntaxKind.CheckedExpression: 708case SyntaxKind.UncheckedExpression: 709case SyntaxKind.AnonymousMethodExpression: 710case SyntaxKind.SuppressNullableWarningExpression: 712case SyntaxKind.SizeOfExpression: 713case SyntaxKind.PointerMemberAccessExpression: 719case SyntaxKind.UnaryPlusExpression: 720case SyntaxKind.UnaryMinusExpression: 721case SyntaxKind.LogicalNotExpression: 722case SyntaxKind.BitwiseNotExpression: 723case SyntaxKind.PreIncrementExpression: 724case SyntaxKind.PreDecrementExpression: 725case SyntaxKind.CastExpression: 726case SyntaxKind.AwaitExpression: 728case SyntaxKind.PointerIndirectionExpression: 729case SyntaxKind.AddressOfExpression: 736case SyntaxKind.RangeExpression: 742case SyntaxKind.MultiplyExpression: 743case SyntaxKind.DivideExpression: 744case SyntaxKind.ModuloExpression: 750case SyntaxKind.AddExpression: 751case SyntaxKind.SubtractExpression: 757case SyntaxKind.LeftShiftExpression: 758case SyntaxKind.RightShiftExpression: 764case SyntaxKind.LessThanExpression: 765case SyntaxKind.GreaterThanExpression: 766case SyntaxKind.LessThanOrEqualExpression: 767case SyntaxKind.GreaterThanOrEqualExpression: 768case SyntaxKind.IsExpression: 769case SyntaxKind.AsExpression: 770case SyntaxKind.IsPatternExpression: 776case SyntaxKind.EqualsExpression: 777case SyntaxKind.NotEqualsExpression: 783case SyntaxKind.BitwiseAndExpression: 789case SyntaxKind.ExclusiveOrExpression: 795case SyntaxKind.BitwiseOrExpression: 801case SyntaxKind.LogicalAndExpression: 807case SyntaxKind.LogicalOrExpression: 813case SyntaxKind.CoalesceExpression: 819case SyntaxKind.ConditionalExpression: 825case SyntaxKind.SimpleAssignmentExpression: 826case SyntaxKind.MultiplyAssignmentExpression: 827case SyntaxKind.DivideAssignmentExpression: 828case SyntaxKind.ModuloAssignmentExpression: 829case SyntaxKind.AddAssignmentExpression: 830case SyntaxKind.SubtractAssignmentExpression: 831case SyntaxKind.LeftShiftAssignmentExpression: 832case SyntaxKind.RightShiftAssignmentExpression: 833case SyntaxKind.AndAssignmentExpression: 834case SyntaxKind.ExclusiveOrAssignmentExpression: 835case SyntaxKind.OrAssignmentExpression: 836case SyntaxKind.SimpleLambdaExpression: 837case SyntaxKind.ParenthesizedLambdaExpression: 843case SyntaxKind.SwitchExpression: 1091return binaryExpression.Kind() == SyntaxKind.CoalesceExpression && binaryExpression.Right == expression && HasType(binaryExpression.Left, out var leftType) ? leftType : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (50)
32case SyntaxKind.EnumDeclaration: 34case SyntaxKind.ClassDeclaration: 36case SyntaxKind.ExtensionBlockDeclaration: 37case SyntaxKind.UnionDeclaration: 39case SyntaxKind.InterfaceDeclaration: 40case SyntaxKind.RecordDeclaration: 41case SyntaxKind.RecordStructDeclaration: 42case SyntaxKind.StructDeclaration: 44case SyntaxKind.DelegateDeclaration: 46case SyntaxKind.FieldDeclaration: 48case SyntaxKind.EventFieldDeclaration: 50case SyntaxKind.PropertyDeclaration: 52case SyntaxKind.EventDeclaration: 54case SyntaxKind.MethodDeclaration: 56case SyntaxKind.ConstructorDeclaration: 58case SyntaxKind.DestructorDeclaration: 60case SyntaxKind.IndexerDeclaration: 62case SyntaxKind.OperatorDeclaration: 77case SyntaxKind.ClassDeclaration: 79case SyntaxKind.ExtensionBlockDeclaration: 80case SyntaxKind.UnionDeclaration: 82case SyntaxKind.InterfaceDeclaration: 83case SyntaxKind.RecordDeclaration: 84case SyntaxKind.RecordStructDeclaration: 85case SyntaxKind.StructDeclaration: 87case SyntaxKind.DelegateDeclaration: 89case SyntaxKind.MethodDeclaration: 105case SyntaxKind.ClassDeclaration: 107case SyntaxKind.ExtensionBlockDeclaration: 108case SyntaxKind.UnionDeclaration: 110case SyntaxKind.InterfaceDeclaration: 111case SyntaxKind.RecordDeclaration: 112case SyntaxKind.RecordStructDeclaration: 113case SyntaxKind.StructDeclaration: 115case SyntaxKind.DelegateDeclaration: 117case SyntaxKind.MethodDeclaration: 135case SyntaxKind.DelegateDeclaration: 137case SyntaxKind.MethodDeclaration: 139case SyntaxKind.ConstructorDeclaration: 141case SyntaxKind.IndexerDeclaration: 143case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.DelegateDeclaration: 161case SyntaxKind.MethodDeclaration: 163case SyntaxKind.OperatorDeclaration: 165case SyntaxKind.PropertyDeclaration: 167case SyntaxKind.IndexerDeclaration: 169case SyntaxKind.EventDeclaration: 171case SyntaxKind.EventFieldDeclaration: 173case SyntaxKind.FieldDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.DeclarationFinder.cs (1)
32if (syntaxToken.Kind() == SyntaxKind.IdentifierToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (75)
38var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 57if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 58parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 84if (expression.Kind() is SyntaxKind.GreaterThanExpression or SyntaxKind.LessThanExpression && 87var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 93if (expression.IsKind(SyntaxKind.ThrowExpression)) 97if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 101if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 105if (nodeParent.Kind() is SyntaxKind.CheckedExpression or SyntaxKind.UncheckedExpression) 109if (expression.IsKind(SyntaxKind.TupleExpression)) 117if (tokenAfterParen.Kind() == SyntaxKind.OpenBracketToken) 170(nodeParent is YieldStatementSyntax(SyntaxKind.YieldReturnStatement) yieldStatement && yieldStatement.Expression == node) || 195if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 205if (nodeParent.IsKind(SyntaxKind.Interpolation)) 210if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 257if (expression.IsKind(SyntaxKind.ThisExpression)) 271if (expression.IsKind(SyntaxKind.ThrowExpression) && 272nodeParent is BinaryExpressionSyntax(SyntaxKind.CoalesceExpression) binary && 279if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 283if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 284nodeParent.IsParentKind(SyntaxKind.CasePatternSwitchLabel)) 290if (nodeParent.IsKind(SyntaxKind.WhenClause)) 318if (parentExpression.IsKind(SyntaxKind.CastExpression) && 319expression.Kind() is SyntaxKind.PreIncrementExpression or SyntaxKind.PreDecrementExpression) 326if (expression.IsKind(SyntaxKind.ConditionalExpression) && 337if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 389if (ancestor.IsKind(SyntaxKind.ParenthesizedExpression)) 392if (ancestor.IsKind(SyntaxKind.Interpolation, out interpolation)) 414if (!childNode.IsKind(SyntaxKind.ParenthesizedExpression)) 419if (nodeOrToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.ColonColonToken) 488if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 510private static bool IsAssociative(SyntaxKind kind) 514case SyntaxKind.AddExpression: 515case SyntaxKind.MultiplyExpression: 516case SyntaxKind.BitwiseOrExpression: 517case SyntaxKind.ExclusiveOrExpression: 518case SyntaxKind.LogicalOrExpression: 519case SyntaxKind.BitwiseAndExpression: 520case SyntaxKind.LogicalAndExpression: 551SyntaxKind.PredefinedType or 552SyntaxKind.ArrayType or 553SyntaxKind.PointerType or 554SyntaxKind.NullableType) 567SyntaxKind.UnaryMinusExpression or 568SyntaxKind.UnaryPlusExpression or 569SyntaxKind.PointerIndirectionExpression or 570SyntaxKind.AddressOfExpression) 581if (name.IsKind(SyntaxKind.AliasQualifiedName)) 607binaryExpression.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.GreaterThanExpression && 608(binaryExpression.IsParentKind(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax)) 610if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 623else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 626binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 638else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 645else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 681previousExpression is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) lessThanExpression) 687|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 716nextExpression is not BinaryExpressionSyntax(SyntaxKind.GreaterThanExpression) greaterThanExpression) 722&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression; 726=> expression.Kind() is SyntaxKind.IdentifierName or SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression; 818if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 821if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (31)
63case SyntaxKind.SimpleMemberAccessExpression: 64case SyntaxKind.PointerMemberAccessExpression: 70case SyntaxKind.QualifiedName: 76case SyntaxKind.AliasQualifiedName: 82case SyntaxKind.GenericName: 88case SyntaxKind.IdentifierName: 153case SyntaxKind.CommaToken: 154case SyntaxKind.DelegateKeyword: 225variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 232if (type.IsParentKind(SyntaxKind.ObjectCreationExpression) && 233type.Parent.IsParentKind(SyntaxKind.EqualsValueClause) && 234type.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclarator) && 235type.Parent.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 236variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 252is SyntaxKind.DelegateDeclaration 253or SyntaxKind.MethodDeclaration 254or SyntaxKind.PropertyDeclaration 255or SyntaxKind.EventDeclaration 256or SyntaxKind.IndexerDeclaration 257or SyntaxKind.OperatorDeclaration) 273if (type.IsParentKind(SyntaxKind.Parameter) && type.Parent.IsParentKind(SyntaxKind.ParameterList)) 276is SyntaxKind.DelegateDeclaration 277or SyntaxKind.MethodDeclaration 278or SyntaxKind.IndexerDeclaration 279or SyntaxKind.OperatorDeclaration) 285if (type.Parent.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration)) 296if (type.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 297variableDeclaration.IsParentKind(SyntaxKind.EventFieldDeclaration)) 307if (type.IsParentKind(SyntaxKind.TypeConstraint)) 447if (SyntaxFacts.GetContextualKeywordKind(parameter.Name) is not SyntaxKind.UnderscoreToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SymbolDisplayPartExtensions.cs (1)
21if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (29)
14/// Determine if the given <see cref="SyntaxKind"/> array contains the given kind. 22public static bool Contains(this SyntaxKind[] kinds, SyntaxKind kind) 24foreach (var k in kinds) 35public static SyntaxKind MapCompoundAssignmentKindToBinaryExpressionKind(this SyntaxKind syntaxKind) 39case SyntaxKind.AddAssignmentExpression: 40return SyntaxKind.AddExpression; 42case SyntaxKind.SubtractAssignmentExpression: 43return SyntaxKind.SubtractExpression; 45case SyntaxKind.MultiplyAssignmentExpression: 46return SyntaxKind.MultiplyExpression; 48case SyntaxKind.DivideAssignmentExpression: 49return SyntaxKind.DivideExpression; 51case SyntaxKind.ModuloAssignmentExpression: 52return SyntaxKind.ModuloExpression; 54case SyntaxKind.AndAssignmentExpression: 55return SyntaxKind.BitwiseAndExpression; 57case SyntaxKind.ExclusiveOrAssignmentExpression: 58return SyntaxKind.ExclusiveOrExpression; 60case SyntaxKind.OrAssignmentExpression: 61return SyntaxKind.BitwiseOrExpression; 63case SyntaxKind.LeftShiftAssignmentExpression: 64return SyntaxKind.LeftShiftExpression; 66case SyntaxKind.RightShiftAssignmentExpression: 67return SyntaxKind.RightShiftExpression; 69case SyntaxKind.CoalesceAssignmentExpression: 70return SyntaxKind.CoalesceExpression; 74return SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (57)
28public static void Deconstruct(this SyntaxNode node, out SyntaxKind kind) 31public static bool IsKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 44public static bool IsParentKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 47public static bool IsParentKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 75if (prevToken.Kind() == SyntaxKind.None) 93is SyntaxKind.ArgumentList 94or SyntaxKind.AttributeArgumentList 95or SyntaxKind.BracketedArgumentList 96or SyntaxKind.TypeArgumentList; 186if ((current?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == current) || 196SyntaxKind.InvocationExpression or 197SyntaxKind.ElementAccessExpression or 198SyntaxKind.SimpleMemberAccessExpression or 199SyntaxKind.MemberBindingExpression or 200SyntaxKind.ElementBindingExpression or 202SyntaxKind.SuppressNullableWarningExpression) && 285=> node is AssignmentExpressionSyntax(kind: not SyntaxKind.SimpleAssignmentExpression); 288=> node?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment && 332m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword)); 345case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 348case AnonymousFunctionExpressionSyntax anonymousFunction when anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 352return current.GetModifiers().Any(SyntaxKind.StaticKeyword); 355return property.Modifiers.Any(SyntaxKind.StaticKeyword) || 360return !current.Parent.IsKind(SyntaxKind.CompilationUnit); 399case SyntaxKind.DoStatement: 400case SyntaxKind.WhileStatement: 401case SyntaxKind.SwitchStatement: 402case SyntaxKind.ForStatement: 403case SyntaxKind.ForEachStatement: 404case SyntaxKind.ForEachVariableStatement: 415case SyntaxKind.DoStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.ForStatement: 418case SyntaxKind.ForEachStatement: 419case SyntaxKind.ForEachVariableStatement: 430case SyntaxKind.AnonymousMethodExpression: 431case SyntaxKind.SimpleLambdaExpression: 432case SyntaxKind.ParenthesizedLambdaExpression: 433case SyntaxKind.LocalFunctionStatement: 434case SyntaxKind.MethodDeclaration: 435case SyntaxKind.ConstructorDeclaration: 436case SyntaxKind.DestructorDeclaration: 437case SyntaxKind.GetAccessorDeclaration: 438case SyntaxKind.SetAccessorDeclaration: 439case SyntaxKind.InitAccessorDeclaration: 440case SyntaxKind.OperatorDeclaration: 441case SyntaxKind.ConversionOperatorDeclaration: 442case SyntaxKind.AddAccessorDeclaration: 443case SyntaxKind.RemoveAccessorDeclaration: 454=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 556if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 570else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 898while (finalTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
60if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (88)
20public static void Deconstruct(this SyntaxToken token, out SyntaxKind kind) 39public static bool IsKindOrHasMatchingText(this SyntaxToken token, SyntaxKind kind) 42public static bool HasMatchingText(this SyntaxToken token, SyntaxKind kind) 46=> token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList); 64if (token.Kind() == SyntaxKind.IdentifierToken) 69SyntaxFacts.GetContextualKeywordKind(simpleNameText) != SyntaxKind.None; 75public static bool IsPotentialModifier(this SyntaxToken token, out SyntaxKind modifierKind) 77var tokenKind = token.Kind(); 78modifierKind = SyntaxKind.None; 82case SyntaxKind.PublicKeyword: 83case SyntaxKind.InternalKeyword: 84case SyntaxKind.ProtectedKeyword: 85case SyntaxKind.PrivateKeyword: 86case SyntaxKind.SealedKeyword: 87case SyntaxKind.AbstractKeyword: 89case SyntaxKind.ClosedKeyword: 91case SyntaxKind.StaticKeyword: 92case SyntaxKind.VirtualKeyword: 93case SyntaxKind.ExternKeyword: 94case SyntaxKind.NewKeyword: 95case SyntaxKind.OverrideKeyword: 96case SyntaxKind.ReadOnlyKeyword: 97case SyntaxKind.VolatileKeyword: 98case SyntaxKind.UnsafeKeyword: 99case SyntaxKind.AsyncKeyword: 100case SyntaxKind.RefKeyword: 101case SyntaxKind.OutKeyword: 102case SyntaxKind.InKeyword: 103case SyntaxKind.RequiredKeyword: 104case SyntaxKind.FileKeyword: 105case SyntaxKind.PartialKeyword: 108case SyntaxKind.IdentifierToken: 109if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 111modifierKind = SyntaxKind.AsyncKeyword; 113if (token.HasMatchingText(SyntaxKind.FileKeyword)) 115modifierKind = SyntaxKind.FileKeyword; 118if (token.HasMatchingText(SyntaxKind.ClosedKeyword)) 120modifierKind = SyntaxKind.ClosedKeyword; 123if (token.HasMatchingText(SyntaxKind.PartialKeyword)) 125modifierKind = SyntaxKind.PartialKeyword; 127return modifierKind != SyntaxKind.None; 137case SyntaxKind.CharacterLiteralToken: 138case SyntaxKind.FalseKeyword: 139case SyntaxKind.NumericLiteralToken: 140case SyntaxKind.StringLiteralToken: 141case SyntaxKind.TrueKeyword: 171if (previousToken.Kind() == SyntaxKind.None) 204=> token.Kind() == SyntaxKind.StringLiteralToken && !token.IsVerbatimStringLiteral(); 210case SyntaxKind.AssemblyKeyword: 211case SyntaxKind.ModuleKeyword: 212case SyntaxKind.FieldKeyword: 213case SyntaxKind.EventKeyword: 214case SyntaxKind.MethodKeyword: 215case SyntaxKind.ParamKeyword: 216case SyntaxKind.PropertyKeyword: 217case SyntaxKind.ReturnKeyword: 218case SyntaxKind.TypeKeyword: 242if (genericIdentifier.GetNextToken(includeSkipped: true).Kind() == SyntaxKind.LessThanToken) 266Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 270Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken); 279if (next.Kind() == SyntaxKind.None) 287if (token.Kind() == SyntaxKind.GreaterThanToken) 302case SyntaxKind.LessThanLessThanToken: 304goto case SyntaxKind.LessThanToken; 307case SyntaxKind.LessThanToken: 311case SyntaxKind.AsteriskToken: // for int* 312case SyntaxKind.QuestionToken: // for int? 313case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 314case SyntaxKind.ColonColonToken: // for global:: 315case SyntaxKind.CloseBracketToken: 316case SyntaxKind.OpenBracketToken: 317case SyntaxKind.DotToken: 318case SyntaxKind.IdentifierToken: 319case SyntaxKind.CommaToken: 323case SyntaxKind.ClassKeyword: 324case SyntaxKind.StructKeyword: 325case SyntaxKind.InterfaceKeyword: 326case SyntaxKind.DelegateKeyword: 327case SyntaxKind.EnumKeyword: 328case SyntaxKind.PrivateKeyword: 329case SyntaxKind.PublicKeyword: 330case SyntaxKind.InternalKeyword: 331case SyntaxKind.ProtectedKeyword: 332case SyntaxKind.VoidKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (54)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 20public static ISet<SyntaxKind> GetPrecedingModifiers( 30var result = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 31while (token.IsPotentialModifier(out var modifierKind)) 87private static readonly Func<SyntaxKind, bool> s_isDot = k => k is SyntaxKind.DotToken; 88private static readonly Func<SyntaxKind, bool> s_isDotOrArrow = k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken; 89private static readonly Func<SyntaxKind, bool> s_isDotOrArrowOrColonColon = 90k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken or SyntaxKind.ColonColonToken; 95(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken) 111if (token.Kind() == SyntaxKind.None) 122return token.Kind() == SyntaxKind.NumericLiteralToken; 125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken) 202var endsWithNewLine = trivia.GetStructure()!.GetLastToken(includeSkipped: true).Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 263if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 269return trivia.Kind() == SyntaxKind.ConflictMarkerTrivia; 277if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 303if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 324var kind = token.Kind(); 326SyntaxKind.StringLiteralToken or 327SyntaxKind.CharacterLiteralToken or 328SyntaxKind.SingleLineRawStringLiteralToken or 329SyntaxKind.MultiLineRawStringLiteralToken or 330SyntaxKind.Utf8StringLiteralToken or 331SyntaxKind.Utf8SingleLineRawStringLiteralToken or 332SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 339SyntaxKind.Utf8StringLiteralToken or 340SyntaxKind.Utf8SingleLineRawStringLiteralToken or 341SyntaxKind.Utf8MultiLineRawStringLiteralToken) 349if (kind is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 399if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 404SyntaxKind.StringLiteralToken or 405SyntaxKind.SingleLineRawStringLiteralToken or 406SyntaxKind.MultiLineRawStringLiteralToken or 407SyntaxKind.Utf8StringLiteralToken or 408SyntaxKind.Utf8SingleLineRawStringLiteralToken or 409SyntaxKind.Utf8MultiLineRawStringLiteralToken) 421SyntaxKind.InterpolatedStringStartToken or 422SyntaxKind.InterpolatedStringEndToken or 423SyntaxKind.InterpolatedRawStringEndToken or 424SyntaxKind.InterpolatedSingleLineRawStringStartToken or 425SyntaxKind.InterpolatedMultiLineRawStringStartToken) 430if (token.Kind() is SyntaxKind.InterpolatedStringTextToken) 455if (token.Kind() == SyntaxKind.CharacterLiteralToken) 497if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 503if (token.Kind() == SyntaxKind.EndOfFileToken) 553if (token.IsKind(SyntaxKind.HashToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (15)
21public static void Deconstruct(this SyntaxTrivia trivia, out SyntaxKind kind) 25=> trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia; 37=> trivia.Kind() == SyntaxKind.SingleLineCommentTrivia; 40=> trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 43=> trivia.Kind() == SyntaxKind.ShebangDirectiveTrivia; 47if (trivia.Kind() != SyntaxKind.MultiLineCommentTrivia) 58=> trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia; 61=> trivia.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia; 66if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 75else if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 148=> trivia.Kind() == SyntaxKind.EndOfLineTrivia; 151=> trivia.Kind() == SyntaxKind.WhitespaceTrivia; 203if (trivia.IsKind(SyntaxKind.PragmaWarningDirectiveTrivia)) 206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (8)
21.Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 38.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.WhitespaceTrivia)) 43=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia); 52if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 55t.Kind() is SyntaxKind.EndOfLineTrivia or 56SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\DefaultOperationProvider.cs (1)
45var space = currentToken.Kind() == SyntaxKind.EndOfFileToken ? 0 : 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (16)
37=> trivia.RawKind == (int)SyntaxKind.WhitespaceTrivia; 40=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 69if (trivia2.IsKind(SyntaxKind.None)) 90if (trivia2.IsKind(SyntaxKind.BadDirectiveTrivia) && existingWhitespaceBetween.Lines == 0 && !implicitLineBreak) 97var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 99if (trivia2.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia) 110if (previous.IsKind(SyntaxKind.DisabledTextTrivia)) 114else if (previous.IsKind(SyntaxKind.EndIfDirectiveTrivia)) 178if (trivia2.IsKind(SyntaxKind.SkippedTokensTrivia)) 198structuredTrivia.GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia); 210var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0); 220if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 334if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 363if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (9)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);) 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 101if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 105else if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 113else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 117else if (trivia.Kind() is SyntaxKind.DisabledTextTrivia or 118SyntaxKind.PreprocessingMessageTrivia) 122else if (trivia.Kind() == SyntaxKind.ConflictMarkerTrivia) 155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (18)
36Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 37Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia); 46if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 63if (trivia.Kind() == SyntaxKind.RegionDirectiveTrivia || 64trivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia || 78if (trivia.Kind() is SyntaxKind.SkippedTokensTrivia or 79SyntaxKind.PreprocessingMessageTrivia) 125if (trivia.Kind() != SyntaxKind.WhitespaceTrivia) 154if (trivia.Kind() != SyntaxKind.EndOfLineTrivia) 213if (trivia.Kind() is not SyntaxKind.SkippedTokensTrivia and 214not SyntaxKind.PreprocessingMessageTrivia) 224if (trivia.Kind() is not SyntaxKind.RegionDirectiveTrivia and 225not SyntaxKind.EndRegionDirectiveTrivia) 269trivia.Kind() == SyntaxKind.WhitespaceTrivia || 270trivia.Kind() == SyntaxKind.EndOfLineTrivia) 309if (trivia.IsKind(SyntaxKind.DisabledTextTrivia)) 332if (xmlTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (2)
53var formatSpanEnd = commonToken2.Kind() == SyntaxKind.None ? commonToken1.Span.End : commonToken2.Span.Start; 81var firstTriviaInTree = this.Token1.Kind() == SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
119if (trivia.Kind() == SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (95)
57if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 59bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 64if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 66return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 69if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 71return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 78=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.ConversionOperatorDeclaration); 81=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.OperatorDeclaration); 84=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 87=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 91return token.Kind() == SyntaxKind.OpenParenToken && 97return token.Kind() == SyntaxKind.CloseParenToken && 104if (token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList)) 110if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 120=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 123=> token.Kind() == SyntaxKind.CommaToken && (token.Parent.IsAnyArgumentList() || token.Parent?.Kind() is SyntaxKind.ParameterList or SyntaxKind.FunctionPointerParameterList); 126=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 130if (node.Kind() != SyntaxKind.Block) 135return node.Parent?.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression; 140if (node.Kind() != SyntaxKind.Block) 145return node.IsParentKind(SyntaxKind.AnonymousMethodExpression); 151token.Kind() == SyntaxKind.SemicolonToken && 158if (token.Kind() != SyntaxKind.SemicolonToken) 174if (token.Kind() != SyntaxKind.CloseBraceToken) 179return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 184if (token.Kind() != SyntaxKind.CloseBraceToken) 210return token.Kind() == SyntaxKind.CommaToken && 211token.Parent.IsKind(SyntaxKind.EnumDeclaration); 216return token.Kind() == SyntaxKind.CommaToken && 222return token.Kind() == SyntaxKind.CommaToken && 223token.Parent.IsKind(SyntaxKind.VariableDeclaration); 237case SyntaxKind.SizeOfExpression: 241case SyntaxKind.TypeOfExpression: 245case SyntaxKind.CheckedExpression: 246case SyntaxKind.UncheckedExpression: 250case SyntaxKind.DefaultExpression: 254case SyntaxKind.MakeRefExpression: 258case SyntaxKind.RefTypeExpression: 262case SyntaxKind.RefValueExpression: 266case SyntaxKind.ArgumentList: 270case SyntaxKind.AttributeArgumentList: 280return token.IsKind(SyntaxKind.EqualsToken) && 281token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 282token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 308=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 317return token.Kind() == SyntaxKind.DotToken 323if (token.Kind() == SyntaxKind.GreaterThanToken) 324return token.Parent is (kind: SyntaxKind.TypeParameterList or SyntaxKind.TypeArgumentList); 331return token.Kind() == SyntaxKind.CommaToken && 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent is CasePatternSwitchLabelSyntax; 340=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 346=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 350return token.Kind() == SyntaxKind.IdentifierToken && 360return token.Kind() == SyntaxKind.ColonToken && 377=> token.Kind() == SyntaxKind.InKeyword && token.Parent is FromClauseSyntax { Expression: QueryExpressionSyntax }; 381return token.Kind() == SyntaxKind.FromKeyword && 404if (expression.Kind() == SyntaxKind.SimpleAssignmentExpression) 432parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 451parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 466return (token1.Kind() == SyntaxKind.OpenParenToken && token2.Kind() == SyntaxKind.CloseParenToken) || 467(token1.Kind() == SyntaxKind.OpenBracketToken && token2.Kind() == SyntaxKind.CloseBracketToken); 472if (token.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 511if (token.Kind() is not SyntaxKind.PlusToken and not SyntaxKind.MinusToken) 520=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 527return currentToken.Kind() == SyntaxKind.OpenParenToken && currentToken is { Parent: ParenthesizedVariableDesignationSyntax, Parent.Parent: DeclarationExpressionSyntax }; 535return currentToken.IsKind(SyntaxKind.CommaToken) && 536currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 541return currentToken.IsKind(SyntaxKind.CommaToken) && 542currentToken.Parent.IsKind(SyntaxKind.TupleType); 547return currentToken.IsKind(SyntaxKind.CommaToken) && 548currentToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation); 552=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression); 559return !previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && !currentToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (3)
20if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression) 26if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (15)
24if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 37if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 51if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 65if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 80if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 116if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 126if (anchorToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 172else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (62)
115currentToken.IsKind(SyntaxKind.WhereKeyword) && 116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 130firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 142currentToken.IsKind(SyntaxKind.OpenBraceToken) && 143currentToken.Parent.IsParentKind(SyntaxKind.IfStatement)) 176if (previousToken.Kind() != SyntaxKind.SemicolonToken) 179if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 182if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 216if (previousMember.Kind() is SyntaxKind.FieldDeclaration or 217SyntaxKind.EventFieldDeclaration) 293if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 310if (currentToken.Kind() == SyntaxKind.None) 317case SyntaxKind.None: 320case SyntaxKind.OpenBraceToken: 321case SyntaxKind.FinallyKeyword: 324case SyntaxKind.CloseBraceToken: 327case SyntaxKind.CloseParenToken: 329|| currentToken.Kind() == SyntaxKind.OpenBraceToken) ? 1 : 0; 331case SyntaxKind.CloseBracketToken: 337(parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.AssemblyKeyword) || 338parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.ModuleKeyword))) 340if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax)) 355case SyntaxKind.SemicolonToken: 358case SyntaxKind.CommaToken: 361case SyntaxKind.ElseKeyword: 362return currentToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 364case SyntaxKind.ColonToken: 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))) 387case SyntaxKind.OpenBraceToken: 388case SyntaxKind.CloseBraceToken: 389case SyntaxKind.ElseKeyword: 390case SyntaxKind.FinallyKeyword: 393case SyntaxKind.OpenBracketToken: 399parent.Target.Identifier.Kind() is SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword && 416case SyntaxKind.WhereKeyword: 425if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 430nextToken.Kind() is SyntaxKind.CatchKeyword or 431SyntaxKind.FinallyKeyword or 432SyntaxKind.ElseKeyword) 437nextToken.Kind() == SyntaxKind.WhileKeyword && 438nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 442else if (nextToken.Kind() == SyntaxKind.EndOfFileToken) 458else if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 482return trivia.Kind() is SyntaxKind.WhitespaceTrivia 483or SyntaxKind.EndOfLineTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\EndOfFileTokenFormattingRule.cs (2)
17if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 29if (currentToken.Kind() == SyntaxKind.EndOfFileToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (7)
95var firstStatementIsBlock = section.Statements is [(kind: SyntaxKind.Block), ..]; 222if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock() || node.Kind() is SyntaxKind.PropertyPatternClause or SyntaxKind.SwitchExpression) 228if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression)) 262if (node.Parent != null && node.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (79)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 53case SyntaxKind.IfStatement: 54case SyntaxKind.ElseClause: 55case SyntaxKind.WhileStatement: 56case SyntaxKind.DoStatement: 57case SyntaxKind.ForEachStatement: 58case SyntaxKind.ForEachVariableStatement: 59case SyntaxKind.UsingStatement: 60case SyntaxKind.ForStatement: 61case SyntaxKind.TryStatement: 62case SyntaxKind.CatchClause: 63case SyntaxKind.FinallyClause: 64case SyntaxKind.LockStatement: 65case SyntaxKind.CheckedStatement: 66case SyntaxKind.UncheckedStatement: 67case SyntaxKind.SwitchSection: 68case SyntaxKind.FixedStatement: 69case SyntaxKind.UnsafeStatement: 83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken)) 132if (currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression 133or SyntaxKind.CollectionInitializerExpression 134or SyntaxKind.ArrayInitializerExpression 135or SyntaxKind.ImplicitArrayCreationExpression 136or SyntaxKind.WithInitializerExpression) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 153var isFirstTokenOfSwitchArm = currentToken.Parent.IsParentKind(SyntaxKind.RecursivePattern, out RecursivePatternSyntax? recursivePattern) 154&& recursivePattern.IsParentKind(SyntaxKind.SwitchExpressionArm, out SwitchExpressionArmSyntax? switchExpressionArm) 170if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 183if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 192if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 201if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 210if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 211currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 220if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 229if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 249if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 263if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 277if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 291if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 304if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 317if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 330if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 346if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 347currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression or SyntaxKind.WithInitializerExpression or SyntaxKind.PropertyPatternClause) 363if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 364currentToken.Parent.Kind() is SyntaxKind.ArrayInitializerExpression or SyntaxKind.ImplicitArrayCreationExpression) 374if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 418if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 431if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 432currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 445if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 458if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 473if (previousToken.IsKind(SyntaxKind.SemicolonToken) 474&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\QueryExpressionFormattingRule.cs (7)
169case SyntaxKind.FromKeyword: 170case SyntaxKind.WhereKeyword: 171case SyntaxKind.LetKeyword: 172case SyntaxKind.JoinKeyword: 173case SyntaxKind.OrderByKeyword: 174case SyntaxKind.GroupKeyword: 175case SyntaxKind.SelectKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (165)
47var previousKind = previousToken.Kind(); 48var currentKind = currentToken.Kind(); 49var previousParentKind = previousToken.Parent.Kind(); 50var currentParentKind = currentToken.Parent.Kind(); 53if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.IdentifierToken) 65if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.GreaterThanToken) 68if (currentToken.IsOpenParenInParameterListOfParenthesizedLambdaExpression() && previousParentKind == SyntaxKind.TypeArgumentList) 73if (previousParentKind == SyntaxKind.TypeParameterList) 85if ((previousToken.IsKeyword() || previousToken.Kind() is SyntaxKind.QuestionToken or SyntaxKind.AsteriskToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseParenToken or SyntaxKind.GreaterThanToken) 92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 137if (currentKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 142if (previousKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(previousParentKind)) 147if (currentKind == SyntaxKind.CloseParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 153if (currentKind == SyntaxKind.OpenParenToken && 154(previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || 155previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || 156previousKind == SyntaxKind.UsingKeyword || previousKind == SyntaxKind.WhenKeyword || previousKind == SyntaxKind.LockKeyword || 157previousKind == SyntaxKind.FixedKeyword)) 163if ((previousToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && previousKind == SyntaxKind.OpenParenToken) || 164(currentToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && currentKind == SyntaxKind.CloseParenToken)) 170if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || 171(currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) 177if (previousParentKind == SyntaxKind.ForStatement 180if (currentKind == SyntaxKind.SemicolonToken 181&& (previousKind != SyntaxKind.SemicolonToken 191if (previousKind == SyntaxKind.OpenParenToken && IsControlFlowLikeKeywordStatementKind(previousParentKind)) 196if (currentKind == SyntaxKind.CloseParenToken && IsControlFlowLikeKeywordStatementKind(currentParentKind)) 202if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) 208if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression) 211if (previousKind == SyntaxKind.CommaToken) 217if (previousKind is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken)) 224if (currentKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(currentToken) && !previousToken.IsOpenBraceOrCommaOfObjectInitializer()) 230if (((currentKind == SyntaxKind.CloseBracketToken && previousKind == SyntaxKind.OpenBracketToken) 231|| currentKind == SyntaxKind.OmittedArraySizeExpressionToken) 238if (previousKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(previousToken)) 243if (currentKind == SyntaxKind.CloseBracketToken && previousKind != SyntaxKind.OmittedArraySizeExpressionToken && HasFormattableBracketParent(currentToken)) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 252if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 259if (currentToken.IsKind(SyntaxKind.EndOfFileToken)) 292bool IsCommaWithCustomSpacing(SyntaxToken previousToken, SyntaxToken currentToken, SyntaxKind currentKind, SyntaxKind previousKind, bool checkPreviousToken) 295var tokenKind = checkPreviousToken ? previousKind : currentKind; 296var otherKind = checkPreviousToken ? currentKind : previousKind; 298return (token.IsCommaInArgumentOrParameterList() && otherKind != SyntaxKind.OmittedTypeArgumentToken) 304|| (tokenKind == SyntaxKind.CommaToken 305&& otherKind != SyntaxKind.OmittedArraySizeExpressionToken 322if (previousToken.IsSemicolonInForStatement() && currentKind != SyntaxKind.CloseParenToken) 338currentToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern || 339previousToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern) 346if (currentKind == SyntaxKind.IsKeyword || 347currentKind == SyntaxKind.AsKeyword || 348currentKind == SyntaxKind.AndKeyword || 349currentKind == SyntaxKind.OrKeyword || 350previousKind == SyntaxKind.IsKeyword || 351previousKind == SyntaxKind.AsKeyword || 352previousKind == SyntaxKind.AndKeyword || 353previousKind == SyntaxKind.OrKeyword) 371if (previousParentKind == SyntaxKind.FunctionPointerType) 374if (currentKind == SyntaxKind.AsteriskToken && previousKind == SyntaxKind.DelegateKeyword) 380if (previousKind == SyntaxKind.AsteriskToken && currentParentKind == SyntaxKind.FunctionPointerCallingConvention) 384case SyntaxKind.IdentifierToken: 385case SyntaxKind.ManagedKeyword: 386case SyntaxKind.UnmanagedKeyword: 392if (currentParentKind == SyntaxKind.FunctionPointerParameterList && currentKind == SyntaxKind.LessThanToken) 397case SyntaxKind.AsteriskToken: 400case SyntaxKind.ManagedKeyword: 401case SyntaxKind.UnmanagedKeyword: 404case SyntaxKind.CloseBracketToken when previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList: 411if (previousParentKind == SyntaxKind.FunctionPointerCallingConvention && currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && currentKind == SyntaxKind.OpenBracketToken) 417if (currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList) 419if (currentKind == SyntaxKind.IdentifierToken) 423if (previousKind == SyntaxKind.OpenBracketToken) 429else if (previousKind == SyntaxKind.CommaToken) 437if (currentKind == SyntaxKind.CommaToken) 444if (currentKind == SyntaxKind.CloseBracketToken) 452if (previousKind == SyntaxKind.LessThanToken && previousParentKind == SyntaxKind.FunctionPointerParameterList) 459if (currentKind == SyntaxKind.GreaterThanToken && currentParentKind == SyntaxKind.FunctionPointerParameterList) 465if (previousToken.Parent.IsKind(SyntaxKind.NotPattern)) 472if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.SlicePattern) 478if (previousKind is SyntaxKind.InterpolatedStringStartToken or 479SyntaxKind.InterpolatedVerbatimStringStartToken or 480SyntaxKind.InterpolatedSingleLineRawStringStartToken or 481SyntaxKind.InterpolatedMultiLineRawStringStartToken) 487if (currentKind is SyntaxKind.InterpolatedStringEndToken or 488SyntaxKind.InterpolatedRawStringEndToken) 494if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || 495(previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) 501if (previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) 507if (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax interpolation) 518if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is InterpolationAlignmentClauseSyntax) || 519(currentKind == SyntaxKind.CommaToken && currentToken.Parent is InterpolationAlignmentClauseSyntax)) 525if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is InterpolationFormatClauseSyntax) || 526(currentKind == SyntaxKind.ColonToken && currentToken.Parent is InterpolationFormatClauseSyntax)) 538if (previousKind == SyntaxKind.CaretToken && previousParentKind == SyntaxKind.IndexExpression) 544if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.RangeExpression) 555if (currentKind == SyntaxKind.DotDotToken && currentParentKind == SyntaxKind.RangeExpression) 581is SyntaxKind.FieldDeclaration 582or SyntaxKind.EventDeclaration 583or SyntaxKind.EventFieldDeclaration 584or SyntaxKind.LocalDeclarationStatement 585or SyntaxKind.EnumMemberDeclaration) 610=> token.Parent is (kind: SyntaxKind.ArrayRankSpecifier or SyntaxKind.BracketedArgumentList or SyntaxKind.BracketedParameterList or SyntaxKind.ImplicitArrayCreationExpression or SyntaxKind.ListPattern or SyntaxKind.CollectionExpression); 612private static bool IsFunctionLikeKeywordExpressionKind(SyntaxKind syntaxKind) 613=> (syntaxKind is SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression); 615private static bool IsControlFlowLikeKeywordStatementKind(SyntaxKind syntaxKind) 617return syntaxKind is SyntaxKind.IfStatement or SyntaxKind.WhileStatement or SyntaxKind.SwitchStatement or 618SyntaxKind.ForStatement or SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement or 619SyntaxKind.DoStatement or 620SyntaxKind.CatchDeclaration or SyntaxKind.UsingStatement or SyntaxKind.LockStatement or 621SyntaxKind.FixedStatement or SyntaxKind.CatchFilterClause;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\StructuredTriviaFormattingRule.cs (8)
31((previousToken.Kind() == SyntaxKind.HashToken && currentToken.Kind() == SyntaxKind.ColonToken) || 32(previousToken.Kind() == SyntaxKind.ColonToken && currentToken.Kind() == SyntaxKind.StringLiteralToken))) 38if (previousToken.Kind() == SyntaxKind.HashToken && SyntaxFacts.IsPreprocessorKeyword(currentToken.Kind())) 43if (previousToken.Kind() == SyntaxKind.RegionKeyword && currentToken.Kind() == SyntaxKind.EndOfDirectiveToken) 48if (currentToken.Kind() == SyntaxKind.EndOfDirectiveToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (8)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression)) 257if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 314if (!IsFormatDirective(pragmaWarningDirectiveTrivia, SyntaxKind.DisableKeyword)) 321var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword)); 326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 332private static bool IsFormatDirective(DirectiveTriviaSyntax? trivia, SyntaxKind disableOrRestoreKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (101)
52case SyntaxKind.OpenBraceToken: 61case SyntaxKind.CloseBraceToken: 69if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword) 77case SyntaxKind.CloseBraceToken: 83if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 103case SyntaxKind.OpenBraceToken: 144if (previousToken.Kind() == SyntaxKind.ElseKeyword) 146var isElseIfOnSameLine = currentToken.Kind() == SyntaxKind.IfKeyword && FormattingHelpers.AreOnSameLine(previousToken, currentToken); 165if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 170if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 182if (previousToken.Kind() == SyntaxKind.SemicolonToken && 183(currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword)) 189if (previousToken.Kind() == SyntaxKind.SemicolonToken) 194if (currentToken.Kind() == SyntaxKind.SemicolonToken && 203if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 301if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) 315if (currentToken.Kind() == SyntaxKind.SemicolonToken) 318if (previousToken.Kind() == SyntaxKind.SemicolonToken) 322if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 330if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 331previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken || 332currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 333currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken) 338if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 339previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 340previousToken.Parent.IsParentKind(SyntaxKind.Parameter)) 342if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 358if (currentToken.Kind() == SyntaxKind.OpenParenToken && 359previousToken.Kind() == SyntaxKind.ThisKeyword) 364if (previousToken.Kind() == SyntaxKind.NewKeyword) 369SyntaxKind.ConstructorConstraint or 370SyntaxKind.ImplicitObjectCreationExpression or 371SyntaxKind.ImplicitArrayCreationExpression) ? 0 : 1; 376if (currentToken.Kind() == SyntaxKind.OpenParenToken) 379is SyntaxKind.IdentifierToken 380or SyntaxKind.DefaultKeyword 381or SyntaxKind.BaseKeyword 382or SyntaxKind.ThisKeyword 384or SyntaxKind.ExtensionKeyword 401if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax) 407if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 420case SyntaxKind.CloseParenToken: 421case SyntaxKind.CloseBracketToken: 422case SyntaxKind.CommaToken: 423case SyntaxKind.DotToken: 424case SyntaxKind.MinusGreaterThanToken: 429if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 430currentToken.Parent?.Kind() is not SyntaxKind.CollectionExpression and not SyntaxKind.AttributeList && 448if (currentToken.IsKind(SyntaxKind.ColonToken) && 450SyntaxKind.AttributeTargetSpecifier or 451SyntaxKind.CaseSwitchLabel or 452SyntaxKind.CasePatternSwitchLabel or 453SyntaxKind.DefaultSwitchLabel or 454SyntaxKind.ExpressionColon or 458SyntaxKind.LabeledStatement or 459SyntaxKind.NameColon or 460SyntaxKind.SwitchExpressionArm)) 467previousToken.Kind() == SyntaxKind.CloseParenToken) 473if (previousToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList or SyntaxKind.FunctionPointerType)) 476if (previousToken.Kind() == SyntaxKind.LessThanToken) 482if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken) 489if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) && 490currentToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList)) 496if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) && 503if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) && 510if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 516if (currentToken.Kind() == SyntaxKind.QuestionToken && 517currentToken.Parent is (kind: SyntaxKind.NullableType or SyntaxKind.ClassConstraint)) 523if (currentToken.IsKind(SyntaxKind.QuestionToken) && 524previousToken.Parent?.IsParentKind(SyntaxKind.ArrayType) == true) 530if (currentToken.Kind() == SyntaxKind.ExclamationToken && 531currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 537if (currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) 543if (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax) 551case SyntaxKind.OpenParenToken: 552case SyntaxKind.OpenBracketToken: 553case SyntaxKind.DotToken: 554case SyntaxKind.MinusGreaterThanToken: 557case SyntaxKind.CloseParenToken: 558case SyntaxKind.CloseBracketToken: 577if (previousToken.Kind() == SyntaxKind.ExclamationToken 578&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 584if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax or DestructorDeclarationSyntax)) 590if (previousToken.Kind() == SyntaxKind.AmpersandToken && 597if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (9)
70if (embeddedStatement.IsKind(SyntaxKind.Block)) 91if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 99if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 112if (!(node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block)) 121if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None)) 179if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (14)
47Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 48Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 71return endToken.IsKind(SyntaxKind.CloseBraceToken) && 72endToken.Parent.IsKind(SyntaxKind.Block) && 73endToken.Parent.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.DoStatement; 78Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 82if (previousToken.Kind() == SyntaxKind.None) 93if (token.IsKind(SyntaxKind.OpenBraceToken) && 98if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 107if (token.IsKind(SyntaxKind.OpenBraceToken) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (12)
245modifiers.Any(SyntaxKind.PartialKeyword)) 286AssignmentExpressionSyntax _ when token.Kind() == SyntaxKind.EqualsToken => GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(), 287ForEachVariableStatementSyntax _ when token.Kind() == SyntaxKind.InKeyword => GetDeconstructionForEachMethods(semanticModel, node).As<ISymbol>(), 310if (token.Kind() == SyntaxKind.CommaToken) 320if (ordering.AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 324else if (orderByClauseSyntax.Orderings[0].AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 343return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 369if (token.IsKind(SyntaxKind.CommaToken)) 479SyntaxKind.IfDirectiveTrivia or 480SyntaxKind.ElifDirectiveTrivia or 481SyntaxKind.DefineDirectiveTrivia or 482SyntaxKind.UndefDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (53)
24case SyntaxKind.ClassDeclaration: 25case SyntaxKind.RecordDeclaration: 26case SyntaxKind.StructDeclaration: 27case SyntaxKind.RecordStructDeclaration: 28case SyntaxKind.InterfaceDeclaration: 29case SyntaxKind.EnumDeclaration: 30case SyntaxKind.DelegateDeclaration: 31return ignoreDeclarationModifiers || !((MemberDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.FileKeyword); 33case SyntaxKind.FieldDeclaration: 34case SyntaxKind.EventFieldDeclaration: 35case SyntaxKind.GetAccessorDeclaration: 36case SyntaxKind.SetAccessorDeclaration: 37case SyntaxKind.InitAccessorDeclaration: 38case SyntaxKind.AddAccessorDeclaration: 39case SyntaxKind.RemoveAccessorDeclaration: 42case SyntaxKind.VariableDeclaration: 45case SyntaxKind.VariableDeclarator: 48case SyntaxKind.ConstructorDeclaration: 50return ignoreDeclarationModifiers || !((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword); 52case SyntaxKind.PropertyDeclaration: 55case SyntaxKind.IndexerDeclaration: 58case SyntaxKind.OperatorDeclaration: 61case SyntaxKind.ConversionOperatorDeclaration: 64case SyntaxKind.MethodDeclaration: 72if (method.Modifiers.Any(SyntaxKind.PartialKeyword)) 80case SyntaxKind.EventDeclaration: 108(SyntaxKind.PublicKeyword, _) => Accessibility.Public, 110(SyntaxKind.PrivateKeyword, Accessibility.Protected) => Accessibility.ProtectedAndInternal, 111(SyntaxKind.PrivateKeyword, _) => Accessibility.Private, 113(SyntaxKind.InternalKeyword, Accessibility.Protected) => Accessibility.ProtectedOrInternal, 114(SyntaxKind.InternalKeyword, _) => Accessibility.Internal, 116(SyntaxKind.ProtectedKeyword, Accessibility.Private) => Accessibility.ProtectedAndInternal, 117(SyntaxKind.ProtectedKeyword, Accessibility.Internal) => Accessibility.ProtectedOrInternal, 118(SyntaxKind.ProtectedKeyword, _) => Accessibility.Protected, 125SyntaxKind.AbstractKeyword => Modifiers.Abstract, 126SyntaxKind.NewKeyword => Modifiers.New, 127SyntaxKind.OverrideKeyword => Modifiers.Override, 128SyntaxKind.VirtualKeyword => Modifiers.Virtual, 129SyntaxKind.StaticKeyword => Modifiers.Static, 130SyntaxKind.AsyncKeyword => Modifiers.Async, 131SyntaxKind.ConstKeyword => Modifiers.Const, 132SyntaxKind.ReadOnlyKeyword => Modifiers.ReadOnly, 133SyntaxKind.SealedKeyword => Modifiers.Sealed, 134SyntaxKind.UnsafeKeyword => Modifiers.Unsafe, 135SyntaxKind.PartialKeyword => Modifiers.Partial, 136SyntaxKind.RefKeyword => Modifiers.Ref, 137SyntaxKind.VolatileKeyword => Modifiers.Volatile, 138SyntaxKind.ExternKeyword => Modifiers.Extern, 139SyntaxKind.FileKeyword => Modifiers.File, 141SyntaxKind.ClosedKeyword => Modifiers.Closed, 143SyntaxKind.RequiredKeyword => Modifiers.Required, 144SyntaxKind.FixedKeyword => Modifiers.Fixed, 148isDefault |= token.Kind() == SyntaxKind.DefaultKeyword;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (4)
22=> node.IsKind(SyntaxKind.Block); 25=> node is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.CompilationUnit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (4)
22=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (175)
101var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 110var kind = token.Kind(); 149if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword) 154else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken && 201=> node is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList); 222=> node is LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not (int)SyntaxKind.None }; 268=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.ThisConstructorInitializer) constructorInit && 272=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.BaseConstructorInitializer) constructorInit && 282case SyntaxKind.FromKeyword: 283case SyntaxKind.JoinKeyword: 284case SyntaxKind.LetKeyword: 285case SyntaxKind.OrderByKeyword: 286case SyntaxKind.WhereKeyword: 287case SyntaxKind.OnKeyword: 288case SyntaxKind.EqualsKeyword: 289case SyntaxKind.InKeyword: 291case SyntaxKind.ByKeyword: 292case SyntaxKind.GroupKeyword: 293case SyntaxKind.SelectKeyword: 295case SyntaxKind.AscendingKeyword: 296case SyntaxKind.DescendingKeyword: 298case SyntaxKind.IntoKeyword: 299return token.Parent is (kind: SyntaxKind.JoinIntoClause or SyntaxKind.QueryContinuation); 326SyntaxKind.BoolKeyword => PredefinedType.Boolean, 327SyntaxKind.ByteKeyword => PredefinedType.Byte, 328SyntaxKind.SByteKeyword => PredefinedType.SByte, 329SyntaxKind.IntKeyword => PredefinedType.Int32, 330SyntaxKind.UIntKeyword => PredefinedType.UInt32, 331SyntaxKind.ShortKeyword => PredefinedType.Int16, 332SyntaxKind.UShortKeyword => PredefinedType.UInt16, 333SyntaxKind.LongKeyword => PredefinedType.Int64, 334SyntaxKind.ULongKeyword => PredefinedType.UInt64, 335SyntaxKind.FloatKeyword => PredefinedType.Single, 336SyntaxKind.DoubleKeyword => PredefinedType.Double, 337SyntaxKind.DecimalKeyword => PredefinedType.Decimal, 338SyntaxKind.StringKeyword => PredefinedType.String, 339SyntaxKind.CharKeyword => PredefinedType.Char, 340SyntaxKind.ObjectKeyword => PredefinedType.Object, 341SyntaxKind.VoidKeyword => PredefinedType.Void, 342SyntaxKind.IdentifierToken => token.Text switch 365switch ((SyntaxKind)token.RawKind) 367case SyntaxKind.PlusToken: 368case SyntaxKind.PlusEqualsToken: 371case SyntaxKind.MinusToken: 372case SyntaxKind.MinusEqualsToken: 375case SyntaxKind.AmpersandAmpersandToken: // overridden bitwise & can be accessed through && 376case SyntaxKind.AmpersandToken: 377case SyntaxKind.AmpersandEqualsToken: 380case SyntaxKind.BarBarToken: // overridden bitwise | can be accessed through || 381case SyntaxKind.BarToken: 382case SyntaxKind.BarEqualsToken: 385case SyntaxKind.MinusMinusToken: 388case SyntaxKind.PlusPlusToken: 391case SyntaxKind.SlashToken: 392case SyntaxKind.SlashEqualsToken: 395case SyntaxKind.EqualsEqualsToken: 398case SyntaxKind.CaretToken: 399case SyntaxKind.CaretEqualsToken: 402case SyntaxKind.GreaterThanToken: 405case SyntaxKind.GreaterThanEqualsToken: 408case SyntaxKind.ExclamationEqualsToken: 411case SyntaxKind.LessThanLessThanToken: 412case SyntaxKind.LessThanLessThanEqualsToken: 415case SyntaxKind.LessThanToken: 418case SyntaxKind.LessThanEqualsToken: 421case SyntaxKind.AsteriskToken: 422case SyntaxKind.AsteriskEqualsToken: 425case SyntaxKind.PercentToken: 426case SyntaxKind.PercentEqualsToken: 429case SyntaxKind.ExclamationToken: 430case SyntaxKind.TildeToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanEqualsToken: 437case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 438case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 446=> SyntaxFacts.GetText((SyntaxKind)kind); 478case SyntaxKind.NumericLiteralToken: 479case SyntaxKind.CharacterLiteralToken: 480case SyntaxKind.StringLiteralToken: 481case SyntaxKind.Utf8StringLiteralToken: 482case SyntaxKind.SingleLineRawStringLiteralToken: 483case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 484case SyntaxKind.MultiLineRawStringLiteralToken: 485case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 486case SyntaxKind.NullKeyword: 487case SyntaxKind.TrueKeyword: 488case SyntaxKind.FalseKeyword: 489case SyntaxKind.InterpolatedStringStartToken: 490case SyntaxKind.InterpolatedStringEndToken: 491case SyntaxKind.InterpolatedRawStringEndToken: 492case SyntaxKind.InterpolatedVerbatimStringStartToken: 493case SyntaxKind.InterpolatedStringTextToken: 494case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 495case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 503=> token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken; 511case SyntaxKind.DelegateKeyword: 512case SyntaxKind.VoidKeyword: 520if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 523if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken) 525if (token.Parent.IsKind(SyntaxKind.CollectionExpression)) 545=> (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression; 555=> simpleName.IsKind(SyntaxKind.GenericName) || 556simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken; 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 607argument.RefOrOutKeyword.Kind() == SyntaxKind.None && 635=> node.IsKind(SyntaxKind.IdentifierName) && 636node.IsParentKind(SyntaxKind.NameColon) && 637node.Parent.IsParentKind(SyntaxKind.Subpattern); 640=> node.Kind() == SyntaxKind.PropertyPatternClause; 649if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression)) 655else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression)) 663else if (objectInitializer?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 694=> node.IsKind(SyntaxKind.ElementAccessExpression); 724var kind = node.Kind(); 725if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is TMemberDeclarationSyntax)) 816case SyntaxKind.CompilationUnit: 818case SyntaxKind.IdentifierName: 821case SyntaxKind.IncompleteMember: 823case SyntaxKind.NamespaceDeclaration: 824case SyntaxKind.FileScopedNamespaceDeclaration: 826case SyntaxKind.QualifiedName: 840if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration) 865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 1016if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1022if (token.Kind() == SyntaxKind.EndOfFileToken) 1091=> node?.Parent?.Kind() is SyntaxKind.PostIncrementExpression or SyntaxKind.PreIncrementExpression; 1094=> node?.Parent?.Kind() is SyntaxKind.PostDecrementExpression or SyntaxKind.PreDecrementExpression; 1107SyntaxKind.SingleLineRawStringLiteralToken or 1108SyntaxKind.MultiLineRawStringLiteralToken or 1109SyntaxKind.Utf8SingleLineRawStringLiteralToken or 1110SyntaxKind.Utf8MultiLineRawStringLiteralToken; 1113=> token.Kind() == SyntaxKind.NumericLiteralToken; 1139=> trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia; 1145=> node?.Kind() is SyntaxKind.UsingDirective or SyntaxKind.ExternAliasDirective; 1148=> IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword); 1151=> IsGlobalAttribute(node, SyntaxKind.ModuleKeyword); 1153private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget) 1154=> node.IsKind(SyntaxKind.Attribute) && 1183case SyntaxKind.VariableDeclarator: 1184return node.Parent?.Parent?.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration; 1186case SyntaxKind.FieldDeclaration: 1187case SyntaxKind.MethodDeclaration: 1188case SyntaxKind.PropertyDeclaration: 1189case SyntaxKind.GetAccessorDeclaration: 1190case SyntaxKind.SetAccessorDeclaration: 1191case SyntaxKind.EventDeclaration: 1192case SyntaxKind.EventFieldDeclaration: 1193case SyntaxKind.AddAccessorDeclaration: 1194case SyntaxKind.RemoveAccessorDeclaration: 1195case SyntaxKind.IndexerDeclaration: 1196case SyntaxKind.OperatorDeclaration: 1197case SyntaxKind.ConversionOperatorDeclaration: 1198case SyntaxKind.ConstructorDeclaration: 1199case SyntaxKind.DestructorDeclaration: 1211=> node is ExpressionStatementSyntax { Expression: (kind: SyntaxKind.SimpleAssignmentExpression) }; 1332if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member) 1440=> node is InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedVerbatimStringStartToken) }; 1482=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: IdentifierNameSyntax }; 1485=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: ImplicitElementAccessSyntax }; 1488=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression); 1491=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression); 1687=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) initExpr ? initExpr.Expressions : default; 1690=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression) initExpr ? initExpr.Expressions : default;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (151)
19=> (TSyntaxKind)(object)(SyntaxKind)kind; 23=> (int)(SyntaxKind)(object)kind; 25public int ConflictMarkerTrivia => (int)SyntaxKind.ConflictMarkerTrivia; 26public int DisabledTextTrivia => (int)SyntaxKind.DisabledTextTrivia; 27public int EndOfLineTrivia => (int)SyntaxKind.EndOfLineTrivia; 28public int SkippedTokensTrivia => (int)SyntaxKind.SkippedTokensTrivia; 29public int WhitespaceTrivia => (int)SyntaxKind.WhitespaceTrivia; 30public int SingleLineCommentTrivia => (int)SyntaxKind.SingleLineCommentTrivia; 31public int? MultiLineCommentTrivia => (int)SyntaxKind.MultiLineCommentTrivia; 32public int SingleLineDocCommentTrivia => (int)SyntaxKind.SingleLineDocumentationCommentTrivia; 33public int? MultiLineDocCommentTrivia => (int)SyntaxKind.MultiLineDocumentationCommentTrivia; 35public int IfDirectiveTrivia => (int)SyntaxKind.IfDirectiveTrivia; 36public int ElifDirectiveTrivia => (int)SyntaxKind.ElifDirectiveTrivia; 37public int ElseDirectiveTrivia => (int)SyntaxKind.ElseDirectiveTrivia; 38public int EndIfDirectiveTrivia => (int)SyntaxKind.EndIfDirectiveTrivia; 39public int RegionDirectiveTrivia => (int)SyntaxKind.RegionDirectiveTrivia; 40public int EndRegionDirectiveTrivia => (int)SyntaxKind.EndRegionDirectiveTrivia; 41public int? ShebangDirectiveTrivia => (int)SyntaxKind.ShebangDirectiveTrivia; 42public int DefineDirectiveTrivia => (int)SyntaxKind.DefineDirectiveTrivia; 43public int? UndefDirectiveTrivia => (int)SyntaxKind.UndefDirectiveTrivia; 45public int CloseBraceToken => (int)SyntaxKind.CloseBraceToken; 46public int? CloseBracketToken => (int)SyntaxKind.CloseBracketToken; 47public int CloseParenToken => (int)SyntaxKind.CloseParenToken; 48public int CommaToken => (int)SyntaxKind.CommaToken; 49public int ColonToken => (int)SyntaxKind.ColonToken; 50public int CharacterLiteralToken => (int)SyntaxKind.CharacterLiteralToken; 51public int DotToken => (int)SyntaxKind.DotToken; 52public int GreaterThanToken => (int)SyntaxKind.GreaterThanToken; 53public int InterpolatedStringTextToken => (int)SyntaxKind.InterpolatedStringTextToken; 54public int LessThanToken => (int)SyntaxKind.LessThanToken; 55public int LessThanSlashToken => (int)SyntaxKind.LessThanSlashToken; 56public int OpenBraceToken => (int)SyntaxKind.OpenBraceToken; 57public int? OpenBracketToken => (int)SyntaxKind.OpenBracketToken; 58public int OpenParenToken => (int)SyntaxKind.OpenParenToken; 59public int QuestionToken => (int)SyntaxKind.QuestionToken; 60public int StringLiteralToken => (int)SyntaxKind.StringLiteralToken; 61public int? SingleLineRawStringLiteralToken => (int)SyntaxKind.SingleLineRawStringLiteralToken; 62public int? MultiLineRawStringLiteralToken => (int)SyntaxKind.MultiLineRawStringLiteralToken; 63public int? Utf8StringLiteralToken => (int)SyntaxKind.Utf8StringLiteralToken; 64public int? Utf8SingleLineRawStringLiteralToken => (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken; 65public int? Utf8MultiLineRawStringLiteralToken => (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 67public int XmlCrefAttribute => (int)SyntaxKind.XmlCrefAttribute; 68public int XmlTextLiteralToken => (int)SyntaxKind.XmlTextLiteralToken; 70public int DelegateKeyword => (int)SyntaxKind.DelegateKeyword; 71public int FalseKeyword => (int)SyntaxKind.FalseKeyword; 72public int IfKeyword => (int)SyntaxKind.IfKeyword; 73public int NewKeyword => (int)SyntaxKind.NewKeyword; 74public int PartialKeyword => (int)SyntaxKind.PartialKeyword; 75public int TrueKeyword => (int)SyntaxKind.TrueKeyword; 76public int UsingKeyword => (int)SyntaxKind.UsingKeyword; 78public int? AliasQualifiedName => (int)SyntaxKind.AliasQualifiedName; 79public int GenericName => (int)SyntaxKind.GenericName; 80public int IdentifierName => (int)SyntaxKind.IdentifierName; 81public int QualifiedName => (int)SyntaxKind.QualifiedName; 83public int TupleType => (int)SyntaxKind.TupleType; 85public int CharacterLiteralExpression => (int)SyntaxKind.CharacterLiteralExpression; 86public int DefaultLiteralExpression => (int)SyntaxKind.DefaultLiteralExpression; 87public int FalseLiteralExpression => (int)SyntaxKind.FalseLiteralExpression; 88public int NullLiteralExpression => (int)SyntaxKind.NullLiteralExpression; 89public int NumericLiteralExpression => (int)SyntaxKind.NumericLiteralExpression; 90public int StringLiteralExpression => (int)SyntaxKind.StringLiteralExpression; 91public int TrueLiteralExpression => (int)SyntaxKind.TrueLiteralExpression; 93public int AddExpression => (int)SyntaxKind.AddExpression; 94public int AddressOfExpression => (int)SyntaxKind.AddressOfExpression; 95public int AnonymousObjectCreationExpression => (int)SyntaxKind.AnonymousObjectCreationExpression; 96public int ArrayCreationExpression => (int)SyntaxKind.ArrayCreationExpression; 97public int AwaitExpression => (int)SyntaxKind.AwaitExpression; 98public int BaseExpression => (int)SyntaxKind.BaseExpression; 99public int? CollectionExpression => (int)SyntaxKind.CollectionExpression; 100public int CollectionInitializerExpression => (int)SyntaxKind.CollectionInitializerExpression; 101public int ConditionalAccessExpression => (int)SyntaxKind.ConditionalAccessExpression; 102public int ConditionalExpression => (int)SyntaxKind.ConditionalExpression; 103public int? FieldExpression => (int)SyntaxKind.FieldExpression; 104public int? ImplicitArrayCreationExpression => (int)SyntaxKind.ImplicitArrayCreationExpression; 105public int? ImplicitObjectCreationExpression => (int)SyntaxKind.ImplicitObjectCreationExpression; 106public int? IndexExpression => (int)SyntaxKind.IndexExpression; 107public int InvocationExpression => (int)SyntaxKind.InvocationExpression; 108public int? IsPatternExpression => (int)SyntaxKind.IsPatternExpression; 109public int IsTypeExpression => (int)SyntaxKind.IsExpression; 111public int LogicalAndExpression => (int)SyntaxKind.LogicalAndExpression; 112public int LogicalOrExpression => (int)SyntaxKind.LogicalOrExpression; 113public int LogicalNotExpression => (int)SyntaxKind.LogicalNotExpression; 114public int ObjectCreationExpression => (int)SyntaxKind.ObjectCreationExpression; 115public int ParenthesizedExpression => (int)SyntaxKind.ParenthesizedExpression; 116public int QueryExpression => (int)SyntaxKind.QueryExpression; 117public int? RangeExpression => (int)SyntaxKind.RangeExpression; 118public int? RefExpression => (int)SyntaxKind.RefExpression; 119public int ReferenceEqualsExpression => (int)SyntaxKind.EqualsExpression; 120public int ReferenceNotEqualsExpression => (int)SyntaxKind.NotEqualsExpression; 121public int SimpleAssignmentExpression => (int)SyntaxKind.SimpleAssignmentExpression; 122public int SimpleMemberAccessExpression => (int)SyntaxKind.SimpleMemberAccessExpression; 123public int? SizeOfExpression => (int)SyntaxKind.SizeOfExpression; 124public int? SuppressNullableWarningExpression => (int)SyntaxKind.SuppressNullableWarningExpression; 125public int TernaryConditionalExpression => (int)SyntaxKind.ConditionalExpression; 126public int ThisExpression => (int)SyntaxKind.ThisExpression; 127public int? ThrowExpression => (int)SyntaxKind.ThrowExpression; 128public int TupleExpression => (int)SyntaxKind.TupleExpression; 129public int TypeOfExpression => (int)SyntaxKind.TypeOfExpression; 131public int? AndPattern => (int)SyntaxKind.AndPattern; 132public int? ConstantPattern => (int)SyntaxKind.ConstantPattern; 133public int? DeclarationPattern => (int)SyntaxKind.DeclarationPattern; 134public int? ListPattern => (int)SyntaxKind.ListPattern; 135public int? NotPattern => (int)SyntaxKind.NotPattern; 136public int? OrPattern => (int)SyntaxKind.OrPattern; 137public int? ParenthesizedPattern => (int)SyntaxKind.ParenthesizedPattern; 138public int? RecursivePattern => (int)SyntaxKind.RecursivePattern; 139public int? RelationalPattern => (int)SyntaxKind.RelationalPattern; 140public int? TypePattern => (int)SyntaxKind.TypePattern; 141public int? VarPattern => (int)SyntaxKind.VarPattern; 143public int EndOfFileToken => (int)SyntaxKind.EndOfFileToken; 144public int AwaitKeyword => (int)SyntaxKind.AwaitKeyword; 145public int AsyncKeyword => (int)SyntaxKind.AsyncKeyword; 146public int IdentifierToken => (int)SyntaxKind.IdentifierToken; 147public int GlobalKeyword => (int)SyntaxKind.GlobalKeyword; 148public int IncompleteMember => (int)SyntaxKind.IncompleteMember; 149public int HashToken => (int)SyntaxKind.HashToken; 151public int ExpressionStatement => (int)SyntaxKind.ExpressionStatement; 152public int ForEachStatement => (int)SyntaxKind.ForEachStatement; 153public int ForStatement => (int)SyntaxKind.ForStatement; 154public int IfStatement => (int)SyntaxKind.IfStatement; 155public int LocalDeclarationStatement => (int)SyntaxKind.LocalDeclarationStatement; 156public int? LocalFunctionStatement => (int)SyntaxKind.LocalFunctionStatement; 157public int LockStatement => (int)SyntaxKind.LockStatement; 158public int ReturnStatement => (int)SyntaxKind.ReturnStatement; 159public int ThrowStatement => (int)SyntaxKind.ThrowStatement; 160public int UsingStatement => (int)SyntaxKind.UsingStatement; 161public int WhileStatement => (int)SyntaxKind.WhileStatement; 162public int YieldReturnStatement => (int)SyntaxKind.YieldReturnStatement; 163public int Attribute => (int)SyntaxKind.Attribute; 164public int ClassDeclaration => (int)SyntaxKind.ClassDeclaration; 165public int ConstructorDeclaration => (int)SyntaxKind.ConstructorDeclaration; 166public int EnumDeclaration => (int)SyntaxKind.EnumDeclaration; 167public int InterfaceDeclaration => (int)SyntaxKind.InterfaceDeclaration; 168public int? StructDeclaration => (int)SyntaxKind.StructDeclaration; 169public int Parameter => (int)SyntaxKind.Parameter; 170public int TypeConstraint => (int)SyntaxKind.TypeConstraint; 171public int VariableDeclarator => (int)SyntaxKind.VariableDeclarator; 172public int FieldDeclaration => (int)SyntaxKind.FieldDeclaration; 173public int PropertyDeclaration => (int)SyntaxKind.PropertyDeclaration; 174public int ParameterList => (int)SyntaxKind.ParameterList; 175public int TypeArgumentList => (int)SyntaxKind.TypeArgumentList; 176public int? GlobalStatement => (int)SyntaxKind.GlobalStatement; 178public int ElseClause => (int)SyntaxKind.ElseClause; 179public int EqualsValueClause => (int)SyntaxKind.EqualsValueClause; 181public int? ExpressionElement => (int)SyntaxKind.ExpressionElement; 182public int? ImplicitElementAccess => (int)SyntaxKind.ImplicitElementAccess; 183public int Interpolation => (int)SyntaxKind.Interpolation; 184public int InterpolatedStringExpression => (int)SyntaxKind.InterpolatedStringExpression; 185public int InterpolatedStringText => (int)SyntaxKind.InterpolatedStringText; 186public int? IndexerMemberCref => (int)SyntaxKind.IndexerMemberCref; 187public int? PrimaryConstructorBaseType => (int)SyntaxKind.PrimaryConstructorBaseType;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
14if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (21)
56return cast.Kind() == SyntaxKind.AsExpression && 126if (leftOrRightChild.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) binary) 160if (castExpression.WalkUpParentheses().Parent is PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression) parent && 187var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 231if (castSyntax.WalkUpParentheses().GetRequiredParent().Kind() is SyntaxKind.BitwiseOrExpression or SyntaxKind.OrAssignmentExpression) 334var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 504if (castNode.WalkUpParentheses().Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) isExpression && 570if (castNode.IsParentKind(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object) 815if (parent is not PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression)) 820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 947if (armExpression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 998if (castExpression.Expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 1063is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) parentBinary) 1151=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.CastExpression or SyntaxKind.AsExpression; 1188if (otherSide.WalkDownParentheses().Kind() == SyntaxKind.NullLiteralExpression) 1257else if (castNode.Parent is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 1365if (!haveHitArgumentNode && currentOld.Kind() != SyntaxKind.Argument)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (46)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None); 40while (currentToken.Kind() != SyntaxKind.CloseBraceToken && previousToken.Kind() == SyntaxKind.OpenBraceToken) 43if (closeBrace.Kind() == SyntaxKind.None || !AreTwoTokensOnSameLine(previousToken, closeBrace)) 60case SyntaxKind.CloseBraceToken: 63case SyntaxKind.SemicolonToken: 66case SyntaxKind.ColonToken: 76if (endToken.Kind() == SyntaxKind.SkippedTokensTrivia) 88if (parent.Kind() is SyntaxKind.StringLiteralExpression or SyntaxKind.CharacterLiteralExpression) 100if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 152if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 252if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 259if (endToken.Kind() == SyntaxKind.ColonToken && parent is LabeledStatementSyntax) 268return previousToken.Kind() == SyntaxKind.None ? token : previousToken; 290if (previousToken.Kind() == SyntaxKind.None) 327return previousToken.IsKind(SyntaxKind.OpenBraceToken) && 328(previousToken.Parent.IsKind(SyntaxKind.Block) || 336node.Kind() is SyntaxKind.IfStatement or 337SyntaxKind.ElseClause or 338SyntaxKind.WhileStatement or 339SyntaxKind.ForStatement or 340SyntaxKind.ForEachStatement or 341SyntaxKind.ForEachVariableStatement or 342SyntaxKind.UsingStatement or 343SyntaxKind.DoStatement or 344SyntaxKind.TryStatement or 345SyntaxKind.CatchClause or 346SyntaxKind.FinallyClause or 347SyntaxKind.LabeledStatement or 348SyntaxKind.LockStatement or 349SyntaxKind.FixedStatement or 350SyntaxKind.UncheckedStatement or 351SyntaxKind.CheckedStatement or 352SyntaxKind.GetAccessorDeclaration or 353SyntaxKind.SetAccessorDeclaration or 354SyntaxKind.InitAccessorDeclaration or 355SyntaxKind.AddAccessorDeclaration or 356SyntaxKind.RemoveAccessorDeclaration; 388return token.Kind() == SyntaxKind.ColonToken && 395if (previousToken.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 400if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 417if (token.Kind() == SyntaxKind.CloseBraceToken) 419if (token.Parent.Kind() is SyntaxKind.Block or 420SyntaxKind.AccessorList)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (4)
84case SyntaxKind.QualifiedName: 89case SyntaxKind.AliasQualifiedName: 94case SyntaxKind.IdentifierName: 97case SyntaxKind.GenericName:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (57)
69=> expression.Kind() is SyntaxKind.ThisExpression or SyntaxKind.BaseExpression; 82if (node.Kind() is not SyntaxKind.PrimaryConstructorBaseType || 83previousNode.Kind() is SyntaxKind.ArgumentList) 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 97node.Kind() is SyntaxKind.Attribute or 98SyntaxKind.ThisConstructorInitializer or 99SyntaxKind.BaseConstructorInitializer or 100SyntaxKind.EqualsValueClause or 101SyntaxKind.ArrowExpressionClause or 102SyntaxKind.PrimaryConstructorBaseType; 109node => node.Kind() is SyntaxKind.UnknownAccessorDeclaration or SyntaxKind.IncompleteMember or SyntaxKind.BracketedArgumentList), 158case SyntaxKind.Attribute: 162case SyntaxKind.BaseConstructorInitializer: 163case SyntaxKind.ThisConstructorInitializer: 167case SyntaxKind.EqualsValueClause: 171case SyntaxKind.ArrowExpressionClause: 175case SyntaxKind.PrimaryConstructorBaseType: 201case SyntaxKind.ParenthesizedLambdaExpression: 235case SyntaxKind.SimpleLambdaExpression: 300if (currentOriginalNode.Kind() is SyntaxKind.CaseSwitchLabel or SyntaxKind.ConstantPattern) 303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 315else if (currentOriginalNode.Kind() == SyntaxKind.LogicalNotExpression) 319else if (currentOriginalNode.Kind() == SyntaxKind.ConditionalAccessExpression) 336else if (currentOriginalNode.Kind() == SyntaxKind.VariableDeclarator) 467if (previousReplacedExpression.WalkDownParentheses().Kind() is SyntaxKind.NullLiteralExpression or SyntaxKind.DefaultLiteralExpression) 515else if (currentOriginalNode.Kind() == SyntaxKind.CollectionInitializerExpression) 520else if (currentOriginalNode.Kind() == SyntaxKind.ImplicitArrayCreationExpression) 529else if (currentOriginalNode.Kind() == SyntaxKind.DefaultExpression) 582SyntaxKind.InvocationExpression or 583SyntaxKind.ElementAccessExpression or 584SyntaxKind.SimpleMemberAccessExpression or 585SyntaxKind.ImplicitElementAccess or 586SyntaxKind.ObjectCreationExpression; 602SyntaxKind.InvocationExpression => ((InvocationExpressionSyntax)expression).ArgumentList, 603SyntaxKind.ObjectCreationExpression => ((ObjectCreationExpressionSyntax)expression).ArgumentList, 604SyntaxKind.ElementAccessExpression => ((ElementAccessExpressionSyntax)expression).ArgumentList, 615case SyntaxKind.SimpleMemberAccessExpression: 618case SyntaxKind.InvocationExpression: 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 629case SyntaxKind.ElementAccessExpression: 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 673if (binaryExpression.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression && 720assignmentExpression.Kind() != SyntaxKind.LeftShiftAssignmentExpression && 721assignmentExpression.Kind() != SyntaxKind.RightShiftAssignmentExpression && 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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (4)
23x.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword && 24y.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (9)
38if (typeName?.FirstAncestorOrSelf<SyntaxNode>(a => a.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement) is not { } declaration) 61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression); 84SyntaxKind.LocalDeclarationStatement or 85SyntaxKind.ForStatement or 86SyntaxKind.UsingStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
104/// to var. <see cref="SyntaxFacts.IsPredefinedType(SyntaxKind)"/> considers string
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (4)
66declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation)) 78if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
104if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) }) 117if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType) && 248if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 252if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (3)
47case SyntaxKind.ArrayType: 50case SyntaxKind.PointerType: 53case SyntaxKind.NullableType:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (5)
29.Select(n => n.GetTrailingTrivia().FirstOrNull(t => t.Kind() == SyntaxKind.EndOfLineTrivia)) 71var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 72var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 170if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 188=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (3)
95var kind = CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(constructor) != null 96? SyntaxKind.ThisConstructorInitializer 97: SyntaxKind.BaseConstructorInitializer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (12)
95if (t1.Kind() == SyntaxKind.MultiLineCommentTrivia) 100return SyntaxTrivia(SyntaxKind.MultiLineCommentTrivia, text + MultiLineCommentTerminator); 103else if (t1.Kind() == SyntaxKind.SkippedTokensTrivia) 196=> declaration.ChildTokens().Where(t => t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken && t.IsMissing).Any(); 233SyntaxKind.ClassDeclaration => CodeGenerationDestination.ClassType, 234SyntaxKind.CompilationUnit => CodeGenerationDestination.CompilationUnit, 235SyntaxKind.EnumDeclaration => CodeGenerationDestination.EnumType, 236SyntaxKind.InterfaceDeclaration => CodeGenerationDestination.InterfaceType, 237SyntaxKind.FileScopedNamespaceDeclaration => CodeGenerationDestination.Namespace, 238SyntaxKind.NamespaceDeclaration => CodeGenerationDestination.Namespace, 239SyntaxKind.StructDeclaration => CodeGenerationDestination.StructType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (20)
457ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); 463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); 511var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1; 515else if (destinationMember is StatementSyntax statement && statement.IsParentKind(SyntaxKind.GlobalStatement)) 786case SyntaxKind.DelegateDeclaration: 794case SyntaxKind.MethodDeclaration: 802case SyntaxKind.OperatorDeclaration: 810case SyntaxKind.ConversionOperatorDeclaration: 818case SyntaxKind.PropertyDeclaration: 826case SyntaxKind.EventDeclaration: 834case SyntaxKind.IndexerDeclaration: 842case SyntaxKind.Parameter: 856case SyntaxKind.IncompleteMember: 870case SyntaxKind.ArrayType: 878case SyntaxKind.PointerType: 886case SyntaxKind.VariableDeclaration: 894case SyntaxKind.CatchDeclaration: 918case SyntaxKind.CompilationUnit: 919case SyntaxKind.NamespaceDeclaration: 920case SyntaxKind.FileScopedNamespaceDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (78)
15private static readonly Dictionary<SyntaxKind, int> s_kindPrecedenceMap = new(SyntaxFacts.EqualityComparer) 17{ SyntaxKind.FieldDeclaration, 0 }, 18{ SyntaxKind.ConstructorDeclaration, 1 }, 19{ SyntaxKind.DestructorDeclaration, 2 }, 20{ SyntaxKind.IndexerDeclaration, 3 }, 21{ SyntaxKind.PropertyDeclaration, 4 }, 22{ SyntaxKind.EventFieldDeclaration, 5 }, 23{ SyntaxKind.EventDeclaration, 6 }, 24{ SyntaxKind.MethodDeclaration, 7 }, 25{ SyntaxKind.OperatorDeclaration, 8 }, 26{ SyntaxKind.ConversionOperatorDeclaration, 9 }, 27{ SyntaxKind.EnumDeclaration, 10 }, 28{ SyntaxKind.InterfaceDeclaration, 11 }, 29{ SyntaxKind.StructDeclaration, 12 }, 30{ SyntaxKind.ClassDeclaration, 13 }, 31{ SyntaxKind.RecordDeclaration, 14 }, 32{ SyntaxKind.RecordStructDeclaration, 15 }, 33{ SyntaxKind.DelegateDeclaration, 16 } 36private static readonly Dictionary<SyntaxKind, int> s_operatorPrecedenceMap = new(SyntaxFacts.EqualityComparer) 38{ SyntaxKind.PlusToken, 0 }, 39{ SyntaxKind.MinusToken, 1 }, 40{ SyntaxKind.ExclamationToken, 2 }, 41{ SyntaxKind.TildeToken, 3 }, 42{ SyntaxKind.PlusPlusToken, 4 }, 43{ SyntaxKind.MinusMinusToken, 5 }, 44{ SyntaxKind.AsteriskToken, 6 }, 45{ SyntaxKind.SlashToken, 7 }, 46{ SyntaxKind.PercentToken, 8 }, 47{ SyntaxKind.AmpersandToken, 9 }, 48{ SyntaxKind.BarToken, 10 }, 49{ SyntaxKind.CaretToken, 11 }, 50{ SyntaxKind.LessThanLessThanToken, 12 }, 51{ SyntaxKind.GreaterThanGreaterThanToken, 13 }, 52{ SyntaxKind.EqualsEqualsToken, 14 }, 53{ SyntaxKind.ExclamationEqualsToken, 15 }, 54{ SyntaxKind.LessThanToken, 16 }, 55{ SyntaxKind.GreaterThanToken, 17 }, 56{ SyntaxKind.LessThanEqualsToken, 18 }, 57{ SyntaxKind.GreaterThanEqualsToken, 19 }, 58{ SyntaxKind.TrueKeyword, 20 }, 59{ SyntaxKind.FalseKeyword, 21 }, 60{ SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 22 }, 103case SyntaxKind.DelegateDeclaration: 106case SyntaxKind.FieldDeclaration: 107case SyntaxKind.EventFieldDeclaration: 110case SyntaxKind.ConstructorDeclaration: 113case SyntaxKind.DestructorDeclaration: 117case SyntaxKind.MethodDeclaration: 120case SyntaxKind.OperatorDeclaration: 123case SyntaxKind.EventDeclaration: 126case SyntaxKind.IndexerDeclaration: 129case SyntaxKind.PropertyDeclaration: 132case SyntaxKind.EnumDeclaration: 135case SyntaxKind.InterfaceDeclaration: 136case SyntaxKind.StructDeclaration: 137case SyntaxKind.RecordStructDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.RecordDeclaration: 142case SyntaxKind.ConversionOperatorDeclaration: 145case SyntaxKind.IncompleteMember: 148case SyntaxKind.GlobalStatement: 217return x.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword ? -1 : 1; 301private static bool ContainsToken(SyntaxTokenList list, SyntaxKind kind) 316if (ContainsToken(modifiers, SyntaxKind.PublicKeyword)) 320else if (ContainsToken(modifiers, SyntaxKind.ProtectedKeyword)) 322if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 327if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 334else if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 338else if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 347if (node.Kind() == SyntaxKind.InterfaceDeclaration) 352else if (node.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration) 362private static bool BothHaveModifier(SyntaxTokenList x, SyntaxTokenList y, SyntaxKind modifierKind, out int comparisonResult) 378=> BothHaveModifier(x, y, SyntaxKind.StaticKeyword, out comparisonResult); 381=> BothHaveModifier(x, y, SyntaxKind.ConstKeyword, out comparisonResult); 384=> BothHaveModifier(x, y, SyntaxKind.ReadOnlyKeyword, out comparisonResult);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (9)
34else if (members.LastOrDefault().Kind() == SyntaxKind.CommaToken) 118if (lastExpression.Kind() == SyntaxKind.LeftShiftExpression && 122if (binaryExpression.Left.Kind() == SyntaxKind.NumericLiteralExpression) 132SyntaxKind.LeftShiftExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)), 134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(shiftValue.ToString(), shiftValue))); 138else if (lastExpression is LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) numericLiteral) 146return LiteralExpression(SyntaxKind.NumericLiteralExpression, 151return LiteralExpression(SyntaxKind.NumericLiteralExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (7)
28if (eventDeclaration.Kind() == SyntaxKind.EventFieldDeclaration) 36if (eventDeclaration.Kind() == SyntaxKind.EventDeclaration) 53if (eventDeclaration.Kind() == SyntaxKind.FieldDeclaration) 164GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 165GenerateAccessorDeclaration(@event, @event.RemoveMethod, SyntaxKind.RemoveAccessorDeclaration, destination, info), 174SyntaxKind kind, 186SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (18)
42InitializerExpression(SyntaxKind.ArrayInitializerExpression, 51=> LiteralExpression(SyntaxKind.NullLiteralExpression); 108? SyntaxKind.TrueLiteralExpression 109: SyntaxKind.FalseLiteralExpression); 116SyntaxKind.StringLiteralExpression, Literal(valueString, val)); 123SyntaxKind.CharacterLiteralExpression, Literal(literal, val)); 186return BinaryExpression(SyntaxKind.DivideExpression, 192return BinaryExpression(SyntaxKind.DivideExpression, 198return BinaryExpression(SyntaxKind.DivideExpression, 199PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateDoubleLiteralExpression(null, 1.0, false)), 215return BinaryExpression(SyntaxKind.DivideExpression, 221return BinaryExpression(SyntaxKind.DivideExpression, 227return BinaryExpression(SyntaxKind.DivideExpression, 228PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateSingleLiteralExpression(null, 1.0F, false)), 279SyntaxKind.NumericLiteralExpression, tokenFactory(stringValue, nonNegativeValue)); 282? PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, literal) 299var result = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccess, IdentifierName(constant.Value)); 315: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, result, name);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (6)
28.Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)) 33if (fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword)) 39.Where(f => f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) 43.Where(f => !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) && !f.Modifiers.Any(SyntaxKind.ConstKeyword)) 48return fieldDeclaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
26private static readonly TypeParameterConstraintSyntax s_classConstraint = ClassOrStructConstraint(SyntaxKind.ClassConstraint); 27private static readonly TypeParameterConstraintSyntax s_structConstraint = ClassOrStructConstraint(SyntaxKind.StructConstraint);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
168case SyntaxKind.EnumDeclaration: 171case SyntaxKind.StructDeclaration: 172case SyntaxKind.RecordStructDeclaration: 173case SyntaxKind.InterfaceDeclaration: 174case SyntaxKind.ClassDeclaration: 175case SyntaxKind.RecordDeclaration: 201var declarationKind = isRecordClass ? SyntaxKind.RecordDeclaration : SyntaxKind.RecordStructDeclaration; 202var classOrStructKeyword = Token(isRecordClass ? default : SyntaxKind.StructKeyword); 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (2)
82var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); 83if (operatorSyntaxKind == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (8)
185if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 282GenerateAccessorDeclaration(property, property.GetMethod, SyntaxKind.GetAccessorDeclaration, destination, info, cancellationToken), 294SyntaxKind kind, 308SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (7)
164case SyntaxKind.IdentifierName: 165case SyntaxKind.GenericName: 169case SyntaxKind.SimpleMemberAccessExpression: 170case SyntaxKind.PointerMemberAccessExpression: 174case SyntaxKind.SimpleLambdaExpression: 175case SyntaxKind.ParenthesizedLambdaExpression: 176case SyntaxKind.AnonymousMethodExpression:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (4)
21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 22case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).SemicolonToken; 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 40case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).WithSemicolonToken(semicolonToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (4)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None)); 131if (!endOfLine.IsKind(SyntaxKind.None)) 150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (42)
48public readonly ISet<SyntaxKind> PrecedingModifiers; 111ISet<SyntaxKind> precedingModifiers, 213targetToken.IsKind(SyntaxKind.TildeToken) && 214targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) && 215targetToken.Parent.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration); 224var isOnArgumentListBracketOrComma = targetToken.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier); 246isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 263isTaskLikeTypeContext: precedingModifiers.Contains(SyntaxKind.AsyncKeyword), 312if (token.Kind() == SyntaxKind.OpenBracketToken && 313token.Parent.IsKind(SyntaxKind.AttributeList) && 324ISet<SyntaxKind>? validModifiers = null, 325ISet<SyntaxKind>? validTypeDeclarations = null, 332public bool IsRecordDeclarationContext(ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) 336if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 346ISet<SyntaxKind> validTypeDeclarations, bool includingRecordParameters, CancellationToken cancellationToken) 352if (token.Kind() == SyntaxKind.OpenBracketToken && 353token.Parent.IsKind(SyntaxKind.AttributeList)) 376if (token.Kind() == SyntaxKind.OpenBracketToken && 377token.Parent.IsKind(SyntaxKind.AttributeList) && 392if (token.Kind() == SyntaxKind.OpenBracketToken && 393token.Parent.IsKind(SyntaxKind.AttributeList) && 403ISet<SyntaxKind>? validModifiers = null, 404ISet<SyntaxKind>? validTypeDeclarations = null, 439if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 450&& targetToken.IsKind(SyntaxKind.IdentifierToken) 451&& targetToken.HasMatchingText(SyntaxKind.AwaitKeyword)) 483if (node.IsKind(SyntaxKind.QueryExpression)) 487if (targetToken.IsKind(SyntaxKind.InKeyword)) 534SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword => AttributeTargets.Assembly | AttributeTargets.Module, 535SyntaxKind.TypeKeyword => AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, 536SyntaxKind.MethodKeyword => AttributeTargets.Method, 537SyntaxKind.FieldKeyword => AttributeTargets.Field, 538SyntaxKind.PropertyKeyword => AttributeTargets.Property, 539SyntaxKind.EventKeyword => AttributeTargets.Event, 540SyntaxKind.ParamKeyword => AttributeTargets.Parameter, 541SyntaxKind.ReturnKeyword => AttributeTargets.ReturnValue, 542SyntaxKind.TypeVarKeyword => AttributeTargets.GenericParameter, 558RecordDeclarationSyntax record => record.ClassOrStructKeyword.IsKind(SyntaxKind.StructKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (114)
19token.Kind() is SyntaxKind.UsingKeyword or 20SyntaxKind.ExternKeyword; 25if (token.IsKind(SyntaxKind.UsingKeyword)) 41if (token is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 47if (token.IsKind(SyntaxKind.UnsafeKeyword) && 48token.GetPreviousToken() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 118case SyntaxKind.SemicolonToken: 120return statement != null && !statement.IsParentKind(SyntaxKind.GlobalStatement) && 123case SyntaxKind.CloseBraceToken: 124if (token.Parent.IsKind(SyntaxKind.Block)) 135if (token.Parent.Parent.Kind() is not SyntaxKind.TryStatement and not SyntaxKind.DoStatement) 139is SyntaxKind.ElseClause 140or SyntaxKind.FinallyClause 141or SyntaxKind.CatchClause 142or SyntaxKind.SwitchSection) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 155case SyntaxKind.ColonToken: 156return token.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel or SyntaxKind.LabeledStatement); 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 161case SyntaxKind.CloseParenToken: 164is SyntaxKind.ForStatement 165or SyntaxKind.ForEachStatement 166or SyntaxKind.ForEachVariableStatement 167or SyntaxKind.WhileStatement 168or SyntaxKind.IfStatement 169or SyntaxKind.LockStatement 170or SyntaxKind.UsingStatement 171or SyntaxKind.FixedStatement; 173case SyntaxKind.ElseKeyword: 174return token.Parent.IsKind(SyntaxKind.ElseClause); 176case SyntaxKind.CloseBracketToken: 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 207if (token.Kind() == SyntaxKind.CloseBraceToken) 211memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 217if (token.Kind() == SyntaxKind.SemicolonToken) 230memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 250if (token.Kind() == SyntaxKind.CloseBracketToken) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 272if (token.Kind() == SyntaxKind.CloseParenToken) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 300if (token.Kind() == SyntaxKind.IdentifierToken && 301token.GetPreviousToken(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword) 326if (targetToken.Kind() is SyntaxKind.IfKeyword or 327SyntaxKind.ElifKeyword) 333if (targetToken.Kind() == SyntaxKind.OpenParenToken && 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 363if (targetToken.Kind() is not (SyntaxKind.IdentifierToken or SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken)) 395if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 401if (targetToken.Kind() == SyntaxKind.ColonToken) 403if (targetToken.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel)) 409if (targetToken.Kind() is SyntaxKind.SemicolonToken or 410SyntaxKind.CloseBraceToken) 430return targetToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken && 431targetToken.Parent is (kind: SyntaxKind.CrefBracketedParameterList or SyntaxKind.CrefParameterList); 449if (targetToken.Kind() == SyntaxKind.ColonToken && 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 456is SyntaxKind.InvocationExpression 457or SyntaxKind.ObjectCreationExpression 458or SyntaxKind.BaseConstructorInitializer 459or SyntaxKind.ThisConstructorInitializer) 465if (targetToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 467if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 470is SyntaxKind.ObjectCreationExpression 471or SyntaxKind.BaseConstructorInitializer 472or SyntaxKind.ThisConstructorInitializer) 480if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression()) 492if (targetToken.Kind() == SyntaxKind.OperatorKeyword && 504targetToken.GetAncestors<StatementSyntax>().Any(s => s.IsKind(SyntaxKind.UnsafeStatement)) || 505targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword) || 506targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) || 507targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.UnsafeKeyword)); 515return targetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword); 518public static bool IsAnyAccessorDeclarationContext(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 525public static bool IsAccessorDeclarationContext<TMemberNode>(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 545if (existingAccessor.Kind() != SyntaxKind.None) 569while (targetToken.Kind() is SyntaxKind.InternalKeyword or 570SyntaxKind.PublicKeyword or 571SyntaxKind.ProtectedKeyword or 572SyntaxKind.PrivateKeyword or 573SyntaxKind.ReadOnlyKeyword) 580if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 581targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 588if (targetToken.Kind() == SyntaxKind.CloseBraceToken && 589targetToken.Parent.IsKind(SyntaxKind.Block) && 596if (targetToken.Kind() == SyntaxKind.SemicolonToken && 603if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 604targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 615if (node.IsKind(SyntaxKind.TypeParameterList)) 617if (node?.Parent is TypeDeclarationSyntax(SyntaxKind.InterfaceDeclaration) typeDecl) 636if (targetToken.Kind() == SyntaxKind.LessThanToken && 642if (targetToken.Kind() == SyntaxKind.CommaToken && 648if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 649targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 650targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) && 661if (token.Kind() == SyntaxKind.CommaToken && token.Parent is BaseArgumentListSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (444)
21private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.ExternKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.AsyncKeyword, 26SyntaxKind.UnsafeKeyword, 36if (token.IsKind(SyntaxKind.OpenBracketToken) && 37token.Parent.IsKind(SyntaxKind.AttributeList)) 44if (token.IsKind(SyntaxKind.CommaToken) && 45token.Parent.IsKind(SyntaxKind.AttributeList)) 52if (token.IsKind(SyntaxKind.ColonToken) && 53token.Parent.IsKind(SyntaxKind.AttributeTargetSpecifier)) 60if (token.Parent.IsKind(SyntaxKind.QualifiedName) && 61token.Parent.IsParentKind(SyntaxKind.Attribute)) 68if (token.Parent.IsKind(SyntaxKind.AliasQualifiedName) && 69token.Parent.IsParentKind(SyntaxKind.Attribute)) 80ISet<SyntaxKind> validModifiers, 95if (token.IsKind(SyntaxKind.CloseBracketToken) 115if (parent.IsKind(SyntaxKind.CompilationUnit) || 116(parent is MemberDeclarationSyntax && parent.IsParentKind(SyntaxKind.CompilationUnit))) 129return kind is ((int)SyntaxKind.AssemblyKeyword) 130or ((int)SyntaxKind.ModuleKeyword); 166if (token.IsKind(SyntaxKind.OpenBraceToken)) 177if (token.IsKind(SyntaxKind.SemicolonToken)) 194if (token.IsKind(SyntaxKind.CloseBraceToken)) 208token.Parent.IsKind(SyntaxKind.Block) && 220if (token.IsKind(SyntaxKind.CloseBracketToken) && 221token.Parent.IsKind(SyntaxKind.AttributeList)) 243ISet<SyntaxKind>? validModifiers, 244ISet<SyntaxKind>? validTypeDeclarations, 257validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 285token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 294validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 299if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 322SyntaxKind otherModifier, 330return modifierTokens.Contains(otherModifier) && IsLambdaDeclarationContext(syntaxTree, position, SyntaxKind.None, cancellationToken); 342ISet<SyntaxKind> validModifiers, 359if (token.Kind() == SyntaxKind.CloseBracketToken && token.Parent is AttributeListSyntax) 420(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 426if (token.IsKind(SyntaxKind.None)) 440if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 455if (token.IsKind(SyntaxKind.SemicolonToken)) 457if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 477if (token.IsKind(SyntaxKind.CloseBraceToken)) 483else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 492token.Parent.IsKind(SyntaxKind.Block) && 507if (token.IsKind(SyntaxKind.CloseBracketToken) && 508token.Parent.IsKind(SyntaxKind.AttributeList)) 511if (token.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 532ISet<SyntaxKind>? validModifiers, 533ISet<SyntaxKind>? validTypeDeclarations, 543validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 576token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 591validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 602return incompleteMember.Type.IsKind(SyntaxKind.RefType); 609if (modifierTokens.Contains(SyntaxKind.FileKeyword)) 612if (modifierTokens.Contains(SyntaxKind.ClosedKeyword)) 638if (token.IsKind(SyntaxKind.ColonColonToken) && 639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 651if (token.IsKind(SyntaxKind.UsingKeyword)) 656if (token.GetNextToken(includeSkipped: true).Kind() != SyntaxKind.EqualsToken && 701is SyntaxKind.ClassKeyword 702or SyntaxKind.StructKeyword 703or SyntaxKind.InterfaceKeyword && 704token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 737syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 738syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || 739syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || 740syntaxTree.IsAfterKeyword(position, SyntaxKind.CaseKeyword, cancellationToken) || 741syntaxTree.IsAfterKeyword(position, SyntaxKind.EventKeyword, cancellationToken) || 742syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) || 785if (token.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken && 801if (token.IsKind(SyntaxKind.EqualsToken) && 831if (token.IsKind(SyntaxKind.WhereKeyword) && 832token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 837if (token.IsKind(SyntaxKind.IdentifierToken) && 838token.HasMatchingText(SyntaxKind.WhereKeyword) && 839token.Parent.IsKind(SyntaxKind.IdentifierName) && 840token.Parent.IsParentKind(SyntaxKind.SimpleBaseType) && 841token.Parent.Parent.IsParentKind(SyntaxKind.BaseList)) 858if (token.IsKind(SyntaxKind.ColonToken) && 859token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 860token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 884if (token.IsKind(SyntaxKind.CommaToken) && 903if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 915if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 928if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 947case SyntaxKind.LessThanToken: 948case SyntaxKind.CommaToken: 949return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955{ Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } => true, 957{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 963=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 964targetToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken; 980if (token.Kind() is not SyntaxKind.LessThanToken and not SyntaxKind.CommaToken) 1015if (name.IsParentKind(SyntaxKind.LessThanExpression) && 1017conditional.IsParentKind(SyntaxKind.ExpressionStatement) && 1018conditional.Parent.IsParentKind(SyntaxKind.GlobalStatement)) 1060out SyntaxKind previousModifier) 1069previousModifier = SyntaxKind.None; 1071if (token.IsKind(SyntaxKind.OpenParenToken) && 1079if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1085if (token.IsKind(SyntaxKind.CommaToken) && 1095if (token.IsKind(SyntaxKind.CommaToken) && 1104if (token.IsKind(SyntaxKind.CloseBracketToken) && 1105token.Parent.IsKind(SyntaxKind.AttributeList) && 1115if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.OutKeyword or SyntaxKind.ThisKeyword or SyntaxKind.ParamsKeyword or SyntaxKind.ScopedKeyword) 1120else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName }) 1123previousModifier = SyntaxKind.ScopedKeyword; 1150if (syntaxTree.IsParameterModifierContext(position, tokenOnLeftOfPosition, includeOperators: false, out _, out var previousModifier) && 1151previousModifier == SyntaxKind.None) 1164if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken) 1166return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1178if (token.IsKind(SyntaxKind.DelegateKeyword) && 1179token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1193if (token.IsKind(SyntaxKind.OperatorKeyword) && 1194token.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 1210if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 1211token.Parent is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList)) 1225typeDecl.IsKind(SyntaxKind.ClassDeclaration) && 1226method.Modifiers.Any(SyntaxKind.StaticKeyword) && 1227typeDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 1236if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1238if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1239token.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 1255if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 1269if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1273else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1277else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName } && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1286return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1295if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 1328if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1331SyntaxKind.ParenthesizedExpression or 1332SyntaxKind.TupleExpression or 1333SyntaxKind.TupleType)) 1345if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1356if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1357leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1358leftToken.Parent.Parent is (kind: SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression)) 1374if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1384if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1392if (leftToken.Kind() is SyntaxKind.CaseKeyword or SyntaxKind.IsKeyword) 1399if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1406if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1413if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1420if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1428if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1429leftToken.Parent.IsParentKind(SyntaxKind.Subpattern)) 1439if (leftToken.IsKindOrHasMatchingText(SyntaxKind.AndKeyword) || leftToken.IsKindOrHasMatchingText(SyntaxKind.OrKeyword)) 1446if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1455if (leftToken.Kind() is SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken or SyntaxKind.LessThanToken or SyntaxKind.LessThanEqualsToken && 1456leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1472if (leftToken.IsKind(SyntaxKind.DotToken) || 1473leftToken.IsKind(SyntaxKind.MinusGreaterThanToken)) 1492return leftToken.Kind() is not (SyntaxKind.OrKeyword 1493or SyntaxKind.AndKeyword 1494or SyntaxKind.NotKeyword 1495or SyntaxKind.OpenParenToken 1496or SyntaxKind.ColonColonToken 1497or SyntaxKind.DotDotToken 1498or SyntaxKind.OpenBraceToken); 1534binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1576if (possibleCommaOrParen.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 1582SyntaxKind.ParenthesizedExpression or 1583SyntaxKind.TupleExpression or 1584SyntaxKind.TupleType or 1585SyntaxKind.CastExpression)) 1591if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1616if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation) || 1617leftToken.Parent.IsParentKind(SyntaxKind.ParenthesizedVariableDesignation)) 1637if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1647if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.TupleExpression)) 1657if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1681if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1687if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1699if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 1700leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1793if (token.IsKind(SyntaxKind.ConstKeyword) && 1794token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1803if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword) 1806if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement)) 1808if (parent.IsParentKind(SyntaxKind.VariableDeclaration) && 1810SyntaxKind.LocalDeclarationStatement or 1811SyntaxKind.ForStatement or 1812SyntaxKind.ForEachVariableStatement)) 1817if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement)) 1825if (token.IsKind(SyntaxKind.OutKeyword) && 1837if (token.IsKind(SyntaxKind.OpenParenToken)) 1840if (previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword or SyntaxKind.UsingKeyword) 1846if (token.IsKind(SyntaxKind.UsingKeyword) && 1854if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) && 1861if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1873if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1879if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax or ScopedTypeSyntax) 1896if (token.IsKind(SyntaxKind.OpenParenToken) && 1897token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1913if (token.IsKind(SyntaxKind.OpenParenToken) && 1914token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1927if (token.Kind() is SyntaxKind.IsKeyword or SyntaxKind.AsKeyword) 1938if (token.IsKind(SyntaxKind.NewKeyword)) 1992if (token.IsKind(SyntaxKind.None)) 2042if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2056if (token.IsKind(SyntaxKind.OpenParenToken) && 2057token.Parent.IsKind(SyntaxKind.CastExpression)) 2076if (token.IsKind(SyntaxKind.CaseKeyword) && 2077token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2082if (token.IsKind(SyntaxKind.EqualsToken) && 2085if (equalsValue.IsParentKind(SyntaxKind.VariableDeclarator) && 2086equalsValue.Parent.IsParentKind(SyntaxKind.VariableDeclaration)) 2092return fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2099return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2104if (equalsValue.IsParentKind(SyntaxKind.EnumMemberDeclaration)) 2110if (equalsValue.IsParentKind(SyntaxKind.Parameter)) 2118if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2119token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken) 2125if (token.IsKind(SyntaxKind.ColonToken) && 2126token.Parent.IsKind(SyntaxKind.NameColon) && 2127token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2133if (token.IsKind(SyntaxKind.EqualsToken) && 2134token.Parent.IsKind(SyntaxKind.NameEquals) && 2135token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2205is SyntaxKind.DotToken 2206or SyntaxKind.ColonColonToken 2207or SyntaxKind.MinusGreaterThanToken) 2214if (token.IsKind(SyntaxKind.EqualsToken)) 2216if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2217token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2237is SyntaxKind.EqualsToken 2238or SyntaxKind.MinusEqualsToken 2239or SyntaxKind.AsteriskEqualsToken 2240or SyntaxKind.PlusEqualsToken 2241or SyntaxKind.SlashEqualsToken 2242or SyntaxKind.ExclamationEqualsToken 2243or SyntaxKind.CaretEqualsToken 2244or SyntaxKind.AmpersandEqualsToken 2245or SyntaxKind.BarEqualsToken 2246or SyntaxKind.PercentEqualsToken 2247or SyntaxKind.LessThanLessThanEqualsToken 2248or SyntaxKind.GreaterThanGreaterThanEqualsToken 2249or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2250or SyntaxKind.QuestionQuestionEqualsToken) 2256if (token.IsKind(SyntaxKind.OpenParenToken)) 2258if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2331if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2348tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2351if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2352previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2355if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2374if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2375token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2382if (token.IsKind(SyntaxKind.DotDotToken) && 2383token.Parent.IsKind(SyntaxKind.RangeExpression) && 2390if (token.IsKind(SyntaxKind.QuestionToken) && 2399if (token.IsKind(SyntaxKind.ColonToken) && 2400token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2408if (token.IsKind(SyntaxKind.OpenParenToken)) 2410if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2419if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2430if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2431token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2440if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2442if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2453if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2455if (token.Parent.IsKind(SyntaxKind.Argument)) 2459else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2463if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2473if (token.IsKind(SyntaxKind.ColonToken) && 2474token.Parent.IsKind(SyntaxKind.NameColon) && 2475token.Parent.IsParentKind(SyntaxKind.Argument)) 2481if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2488if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2494if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2497if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2524if (token.IsKind(SyntaxKind.SemicolonToken) && 2535if (token.IsKind(SyntaxKind.OpenParenToken) && 2544if (token.IsKind(SyntaxKind.CommaToken) && 2545token.Parent.IsKind(SyntaxKind.ForStatement)) 2554if (token.IsKind(SyntaxKind.InKeyword)) 2557SyntaxKind.ForEachStatement or 2558SyntaxKind.ForEachVariableStatement or 2559SyntaxKind.FromClause or 2560SyntaxKind.JoinClause)) 2568if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2569token.Parent.IsKind(SyntaxKind.JoinClause)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2576token.Parent.IsKind(SyntaxKind.WhereClause)) 2583if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2584token.Parent.IsKind(SyntaxKind.OrderByClause)) 2590if (token.IsKind(SyntaxKind.SelectKeyword) && 2591token.Parent.IsKind(SyntaxKind.SelectClause)) 2598if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2599token.Parent.IsKind(SyntaxKind.GroupClause)) 2607if (token.IsKind(SyntaxKind.ReturnKeyword)) 2609if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2616if (token.IsKind(SyntaxKind.ThrowKeyword)) 2622if (token.IsKind(SyntaxKind.OpenParenToken) && 2623token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2632if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2673if (token.IsKind(SyntaxKind.OpenParenToken) && 2674token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2680if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2697if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2698token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2706if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2707token.Parent.IsKind(SyntaxKind.ListPattern)) 2715if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2716token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2724if (token.Kind() is SyntaxKind.DotDotToken && 2725token.Parent.IsKind(SyntaxKind.SpreadElement)) 2736if (token.IsKind(SyntaxKind.OpenBraceToken)) 2757if (token.IsKind(SyntaxKind.DotToken)) 2760if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2763while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2768if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2776if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2779while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2784if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2795if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2829if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2859if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2874if (token.IsKind(SyntaxKind.IdentifierToken) && 2875token.Parent.IsKind(SyntaxKind.IdentifierName) && 2876token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2882if (token.Kind() is SyntaxKind.IdentifierToken && 2883token.Parent.IsKind(SyntaxKind.IdentifierName)) 2885if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2889if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2907if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2925case SyntaxKind.QualifiedName: 2927case SyntaxKind.AliasQualifiedName: 2929case SyntaxKind.SimpleMemberAccessExpression: 2958if (token.IsKind(SyntaxKind.CloseBraceToken)) 2964block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2984if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2989if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2990token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3007targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3018targetToken.IsKind(SyntaxKind.ColonToken) && 3019targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3020targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3029if (!token.IsKind(SyntaxKind.DotToken)) 3035if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3041token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3080return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3081targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
30if (expression.IsKind(SyntaxKind.RefExpression)) 42if (expression.IsKind(SyntaxKind.ThrowExpression)) 58Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 60Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 72Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 74Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (2)
43constraints.Add(ClassOrStructConstraint(SyntaxKind.ClassConstraint)); 51constraints.Add(ClassOrStructConstraint(SyntaxKind.StructConstraint));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
97if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
111SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\NameSyntaxExtensions.cs (4)
36is SyntaxKind.AliasQualifiedName 37or SyntaxKind.NameColon 38or SyntaxKind.NameEquals 39or SyntaxKind.TypeParameterConstraintClause)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (4)
12this SeparatedSyntaxList<T> separatedList, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken) 19this SeparatedSyntaxList<T> separatedList, int index, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (2)
23var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 47default, SyntaxKind.None, "@" + unescaped, unescaped, default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenListExtensions.cs (1)
12public static IEnumerable<SyntaxToken> SkipKinds(this SyntaxTokenList tokenList, params SyntaxKind[] kinds)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs (17)
58if (token.Kind() == SyntaxKind.None) 74case SyntaxKind.LessThanToken: 81if (token.Kind() == SyntaxKind.None) 92if (token.Kind() == SyntaxKind.IdentifierToken) 113case SyntaxKind.GreaterThanToken: 114case SyntaxKind.GreaterThanGreaterThanToken: 115case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 127case SyntaxKind.AsteriskToken: // for int* 128case SyntaxKind.QuestionToken: // for int? 129case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 130case SyntaxKind.ColonColonToken: // for global:: 131case SyntaxKind.CloseBracketToken: 132case SyntaxKind.OpenBracketToken: 133case SyntaxKind.DotToken: 134case SyntaxKind.IdentifierToken: 137case SyntaxKind.CommaToken: 162if (token.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (6)
74if (typeNode.Modifiers.Any(SyntaxKind.PartialKeyword)) 97private static SyntaxToken EnsureToken(SyntaxToken token, SyntaxKind kind, bool prependNewLineIfMissing = false, bool appendNewLineIfMissing = false) 99if (token.IsMissing || token.IsKind(SyntaxKind.None)) 111var openBrace = EnsureToken(typeDeclaration.OpenBraceToken, SyntaxKind.OpenBraceToken); 112var closeBrace = EnsureToken(typeDeclaration.CloseBraceToken, SyntaxKind.CloseBraceToken, appendNewLineIfMissing: true); 117if (addedBraces && typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (26)
50token.Kind() is SyntaxKind.EndOfFileToken or SyntaxKind.None || 58if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 63if (token.IsKind(SyntaxKind.ColonToken) && !token.Parent.IsKind(SyntaxKind.LabeledStatement) && token.Parent is not SwitchLabelSyntax) 67if (token.IsKind(SyntaxKind.OpenBraceToken) && !token.IsFirstTokenOnLine(documentSyntax.Text)) 129(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 130(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 151if (token.Kind() != SyntaxKind.ElseKeyword || 199if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 289if (tokenBeforeCaret.Kind() is SyntaxKind.CloseBraceToken or 290SyntaxKind.EndOfFileToken) 301internal static bool ValidSingleOrMultiCharactersTokenKind(char typedChar, SyntaxKind kind) 304'n' => kind is SyntaxKind.RegionKeyword or SyntaxKind.EndRegionKeyword, 305't' => kind is SyntaxKind.SelectKeyword, 306'e' => kind is SyntaxKind.WhereKeyword or SyntaxKind.ElseKeyword, 317is SyntaxKind.None 318or SyntaxKind.EndOfDirectiveToken 319or SyntaxKind.EndOfFileToken; 354if (currentToken.Kind() == SyntaxKind.OpenBraceToken && 356currentTokenParentParent.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
104while (node != null && node.Kind() != SyntaxKind.CompilationUnit)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (8)
79if (token.IsKind(SyntaxKind.None) || 89if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing) 109return token.Kind() is SyntaxKind.None or SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken; 125node.IsKind(SyntaxKind.Interpolation)) 132!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) && 141constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (22)
74Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 81if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 120if (token.Kind() is SyntaxKind.InterpolatedMultiLineRawStringStartToken or SyntaxKind.InterpolatedStringTextToken 121|| token is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax }) 125if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 139if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 175token.Kind() is SyntaxKind.InterpolatedVerbatimStringStartToken or SyntaxKind.InterpolatedStringTextToken || 176(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 240case SyntaxKind.SemicolonToken: 251case SyntaxKind.CloseBraceToken: 253if (token.Parent.IsKind(SyntaxKind.AccessorList) && 254token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 265case SyntaxKind.OpenBraceToken: 270case SyntaxKind.ColonToken: 283case SyntaxKind.CloseBracketToken: 297case SyntaxKind.XmlTextLiteralToken: 302case SyntaxKind.CommaToken: 307case SyntaxKind.CloseParenToken: 309if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
103=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63(i == 0 && currentUsing.IsParentKind(SyntaxKind.FileScopedNamespaceDeclaration)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
85if (braces.openBrace.Kind() == SyntaxKind.None && 86braces.closeBrace.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (19)
67.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 109=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 126SyntaxKind.InterpolatedStringTextToken, 139SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 216=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 242=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 270return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 276return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 289SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 313SyntaxKind.SimpleMemberAccessExpression, 325is SyntaxKind.ThisExpression 326or SyntaxKind.BaseExpression 327or SyntaxKind.ParenthesizedExpression 328or SyntaxKind.SimpleMemberAccessExpression 329or SyntaxKind.InvocationExpression 330or SyntaxKind.ElementAccessExpression 331or SyntaxKind.MemberBindingExpression) 340=> CreateBinaryExpression(SyntaxKind.BitwiseOrExpression, left, right); 342public static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (81)
327if (argument.Parent.IsParentKind(SyntaxKind.ImplicitElementAccess) && 328argument.Parent.Parent.IsParentKind(SyntaxKind.SimpleAssignmentExpression) && 329argument.Parent.Parent.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression) && 350if (previousToken.IsKind(SyntaxKind.CommaToken)) 431if (previousToken.Kind() == SyntaxKind.NewKeyword && 432previousToken.GetPreviousToken().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 518if (previousToken != argumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 548if (previousToken != attributeArgumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 822if (previousToken.HasValue && previousToken.Value.GetPreviousToken().Kind() == SyntaxKind.EqualsToken) 897if (previousToken != bracketedArgumentList.OpenBracketToken && previousToken.Kind() != SyntaxKind.CommaToken) 954if (binop.Kind() == SyntaxKind.CoalesceExpression) 962case SyntaxKind.LessThanLessThanToken: 963case SyntaxKind.GreaterThanGreaterThanToken: 964case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 965case SyntaxKind.LessThanLessThanEqualsToken: 966case SyntaxKind.GreaterThanGreaterThanEqualsToken: 967case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 979if (operatorToken.Kind() is SyntaxKind.AmpersandAmpersandToken or 980SyntaxKind.BarBarToken) 986if (binop.Kind() == SyntaxKind.SimpleAssignmentExpression && 1015if (operatorToken.Kind() is SyntaxKind.AmpersandToken or 1016SyntaxKind.AmpersandEqualsToken or 1017SyntaxKind.BarToken or 1018SyntaxKind.BarEqualsToken or 1019SyntaxKind.CaretToken or 1020SyntaxKind.CaretEqualsToken) 1031if (operatorToken.Kind() == SyntaxKind.PlusToken) 1046case SyntaxKind.BarToken: 1047case SyntaxKind.CaretToken: 1048case SyntaxKind.AmpersandToken: 1049case SyntaxKind.LessThanToken: 1050case SyntaxKind.LessThanEqualsToken: 1051case SyntaxKind.GreaterThanToken: 1052case SyntaxKind.GreaterThanEqualsToken: 1053case SyntaxKind.PlusToken: 1054case SyntaxKind.MinusToken: 1055case SyntaxKind.AsteriskToken: 1056case SyntaxKind.SlashToken: 1057case SyntaxKind.PercentToken: 1058case SyntaxKind.CaretEqualsToken: 1059case SyntaxKind.PlusEqualsToken: 1060case SyntaxKind.MinusEqualsToken: 1061case SyntaxKind.AsteriskEqualsToken: 1062case SyntaxKind.SlashEqualsToken: 1063case SyntaxKind.PercentEqualsToken: 1064case SyntaxKind.LessThanLessThanToken: 1065case SyntaxKind.GreaterThanGreaterThanToken: 1066case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1067case SyntaxKind.LessThanLessThanEqualsToken: 1068case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1069case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1072case SyntaxKind.BarEqualsToken: 1073case SyntaxKind.AmpersandEqualsToken: 1224if (equalsValue.IsParentKind(SyntaxKind.Parameter) && 1381if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1401else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression)) 1423foreach (var sibling in initializerExpression.Expressions.Where(e => e.Kind() != SyntaxKind.ComplexElementInitializerExpression)) 1492else if (initializerExpression.IsParentKind(SyntaxKind.SimpleAssignmentExpression)) 1582if (identifier.HasMatchingText(SyntaxKind.OrKeyword) || 1583identifier.HasMatchingText(SyntaxKind.AndKeyword)) 1703var isAsync = anonymousFunction.AsyncKeyword.Kind() != SyntaxKind.None; 1807memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) 1831if (ienumerableType != null && memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocation)) 1973case SyntaxKind.PostDecrementExpression: 1974case SyntaxKind.PostIncrementExpression: 1988case SyntaxKind.PreDecrementExpression: 1989case SyntaxKind.PreIncrementExpression: 1990case SyntaxKind.UnaryPlusExpression: 1991case SyntaxKind.UnaryMinusExpression: 1995case SyntaxKind.BitwiseNotExpression: 2007case SyntaxKind.LogicalNotExpression: 2011case SyntaxKind.AddressOfExpression: 2062if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))) 2180if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2192switchLabel.Kind() != SyntaxKind.CaseSwitchLabel) 2211.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2270if (variableDeclaration.IsParentKind(SyntaxKind.UsingStatement)) 2274if (variableDeclaration.IsParentKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
276.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (5)
23if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 28if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 34if (parentOfToken is SimpleNameSyntax && parent.Kind() == SyntaxKind.XmlNameAttribute) 41if (parent.Kind() == SyntaxKind.AliasQualifiedName &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NameSyntaxIterator.cs (1)
27if (currentNode.Kind() == SyntaxKind.QualifiedName)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (101)
11public static readonly ISet<SyntaxKind> AllTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 13SyntaxKind.AbstractKeyword, 15SyntaxKind.ClosedKeyword, 17SyntaxKind.FileKeyword, 18SyntaxKind.InternalKeyword, 19SyntaxKind.NewKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.RefKeyword 30public static readonly ISet<SyntaxKind> AllMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.AbstractKeyword, 33SyntaxKind.AsyncKeyword, 34SyntaxKind.ExternKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.NewKeyword, 37SyntaxKind.OverrideKeyword, 38SyntaxKind.PublicKeyword, 39SyntaxKind.PrivateKeyword, 40SyntaxKind.ProtectedKeyword, 41SyntaxKind.ReadOnlyKeyword, 42SyntaxKind.RequiredKeyword, 43SyntaxKind.SealedKeyword, 44SyntaxKind.StaticKeyword, 45SyntaxKind.UnsafeKeyword, 46SyntaxKind.VirtualKeyword, 47SyntaxKind.VolatileKeyword, 50public static readonly ISet<SyntaxKind> AllGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 52SyntaxKind.ExternKeyword, 53SyntaxKind.InternalKeyword, 54SyntaxKind.NewKeyword, 55SyntaxKind.OverrideKeyword, 56SyntaxKind.PublicKeyword, 57SyntaxKind.PrivateKeyword, 58SyntaxKind.ReadOnlyKeyword, 59SyntaxKind.StaticKeyword, 60SyntaxKind.UnsafeKeyword, 61SyntaxKind.VolatileKeyword, 64public static readonly ISet<SyntaxKind> AccessibilityModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 66SyntaxKind.PublicKeyword, 67SyntaxKind.PrivateKeyword, 68SyntaxKind.ProtectedKeyword, 69SyntaxKind.InternalKeyword, 72public static readonly ISet<SyntaxKind> AllTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 74SyntaxKind.InterfaceDeclaration, 75SyntaxKind.ClassDeclaration, 76SyntaxKind.RecordDeclaration, 77SyntaxKind.StructDeclaration, 78SyntaxKind.RecordStructDeclaration, 80SyntaxKind.UnionDeclaration, 82SyntaxKind.EnumDeclaration, 85public static readonly ISet<SyntaxKind> ClassInterfaceStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 87SyntaxKind.InterfaceDeclaration, 88SyntaxKind.ClassDeclaration, 89SyntaxKind.RecordDeclaration, 90SyntaxKind.StructDeclaration, 91SyntaxKind.RecordStructDeclaration, 93SyntaxKind.UnionDeclaration, 97public static readonly ISet<SyntaxKind> NonEnumTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 99SyntaxKind.ClassDeclaration, 101SyntaxKind.ExtensionBlockDeclaration, 102SyntaxKind.UnionDeclaration, 104SyntaxKind.InterfaceDeclaration, 105SyntaxKind.RecordDeclaration, 106SyntaxKind.RecordStructDeclaration, 107SyntaxKind.StructDeclaration, 110public static readonly ISet<SyntaxKind> ClassInterfaceRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 112SyntaxKind.InterfaceDeclaration, 113SyntaxKind.ClassDeclaration, 114SyntaxKind.RecordDeclaration, 117public static readonly ISet<SyntaxKind> ClassRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 119SyntaxKind.ClassDeclaration, 120SyntaxKind.RecordDeclaration, 123public static readonly ISet<SyntaxKind> ClassStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 125SyntaxKind.ClassDeclaration, 126SyntaxKind.RecordDeclaration, 127SyntaxKind.StructDeclaration, 128SyntaxKind.RecordStructDeclaration, 130SyntaxKind.UnionDeclaration, 134public static readonly ISet<SyntaxKind> StructOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 136SyntaxKind.StructDeclaration, 137SyntaxKind.RecordStructDeclaration, 139SyntaxKind.UnionDeclaration, 143public static readonly ISet<SyntaxKind> InterfaceOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 145SyntaxKind.InterfaceDeclaration,
SuperFileCheck (3)
Program.cs (3)
241namespaceDecl.Name.DescendantTokens().Where(x => x.IsKind(SyntaxKind.IdentifierToken)).Select(x => x.ValueText); 256.Where(x => x.IsKind(SyntaxKind.SingleLineCommentTrivia)); 290return !x.Token.Parent.Ancestors().Any(p => p.IsKind(SyntaxKind.MethodDeclaration) && p.Span.Contains(x.Span));
System.Text.Json.SourceGeneration (10)
Helpers\RoslynExtensions.cs (9)
634=> SyntaxFacts.GetKeywordKind(symbol.Name) != SyntaxKind.None || SyntaxFacts.GetContextualKeywordKind(symbol.Name) != SyntaxKind.None; 669case SyntaxKind.ClassDeclaration: 671case SyntaxKind.InterfaceDeclaration: 673case SyntaxKind.StructDeclaration: 675case SyntaxKind.RecordDeclaration: 677case SyntaxKind.RecordStructDeclaration: 679case SyntaxKind.EnumDeclaration: 681case SyntaxKind.DelegateDeclaration:
JsonSourceGenerator.Parser.cs (1)
203isPartialType |= modifier.IsKind(SyntaxKind.PartialKeyword);
System.Text.RegularExpressions.Generator (25)
RegexGenerator.Parser.cs (7)
130if (!memberSyntax.Modifiers.Any(SyntaxKind.PartialKeyword) || // TODO: Switch to using regexPropertySymbol.IsPartialDefinition when available 244static bool IsAllowedKind(SyntaxKind kind) => kind is 245SyntaxKind.ClassDeclaration or 246SyntaxKind.StructDeclaration or 247SyntaxKind.RecordDeclaration or 248SyntaxKind.RecordStructDeclaration or 249SyntaxKind.InterfaceDeclaration;
UpgradeToGeneratedRegexCodeFixer.cs (18)
176SyntaxFactory.Token(SyntaxKind.PrivateKeyword), 177SyntaxFactory.Token(SyntaxKind.StaticKeyword), 178SyntaxFactory.Token(SyntaxKind.PartialKeyword))) 181SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 182.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken))))) 220where modifier.Kind() is SyntaxKind.PublicKeyword or SyntaxKind.PrivateKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.InternalKeyword or SyntaxKind.StaticKeyword 222SyntaxFactory.Token(SyntaxKind.PartialKeyword) 226SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 227.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken))))); 268.WithModifiers(SyntaxFactory.TokenList([.. propertyDeclaration.Modifiers, SyntaxFactory.Token(SyntaxKind.PartialKeyword)])) 271SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 272.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken))))); 367typeDeclaration.Modifiers.Any(m => m.IsKind(SyntaxKind.PartialKeyword)) ? 369typeDeclaration.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword)));
System.Windows.Forms.Analyzers.CSharp (2)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (1)
27context.RegisterSyntaxNodeAction(AnalyzeInvocation, SyntaxKind.InvocationExpression);
System\Windows\Forms\CSharp\Analyzers\ImplementITypedDataObject\ImplementITypedDataObjectAnalyzer.cs (1)
25context.RegisterSyntaxNodeAction(AnalyzeClassDeclaration, SyntaxKind.ClassDeclaration);