28241 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 (20)
ComponentParameterAnalyzer.cs (3)
157if (getterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration)) 163if (!getterAccessor.IsKind(SyntaxKind.GetAccessorDeclaration) || !setterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration))
ComponentParametersShouldBePublicCodeFixProvider.cs (5)
69SyntaxFactory.Token(SyntaxKind.PublicKeyword) 75if (modifier.IsKind(SyntaxKind.PrivateKeyword) || 76modifier.IsKind(SyntaxKind.ProtectedKeyword) || 77modifier.IsKind(SyntaxKind.InternalKeyword) || 78modifier.IsKind(SyntaxKind.PublicKeyword))
JSInvokableCodeFixProvider.cs (5)
72SyntaxFactory.Token(SyntaxKind.PublicKeyword) 78if (modifier.IsKind(SyntaxKind.PrivateKeyword) 79|| modifier.IsKind(SyntaxKind.ProtectedKeyword) 80|| modifier.IsKind(SyntaxKind.InternalKeyword) 81|| modifier.IsKind(SyntaxKind.PublicKeyword))
PersistentStateAnalyzer.cs (3)
81}, SyntaxKind.PropertyDeclaration); 94LiteralExpressionSyntax literal when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true, 97when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true,
StateHasChangedAnalyzer.cs (1)
146}, Microsoft.CodeAnalysis.CSharp.SyntaxKind.MethodDeclaration);
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)
69SyntaxFactory.Token(SyntaxKind.PublicKeyword) 75if (modifier.IsKind(SyntaxKind.PrivateKeyword) || 76modifier.IsKind(SyntaxKind.ProtectedKeyword) || 77modifier.IsKind(SyntaxKind.InternalKeyword) || 78modifier.IsKind(SyntaxKind.PublicKeyword))
Microsoft.AspNetCore.Components.Testing.Generators (1)
ServiceOverrideAnalyzer.cs (1)
26context.RegisterSyntaxNodeAction(AnalyzeInvocation, SyntaxKind.InvocationExpression);
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 (12269)
_generated\0\Syntax.xml.Main.Generated.cs (1525)
2292case SyntaxKind.IdentifierToken: 2293case SyntaxKind.GlobalKeyword: break; 2303if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 2310=> SyntaxFactory.QualifiedName(left, SyntaxFactory.Token(SyntaxKind.DotToken), right); 2315if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 2331if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 2332if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 2338=> SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), arguments, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 2344if (colonColonToken.Kind() != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 2351=> SyntaxFactory.AliasQualifiedName(alias, SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); 2355=> SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(alias), SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); 2362case SyntaxKind.BoolKeyword: 2363case SyntaxKind.ByteKeyword: 2364case SyntaxKind.SByteKeyword: 2365case SyntaxKind.IntKeyword: 2366case SyntaxKind.UIntKeyword: 2367case SyntaxKind.ShortKeyword: 2368case SyntaxKind.UShortKeyword: 2369case SyntaxKind.LongKeyword: 2370case SyntaxKind.ULongKeyword: 2371case SyntaxKind.FloatKeyword: 2372case SyntaxKind.DoubleKeyword: 2373case SyntaxKind.DecimalKeyword: 2374case SyntaxKind.StringKeyword: 2375case SyntaxKind.CharKeyword: 2376case SyntaxKind.ObjectKeyword: 2377case SyntaxKind.VoidKeyword: break; 2397if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 2398if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 2404=> SyntaxFactory.ArrayRankSpecifier(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), sizes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 2410if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 2416=> SyntaxFactory.PointerType(elementType, SyntaxFactory.Token(SyntaxKind.AsteriskToken)); 2421if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 2422if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 2429=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), callingConvention, parameterList); 2433=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), default, SyntaxFactory.FunctionPointerParameterList()); 2438if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 2439if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 2445=> SyntaxFactory.FunctionPointerParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 2452case SyntaxKind.ManagedKeyword: 2453case SyntaxKind.UnmanagedKeyword: break; 2466if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 2467if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 2473=> SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), callingConventions, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 2478if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 2486if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 2492=> SyntaxFactory.NullableType(elementType, SyntaxFactory.Token(SyntaxKind.QuestionToken)); 2497if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2498if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2504=> SyntaxFactory.TupleType(SyntaxFactory.Token(SyntaxKind.OpenParenToken), elements, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2512case SyntaxKind.IdentifierToken: 2513case SyntaxKind.None: break; 2526if (omittedTypeArgumentToken.Kind() != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 2532=> SyntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 2537if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 2540case SyntaxKind.ReadOnlyKeyword: 2541case SyntaxKind.None: break; 2550=> SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), default, type); 2555if (scopedKeyword.Kind() != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 2562=> SyntaxFactory.ScopedType(SyntaxFactory.Token(SyntaxKind.ScopedKeyword), type); 2567if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2569if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2575=> SyntaxFactory.ParenthesizedExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2580if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2581if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2587=> SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2590public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 2594case SyntaxKind.UnaryPlusExpression: 2595case SyntaxKind.UnaryMinusExpression: 2596case SyntaxKind.BitwiseNotExpression: 2597case SyntaxKind.LogicalNotExpression: 2598case SyntaxKind.PreIncrementExpression: 2599case SyntaxKind.PreDecrementExpression: 2600case SyntaxKind.AddressOfExpression: 2601case SyntaxKind.PointerIndirectionExpression: 2602case SyntaxKind.IndexExpression: break; 2607case SyntaxKind.PlusToken: 2608case SyntaxKind.MinusToken: 2609case SyntaxKind.TildeToken: 2610case SyntaxKind.ExclamationToken: 2611case SyntaxKind.PlusPlusToken: 2612case SyntaxKind.MinusMinusToken: 2613case SyntaxKind.AmpersandToken: 2614case SyntaxKind.AsteriskToken: 2615case SyntaxKind.CaretToken: break; 2623public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) 2626private static SyntaxKind GetPrefixUnaryExpressionOperatorTokenKind(SyntaxKind kind) 2629SyntaxKind.UnaryPlusExpression => SyntaxKind.PlusToken, 2630SyntaxKind.UnaryMinusExpression => SyntaxKind.MinusToken, 2631SyntaxKind.BitwiseNotExpression => SyntaxKind.TildeToken, 2632SyntaxKind.LogicalNotExpression => SyntaxKind.ExclamationToken, 2633SyntaxKind.PreIncrementExpression => SyntaxKind.PlusPlusToken, 2634SyntaxKind.PreDecrementExpression => SyntaxKind.MinusMinusToken, 2635SyntaxKind.AddressOfExpression => SyntaxKind.AmpersandToken, 2636SyntaxKind.PointerIndirectionExpression => SyntaxKind.AsteriskToken, 2637SyntaxKind.IndexExpression => SyntaxKind.CaretToken, 2644if (awaitKeyword.Kind() != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 2651=> SyntaxFactory.AwaitExpression(SyntaxFactory.Token(SyntaxKind.AwaitKeyword), expression); 2654public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 2658case SyntaxKind.PostIncrementExpression: 2659case SyntaxKind.PostDecrementExpression: 2660case SyntaxKind.SuppressNullableWarningExpression: break; 2666case SyntaxKind.PlusPlusToken: 2667case SyntaxKind.MinusMinusToken: 2668case SyntaxKind.ExclamationToken: break; 2675public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) 2678private static SyntaxKind GetPostfixUnaryExpressionOperatorTokenKind(SyntaxKind kind) 2681SyntaxKind.PostIncrementExpression => SyntaxKind.PlusPlusToken, 2682SyntaxKind.PostDecrementExpression => SyntaxKind.MinusMinusToken, 2683SyntaxKind.SuppressNullableWarningExpression => SyntaxKind.ExclamationToken, 2688public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 2692case SyntaxKind.SimpleMemberAccessExpression: 2693case SyntaxKind.PointerMemberAccessExpression: break; 2699case SyntaxKind.DotToken: 2700case SyntaxKind.MinusGreaterThanToken: break; 2708public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SimpleNameSyntax name) 2711private static SyntaxKind GetMemberAccessExpressionOperatorTokenKind(SyntaxKind kind) 2714SyntaxKind.SimpleMemberAccessExpression => SyntaxKind.DotToken, 2715SyntaxKind.PointerMemberAccessExpression => SyntaxKind.MinusGreaterThanToken, 2723if (operatorToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 2730=> SyntaxFactory.ConditionalAccessExpression(expression, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenNotNull); 2735if (operatorToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 2742=> SyntaxFactory.MemberBindingExpression(SyntaxFactory.Token(SyntaxKind.DotToken), name); 2758if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 2764=> SyntaxFactory.RangeExpression(leftOperand, SyntaxFactory.Token(SyntaxKind.DotDotToken), rightOperand); 2768=> SyntaxFactory.RangeExpression(default, SyntaxFactory.Token(SyntaxKind.DotDotToken), default); 2782public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2786case SyntaxKind.AddExpression: 2787case SyntaxKind.SubtractExpression: 2788case SyntaxKind.MultiplyExpression: 2789case SyntaxKind.DivideExpression: 2790case SyntaxKind.ModuloExpression: 2791case SyntaxKind.LeftShiftExpression: 2792case SyntaxKind.RightShiftExpression: 2793case SyntaxKind.UnsignedRightShiftExpression: 2794case SyntaxKind.LogicalOrExpression: 2795case SyntaxKind.LogicalAndExpression: 2796case SyntaxKind.BitwiseOrExpression: 2797case SyntaxKind.BitwiseAndExpression: 2798case SyntaxKind.ExclusiveOrExpression: 2799case SyntaxKind.EqualsExpression: 2800case SyntaxKind.NotEqualsExpression: 2801case SyntaxKind.LessThanExpression: 2802case SyntaxKind.LessThanOrEqualExpression: 2803case SyntaxKind.GreaterThanExpression: 2804case SyntaxKind.GreaterThanOrEqualExpression: 2805case SyntaxKind.IsExpression: 2806case SyntaxKind.AsExpression: 2807case SyntaxKind.CoalesceExpression: break; 2813case SyntaxKind.PlusToken: 2814case SyntaxKind.MinusToken: 2815case SyntaxKind.AsteriskToken: 2816case SyntaxKind.SlashToken: 2817case SyntaxKind.PercentToken: 2818case SyntaxKind.LessThanLessThanToken: 2819case SyntaxKind.GreaterThanGreaterThanToken: 2820case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 2821case SyntaxKind.BarBarToken: 2822case SyntaxKind.AmpersandAmpersandToken: 2823case SyntaxKind.BarToken: 2824case SyntaxKind.AmpersandToken: 2825case SyntaxKind.CaretToken: 2826case SyntaxKind.EqualsEqualsToken: 2827case SyntaxKind.ExclamationEqualsToken: 2828case SyntaxKind.LessThanToken: 2829case SyntaxKind.LessThanEqualsToken: 2830case SyntaxKind.GreaterThanToken: 2831case SyntaxKind.GreaterThanEqualsToken: 2832case SyntaxKind.IsKeyword: 2833case SyntaxKind.AsKeyword: 2834case SyntaxKind.QuestionQuestionToken: break; 2842public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) 2845private static SyntaxKind GetBinaryExpressionOperatorTokenKind(SyntaxKind kind) 2848SyntaxKind.AddExpression => SyntaxKind.PlusToken, 2849SyntaxKind.SubtractExpression => SyntaxKind.MinusToken, 2850SyntaxKind.MultiplyExpression => SyntaxKind.AsteriskToken, 2851SyntaxKind.DivideExpression => SyntaxKind.SlashToken, 2852SyntaxKind.ModuloExpression => SyntaxKind.PercentToken, 2853SyntaxKind.LeftShiftExpression => SyntaxKind.LessThanLessThanToken, 2854SyntaxKind.RightShiftExpression => SyntaxKind.GreaterThanGreaterThanToken, 2855SyntaxKind.UnsignedRightShiftExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 2856SyntaxKind.LogicalOrExpression => SyntaxKind.BarBarToken, 2857SyntaxKind.LogicalAndExpression => SyntaxKind.AmpersandAmpersandToken, 2858SyntaxKind.BitwiseOrExpression => SyntaxKind.BarToken, 2859SyntaxKind.BitwiseAndExpression => SyntaxKind.AmpersandToken, 2860SyntaxKind.ExclusiveOrExpression => SyntaxKind.CaretToken, 2861SyntaxKind.EqualsExpression => SyntaxKind.EqualsEqualsToken, 2862SyntaxKind.NotEqualsExpression => SyntaxKind.ExclamationEqualsToken, 2863SyntaxKind.LessThanExpression => SyntaxKind.LessThanToken, 2864SyntaxKind.LessThanOrEqualExpression => SyntaxKind.LessThanEqualsToken, 2865SyntaxKind.GreaterThanExpression => SyntaxKind.GreaterThanToken, 2866SyntaxKind.GreaterThanOrEqualExpression => SyntaxKind.GreaterThanEqualsToken, 2867SyntaxKind.IsExpression => SyntaxKind.IsKeyword, 2868SyntaxKind.AsExpression => SyntaxKind.AsKeyword, 2869SyntaxKind.CoalesceExpression => SyntaxKind.QuestionQuestionToken, 2874public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2878case SyntaxKind.SimpleAssignmentExpression: 2879case SyntaxKind.AddAssignmentExpression: 2880case SyntaxKind.SubtractAssignmentExpression: 2881case SyntaxKind.MultiplyAssignmentExpression: 2882case SyntaxKind.DivideAssignmentExpression: 2883case SyntaxKind.ModuloAssignmentExpression: 2884case SyntaxKind.AndAssignmentExpression: 2885case SyntaxKind.ExclusiveOrAssignmentExpression: 2886case SyntaxKind.OrAssignmentExpression: 2887case SyntaxKind.LeftShiftAssignmentExpression: 2888case SyntaxKind.RightShiftAssignmentExpression: 2889case SyntaxKind.UnsignedRightShiftAssignmentExpression: 2890case SyntaxKind.CoalesceAssignmentExpression: break; 2896case SyntaxKind.EqualsToken: 2897case SyntaxKind.PlusEqualsToken: 2898case SyntaxKind.MinusEqualsToken: 2899case SyntaxKind.AsteriskEqualsToken: 2900case SyntaxKind.SlashEqualsToken: 2901case SyntaxKind.PercentEqualsToken: 2902case SyntaxKind.AmpersandEqualsToken: 2903case SyntaxKind.CaretEqualsToken: 2904case SyntaxKind.BarEqualsToken: 2905case SyntaxKind.LessThanLessThanEqualsToken: 2906case SyntaxKind.GreaterThanGreaterThanEqualsToken: 2907case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 2908case SyntaxKind.QuestionQuestionEqualsToken: break; 2916public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) 2919private static SyntaxKind GetAssignmentExpressionOperatorTokenKind(SyntaxKind kind) 2922SyntaxKind.SimpleAssignmentExpression => SyntaxKind.EqualsToken, 2923SyntaxKind.AddAssignmentExpression => SyntaxKind.PlusEqualsToken, 2924SyntaxKind.SubtractAssignmentExpression => SyntaxKind.MinusEqualsToken, 2925SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.AsteriskEqualsToken, 2926SyntaxKind.DivideAssignmentExpression => SyntaxKind.SlashEqualsToken, 2927SyntaxKind.ModuloAssignmentExpression => SyntaxKind.PercentEqualsToken, 2928SyntaxKind.AndAssignmentExpression => SyntaxKind.AmpersandEqualsToken, 2929SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.CaretEqualsToken, 2930SyntaxKind.OrAssignmentExpression => SyntaxKind.BarEqualsToken, 2931SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LessThanLessThanEqualsToken, 2932SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanEqualsToken, 2933SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, 2934SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.QuestionQuestionEqualsToken, 2942if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 2944if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 2951=> SyntaxFactory.ConditionalExpression(condition, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenTrue, SyntaxFactory.Token(SyntaxKind.ColonToken), whenFalse); 2956if (token.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 2962=> SyntaxFactory.ThisExpression(SyntaxFactory.Token(SyntaxKind.ThisKeyword)); 2967if (token.Kind() != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 2973=> SyntaxFactory.BaseExpression(SyntaxFactory.Token(SyntaxKind.BaseKeyword)); 2976public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 2980case SyntaxKind.ArgListExpression: 2981case SyntaxKind.NumericLiteralExpression: 2982case SyntaxKind.StringLiteralExpression: 2983case SyntaxKind.Utf8StringLiteralExpression: 2984case SyntaxKind.CharacterLiteralExpression: 2985case SyntaxKind.TrueLiteralExpression: 2986case SyntaxKind.FalseLiteralExpression: 2987case SyntaxKind.NullLiteralExpression: 2988case SyntaxKind.DefaultLiteralExpression: break; 2993case SyntaxKind.ArgListKeyword: 2994case SyntaxKind.NumericLiteralToken: 2995case SyntaxKind.StringLiteralToken: 2996case SyntaxKind.Utf8StringLiteralToken: 2997case SyntaxKind.MultiLineRawStringLiteralToken: 2998case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 2999case SyntaxKind.SingleLineRawStringLiteralToken: 3000case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 3001case SyntaxKind.CharacterLiteralToken: 3002case SyntaxKind.TrueKeyword: 3003case SyntaxKind.FalseKeyword: 3004case SyntaxKind.NullKeyword: 3005case SyntaxKind.DefaultKeyword: break; 3014if (token.Kind() != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 3020=> SyntaxFactory.FieldExpression(SyntaxFactory.Token(SyntaxKind.FieldKeyword)); 3025if (keyword.Kind() != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 3026if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3028if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3034=> SyntaxFactory.MakeRefExpression(SyntaxFactory.Token(SyntaxKind.MakeRefKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3039if (keyword.Kind() != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 3040if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3042if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3048=> SyntaxFactory.RefTypeExpression(SyntaxFactory.Token(SyntaxKind.RefTypeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3053if (keyword.Kind() != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 3054if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3056if (comma.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 3058if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3064=> SyntaxFactory.RefValueExpression(SyntaxFactory.Token(SyntaxKind.RefValueKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CommaToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3067public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3071case SyntaxKind.CheckedExpression: 3072case SyntaxKind.UncheckedExpression: break; 3077case SyntaxKind.CheckedKeyword: 3078case SyntaxKind.UncheckedKeyword: break; 3081if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3083if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3088public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, ExpressionSyntax expression) 3089=> SyntaxFactory.CheckedExpression(kind, SyntaxFactory.Token(GetCheckedExpressionKeywordKind(kind)), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3091private static SyntaxKind GetCheckedExpressionKeywordKind(SyntaxKind kind) 3094SyntaxKind.CheckedExpression => SyntaxKind.CheckedKeyword, 3095SyntaxKind.UncheckedExpression => SyntaxKind.UncheckedKeyword, 3103if (keyword.Kind() != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(keyword)); 3104if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3106if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3113=> SyntaxFactory.UnsafeExpression(SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3118if (keyword.Kind() != SyntaxKind.DefaultKeyword) 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.DefaultExpression(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3132if (keyword.Kind() != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 3133if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3135if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3141=> SyntaxFactory.TypeOfExpression(SyntaxFactory.Token(SyntaxKind.TypeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3146if (keyword.Kind() != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 3147if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3149if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3155=> SyntaxFactory.SizeOfExpression(SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3184if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3185if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3191=> SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3196if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3197if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3203=> SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 3210case SyntaxKind.RefKeyword: 3211case SyntaxKind.OutKeyword: 3212case SyntaxKind.InKeyword: 3213case SyntaxKind.None: break; 3228if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 3236if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 3251if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3253if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3260=> SyntaxFactory.CastExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken), expression); 3265if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 3274if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 3281if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 3288=> SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), expression); 3294if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 3300=> SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); 3304=> SyntaxFactory.ParenthesizedLambdaExpression(default, default(SyntaxTokenList), default, SyntaxFactory.ParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); 3307public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 3311case SyntaxKind.ObjectInitializerExpression: 3312case SyntaxKind.CollectionInitializerExpression: 3313case SyntaxKind.ArrayInitializerExpression: 3314case SyntaxKind.ComplexElementInitializerExpression: 3315case SyntaxKind.WithInitializerExpression: break; 3318if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3319if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3324public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SeparatedSyntaxList<ExpressionSyntax> expressions = default) 3325=> SyntaxFactory.InitializerExpression(kind, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expressions, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3330if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3337=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), argumentList, initializer); 3341=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.ArgumentList(), default); 3346if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3353=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, argumentList, initializer); 3357=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default, default); 3363if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 3370=> SyntaxFactory.WithExpression(expression, SyntaxFactory.Token(SyntaxKind.WithKeyword), initializer); 3386if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3387if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3388if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3394=> SyntaxFactory.AnonymousObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), initializers, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3399if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3406=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, initializer); 3410=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default); 3415if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3416if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3417if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3424=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), commas, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3428=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3433if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 3440=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, initializer); 3444=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, default); 3449if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 3450if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3451if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3458=> SyntaxFactory.ImplicitStackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3463if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3464if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3470=> SyntaxFactory.CollectionExpression(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), elements, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 3482if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 3489=> SyntaxFactory.SpreadElement(SyntaxFactory.Token(SyntaxKind.DotDotToken), expression); 3495if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 3503=> SyntaxFactory.WithElement(SyntaxFactory.Token(SyntaxKind.WithKeyword), argumentList ?? SyntaxFactory.ArgumentList()); 3527if (fromKeyword.Kind() != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 3528if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3529if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 3536=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3540=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3544=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3549if (letKeyword.Kind() != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 3550if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3551if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 3558=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), identifier, SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); 3562=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); 3567if (joinKeyword.Kind() != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 3568if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3569if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 3571if (onKeyword.Kind() != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 3573if (equalsKeyword.Kind() != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 3580=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, into); 3584=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, default); 3588=> 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); 3593if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 3594if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3600=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier); 3604=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier)); 3609if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 3616=> SyntaxFactory.WhereClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), condition); 3621if (orderByKeyword.Kind() != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 3627=> SyntaxFactory.OrderByClause(SyntaxFactory.Token(SyntaxKind.OrderByKeyword), orderings); 3630public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) 3634case SyntaxKind.AscendingOrdering: 3635case SyntaxKind.DescendingOrdering: break; 3641case SyntaxKind.AscendingKeyword: 3642case SyntaxKind.DescendingKeyword: 3643case SyntaxKind.None: break; 3650public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression) 3653private static SyntaxKind GetOrderingAscendingOrDescendingKeywordKind(SyntaxKind kind) 3656SyntaxKind.AscendingOrdering => SyntaxKind.AscendingKeyword, 3657SyntaxKind.DescendingOrdering => SyntaxKind.DescendingKeyword, 3664if (selectKeyword.Kind() != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 3671=> SyntaxFactory.SelectClause(SyntaxFactory.Token(SyntaxKind.SelectKeyword), expression); 3676if (groupKeyword.Kind() != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 3678if (byKeyword.Kind() != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 3685=> SyntaxFactory.GroupClause(SyntaxFactory.Token(SyntaxKind.GroupKeyword), groupExpression, SyntaxFactory.Token(SyntaxKind.ByKeyword), byExpression); 3690if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 3691if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3698=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier, body); 3702=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier), body); 3707if (omittedArraySizeExpressionToken.Kind() != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 3713=> SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 3720case SyntaxKind.InterpolatedStringStartToken: 3721case SyntaxKind.InterpolatedVerbatimStringStartToken: 3722case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 3723case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 3728case SyntaxKind.InterpolatedStringEndToken: 3729case SyntaxKind.InterpolatedRawStringEndToken: break; 3743if (isKeyword.Kind() != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 3750=> SyntaxFactory.IsPatternExpression(expression, SyntaxFactory.Token(SyntaxKind.IsKeyword), pattern); 3755if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 3762=> SyntaxFactory.ThrowExpression(SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression); 3767if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 3774=> SyntaxFactory.WhenClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), condition); 3779if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 3785=> SyntaxFactory.DiscardPattern(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 3798if (varKeyword.Kind() != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 3805=> SyntaxFactory.VarPattern(SyntaxFactory.Token(SyntaxKind.VarKeyword), designation); 3820if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3821if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3827=> SyntaxFactory.PositionalPatternClause(SyntaxFactory.Token(SyntaxKind.OpenParenToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3832if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3833if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3839=> SyntaxFactory.PropertyPatternClause(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3862if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3864if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3870=> SyntaxFactory.ParenthesizedPattern(SyntaxFactory.Token(SyntaxKind.OpenParenToken), pattern, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3877case SyntaxKind.EqualsEqualsToken: 3878case SyntaxKind.ExclamationEqualsToken: 3879case SyntaxKind.LessThanToken: 3880case SyntaxKind.LessThanEqualsToken: 3881case SyntaxKind.GreaterThanToken: 3882case SyntaxKind.GreaterThanEqualsToken: break; 3897public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 3901case SyntaxKind.OrPattern: 3902case SyntaxKind.AndPattern: break; 3908case SyntaxKind.OrKeyword: 3909case SyntaxKind.AndKeyword: break; 3917public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, PatternSyntax right) 3920private static SyntaxKind GetBinaryPatternOperatorTokenKind(SyntaxKind kind) 3923SyntaxKind.OrPattern => SyntaxKind.OrKeyword, 3924SyntaxKind.AndPattern => SyntaxKind.AndKeyword, 3931if (operatorToken.Kind() != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 3938=> SyntaxFactory.UnaryPattern(SyntaxFactory.Token(SyntaxKind.NotKeyword), pattern); 3943if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3944if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3950=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), designation); 3954=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), default); 3959if (dotDotToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 3965=> SyntaxFactory.SlicePattern(SyntaxFactory.Token(SyntaxKind.DotDotToken), pattern); 3970if (textToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 3976=> SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 3981if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3983if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3989=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3993=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4005if (formatStringToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 4011=> SyntaxFactory.InterpolationFormatClause(colonToken, SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 4027if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4028if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4034=> SyntaxFactory.Block(attributeLists, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4039=> SyntaxFactory.Block(default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4046if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4050case SyntaxKind.SemicolonToken: 4051case SyntaxKind.None: break; 4074case SyntaxKind.AwaitKeyword: 4075case SyntaxKind.None: break; 4080case SyntaxKind.UsingKeyword: 4081case SyntaxKind.None: break; 4085if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4091=> SyntaxFactory.LocalDeclarationStatement(attributeLists, default, default, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4095=> SyntaxFactory.LocalDeclarationStatement(default, default, default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4111if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4126if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 4133=> SyntaxFactory.EqualsValueClause(SyntaxFactory.Token(SyntaxKind.EqualsToken), value); 4138if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4145if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 4151=> SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 4156if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4157if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4163=> SyntaxFactory.ParenthesizedVariableDesignation(SyntaxFactory.Token(SyntaxKind.OpenParenToken), variables, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4169if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4175=> SyntaxFactory.ExpressionStatement(attributeLists, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4179=> SyntaxFactory.ExpressionStatement(default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4184if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4190=> SyntaxFactory.EmptyStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4194=> SyntaxFactory.EmptyStatement(default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4199if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4200if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4207=> SyntaxFactory.LabeledStatement(attributeLists, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4211=> SyntaxFactory.LabeledStatement(default, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4215=> SyntaxFactory.LabeledStatement(default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4218public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 4222case SyntaxKind.GotoStatement: 4223case SyntaxKind.GotoCaseStatement: 4224case SyntaxKind.GotoDefaultStatement: break; 4227if (gotoKeyword.Kind() != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 4230case SyntaxKind.CaseKeyword: 4231case SyntaxKind.DefaultKeyword: 4232case SyntaxKind.None: break; 4235if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4240public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression) 4241=> SyntaxFactory.GotoStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.GotoKeyword), caseOrDefaultKeyword, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4245public static GotoStatementSyntax GotoStatement(SyntaxKind kind, ExpressionSyntax? expression = default) 4246=> SyntaxFactory.GotoStatement(kind, default, SyntaxFactory.Token(SyntaxKind.GotoKeyword), default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4253if (breakKeyword.Kind() != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 4254if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4261=> SyntaxFactory.BreakStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.BreakKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4267=> SyntaxFactory.BreakStatement(default, SyntaxFactory.Token(SyntaxKind.BreakKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4274if (continueKeyword.Kind() != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 4275if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4282=> SyntaxFactory.ContinueStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4288=> SyntaxFactory.ContinueStatement(default, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4294if (returnKeyword.Kind() != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 4295if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4301=> SyntaxFactory.ReturnStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4306=> SyntaxFactory.ReturnStatement(default, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4312if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 4313if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4319=> SyntaxFactory.ThrowStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4324=> SyntaxFactory.ThrowStatement(default, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4328public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 4332case SyntaxKind.YieldReturnStatement: 4333case SyntaxKind.YieldBreakStatement: break; 4336if (yieldKeyword.Kind() != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 4339case SyntaxKind.ReturnKeyword: 4340case SyntaxKind.BreakKeyword: break; 4343if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4348public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax? expression) 4349=> SyntaxFactory.YieldStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4353public static YieldStatementSyntax YieldStatement(SyntaxKind kind, ExpressionSyntax? expression = default) 4354=> SyntaxFactory.YieldStatement(kind, default, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4357private static SyntaxKind GetYieldStatementReturnOrBreakKeywordKind(SyntaxKind kind) 4360SyntaxKind.YieldReturnStatement => SyntaxKind.ReturnKeyword, 4361SyntaxKind.YieldBreakStatement => SyntaxKind.BreakKeyword, 4368if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 4369if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4371if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4378=> SyntaxFactory.WhileStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4382=> SyntaxFactory.WhileStatement(default, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4387if (doKeyword.Kind() != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 4389if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 4390if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4392if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4393if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4399=> 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)); 4403=> 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)); 4408if (forKeyword.Kind() != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 4409if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4410if (firstSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 4411if (secondSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 4412if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4419=> 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); 4423=> 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); 4430case SyntaxKind.AwaitKeyword: 4431case SyntaxKind.None: break; 4434if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 4435if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4437if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4438if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 4440if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4447=> SyntaxFactory.ForEachStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4451=> SyntaxFactory.ForEachStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4455=> 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); 4462case SyntaxKind.AwaitKeyword: 4463case SyntaxKind.None: break; 4466if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 4467if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4469if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 4471if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4478=> SyntaxFactory.ForEachVariableStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4482=> SyntaxFactory.ForEachVariableStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4489case SyntaxKind.AwaitKeyword: 4490case SyntaxKind.None: break; 4493if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 4494if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4495if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4502=> SyntaxFactory.UsingStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4506=> SyntaxFactory.UsingStatement(default, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4511if (fixedKeyword.Kind() != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 4512if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4514if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4521=> SyntaxFactory.FixedStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4525=> SyntaxFactory.FixedStatement(default, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4528public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 4532case SyntaxKind.CheckedStatement: 4533case SyntaxKind.UncheckedStatement: break; 4538case SyntaxKind.CheckedKeyword: 4539case SyntaxKind.UncheckedKeyword: break; 4547public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, BlockSyntax block) 4552public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, BlockSyntax? block = default) 4556private static SyntaxKind GetCheckedStatementKeywordKind(SyntaxKind kind) 4559SyntaxKind.CheckedStatement => SyntaxKind.CheckedKeyword, 4560SyntaxKind.UncheckedStatement => SyntaxKind.UncheckedKeyword, 4567if (unsafeKeyword.Kind() != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 4574=> SyntaxFactory.UnsafeStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block); 4579=> SyntaxFactory.UnsafeStatement(default, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block ?? SyntaxFactory.Block()); 4585if (lockKeyword.Kind() != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 4586if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4588if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4595=> SyntaxFactory.LockStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4599=> SyntaxFactory.LockStatement(default, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4604if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 4605if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4607if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4614=> SyntaxFactory.IfStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, @else); 4618=> SyntaxFactory.IfStatement(default, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, default); 4623if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 4630=> SyntaxFactory.ElseClause(SyntaxFactory.Token(SyntaxKind.ElseKeyword), statement); 4635if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 4638case SyntaxKind.OpenParenToken: 4639case SyntaxKind.None: break; 4645case SyntaxKind.CloseParenToken: 4646case SyntaxKind.None: break; 4649if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4650if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4667if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 4669if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4675=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, whenClause, colonToken); 4679=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, default, colonToken); 4684if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 4686if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4692=> SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, colonToken); 4697if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 4698if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4704=> SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), colonToken); 4710if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 4711if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4712if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4718=> SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), arms, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4722=> SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4728if (equalsGreaterThanToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 4735=> SyntaxFactory.SwitchExpressionArm(pattern, whenClause, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 4739=> SyntaxFactory.SwitchExpressionArm(pattern, default, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 4744if (tryKeyword.Kind() != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 4751=> SyntaxFactory.TryStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.TryKeyword), block, catches, @finally); 4756=> SyntaxFactory.TryStatement(default, SyntaxFactory.Token(SyntaxKind.TryKeyword), SyntaxFactory.Block(), catches, default); 4762if (catchKeyword.Kind() != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 4769=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), declaration, filter, block); 4773=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), default, default, SyntaxFactory.Block()); 4778if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4782case SyntaxKind.IdentifierToken: 4783case SyntaxKind.None: break; 4786if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4792=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4796=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4801if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 4802if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4804if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4810=> SyntaxFactory.CatchFilterClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), filterExpression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4815if (finallyKeyword.Kind() != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 4822=> SyntaxFactory.FinallyClause(SyntaxFactory.Token(SyntaxKind.FinallyKeyword), block ?? SyntaxFactory.Block()); 4827if (endOfFileToken.Kind() != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 4833=> SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 4837=> SyntaxFactory.CompilationUnit(default, default, default, default, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 4842if (externKeyword.Kind() != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 4843if (aliasKeyword.Kind() != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 4844if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4845if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4851=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), identifier, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4855=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4862case SyntaxKind.GlobalKeyword: 4863case SyntaxKind.None: break; 4866if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 4869case SyntaxKind.StaticKeyword: 4870case SyntaxKind.None: break; 4875case SyntaxKind.UnsafeKeyword: 4876case SyntaxKind.None: break; 4880if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4886=> SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, alias, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4890=> SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, default, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4895if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 4897if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4898if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4901case SyntaxKind.SemicolonToken: 4902case SyntaxKind.None: break; 4910=> SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), externs, usings, members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 4914=> SyntaxFactory.NamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 4919if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 4921if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4927=> SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), externs, usings, members); 4931=> SyntaxFactory.FileScopedNamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, default, default); 4936if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 4937if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 4943=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), target, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 4947=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 4952if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4958=> SyntaxFactory.AttributeTargetSpecifier(identifier, SyntaxFactory.Token(SyntaxKind.ColonToken)); 4974if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4975if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4981=> SyntaxFactory.AttributeArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4998if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 5004=> SyntaxFactory.NameEquals(name, SyntaxFactory.Token(SyntaxKind.EqualsToken)); 5008=> SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.EqualsToken)); 5013if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 5014if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 5020=> SyntaxFactory.TypeParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 5027case SyntaxKind.InKeyword: 5028case SyntaxKind.OutKeyword: 5029case SyntaxKind.None: break; 5032if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5047if (keyword.Kind() != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 5048if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5051case SyntaxKind.OpenBraceToken: 5052case SyntaxKind.None: break; 5057case SyntaxKind.CloseBraceToken: 5058case SyntaxKind.None: break; 5063case SyntaxKind.SemicolonToken: 5064case SyntaxKind.None: break; 5073if (keyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); 5074if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5077case SyntaxKind.OpenBraceToken: 5078case SyntaxKind.None: break; 5083case SyntaxKind.CloseBraceToken: 5084case SyntaxKind.None: break; 5089case SyntaxKind.SemicolonToken: 5090case SyntaxKind.None: break; 5100if (keyword.Kind() != SyntaxKind.UnionKeyword) throw new ArgumentException(nameof(keyword)); 5101if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5104case SyntaxKind.OpenBraceToken: 5105case SyntaxKind.None: break; 5110case SyntaxKind.CloseBraceToken: 5111case SyntaxKind.None: break; 5116case SyntaxKind.SemicolonToken: 5117case SyntaxKind.None: break; 5126if (keyword.Kind() != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 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 classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) 5154case SyntaxKind.RecordDeclaration: 5155case SyntaxKind.RecordStructDeclaration: break; 5160case SyntaxKind.ClassKeyword: 5161case SyntaxKind.StructKeyword: 5162case SyntaxKind.None: break; 5165if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5168case SyntaxKind.OpenBraceToken: 5169case SyntaxKind.None: break; 5174case SyntaxKind.CloseBraceToken: 5175case SyntaxKind.None: break; 5180case SyntaxKind.SemicolonToken: 5181case SyntaxKind.None: break; 5188public 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) 5192public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, SyntaxToken identifier) 5196public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, string identifier) 5199private static SyntaxKind GetRecordDeclarationClassOrStructKeywordKind(SyntaxKind kind) 5202SyntaxKind.RecordDeclaration => SyntaxKind.ClassKeyword, 5203SyntaxKind.RecordStructDeclaration => SyntaxKind.StructKeyword, 5210if (enumKeyword.Kind() != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 5211if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5214case SyntaxKind.OpenBraceToken: 5215case SyntaxKind.None: break; 5220case SyntaxKind.CloseBraceToken: 5221case SyntaxKind.None: break; 5226case SyntaxKind.SemicolonToken: 5227case SyntaxKind.None: break; 5236if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 5238if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5240if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5246=> SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, typeParameterList, parameterList, constraintClauses, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5250=> SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5254=> SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5259if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5274if (keyword.Kind() != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 5277case SyntaxKind.OpenBraceToken: 5278case SyntaxKind.None: break; 5283case SyntaxKind.CloseBraceToken: 5284case SyntaxKind.None: break; 5289case SyntaxKind.SemicolonToken: 5290case SyntaxKind.None: break; 5298=> SyntaxFactory.ExtensionBlockDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), typeParameterList, parameterList, constraintClauses, default, members, default, default); 5302=> SyntaxFactory.ExtensionBlockDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), default, default, default, default, default, default, default); 5307if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5313=> SyntaxFactory.BaseList(SyntaxFactory.Token(SyntaxKind.ColonToken), types); 5337if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 5339if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5345=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), constraints); 5349=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), default); 5353=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.ColonToken), default); 5358if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 5359if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 5360if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 5366=> SyntaxFactory.ConstructorConstraint(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 5369public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken questionToken) 5373case SyntaxKind.ClassConstraint: 5374case SyntaxKind.StructConstraint: break; 5379case SyntaxKind.ClassKeyword: 5380case SyntaxKind.StructKeyword: break; 5385case SyntaxKind.QuestionToken: 5386case SyntaxKind.None: break; 5393public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind) 5396private static SyntaxKind GetClassOrStructConstraintClassOrStructKeywordKind(SyntaxKind kind) 5399SyntaxKind.ClassConstraint => SyntaxKind.ClassKeyword, 5400SyntaxKind.StructConstraint => SyntaxKind.StructKeyword, 5414if (defaultKeyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 5420=> SyntaxFactory.DefaultConstraint(SyntaxFactory.Token(SyntaxKind.DefaultKeyword)); 5425if (allowsKeyword.Kind() != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 5431=> SyntaxFactory.AllowsConstraintClause(SyntaxFactory.Token(SyntaxKind.AllowsKeyword), constraints); 5436if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 5437if (structKeyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 5443=> SyntaxFactory.RefStructConstraint(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.StructKeyword)); 5449if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5455=> SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5459=> SyntaxFactory.FieldDeclaration(default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5464if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 5466if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5472=> SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5476=> SyntaxFactory.EventFieldDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5482if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5488=> SyntaxFactory.ExplicitInterfaceSpecifier(name, SyntaxFactory.Token(SyntaxKind.DotToken)); 5494if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5498case SyntaxKind.SemicolonToken: 5499case SyntaxKind.None: break; 5521if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5524case SyntaxKind.CheckedKeyword: 5525case SyntaxKind.None: break; 5530case SyntaxKind.PlusToken: 5531case SyntaxKind.MinusToken: 5532case SyntaxKind.ExclamationToken: 5533case SyntaxKind.TildeToken: 5534case SyntaxKind.PlusPlusToken: 5535case SyntaxKind.MinusMinusToken: 5536case SyntaxKind.AsteriskToken: 5537case SyntaxKind.SlashToken: 5538case SyntaxKind.PercentToken: 5539case SyntaxKind.LessThanLessThanToken: 5540case SyntaxKind.GreaterThanGreaterThanToken: 5541case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 5542case SyntaxKind.BarToken: 5543case SyntaxKind.AmpersandToken: 5544case SyntaxKind.CaretToken: 5545case SyntaxKind.EqualsEqualsToken: 5546case SyntaxKind.ExclamationEqualsToken: 5547case SyntaxKind.LessThanToken: 5548case SyntaxKind.LessThanEqualsToken: 5549case SyntaxKind.GreaterThanToken: 5550case SyntaxKind.GreaterThanEqualsToken: 5551case SyntaxKind.FalseKeyword: 5552case SyntaxKind.TrueKeyword: 5553case SyntaxKind.IsKeyword: 5554case SyntaxKind.PlusEqualsToken: 5555case SyntaxKind.MinusEqualsToken: 5556case SyntaxKind.AsteriskEqualsToken: 5557case SyntaxKind.SlashEqualsToken: 5558case SyntaxKind.PercentEqualsToken: 5559case SyntaxKind.AmpersandEqualsToken: 5560case SyntaxKind.BarEqualsToken: 5561case SyntaxKind.CaretEqualsToken: 5562case SyntaxKind.LessThanLessThanEqualsToken: 5563case SyntaxKind.GreaterThanGreaterThanEqualsToken: 5564case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 5570case SyntaxKind.SemicolonToken: 5571case SyntaxKind.None: break; 5579=> SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameterList, body, expressionBody, default); 5583=> SyntaxFactory.OperatorDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, SyntaxFactory.ParameterList(), default, default, default); 5590case SyntaxKind.ImplicitKeyword: 5591case SyntaxKind.ExplicitKeyword: break; 5594if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5597case SyntaxKind.CheckedKeyword: 5598case SyntaxKind.None: break; 5605case SyntaxKind.SemicolonToken: 5606case SyntaxKind.None: break; 5614=> SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameterList, body, expressionBody, default); 5618=> SyntaxFactory.ConversionOperatorDeclaration(default, default(SyntaxTokenList), implicitOrExplicitKeyword, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, SyntaxFactory.ParameterList(), default, default, default); 5623if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5627case SyntaxKind.SemicolonToken: 5628case SyntaxKind.None: break; 5647public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 5651case SyntaxKind.BaseConstructorInitializer: 5652case SyntaxKind.ThisConstructorInitializer: break; 5655if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5658case SyntaxKind.BaseKeyword: 5659case SyntaxKind.ThisKeyword: break; 5667public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, ArgumentListSyntax? argumentList = default) 5668=> SyntaxFactory.ConstructorInitializer(kind, SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(GetConstructorInitializerThisOrBaseKeywordKind(kind)), argumentList ?? SyntaxFactory.ArgumentList()); 5670private static SyntaxKind GetConstructorInitializerThisOrBaseKeywordKind(SyntaxKind kind) 5673SyntaxKind.BaseConstructorInitializer => SyntaxKind.BaseKeyword, 5674SyntaxKind.ThisConstructorInitializer => SyntaxKind.ThisKeyword, 5681if (tildeToken.Kind() != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 5682if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5686case SyntaxKind.SemicolonToken: 5687case SyntaxKind.None: break; 5695=> SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, parameterList, body, expressionBody, default); 5699=> SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, SyntaxFactory.ParameterList(), default, default, default); 5703=> SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default); 5709if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5712case SyntaxKind.SemicolonToken: 5713case SyntaxKind.None: break; 5734if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 5741=> SyntaxFactory.ArrowExpressionClause(SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 5746if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 5748if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5751case SyntaxKind.SemicolonToken: 5752case SyntaxKind.None: break; 5760=> SyntaxFactory.EventDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), type, explicitInterfaceSpecifier, identifier, accessorList, default); 5764=> SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, identifier, default, default); 5768=> SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, SyntaxFactory.Identifier(identifier), default, default); 5774if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 5778case SyntaxKind.SemicolonToken: 5779case SyntaxKind.None: break; 5787=> SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameterList, accessorList, expressionBody, default); 5791=> SyntaxFactory.IndexerDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Token(SyntaxKind.ThisKeyword), SyntaxFactory.BracketedParameterList(), default, default, default); 5796if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 5797if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 5803=> SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), accessors, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 5806public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5810case SyntaxKind.GetAccessorDeclaration: 5811case SyntaxKind.SetAccessorDeclaration: 5812case SyntaxKind.InitAccessorDeclaration: 5813case SyntaxKind.AddAccessorDeclaration: 5814case SyntaxKind.RemoveAccessorDeclaration: 5815case SyntaxKind.UnknownAccessorDeclaration: break; 5820case SyntaxKind.GetKeyword: 5821case SyntaxKind.SetKeyword: 5822case SyntaxKind.InitKeyword: 5823case SyntaxKind.AddKeyword: 5824case SyntaxKind.RemoveKeyword: 5825case SyntaxKind.IdentifierToken: break; 5830case SyntaxKind.SemicolonToken: 5831case SyntaxKind.None: break; 5838public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 5842public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind) 5845private static SyntaxKind GetAccessorDeclarationKeywordKind(SyntaxKind kind) 5848SyntaxKind.GetAccessorDeclaration => SyntaxKind.GetKeyword, 5849SyntaxKind.SetAccessorDeclaration => SyntaxKind.SetKeyword, 5850SyntaxKind.InitAccessorDeclaration => SyntaxKind.InitKeyword, 5851SyntaxKind.AddAccessorDeclaration => SyntaxKind.AddKeyword, 5852SyntaxKind.RemoveAccessorDeclaration => SyntaxKind.RemoveKeyword, 5853SyntaxKind.UnknownAccessorDeclaration => SyntaxKind.IdentifierToken, 5860if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 5861if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 5867=> SyntaxFactory.ParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 5872if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 5873if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 5879=> SyntaxFactory.BracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 5886case SyntaxKind.IdentifierToken: 5887case SyntaxKind.ArgListKeyword: 5888case SyntaxKind.None: break; 5928public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 5932case SyntaxKind.SingleLineDocumentationCommentTrivia: 5933case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 5936if (endOfComment.Kind() != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 5941public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList<XmlNodeSyntax> content = default) 5942=> SyntaxFactory.DocumentationCommentTrivia(kind, content, SyntaxFactory.Token(SyntaxKind.EndOfDocumentationCommentToken)); 5955if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5962=> SyntaxFactory.QualifiedCref(container, SyntaxFactory.Token(SyntaxKind.DotToken), member); 5978if (extensionKeyword.Kind() != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 5980if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5987=> SyntaxFactory.ExtensionMemberCref(SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), typeArgumentList, parameters, SyntaxFactory.Token(SyntaxKind.DotToken), member); 5991=> SyntaxFactory.ExtensionMemberCref(SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), default, SyntaxFactory.CrefParameterList(), SyntaxFactory.Token(SyntaxKind.DotToken), member); 5996if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 6002=> SyntaxFactory.IndexerMemberCref(SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameters); 6007if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 6010case SyntaxKind.CheckedKeyword: 6011case SyntaxKind.None: break; 6016case SyntaxKind.PlusToken: 6017case SyntaxKind.MinusToken: 6018case SyntaxKind.ExclamationToken: 6019case SyntaxKind.TildeToken: 6020case SyntaxKind.PlusPlusToken: 6021case SyntaxKind.MinusMinusToken: 6022case SyntaxKind.AsteriskToken: 6023case SyntaxKind.SlashToken: 6024case SyntaxKind.PercentToken: 6025case SyntaxKind.LessThanLessThanToken: 6026case SyntaxKind.GreaterThanGreaterThanToken: 6027case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 6028case SyntaxKind.BarToken: 6029case SyntaxKind.AmpersandToken: 6030case SyntaxKind.CaretToken: 6031case SyntaxKind.EqualsEqualsToken: 6032case SyntaxKind.ExclamationEqualsToken: 6033case SyntaxKind.LessThanToken: 6034case SyntaxKind.LessThanEqualsToken: 6035case SyntaxKind.GreaterThanToken: 6036case SyntaxKind.GreaterThanEqualsToken: 6037case SyntaxKind.FalseKeyword: 6038case SyntaxKind.TrueKeyword: 6039case SyntaxKind.PlusEqualsToken: 6040case SyntaxKind.MinusEqualsToken: 6041case SyntaxKind.AsteriskEqualsToken: 6042case SyntaxKind.SlashEqualsToken: 6043case SyntaxKind.PercentEqualsToken: 6044case SyntaxKind.AmpersandEqualsToken: 6045case SyntaxKind.BarEqualsToken: 6046case SyntaxKind.CaretEqualsToken: 6047case SyntaxKind.LessThanLessThanEqualsToken: 6048case SyntaxKind.GreaterThanGreaterThanEqualsToken: 6049case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 6057=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameters); 6061=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, default); 6068case SyntaxKind.ImplicitKeyword: 6069case SyntaxKind.ExplicitKeyword: break; 6072if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 6075case SyntaxKind.CheckedKeyword: 6076case SyntaxKind.None: break; 6085=> SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameters); 6089=> SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, default); 6094if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 6095if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 6101=> SyntaxFactory.CrefParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 6106if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 6107if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 6113=> SyntaxFactory.CrefBracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 6120case SyntaxKind.RefKeyword: 6121case SyntaxKind.OutKeyword: 6122case SyntaxKind.InKeyword: 6123case SyntaxKind.None: break; 6128case SyntaxKind.ReadOnlyKeyword: 6129case SyntaxKind.None: break; 6159if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 6161if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 6167=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6171=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6176if (lessThanSlashToken.Kind() != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 6178if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 6184=> SyntaxFactory.XmlElementEndTag(SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), name, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6189if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 6191if (slashGreaterThanToken.Kind() != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 6197=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 6201=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 6206if (localName.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 6221if (prefix.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 6222if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 6228=> SyntaxFactory.XmlPrefix(prefix, SyntaxFactory.Token(SyntaxKind.ColonToken)); 6232=> SyntaxFactory.XmlPrefix(SyntaxFactory.Identifier(prefix), SyntaxFactory.Token(SyntaxKind.ColonToken)); 6238if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6241case SyntaxKind.SingleQuoteToken: 6242case SyntaxKind.DoubleQuoteToken: break; 6247case SyntaxKind.SingleQuoteToken: 6248case SyntaxKind.DoubleQuoteToken: break; 6256=> SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, textTokens, endQuoteToken); 6260=> SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, default(SyntaxTokenList), endQuoteToken); 6266if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6269case SyntaxKind.SingleQuoteToken: 6270case SyntaxKind.DoubleQuoteToken: break; 6276case SyntaxKind.SingleQuoteToken: 6277case SyntaxKind.DoubleQuoteToken: break; 6285=> SyntaxFactory.XmlCrefAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, cref, endQuoteToken); 6291if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6294case SyntaxKind.SingleQuoteToken: 6295case SyntaxKind.DoubleQuoteToken: break; 6301case SyntaxKind.SingleQuoteToken: 6302case SyntaxKind.DoubleQuoteToken: break; 6310=> SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, identifier, endQuoteToken); 6314=> SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, SyntaxFactory.IdentifierName(identifier), endQuoteToken); 6329if (startCDataToken.Kind() != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 6330if (endCDataToken.Kind() != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 6336=> SyntaxFactory.XmlCDataSection(SyntaxFactory.Token(SyntaxKind.XmlCDataStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCDataEndToken)); 6341if (startProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 6343if (endProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 6349=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, textTokens, SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 6353=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 6358if (lessThanExclamationMinusMinusToken.Kind() != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 6359if (minusMinusGreaterThanToken.Kind() != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 6365=> SyntaxFactory.XmlComment(SyntaxFactory.Token(SyntaxKind.XmlCommentStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCommentEndToken)); 6370if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6371if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 6373if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6379=> SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.IfKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); 6384if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6385if (elifKeyword.Kind() != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 6387if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6393=> SyntaxFactory.ElifDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElifKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); 6398if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6399if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 6400if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6406=> SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElseKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken); 6411if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6412if (endIfKeyword.Kind() != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 6413if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6419=> SyntaxFactory.EndIfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndIfKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6424if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6425if (regionKeyword.Kind() != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 6426if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6432=> SyntaxFactory.RegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.RegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6437if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6438if (endRegionKeyword.Kind() != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 6439if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6445=> SyntaxFactory.EndRegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndRegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6450if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6451if (errorKeyword.Kind() != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 6452if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6458=> SyntaxFactory.ErrorDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ErrorKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6463if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6464if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 6465if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6471=> SyntaxFactory.WarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6476if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6477if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6483=> SyntaxFactory.BadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), identifier, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6488if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6489if (defineKeyword.Kind() != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 6490if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 6491if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6497=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6501=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6506if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6507if (undefKeyword.Kind() != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 6508if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 6509if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6515=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6519=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6524if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6525if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 6528case SyntaxKind.NumericLiteralToken: 6529case SyntaxKind.DefaultKeyword: 6530case SyntaxKind.HiddenKeyword: break; 6535case SyntaxKind.StringLiteralToken: 6536case SyntaxKind.None: break; 6539if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6545=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6549=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6554if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 6555if (line.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 6556if (commaToken.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 6557if (character.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 6558if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 6564=> SyntaxFactory.LineDirectivePosition(SyntaxFactory.Token(SyntaxKind.OpenParenToken), line, SyntaxFactory.Token(SyntaxKind.CommaToken), character, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 6569if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6570if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 6572if (minusToken.Kind() != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 6576case SyntaxKind.NumericLiteralToken: 6577case SyntaxKind.None: break; 6580if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6581if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6587=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, characterOffset, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6591=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, default, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6596if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6597if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 6598if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 6601case SyntaxKind.DisableKeyword: 6602case SyntaxKind.RestoreKeyword: break; 6605if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6611=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, errorCodes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6615=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6620if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6621if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 6622if (checksumKeyword.Kind() != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 6623if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6624if (guid.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 6625if (bytes.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 6626if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6632=> SyntaxFactory.PragmaChecksumDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.ChecksumKeyword), file, guid, bytes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6637if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6638if (referenceKeyword.Kind() != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 6639if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6640if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6646=> SyntaxFactory.ReferenceDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ReferenceKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6651if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6652if (loadKeyword.Kind() != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 6653if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6654if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6660=> SyntaxFactory.LoadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LoadKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6665if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6666if (exclamationToken.Kind() != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 6667if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6673=> SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6678if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6679if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 6682case SyntaxKind.StringLiteralToken: 6683case SyntaxKind.None: break; 6686if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6692=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), content, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6696=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6701if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6702if (nullableKeyword.Kind() != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 6705case SyntaxKind.EnableKeyword: 6706case SyntaxKind.DisableKeyword: 6707case SyntaxKind.RestoreKeyword: break; 6712case SyntaxKind.WarningsKeyword: 6713case SyntaxKind.AnnotationsKeyword: 6714case SyntaxKind.None: break; 6717if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6723=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, targetToken, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6727=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);
_generated\1\Syntax.xml.Internal.Generated.cs (3200)
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 UnsafeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3707internal UnsafeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3722internal UnsafeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3792internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3806internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3821internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3891internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3905internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3920internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3990internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4004internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 4019internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 4087internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4097internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 4108internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) 4166internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4176internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 4187internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) 4242internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4247internal BaseArgumentListSyntax(SyntaxKind kind) 4263internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4278internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 4294internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 4361internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4376internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 4392internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) 4459internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4477internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 4496internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) 4561internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4566internal BaseExpressionColonSyntax(SyntaxKind kind) 4581internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4591internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) 4602internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) 4658internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4668internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) 4679internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) 4737internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4747internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) 4758internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) 4817internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4831internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) 4846internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) 4911internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4916internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) 4945internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4970internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 4996internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) 5080internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5085internal LambdaExpressionSyntax(SyntaxKind kind) 5106internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5136internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 5167internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 5260internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5270internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 5281internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) 5342internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5377internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 5413internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 5515internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5530internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 5546internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) 5608internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5613internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) 5635internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5650internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 5666internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) 5734internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5754internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 5775internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) 5849internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5861internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 5874internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) 5934internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5947internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) 5961internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) 6024internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6041internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 6059internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) 6131internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6146internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 6162internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) 6231internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6250internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 6270internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) 6347internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6362internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 6378internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) 6446internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6460internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 6475internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) 6543internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6558internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 6574internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) 6634internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6639internal CollectionElementSyntax(SyntaxKind kind) 6649internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6657internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) 6666internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) 6713internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6723internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) 6734internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) 6789internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6799internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 6810internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList) 6862internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6867internal QueryClauseSyntax(SyntaxKind kind) 6875internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6880internal SelectOrGroupClauseSyntax(SyntaxKind kind) 6891internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6901internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) 6912internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) 6968internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6986internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) 7005internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) 7073internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7092internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 7112internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) 7185internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7199internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) 7214internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) 7286internal 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) 7318internal 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) 7351internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) 7445internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7455internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) 7466internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) 7522internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7532internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) 7543internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) 7598internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7611internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) 7625internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) 7683internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7696internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) 7710internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 7768internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7778internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 7789internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) 7846internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7860internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) 7875internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) 7939internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7951internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) 7964internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) 8024internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8032internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) 8041internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) 8090internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8105internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) 8121internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) 8188internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8200internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) 8213internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) 8274internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8284internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 8295internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) 8350internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8360internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) 8371internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) 8423internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8428internal PatternSyntax(SyntaxKind kind) 8438internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8446internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) 8455internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) 8502internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8512internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) 8523internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) 8578internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8588internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) 8599internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) 8656internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8682internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) 8709internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) 8785internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8800internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) 8816internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) 8879internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8894internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 8910internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) 8972internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8985internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) 8999internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) 9056internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9064internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) 9073internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) 9122internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9134internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) 9147internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) 9206internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9216internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) 9227internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) 9282internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9290internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 9299internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) 9348internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9360internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) 9373internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 9432internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9442internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) 9453internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) 9510internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9530internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) 9551internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) 9620internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9633internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) 9647internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) 9702internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9707internal InterpolatedStringContentSyntax(SyntaxKind kind) 9717internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9725internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) 9734internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) 9785internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9807internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 9830internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) 9907internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9917internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) 9928internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) 9983internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9993internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) 10004internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) 10062internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10080internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) 10099internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) 10162internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10167internal StatementSyntax(SyntaxKind kind) 10182internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10202internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 10223internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) 10300internal 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) 10347internal 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) 10395internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 10509internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10539internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 10570internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 10654internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10667internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) 10681internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) 10740internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10758internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) 10777internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) 10843internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10853internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) 10864internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) 10916internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10921internal VariableDesignationSyntax(SyntaxKind kind) 10931internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10939internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) 10948internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) 10994internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11002internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) 11011internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) 11059internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11074internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) 11090internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) 11153internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11168internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11184internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) 11246internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11259internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11273internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) 11334internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11351internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) 11369internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) 11443internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11468internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11494internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11584internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, IdentifierNameSyntax? name, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11604internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, IdentifierNameSyntax? name, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11625internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, IdentifierNameSyntax? name, SyntaxToken semicolonToken) 11696internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, IdentifierNameSyntax? name, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11716internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, IdentifierNameSyntax? name, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11737internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, IdentifierNameSyntax? name, SyntaxToken semicolonToken) 11808internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11828internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11849internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11920internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11940internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11961internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 12033internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12055internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 12078internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 12155internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12176internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12198internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) 12278internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12303internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) 12329internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) 12420internal 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) 12463internal 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) 12507internal 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) 12610internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12615internal CommonForEachStatementSyntax(SyntaxKind kind) 12648internal 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) 12680internal 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) 12713internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 12814internal 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) 12844internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12875internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 12976internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13010internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13045internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 13140internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13161internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13183internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) 13258internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13273internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) 13289internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) 13352internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13367internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) 13383internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) 13449internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13470internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13492internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 13574internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13600internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) 13627internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) 13727internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13737internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) 13748internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) 13813internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13847internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 13882internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) 13995internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14011internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) 14028internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) 14093internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14098internal SwitchLabelSyntax(SyntaxKind kind) 14122internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14139internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) 14157internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) 14229internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14241internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) 14254internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) 14318internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14328internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) 14339internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) 14398internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14417internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 14437internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) 14509internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14526internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) 14544internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) 14613internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14638internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) 14664internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) 14742internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14762internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) 14783internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) 14854internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14871internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) 14889internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) 14957internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14971internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 14986internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) 15049internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15059internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) 15070internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) 15128internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15156internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) 15185internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) 15270internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15284internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) 15299internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) 15371internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15403internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) 15436internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) 15521internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15526internal MemberDeclarationSyntax(SyntaxKind kind) 15540internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15545internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) 15574internal 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) 15618internal 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) 15663internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) 15775internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15812internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) 15850internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) 15947internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15967internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 15988internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) 16062internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16072internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) 16083internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) 16141internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16155internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) 16170internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) 16232internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16247internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 16263internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 16330internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16348internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) 16367internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) 16434internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16444internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) 16455internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) 16513internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16528internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 16544internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) 16611internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16629internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) 16648internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) 16713internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16718internal BaseTypeDeclarationSyntax(SyntaxKind kind) 16742internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16747internal TypeDeclarationSyntax(SyntaxKind kind) 16782internal 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) 16842internal 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) 16903internal 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) 17040internal 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) 17100internal 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) 17161internal 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) 17298internal 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) 17358internal 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) 17419internal 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) 17556internal 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) 17616internal 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) 17677internal 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) 17814internal 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) 17879internal 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) 17945internal 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) 18085internal 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) 18130internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 18176internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 18291internal 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) 18327internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) 18364internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) 18467internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18490internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) 18514internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) 18596internal 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) 18649internal 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) 18703internal ExtensionBlockDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 18818internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18831internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) 18845internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) 18903internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18908internal BaseTypeSyntax(SyntaxKind kind) 18920internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18928internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 18937internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) 18984internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18994internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 19005internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) 19063internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19080internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) 19098internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) 19165internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19170internal TypeParameterConstraintSyntax(SyntaxKind kind) 19183internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19195internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) 19208internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) 19271internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19284internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) 19298internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 19358internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19366internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 19375internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) 19423internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19431internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) 19440internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) 19489internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19502internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints, SyntaxFactoryContext context) 19516internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints) 19573internal AllowsConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19578internal AllowsConstraintSyntax(SyntaxKind kind) 19590internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19600internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword, SyntaxFactoryContext context) 19611internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword) 19665internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19670internal BaseFieldDeclarationSyntax(SyntaxKind kind) 19687internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19707internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 19728internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 19800internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19822internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 19845internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 19918internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19928internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) 19939internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) 19992internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19997internal BaseMethodDeclarationSyntax(SyntaxKind kind) 20028internal 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) 20080internal 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) 20133internal 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) 20262internal 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) 20311internal 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) 20361internal 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) 20488internal 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) 20537internal 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) 20587internal 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) 20711internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20751internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20792internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20893internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20905internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 20918internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 20986internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21023internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21061internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21156internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21161internal BasePropertyDeclarationSyntax(SyntaxKind kind) 21187internal 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) 21232internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21278internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) 21384internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21394internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) 21405internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) 21466internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21503internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21541internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) 21643internal 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) 21685internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21728internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21831internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21846internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 21862internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) 21928internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21961internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21995internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 22085internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22090internal BaseParameterListSyntax(SyntaxKind kind) 22106internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22121internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) 22137internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) 22203internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22218internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 22234internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) 22296internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22301internal BaseParameterSyntax(SyntaxKind kind) 22324internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22355internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) 22387internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default) 22474internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22492internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) 22511internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) 22579internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22600internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) 22622internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) 22689internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22700internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) 22712internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) 22762internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22775internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) 22789internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) 22848internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22853internal CrefSyntax(SyntaxKind kind) 22870internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22878internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 22887internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) 22942internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22954internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) 22967internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) 23030internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23035internal MemberCrefSyntax(SyntaxKind kind) 23052internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23065internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 23079internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) 23140internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23159internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) 23179internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member) 23253internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23266internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) 23280internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) 23345internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23365internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 23386internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) 23463internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23485internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 23508internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) 23582internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23587internal BaseCrefParameterListSyntax(SyntaxKind kind) 23605internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23620internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) 23636internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) 23704internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23719internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 23735internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) 23806internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23824internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) 23843internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) 23905internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23910internal XmlNodeSyntax(SyntaxKind kind) 23922internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23937internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) 23953internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) 24017internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24034internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 24052internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) 24119internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24131internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 24144internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) 24205internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24222internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) 24240internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) 24306internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24319internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) 24333internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) 24391internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24401internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) 24412internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) 24464internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24469internal XmlAttributeSyntax(SyntaxKind kind) 24491internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24510internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24530internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) 24603internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24619internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24636internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) 24706internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24722internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24739internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) 24805internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24816internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) 24828internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) 24879internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24894internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) 24910internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) 24974internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24991internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) 25009internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) 25076internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25091internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) 25107internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) 25166internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25172internal DirectiveTriviaSyntax(SyntaxKind kind) 25187internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25192internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) 25202internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25207internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) 25227internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25244internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) 25262internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) 25336internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25353internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) 25371internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) 25443internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25457internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) 25472internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) 25537internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25550internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25564internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25627internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25640internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25654internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25717internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25730internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25744internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25807internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25820internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25834internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25897internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25910internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25924internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25987internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26000internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26014internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) 26078internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26093internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26109internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) 26177internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26192internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26208internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) 26270internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26275internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) 26294internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26314internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26335internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) 26410internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26426internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) 26443internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) 26517internal 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) 26543internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26570internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26659internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26681internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26704internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) 26786internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26807internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26829internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) 26909internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26924internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26940internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 27008internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 27023internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 27039internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 27106internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 27119internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 27133internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) 27197internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 27215internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 27234internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive) 27306internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 27326internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 27347internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) 28689case SyntaxKind.IdentifierToken: 28690case SyntaxKind.GlobalKeyword: break; 28696var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); 28699var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); 28713if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 28718var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); 28721var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); 28734if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 28739var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); 28742var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); 28755if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 28757if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 28761var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); 28764var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); 28778if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 28783var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); 28786var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); 28801case SyntaxKind.BoolKeyword: 28802case SyntaxKind.ByteKeyword: 28803case SyntaxKind.SByteKeyword: 28804case SyntaxKind.IntKeyword: 28805case SyntaxKind.UIntKeyword: 28806case SyntaxKind.ShortKeyword: 28807case SyntaxKind.UShortKeyword: 28808case SyntaxKind.LongKeyword: 28809case SyntaxKind.ULongKeyword: 28810case SyntaxKind.FloatKeyword: 28811case SyntaxKind.DoubleKeyword: 28812case SyntaxKind.DecimalKeyword: 28813case SyntaxKind.StringKeyword: 28814case SyntaxKind.CharKeyword: 28815case SyntaxKind.ObjectKeyword: 28816case SyntaxKind.VoidKeyword: break; 28822var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); 28825var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); 28841var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); 28844var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); 28857if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 28859if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 28863var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); 28866var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); 28880if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 28884var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); 28887var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); 28900if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 28902if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 28906return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); 28913if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 28915if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 28919var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); 28922var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); 28937case SyntaxKind.ManagedKeyword: 28938case SyntaxKind.UnmanagedKeyword: break; 28944var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); 28947var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); 28960if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 28962if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 28966var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); 28969var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); 28982if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 28986var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); 28989var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); 29003if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 29007var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); 29010var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); 29023if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29025if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29029var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); 29032var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); 29049case SyntaxKind.IdentifierToken: 29050case SyntaxKind.None: break; 29057var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); 29060var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); 29073if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 29077var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); 29080var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); 29093if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 29098case SyntaxKind.ReadOnlyKeyword: 29099case SyntaxKind.None: break; 29107var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); 29110var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); 29123if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 29128var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); 29131var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); 29144if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29147if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29151var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); 29154var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); 29167if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29169if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29173var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 29176var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); 29185public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 29189case SyntaxKind.UnaryPlusExpression: 29190case SyntaxKind.UnaryMinusExpression: 29191case SyntaxKind.BitwiseNotExpression: 29192case SyntaxKind.LogicalNotExpression: 29193case SyntaxKind.PreIncrementExpression: 29194case SyntaxKind.PreDecrementExpression: 29195case SyntaxKind.AddressOfExpression: 29196case SyntaxKind.PointerIndirectionExpression: 29197case SyntaxKind.IndexExpression: break; 29204case SyntaxKind.PlusToken: 29205case SyntaxKind.MinusToken: 29206case SyntaxKind.TildeToken: 29207case SyntaxKind.ExclamationToken: 29208case SyntaxKind.PlusPlusToken: 29209case SyntaxKind.MinusMinusToken: 29210case SyntaxKind.AmpersandToken: 29211case SyntaxKind.AsteriskToken: 29212case SyntaxKind.CaretToken: break; 29235if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 29240var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); 29243var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); 29252public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 29256case SyntaxKind.PostIncrementExpression: 29257case SyntaxKind.PostDecrementExpression: 29258case SyntaxKind.SuppressNullableWarningExpression: break; 29266case SyntaxKind.PlusPlusToken: 29267case SyntaxKind.MinusMinusToken: 29268case SyntaxKind.ExclamationToken: break; 29286public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 29290case SyntaxKind.SimpleMemberAccessExpression: 29291case SyntaxKind.PointerMemberAccessExpression: break; 29299case SyntaxKind.DotToken: 29300case SyntaxKind.MinusGreaterThanToken: break; 29324if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 29329var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); 29332var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); 29345if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 29350var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); 29353var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); 29369var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); 29372var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); 29385if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 29389var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); 29392var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); 29408var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); 29411var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); 29420public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 29424case SyntaxKind.AddExpression: 29425case SyntaxKind.SubtractExpression: 29426case SyntaxKind.MultiplyExpression: 29427case SyntaxKind.DivideExpression: 29428case SyntaxKind.ModuloExpression: 29429case SyntaxKind.LeftShiftExpression: 29430case SyntaxKind.RightShiftExpression: 29431case SyntaxKind.UnsignedRightShiftExpression: 29432case SyntaxKind.LogicalOrExpression: 29433case SyntaxKind.LogicalAndExpression: 29434case SyntaxKind.BitwiseOrExpression: 29435case SyntaxKind.BitwiseAndExpression: 29436case SyntaxKind.ExclusiveOrExpression: 29437case SyntaxKind.EqualsExpression: 29438case SyntaxKind.NotEqualsExpression: 29439case SyntaxKind.LessThanExpression: 29440case SyntaxKind.LessThanOrEqualExpression: 29441case SyntaxKind.GreaterThanExpression: 29442case SyntaxKind.GreaterThanOrEqualExpression: 29443case SyntaxKind.IsExpression: 29444case SyntaxKind.AsExpression: 29445case SyntaxKind.CoalesceExpression: break; 29453case SyntaxKind.PlusToken: 29454case SyntaxKind.MinusToken: 29455case SyntaxKind.AsteriskToken: 29456case SyntaxKind.SlashToken: 29457case SyntaxKind.PercentToken: 29458case SyntaxKind.LessThanLessThanToken: 29459case SyntaxKind.GreaterThanGreaterThanToken: 29460case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 29461case SyntaxKind.BarBarToken: 29462case SyntaxKind.AmpersandAmpersandToken: 29463case SyntaxKind.BarToken: 29464case SyntaxKind.AmpersandToken: 29465case SyntaxKind.CaretToken: 29466case SyntaxKind.EqualsEqualsToken: 29467case SyntaxKind.ExclamationEqualsToken: 29468case SyntaxKind.LessThanToken: 29469case SyntaxKind.LessThanEqualsToken: 29470case SyntaxKind.GreaterThanToken: 29471case SyntaxKind.GreaterThanEqualsToken: 29472case SyntaxKind.IsKeyword: 29473case SyntaxKind.AsKeyword: 29474case SyntaxKind.QuestionQuestionToken: break; 29493public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 29497case SyntaxKind.SimpleAssignmentExpression: 29498case SyntaxKind.AddAssignmentExpression: 29499case SyntaxKind.SubtractAssignmentExpression: 29500case SyntaxKind.MultiplyAssignmentExpression: 29501case SyntaxKind.DivideAssignmentExpression: 29502case SyntaxKind.ModuloAssignmentExpression: 29503case SyntaxKind.AndAssignmentExpression: 29504case SyntaxKind.ExclusiveOrAssignmentExpression: 29505case SyntaxKind.OrAssignmentExpression: 29506case SyntaxKind.LeftShiftAssignmentExpression: 29507case SyntaxKind.RightShiftAssignmentExpression: 29508case SyntaxKind.UnsignedRightShiftAssignmentExpression: 29509case SyntaxKind.CoalesceAssignmentExpression: break; 29517case SyntaxKind.EqualsToken: 29518case SyntaxKind.PlusEqualsToken: 29519case SyntaxKind.MinusEqualsToken: 29520case SyntaxKind.AsteriskEqualsToken: 29521case SyntaxKind.SlashEqualsToken: 29522case SyntaxKind.PercentEqualsToken: 29523case SyntaxKind.AmpersandEqualsToken: 29524case SyntaxKind.CaretEqualsToken: 29525case SyntaxKind.BarEqualsToken: 29526case SyntaxKind.LessThanLessThanEqualsToken: 29527case SyntaxKind.GreaterThanGreaterThanEqualsToken: 29528case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 29529case SyntaxKind.QuestionQuestionEqualsToken: break; 29553if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 29556if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 29560return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); 29567if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 29571var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); 29574var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); 29587if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 29591var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); 29594var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); 29603public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 29607case SyntaxKind.ArgListExpression: 29608case SyntaxKind.NumericLiteralExpression: 29609case SyntaxKind.StringLiteralExpression: 29610case SyntaxKind.Utf8StringLiteralExpression: 29611case SyntaxKind.CharacterLiteralExpression: 29612case SyntaxKind.TrueLiteralExpression: 29613case SyntaxKind.FalseLiteralExpression: 29614case SyntaxKind.NullLiteralExpression: 29615case SyntaxKind.DefaultLiteralExpression: break; 29622case SyntaxKind.ArgListKeyword: 29623case SyntaxKind.NumericLiteralToken: 29624case SyntaxKind.StringLiteralToken: 29625case SyntaxKind.Utf8StringLiteralToken: 29626case SyntaxKind.MultiLineRawStringLiteralToken: 29627case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 29628case SyntaxKind.SingleLineRawStringLiteralToken: 29629case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 29630case SyntaxKind.CharacterLiteralToken: 29631case SyntaxKind.TrueKeyword: 29632case SyntaxKind.FalseKeyword: 29633case SyntaxKind.NullKeyword: 29634case SyntaxKind.DefaultKeyword: break; 29656if (token.Kind != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 29660var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FieldExpression, token, this.context, out hash); 29663var result = new FieldExpressionSyntax(SyntaxKind.FieldExpression, token, this.context); 29676if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 29678if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29681if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29684return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29691if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 29693if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29696if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29699return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29706if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 29708if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29711if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 29714if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29717return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); 29720public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 29724case SyntaxKind.CheckedExpression: 29725case SyntaxKind.UncheckedExpression: break; 29732case SyntaxKind.CheckedKeyword: 29733case SyntaxKind.UncheckedKeyword: break; 29737if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29740if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29750if (keyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(keyword)); 29752if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29755if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29758return new UnsafeExpressionSyntax(SyntaxKind.UnsafeExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29765if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 29767if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29770if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29773return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); 29780if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 29782if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29785if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29788return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); 29795if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 29797if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29800if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29803return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); 29814var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); 29817var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); 29834var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); 29837var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); 29850if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29852if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29856var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 29859var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); 29872if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 29874if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 29878var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); 29881var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); 29897case SyntaxKind.RefKeyword: 29898case SyntaxKind.OutKeyword: 29899case SyntaxKind.InKeyword: 29900case SyntaxKind.None: break; 29908var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); 29911var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); 29928var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); 29931var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); 29948var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); 29951var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); 29968var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); 29971var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); 29984if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29987if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29991return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); 29998if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 30002return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); 30010if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 30013return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); 30020if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 30025var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); 30028var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); 30042if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 30045return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); 30048public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 30052case SyntaxKind.ObjectInitializerExpression: 30053case SyntaxKind.CollectionInitializerExpression: 30054case SyntaxKind.ArrayInitializerExpression: 30055case SyntaxKind.ComplexElementInitializerExpression: 30056case SyntaxKind.WithInitializerExpression: break; 30061if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30063if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30083if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30088var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); 30091var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); 30104if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30108return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); 30116if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 30121var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); 30124var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); 30140var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); 30143var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); 30156if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30158if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30160if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30163return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); 30170if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30175var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); 30178var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); 30191if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 30193if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30195if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30199return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); 30206if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 30211var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); 30214var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); 30227if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 30229if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30231if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30235return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); 30242if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30244if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30248var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); 30251var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); 30267var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); 30270var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); 30283if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 30288var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); 30291var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); 30304if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 30309var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithElement, withKeyword, argumentList, this.context, out hash); 30312var result = new WithElementSyntax(SyntaxKind.WithElement, withKeyword, argumentList, this.context); 30329var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); 30332var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); 30348var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); 30351var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); 30364if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 30366if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30368if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 30372return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); 30379if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 30381if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30383if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 30387return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); 30394if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 30396if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30398if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 30401if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 30404if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 30408return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); 30415if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 30417if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30421var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); 30424var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); 30437if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 30442var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); 30445var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); 30458if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 30462var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); 30465var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); 30474public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 30478case SyntaxKind.AscendingOrdering: 30479case SyntaxKind.DescendingOrdering: break; 30488case SyntaxKind.AscendingKeyword: 30489case SyntaxKind.DescendingKeyword: 30490case SyntaxKind.None: break; 30513if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 30518var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); 30521var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); 30534if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 30537if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 30541return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); 30548if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 30550if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30555var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); 30558var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); 30571if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 30575var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); 30578var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); 30593case SyntaxKind.InterpolatedStringStartToken: 30594case SyntaxKind.InterpolatedVerbatimStringStartToken: 30595case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 30596case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 30602case SyntaxKind.InterpolatedStringEndToken: 30603case SyntaxKind.InterpolatedRawStringEndToken: break; 30609var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); 30612var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); 30626if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 30631var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); 30634var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); 30647if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 30652var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); 30655var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); 30668if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 30673var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); 30676var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); 30689if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 30693var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); 30696var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); 30713var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); 30716var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); 30729if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 30734var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); 30737var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); 30751return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); 30758if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30760if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30764var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); 30767var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); 30780if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30782if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30786var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); 30789var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); 30805var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); 30808var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); 30824var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); 30827var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); 30840if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30843if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30847var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); 30850var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); 30865case SyntaxKind.EqualsEqualsToken: 30866case SyntaxKind.ExclamationEqualsToken: 30867case SyntaxKind.LessThanToken: 30868case SyntaxKind.LessThanEqualsToken: 30869case SyntaxKind.GreaterThanToken: 30870case SyntaxKind.GreaterThanEqualsToken: break; 30877var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); 30880var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); 30896var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); 30899var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); 30908public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 30912case SyntaxKind.OrPattern: 30913case SyntaxKind.AndPattern: break; 30921case SyntaxKind.OrKeyword: 30922case SyntaxKind.AndKeyword: break; 30945if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 30950var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); 30953var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); 30966if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30968if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30971return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); 30978if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 30982var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); 30985var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); 30998if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 31002var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); 31005var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); 31018if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31021if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31024return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); 31035var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); 31038var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); 31052if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 31056var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); 31059var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); 31075var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); 31078var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); 31091if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31093if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31096return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); 31104if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31110case SyntaxKind.SemicolonToken: 31111case SyntaxKind.None: break; 31117return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); 31127case SyntaxKind.AwaitKeyword: 31128case SyntaxKind.None: break; 31136case SyntaxKind.UsingKeyword: 31137case SyntaxKind.None: break; 31143if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31146return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); 31156var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); 31159var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); 31172if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31176var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); 31179var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); 31192if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 31197var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); 31200var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); 31213if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31217var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); 31220var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); 31233if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 31237var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); 31240var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); 31253if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31255if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31259var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); 31262var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); 31276if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31280var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); 31283var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); 31296if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31300var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); 31303var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); 31316if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31318if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 31322return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); 31325public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 31329case SyntaxKind.GotoStatement: 31330case SyntaxKind.GotoCaseStatement: 31331case SyntaxKind.GotoDefaultStatement: break; 31336if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 31341case SyntaxKind.CaseKeyword: 31342case SyntaxKind.DefaultKeyword: 31343case SyntaxKind.None: break; 31348if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31358if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 31360if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31363return new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, name, semicolonToken, this.context); 31370if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 31372if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31375return new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, name, semicolonToken, this.context); 31382if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 31384if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31387return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); 31394if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 31396if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31399return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); 31402public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 31406case SyntaxKind.YieldReturnStatement: 31407case SyntaxKind.YieldBreakStatement: break; 31412if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 31416case SyntaxKind.ReturnKeyword: 31417case SyntaxKind.BreakKeyword: break; 31421if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31431if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 31433if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31436if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31440return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); 31447if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 31450if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 31452if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31455if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31457if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31460return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); 31467if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 31469if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31471if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 31473if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 31475if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31479return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); 31489case SyntaxKind.AwaitKeyword: 31490case SyntaxKind.None: break; 31495if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 31497if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31500if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31502if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 31505if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31509return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); 31519case SyntaxKind.AwaitKeyword: 31520case SyntaxKind.None: break; 31525if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 31527if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31530if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 31533if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31537return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); 31547case SyntaxKind.AwaitKeyword: 31548case SyntaxKind.None: break; 31553if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 31555if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31557if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31561return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); 31568if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 31570if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31573if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31577return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); 31580public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 31584case SyntaxKind.CheckedStatement: 31585case SyntaxKind.UncheckedStatement: break; 31592case SyntaxKind.CheckedKeyword: 31593case SyntaxKind.UncheckedKeyword: break; 31616if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 31621var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); 31624var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); 31637if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 31639if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31642if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31646return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); 31653if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 31655if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31658if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31662return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); 31669if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 31674var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); 31677var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); 31690if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 31695case SyntaxKind.OpenParenToken: 31696case SyntaxKind.None: break; 31705case SyntaxKind.CloseParenToken: 31706case SyntaxKind.None: break; 31711if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31713if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31716return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); 31725var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); 31728var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); 31741if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 31746return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); 31753if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 31759var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); 31762var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); 31775if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 31780var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); 31783var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); 31797if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 31799if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31801if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31804return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); 31812if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 31816return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); 31823if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 31827return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); 31834if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 31838return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); 31845if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31851case SyntaxKind.IdentifierToken: 31852case SyntaxKind.None: break; 31857if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31860return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); 31867if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 31869if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31872if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31875return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); 31882if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 31887var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); 31890var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); 31903if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 31906return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); 31913if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 31915if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 31917if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31919if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31922return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); 31932case SyntaxKind.GlobalKeyword: 31933case SyntaxKind.None: break; 31938if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 31943case SyntaxKind.StaticKeyword: 31944case SyntaxKind.None: break; 31952case SyntaxKind.UnsafeKeyword: 31953case SyntaxKind.None: break; 31959if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31962return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); 31969if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 31972if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31974if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31979case SyntaxKind.SemicolonToken: 31980case SyntaxKind.None: break; 31986return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); 31993if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 31996if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31999return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); 32006if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 32008if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 32011return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); 32019if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32023var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); 32026var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); 32041return new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); 32048if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32050if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32054var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 32057var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); 32073var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); 32076var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); 32090if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 32094var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); 32097var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); 32110if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 32112if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 32116var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); 32119var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); 32135case SyntaxKind.InKeyword: 32136case SyntaxKind.OutKeyword: 32137case SyntaxKind.None: break; 32142if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32146var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); 32149var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); 32162if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 32164if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32169case SyntaxKind.OpenBraceToken: 32170case SyntaxKind.None: break; 32178case SyntaxKind.CloseBraceToken: 32179case SyntaxKind.None: break; 32187case SyntaxKind.SemicolonToken: 32188case SyntaxKind.None: break; 32194return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32201if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); 32203if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32208case SyntaxKind.OpenBraceToken: 32209case SyntaxKind.None: break; 32217case SyntaxKind.CloseBraceToken: 32218case SyntaxKind.None: break; 32226case SyntaxKind.SemicolonToken: 32227case SyntaxKind.None: break; 32233return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32240if (keyword.Kind != SyntaxKind.UnionKeyword) throw new ArgumentException(nameof(keyword)); 32242if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32247case SyntaxKind.OpenBraceToken: 32248case SyntaxKind.None: break; 32256case SyntaxKind.CloseBraceToken: 32257case SyntaxKind.None: break; 32265case SyntaxKind.SemicolonToken: 32266case SyntaxKind.None: break; 32272return new UnionDeclarationSyntax(SyntaxKind.UnionDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32279if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 32281if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32286case SyntaxKind.OpenBraceToken: 32287case SyntaxKind.None: break; 32295case SyntaxKind.CloseBraceToken: 32296case SyntaxKind.None: break; 32304case SyntaxKind.SemicolonToken: 32305case SyntaxKind.None: break; 32311return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32314public 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) 32318case SyntaxKind.RecordDeclaration: 32319case SyntaxKind.RecordStructDeclaration: break; 32328case SyntaxKind.ClassKeyword: 32329case SyntaxKind.StructKeyword: 32330case SyntaxKind.None: break; 32335if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32340case SyntaxKind.OpenBraceToken: 32341case SyntaxKind.None: break; 32349case SyntaxKind.CloseBraceToken: 32350case SyntaxKind.None: break; 32358case SyntaxKind.SemicolonToken: 32359case SyntaxKind.None: break; 32372if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 32374if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32379case SyntaxKind.OpenBraceToken: 32380case SyntaxKind.None: break; 32388case SyntaxKind.CloseBraceToken: 32389case SyntaxKind.None: break; 32397case SyntaxKind.SemicolonToken: 32398case SyntaxKind.None: break; 32404return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32411if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 32414if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32417if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32420return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); 32427if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32430return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); 32437if (keyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 32442case SyntaxKind.OpenBraceToken: 32443case SyntaxKind.None: break; 32451case SyntaxKind.CloseBraceToken: 32452case SyntaxKind.None: break; 32460case SyntaxKind.SemicolonToken: 32461case SyntaxKind.None: break; 32467return new ExtensionBlockDeclarationSyntax(SyntaxKind.ExtensionBlockDeclaration, attributeLists.Node, modifiers.Node, keyword, typeParameterList, parameterList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32474if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32478var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); 32481var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); 32497var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); 32500var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); 32517var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); 32520var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); 32533if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 32536if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32539return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); 32546if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 32548if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32550if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32554var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); 32557var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); 32566public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 32570case SyntaxKind.ClassConstraint: 32571case SyntaxKind.StructConstraint: break; 32578case SyntaxKind.ClassKeyword: 32579case SyntaxKind.StructKeyword: break; 32586case SyntaxKind.QuestionToken: 32587case SyntaxKind.None: break; 32613var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); 32616var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); 32629if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 32633var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); 32636var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); 32649if (allowsKeyword.Kind != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 32653var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, this.context, out hash); 32656var result = new AllowsConstraintClauseSyntax(SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, this.context); 32669if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 32671if (structKeyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 32675var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefStructConstraint, refKeyword, structKeyword, this.context, out hash); 32678var result = new RefStructConstraintSyntax(SyntaxKind.RefStructConstraint, refKeyword, structKeyword, this.context); 32692if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32695return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); 32702if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 32705if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32708return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); 32716if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 32720var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); 32723var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); 32737if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32743case SyntaxKind.SemicolonToken: 32744case SyntaxKind.None: break; 32750return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); 32758if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32763case SyntaxKind.CheckedKeyword: 32764case SyntaxKind.None: break; 32771case SyntaxKind.PlusToken: 32772case SyntaxKind.MinusToken: 32773case SyntaxKind.ExclamationToken: 32774case SyntaxKind.TildeToken: 32775case SyntaxKind.PlusPlusToken: 32776case SyntaxKind.MinusMinusToken: 32777case SyntaxKind.AsteriskToken: 32778case SyntaxKind.SlashToken: 32779case SyntaxKind.PercentToken: 32780case SyntaxKind.LessThanLessThanToken: 32781case SyntaxKind.GreaterThanGreaterThanToken: 32782case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 32783case SyntaxKind.BarToken: 32784case SyntaxKind.AmpersandToken: 32785case SyntaxKind.CaretToken: 32786case SyntaxKind.EqualsEqualsToken: 32787case SyntaxKind.ExclamationEqualsToken: 32788case SyntaxKind.LessThanToken: 32789case SyntaxKind.LessThanEqualsToken: 32790case SyntaxKind.GreaterThanToken: 32791case SyntaxKind.GreaterThanEqualsToken: 32792case SyntaxKind.FalseKeyword: 32793case SyntaxKind.TrueKeyword: 32794case SyntaxKind.IsKeyword: 32795case SyntaxKind.PlusEqualsToken: 32796case SyntaxKind.MinusEqualsToken: 32797case SyntaxKind.AsteriskEqualsToken: 32798case SyntaxKind.SlashEqualsToken: 32799case SyntaxKind.PercentEqualsToken: 32800case SyntaxKind.AmpersandEqualsToken: 32801case SyntaxKind.BarEqualsToken: 32802case SyntaxKind.CaretEqualsToken: 32803case SyntaxKind.LessThanLessThanEqualsToken: 32804case SyntaxKind.GreaterThanGreaterThanEqualsToken: 32805case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 32813case SyntaxKind.SemicolonToken: 32814case SyntaxKind.None: break; 32820return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); 32829case SyntaxKind.ImplicitKeyword: 32830case SyntaxKind.ExplicitKeyword: break; 32834if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32839case SyntaxKind.CheckedKeyword: 32840case SyntaxKind.None: break; 32850case SyntaxKind.SemicolonToken: 32851case SyntaxKind.None: break; 32857return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); 32864if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32870case SyntaxKind.SemicolonToken: 32871case SyntaxKind.None: break; 32877return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); 32880public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 32884case SyntaxKind.BaseConstructorInitializer: 32885case SyntaxKind.ThisConstructorInitializer: break; 32890if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32894case SyntaxKind.BaseKeyword: 32895case SyntaxKind.ThisKeyword: break; 32918if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 32920if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32926case SyntaxKind.SemicolonToken: 32927case SyntaxKind.None: break; 32933return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); 32941if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32946case SyntaxKind.SemicolonToken: 32947case SyntaxKind.None: break; 32953return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); 32960if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 32965var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); 32968var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); 32981if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 32984if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32989case SyntaxKind.SemicolonToken: 32990case SyntaxKind.None: break; 32996return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); 33004if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 33010case SyntaxKind.SemicolonToken: 33011case SyntaxKind.None: break; 33017return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); 33024if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 33026if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 33030var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); 33033var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); 33042public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 33046case SyntaxKind.GetAccessorDeclaration: 33047case SyntaxKind.SetAccessorDeclaration: 33048case SyntaxKind.InitAccessorDeclaration: 33049case SyntaxKind.AddAccessorDeclaration: 33050case SyntaxKind.RemoveAccessorDeclaration: 33051case SyntaxKind.UnknownAccessorDeclaration: break; 33058case SyntaxKind.GetKeyword: 33059case SyntaxKind.SetKeyword: 33060case SyntaxKind.InitKeyword: 33061case SyntaxKind.AddKeyword: 33062case SyntaxKind.RemoveKeyword: 33063case SyntaxKind.IdentifierToken: break; 33070case SyntaxKind.SemicolonToken: 33071case SyntaxKind.None: break; 33084if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 33086if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 33090var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); 33093var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); 33106if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 33108if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 33112var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); 33115var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); 33131case SyntaxKind.IdentifierToken: 33132case SyntaxKind.ArgListKeyword: 33133case SyntaxKind.None: break; 33139return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); 33149var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); 33152var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); 33166return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); 33174return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); 33177public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 33181case SyntaxKind.SingleLineDocumentationCommentTrivia: 33182case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 33187if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 33200var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); 33203var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); 33217if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 33222var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); 33225var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); 33241var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); 33244var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); 33257if (extensionKeyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 33260if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 33264return new ExtensionMemberCrefSyntax(SyntaxKind.ExtensionMemberCref, extensionKeyword, typeArgumentList, parameters, dotToken, member, this.context); 33271if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 33275var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); 33278var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); 33291if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 33296case SyntaxKind.CheckedKeyword: 33297case SyntaxKind.None: break; 33304case SyntaxKind.PlusToken: 33305case SyntaxKind.MinusToken: 33306case SyntaxKind.ExclamationToken: 33307case SyntaxKind.TildeToken: 33308case SyntaxKind.PlusPlusToken: 33309case SyntaxKind.MinusMinusToken: 33310case SyntaxKind.AsteriskToken: 33311case SyntaxKind.SlashToken: 33312case SyntaxKind.PercentToken: 33313case SyntaxKind.LessThanLessThanToken: 33314case SyntaxKind.GreaterThanGreaterThanToken: 33315case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 33316case SyntaxKind.BarToken: 33317case SyntaxKind.AmpersandToken: 33318case SyntaxKind.CaretToken: 33319case SyntaxKind.EqualsEqualsToken: 33320case SyntaxKind.ExclamationEqualsToken: 33321case SyntaxKind.LessThanToken: 33322case SyntaxKind.LessThanEqualsToken: 33323case SyntaxKind.GreaterThanToken: 33324case SyntaxKind.GreaterThanEqualsToken: 33325case SyntaxKind.FalseKeyword: 33326case SyntaxKind.TrueKeyword: 33327case SyntaxKind.PlusEqualsToken: 33328case SyntaxKind.MinusEqualsToken: 33329case SyntaxKind.AsteriskEqualsToken: 33330case SyntaxKind.SlashEqualsToken: 33331case SyntaxKind.PercentEqualsToken: 33332case SyntaxKind.AmpersandEqualsToken: 33333case SyntaxKind.BarEqualsToken: 33334case SyntaxKind.CaretEqualsToken: 33335case SyntaxKind.LessThanLessThanEqualsToken: 33336case SyntaxKind.GreaterThanGreaterThanEqualsToken: 33337case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 33342return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); 33351case SyntaxKind.ImplicitKeyword: 33352case SyntaxKind.ExplicitKeyword: break; 33356if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 33361case SyntaxKind.CheckedKeyword: 33362case SyntaxKind.None: break; 33369return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); 33376if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 33378if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 33382var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); 33385var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); 33398if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 33400if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 33404var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); 33407var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); 33423case SyntaxKind.RefKeyword: 33424case SyntaxKind.OutKeyword: 33425case SyntaxKind.InKeyword: 33426case SyntaxKind.None: break; 33434case SyntaxKind.ReadOnlyKeyword: 33435case SyntaxKind.None: break; 33443var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); 33446var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); 33463var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); 33466var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); 33479if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33482if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33485return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); 33492if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 33495if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33499var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); 33502var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); 33515if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33518if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 33521return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); 33528if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 33532var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); 33535var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); 33548if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 33550if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 33554var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); 33557var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); 33571if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33575case SyntaxKind.SingleQuoteToken: 33576case SyntaxKind.DoubleQuoteToken: break; 33582case SyntaxKind.SingleQuoteToken: 33583case SyntaxKind.DoubleQuoteToken: break; 33588return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); 33596if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33600case SyntaxKind.SingleQuoteToken: 33601case SyntaxKind.DoubleQuoteToken: break; 33608case SyntaxKind.SingleQuoteToken: 33609case SyntaxKind.DoubleQuoteToken: break; 33614return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); 33622if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33626case SyntaxKind.SingleQuoteToken: 33627case SyntaxKind.DoubleQuoteToken: break; 33634case SyntaxKind.SingleQuoteToken: 33635case SyntaxKind.DoubleQuoteToken: break; 33640return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); 33649var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); 33652var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); 33665if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 33667if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 33671var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); 33674var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); 33687if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 33690if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 33693return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); 33700if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 33702if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 33706var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); 33709var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); 33722if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33724if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 33727if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33730return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); 33737if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33739if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 33742if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33745return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); 33752if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33754if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 33756if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33759return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); 33766if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33768if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 33770if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33773return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); 33780if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33782if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 33784if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33787return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); 33794if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33796if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 33798if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33801return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); 33808if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33810if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 33812if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33815return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); 33822if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33824if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 33826if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33829return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); 33836if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33839if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33842return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); 33849if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33851if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 33853if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33855if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33858return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); 33865if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33867if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 33869if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33871if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33874return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); 33881if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33883if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 33887case SyntaxKind.NumericLiteralToken: 33888case SyntaxKind.DefaultKeyword: 33889case SyntaxKind.HiddenKeyword: break; 33896case SyntaxKind.StringLiteralToken: 33897case SyntaxKind.None: break; 33902if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33905return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); 33912if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 33914if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 33916if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 33918if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 33920if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 33923return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); 33930if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33932if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 33935if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 33941case SyntaxKind.NumericLiteralToken: 33942case SyntaxKind.None: break; 33947if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33949if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33952return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); 33959if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33961if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 33963if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 33967case SyntaxKind.DisableKeyword: 33968case SyntaxKind.RestoreKeyword: break; 33972if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33975return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); 33982if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33984if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 33986if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 33988if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33990if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 33992if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 33994if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33997return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); 34004if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 34006if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 34008if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 34010if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 34013return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); 34020if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 34022if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 34024if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 34026if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 34029return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); 34036if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 34038if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 34040if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 34043return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); 34050if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 34052if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 34057case SyntaxKind.StringLiteralToken: 34058case SyntaxKind.None: break; 34063if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 34066return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive, this.context); 34073if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 34075if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 34079case SyntaxKind.EnableKeyword: 34080case SyntaxKind.DisableKeyword: 34081case SyntaxKind.RestoreKeyword: break; 34088case SyntaxKind.WarningsKeyword: 34089case SyntaxKind.AnnotationsKeyword: 34090case SyntaxKind.None: break; 34095if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 34098return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); 34111case SyntaxKind.IdentifierToken: 34112case SyntaxKind.GlobalKeyword: break; 34118var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); 34121var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); 34135if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 34140var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); 34143var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); 34156if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 34161var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); 34164var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); 34177if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 34179if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 34183var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); 34186var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); 34200if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 34205var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); 34208var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); 34223case SyntaxKind.BoolKeyword: 34224case SyntaxKind.ByteKeyword: 34225case SyntaxKind.SByteKeyword: 34226case SyntaxKind.IntKeyword: 34227case SyntaxKind.UIntKeyword: 34228case SyntaxKind.ShortKeyword: 34229case SyntaxKind.UShortKeyword: 34230case SyntaxKind.LongKeyword: 34231case SyntaxKind.ULongKeyword: 34232case SyntaxKind.FloatKeyword: 34233case SyntaxKind.DoubleKeyword: 34234case SyntaxKind.DecimalKeyword: 34235case SyntaxKind.StringKeyword: 34236case SyntaxKind.CharKeyword: 34237case SyntaxKind.ObjectKeyword: 34238case SyntaxKind.VoidKeyword: break; 34244var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); 34247var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); 34263var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); 34266var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); 34279if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 34281if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 34285var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); 34288var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); 34302if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 34306var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); 34309var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); 34322if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 34324if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 34328return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); 34335if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 34337if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 34341var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); 34344var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); 34359case SyntaxKind.ManagedKeyword: 34360case SyntaxKind.UnmanagedKeyword: break; 34366var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); 34369var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); 34382if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 34384if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 34388var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); 34391var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); 34404if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 34408var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); 34411var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); 34425if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 34429var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); 34432var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); 34445if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34447if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34451var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); 34454var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); 34471case SyntaxKind.IdentifierToken: 34472case SyntaxKind.None: break; 34479var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); 34482var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); 34495if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 34499var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); 34502var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); 34515if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 34520case SyntaxKind.ReadOnlyKeyword: 34521case SyntaxKind.None: break; 34529var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); 34532var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); 34545if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 34550var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); 34553var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); 34566if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34569if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34573var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); 34576var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); 34589if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34591if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34595var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); 34598var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); 34607public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 34611case SyntaxKind.UnaryPlusExpression: 34612case SyntaxKind.UnaryMinusExpression: 34613case SyntaxKind.BitwiseNotExpression: 34614case SyntaxKind.LogicalNotExpression: 34615case SyntaxKind.PreIncrementExpression: 34616case SyntaxKind.PreDecrementExpression: 34617case SyntaxKind.AddressOfExpression: 34618case SyntaxKind.PointerIndirectionExpression: 34619case SyntaxKind.IndexExpression: break; 34626case SyntaxKind.PlusToken: 34627case SyntaxKind.MinusToken: 34628case SyntaxKind.TildeToken: 34629case SyntaxKind.ExclamationToken: 34630case SyntaxKind.PlusPlusToken: 34631case SyntaxKind.MinusMinusToken: 34632case SyntaxKind.AmpersandToken: 34633case SyntaxKind.AsteriskToken: 34634case SyntaxKind.CaretToken: break; 34657if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 34662var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); 34665var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); 34674public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 34678case SyntaxKind.PostIncrementExpression: 34679case SyntaxKind.PostDecrementExpression: 34680case SyntaxKind.SuppressNullableWarningExpression: break; 34688case SyntaxKind.PlusPlusToken: 34689case SyntaxKind.MinusMinusToken: 34690case SyntaxKind.ExclamationToken: break; 34708public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 34712case SyntaxKind.SimpleMemberAccessExpression: 34713case SyntaxKind.PointerMemberAccessExpression: break; 34721case SyntaxKind.DotToken: 34722case SyntaxKind.MinusGreaterThanToken: break; 34746if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 34751var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); 34754var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); 34767if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 34772var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); 34775var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); 34791var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); 34794var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); 34807if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 34811var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); 34814var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); 34830var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); 34833var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); 34842public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 34846case SyntaxKind.AddExpression: 34847case SyntaxKind.SubtractExpression: 34848case SyntaxKind.MultiplyExpression: 34849case SyntaxKind.DivideExpression: 34850case SyntaxKind.ModuloExpression: 34851case SyntaxKind.LeftShiftExpression: 34852case SyntaxKind.RightShiftExpression: 34853case SyntaxKind.UnsignedRightShiftExpression: 34854case SyntaxKind.LogicalOrExpression: 34855case SyntaxKind.LogicalAndExpression: 34856case SyntaxKind.BitwiseOrExpression: 34857case SyntaxKind.BitwiseAndExpression: 34858case SyntaxKind.ExclusiveOrExpression: 34859case SyntaxKind.EqualsExpression: 34860case SyntaxKind.NotEqualsExpression: 34861case SyntaxKind.LessThanExpression: 34862case SyntaxKind.LessThanOrEqualExpression: 34863case SyntaxKind.GreaterThanExpression: 34864case SyntaxKind.GreaterThanOrEqualExpression: 34865case SyntaxKind.IsExpression: 34866case SyntaxKind.AsExpression: 34867case SyntaxKind.CoalesceExpression: break; 34875case SyntaxKind.PlusToken: 34876case SyntaxKind.MinusToken: 34877case SyntaxKind.AsteriskToken: 34878case SyntaxKind.SlashToken: 34879case SyntaxKind.PercentToken: 34880case SyntaxKind.LessThanLessThanToken: 34881case SyntaxKind.GreaterThanGreaterThanToken: 34882case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 34883case SyntaxKind.BarBarToken: 34884case SyntaxKind.AmpersandAmpersandToken: 34885case SyntaxKind.BarToken: 34886case SyntaxKind.AmpersandToken: 34887case SyntaxKind.CaretToken: 34888case SyntaxKind.EqualsEqualsToken: 34889case SyntaxKind.ExclamationEqualsToken: 34890case SyntaxKind.LessThanToken: 34891case SyntaxKind.LessThanEqualsToken: 34892case SyntaxKind.GreaterThanToken: 34893case SyntaxKind.GreaterThanEqualsToken: 34894case SyntaxKind.IsKeyword: 34895case SyntaxKind.AsKeyword: 34896case SyntaxKind.QuestionQuestionToken: break; 34915public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 34919case SyntaxKind.SimpleAssignmentExpression: 34920case SyntaxKind.AddAssignmentExpression: 34921case SyntaxKind.SubtractAssignmentExpression: 34922case SyntaxKind.MultiplyAssignmentExpression: 34923case SyntaxKind.DivideAssignmentExpression: 34924case SyntaxKind.ModuloAssignmentExpression: 34925case SyntaxKind.AndAssignmentExpression: 34926case SyntaxKind.ExclusiveOrAssignmentExpression: 34927case SyntaxKind.OrAssignmentExpression: 34928case SyntaxKind.LeftShiftAssignmentExpression: 34929case SyntaxKind.RightShiftAssignmentExpression: 34930case SyntaxKind.UnsignedRightShiftAssignmentExpression: 34931case SyntaxKind.CoalesceAssignmentExpression: break; 34939case SyntaxKind.EqualsToken: 34940case SyntaxKind.PlusEqualsToken: 34941case SyntaxKind.MinusEqualsToken: 34942case SyntaxKind.AsteriskEqualsToken: 34943case SyntaxKind.SlashEqualsToken: 34944case SyntaxKind.PercentEqualsToken: 34945case SyntaxKind.AmpersandEqualsToken: 34946case SyntaxKind.CaretEqualsToken: 34947case SyntaxKind.BarEqualsToken: 34948case SyntaxKind.LessThanLessThanEqualsToken: 34949case SyntaxKind.GreaterThanGreaterThanEqualsToken: 34950case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 34951case SyntaxKind.QuestionQuestionEqualsToken: break; 34975if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 34978if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 34982return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); 34989if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 34993var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); 34996var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); 35009if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 35013var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); 35016var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); 35025public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 35029case SyntaxKind.ArgListExpression: 35030case SyntaxKind.NumericLiteralExpression: 35031case SyntaxKind.StringLiteralExpression: 35032case SyntaxKind.Utf8StringLiteralExpression: 35033case SyntaxKind.CharacterLiteralExpression: 35034case SyntaxKind.TrueLiteralExpression: 35035case SyntaxKind.FalseLiteralExpression: 35036case SyntaxKind.NullLiteralExpression: 35037case SyntaxKind.DefaultLiteralExpression: break; 35044case SyntaxKind.ArgListKeyword: 35045case SyntaxKind.NumericLiteralToken: 35046case SyntaxKind.StringLiteralToken: 35047case SyntaxKind.Utf8StringLiteralToken: 35048case SyntaxKind.MultiLineRawStringLiteralToken: 35049case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 35050case SyntaxKind.SingleLineRawStringLiteralToken: 35051case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 35052case SyntaxKind.CharacterLiteralToken: 35053case SyntaxKind.TrueKeyword: 35054case SyntaxKind.FalseKeyword: 35055case SyntaxKind.NullKeyword: 35056case SyntaxKind.DefaultKeyword: break; 35078if (token.Kind != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 35082var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FieldExpression, token, out hash); 35085var result = new FieldExpressionSyntax(SyntaxKind.FieldExpression, token); 35098if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 35100if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35103if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35106return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); 35113if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 35115if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35118if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35121return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); 35128if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 35130if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35133if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 35136if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35139return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); 35142public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 35146case SyntaxKind.CheckedExpression: 35147case SyntaxKind.UncheckedExpression: break; 35154case SyntaxKind.CheckedKeyword: 35155case SyntaxKind.UncheckedKeyword: break; 35159if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35162if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35172if (keyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(keyword)); 35174if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35177if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35180return new UnsafeExpressionSyntax(SyntaxKind.UnsafeExpression, keyword, openParenToken, expression, closeParenToken); 35187if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 35189if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35192if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35195return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); 35202if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 35204if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35207if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35210return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); 35217if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 35219if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35222if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35225return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); 35236var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); 35239var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); 35256var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); 35259var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); 35272if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35274if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35278var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); 35281var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); 35294if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35296if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35300var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); 35303var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); 35319case SyntaxKind.RefKeyword: 35320case SyntaxKind.OutKeyword: 35321case SyntaxKind.InKeyword: 35322case SyntaxKind.None: break; 35330var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); 35333var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); 35350var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); 35353var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); 35370var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); 35373var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); 35390var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); 35393var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); 35406if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35409if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35413return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); 35420if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 35424return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); 35432if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 35435return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); 35442if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 35447var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); 35450var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); 35464if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 35467return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); 35470public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 35474case SyntaxKind.ObjectInitializerExpression: 35475case SyntaxKind.CollectionInitializerExpression: 35476case SyntaxKind.ArrayInitializerExpression: 35477case SyntaxKind.ComplexElementInitializerExpression: 35478case SyntaxKind.WithInitializerExpression: break; 35483if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35485if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35505if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35510var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); 35513var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); 35526if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35530return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); 35538if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 35543var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); 35546var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); 35562var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); 35565var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); 35578if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35580if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35582if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35585return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); 35592if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35597var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); 35600var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); 35613if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35615if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35617if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35621return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); 35628if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 35633var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); 35636var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); 35649if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 35651if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35653if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35657return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); 35664if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35666if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35670var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); 35673var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); 35689var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); 35692var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); 35705if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 35710var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); 35713var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); 35726if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 35731var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithElement, withKeyword, argumentList, out hash); 35734var result = new WithElementSyntax(SyntaxKind.WithElement, withKeyword, argumentList); 35751var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); 35754var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); 35770var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); 35773var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); 35786if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 35788if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35790if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 35794return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); 35801if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 35803if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35805if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 35809return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); 35816if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 35818if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35820if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 35823if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 35826if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 35830return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); 35837if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 35839if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35843var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); 35846var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); 35859if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 35864var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); 35867var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); 35880if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 35884var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); 35887var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); 35896public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 35900case SyntaxKind.AscendingOrdering: 35901case SyntaxKind.DescendingOrdering: break; 35910case SyntaxKind.AscendingKeyword: 35911case SyntaxKind.DescendingKeyword: 35912case SyntaxKind.None: break; 35935if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 35940var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); 35943var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); 35956if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 35959if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 35963return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); 35970if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 35972if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35977var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); 35980var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); 35993if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 35997var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); 36000var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); 36015case SyntaxKind.InterpolatedStringStartToken: 36016case SyntaxKind.InterpolatedVerbatimStringStartToken: 36017case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 36018case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 36024case SyntaxKind.InterpolatedStringEndToken: 36025case SyntaxKind.InterpolatedRawStringEndToken: break; 36031var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); 36034var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); 36048if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 36053var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); 36056var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); 36069if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 36074var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); 36077var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); 36090if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 36095var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); 36098var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); 36111if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 36115var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); 36118var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); 36135var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); 36138var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); 36151if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 36156var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); 36159var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); 36173return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); 36180if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36182if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36186var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); 36189var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); 36202if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36204if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36208var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); 36211var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); 36227var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); 36230var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); 36246var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); 36249var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); 36262if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36265if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36269var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); 36272var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); 36287case SyntaxKind.EqualsEqualsToken: 36288case SyntaxKind.ExclamationEqualsToken: 36289case SyntaxKind.LessThanToken: 36290case SyntaxKind.LessThanEqualsToken: 36291case SyntaxKind.GreaterThanToken: 36292case SyntaxKind.GreaterThanEqualsToken: break; 36299var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); 36302var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); 36318var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); 36321var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); 36330public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 36334case SyntaxKind.OrPattern: 36335case SyntaxKind.AndPattern: break; 36343case SyntaxKind.OrKeyword: 36344case SyntaxKind.AndKeyword: break; 36367if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 36372var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); 36375var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); 36388if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 36390if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 36393return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); 36400if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 36404var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); 36407var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); 36420if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 36424var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); 36427var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); 36440if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36443if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36446return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); 36457var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); 36460var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); 36474if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 36478var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); 36481var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); 36497var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); 36500var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); 36513if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36515if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36518return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); 36526if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36532case SyntaxKind.SemicolonToken: 36533case SyntaxKind.None: break; 36539return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); 36549case SyntaxKind.AwaitKeyword: 36550case SyntaxKind.None: break; 36558case SyntaxKind.UsingKeyword: 36559case SyntaxKind.None: break; 36565if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36568return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); 36578var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); 36581var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); 36594if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36598var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); 36601var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); 36614if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 36619var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); 36622var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); 36635if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36639var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); 36642var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); 36655if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 36659var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); 36662var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); 36675if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36677if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36681var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); 36684var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); 36698if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36702var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); 36705var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); 36718if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36722var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); 36725var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); 36738if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36740if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 36744return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); 36747public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 36751case SyntaxKind.GotoStatement: 36752case SyntaxKind.GotoCaseStatement: 36753case SyntaxKind.GotoDefaultStatement: break; 36758if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 36763case SyntaxKind.CaseKeyword: 36764case SyntaxKind.DefaultKeyword: 36765case SyntaxKind.None: break; 36770if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36780if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 36782if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36785return new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, name, semicolonToken); 36792if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 36794if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36797return new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, name, semicolonToken); 36804if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 36806if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36809return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); 36816if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 36818if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36821return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); 36824public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 36828case SyntaxKind.YieldReturnStatement: 36829case SyntaxKind.YieldBreakStatement: break; 36834if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 36838case SyntaxKind.ReturnKeyword: 36839case SyntaxKind.BreakKeyword: break; 36843if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36853if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 36855if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36858if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36862return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); 36869if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 36872if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 36874if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36877if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36879if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36882return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); 36889if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 36891if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36893if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 36895if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 36897if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36901return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); 36911case SyntaxKind.AwaitKeyword: 36912case SyntaxKind.None: break; 36917if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 36919if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36922if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36924if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 36927if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36931return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); 36941case SyntaxKind.AwaitKeyword: 36942case SyntaxKind.None: break; 36947if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 36949if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36952if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 36955if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36959return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); 36969case SyntaxKind.AwaitKeyword: 36970case SyntaxKind.None: break; 36975if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 36977if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36979if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36983return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); 36990if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 36992if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36995if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36999return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); 37002public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 37006case SyntaxKind.CheckedStatement: 37007case SyntaxKind.UncheckedStatement: break; 37014case SyntaxKind.CheckedKeyword: 37015case SyntaxKind.UncheckedKeyword: break; 37038if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 37043var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); 37046var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); 37059if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 37061if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37064if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37068return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); 37075if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 37077if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37080if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37084return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); 37091if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 37096var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); 37099var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); 37112if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 37117case SyntaxKind.OpenParenToken: 37118case SyntaxKind.None: break; 37127case SyntaxKind.CloseParenToken: 37128case SyntaxKind.None: break; 37133if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37135if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 37138return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); 37147var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); 37150var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); 37163if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 37168return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); 37175if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 37181var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); 37184var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); 37197if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 37202var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); 37205var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); 37219if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 37221if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37223if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 37226return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); 37234if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 37238return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); 37245if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 37249return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); 37256if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 37260return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); 37267if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37273case SyntaxKind.IdentifierToken: 37274case SyntaxKind.None: break; 37279if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37282return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); 37289if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 37291if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37294if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37297return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); 37304if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 37309var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); 37312var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); 37325if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 37328return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); 37335if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 37337if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 37339if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37341if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37344return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); 37354case SyntaxKind.GlobalKeyword: 37355case SyntaxKind.None: break; 37360if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 37365case SyntaxKind.StaticKeyword: 37366case SyntaxKind.None: break; 37374case SyntaxKind.UnsafeKeyword: 37375case SyntaxKind.None: break; 37381if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37384return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); 37391if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 37394if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37396if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 37401case SyntaxKind.SemicolonToken: 37402case SyntaxKind.None: break; 37408return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); 37415if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 37418if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37421return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); 37428if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 37430if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 37433return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); 37441if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37445var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); 37448var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); 37463return new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); 37470if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37472if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37476var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); 37479var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); 37495var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); 37498var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); 37512if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 37516var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); 37519var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); 37532if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 37534if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 37538var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); 37541var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); 37557case SyntaxKind.InKeyword: 37558case SyntaxKind.OutKeyword: 37559case SyntaxKind.None: break; 37564if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37568var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); 37571var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); 37584if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 37586if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37591case SyntaxKind.OpenBraceToken: 37592case SyntaxKind.None: break; 37600case SyntaxKind.CloseBraceToken: 37601case SyntaxKind.None: break; 37609case SyntaxKind.SemicolonToken: 37610case SyntaxKind.None: break; 37616return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37623if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); 37625if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37630case SyntaxKind.OpenBraceToken: 37631case SyntaxKind.None: break; 37639case SyntaxKind.CloseBraceToken: 37640case SyntaxKind.None: break; 37648case SyntaxKind.SemicolonToken: 37649case SyntaxKind.None: break; 37655return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37662if (keyword.Kind != SyntaxKind.UnionKeyword) throw new ArgumentException(nameof(keyword)); 37664if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37669case SyntaxKind.OpenBraceToken: 37670case SyntaxKind.None: break; 37678case SyntaxKind.CloseBraceToken: 37679case SyntaxKind.None: break; 37687case SyntaxKind.SemicolonToken: 37688case SyntaxKind.None: break; 37694return new UnionDeclarationSyntax(SyntaxKind.UnionDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37701if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 37703if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37708case SyntaxKind.OpenBraceToken: 37709case SyntaxKind.None: break; 37717case SyntaxKind.CloseBraceToken: 37718case SyntaxKind.None: break; 37726case SyntaxKind.SemicolonToken: 37727case SyntaxKind.None: break; 37733return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37736public 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) 37740case SyntaxKind.RecordDeclaration: 37741case SyntaxKind.RecordStructDeclaration: break; 37750case SyntaxKind.ClassKeyword: 37751case SyntaxKind.StructKeyword: 37752case SyntaxKind.None: break; 37757if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37762case SyntaxKind.OpenBraceToken: 37763case SyntaxKind.None: break; 37771case SyntaxKind.CloseBraceToken: 37772case SyntaxKind.None: break; 37780case SyntaxKind.SemicolonToken: 37781case SyntaxKind.None: break; 37794if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 37796if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37801case SyntaxKind.OpenBraceToken: 37802case SyntaxKind.None: break; 37810case SyntaxKind.CloseBraceToken: 37811case SyntaxKind.None: break; 37819case SyntaxKind.SemicolonToken: 37820case SyntaxKind.None: break; 37826return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37833if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 37836if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37839if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37842return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); 37849if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37852return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); 37859if (keyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 37864case SyntaxKind.OpenBraceToken: 37865case SyntaxKind.None: break; 37873case SyntaxKind.CloseBraceToken: 37874case SyntaxKind.None: break; 37882case SyntaxKind.SemicolonToken: 37883case SyntaxKind.None: break; 37889return new ExtensionBlockDeclarationSyntax(SyntaxKind.ExtensionBlockDeclaration, attributeLists.Node, modifiers.Node, keyword, typeParameterList, parameterList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37896if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37900var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); 37903var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); 37919var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); 37922var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); 37939var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); 37942var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); 37955if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 37958if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37961return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); 37968if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 37970if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37972if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37976var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); 37979var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); 37988public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 37992case SyntaxKind.ClassConstraint: 37993case SyntaxKind.StructConstraint: break; 38000case SyntaxKind.ClassKeyword: 38001case SyntaxKind.StructKeyword: break; 38008case SyntaxKind.QuestionToken: 38009case SyntaxKind.None: break; 38035var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); 38038var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); 38051if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 38055var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); 38058var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); 38071if (allowsKeyword.Kind != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 38075var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, out hash); 38078var result = new AllowsConstraintClauseSyntax(SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node); 38091if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 38093if (structKeyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 38097var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefStructConstraint, refKeyword, structKeyword, out hash); 38100var result = new RefStructConstraintSyntax(SyntaxKind.RefStructConstraint, refKeyword, structKeyword); 38114if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 38117return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); 38124if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 38127if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 38130return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); 38138if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38142var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); 38145var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); 38159if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38165case SyntaxKind.SemicolonToken: 38166case SyntaxKind.None: break; 38172return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); 38180if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38185case SyntaxKind.CheckedKeyword: 38186case SyntaxKind.None: break; 38193case SyntaxKind.PlusToken: 38194case SyntaxKind.MinusToken: 38195case SyntaxKind.ExclamationToken: 38196case SyntaxKind.TildeToken: 38197case SyntaxKind.PlusPlusToken: 38198case SyntaxKind.MinusMinusToken: 38199case SyntaxKind.AsteriskToken: 38200case SyntaxKind.SlashToken: 38201case SyntaxKind.PercentToken: 38202case SyntaxKind.LessThanLessThanToken: 38203case SyntaxKind.GreaterThanGreaterThanToken: 38204case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 38205case SyntaxKind.BarToken: 38206case SyntaxKind.AmpersandToken: 38207case SyntaxKind.CaretToken: 38208case SyntaxKind.EqualsEqualsToken: 38209case SyntaxKind.ExclamationEqualsToken: 38210case SyntaxKind.LessThanToken: 38211case SyntaxKind.LessThanEqualsToken: 38212case SyntaxKind.GreaterThanToken: 38213case SyntaxKind.GreaterThanEqualsToken: 38214case SyntaxKind.FalseKeyword: 38215case SyntaxKind.TrueKeyword: 38216case SyntaxKind.IsKeyword: 38217case SyntaxKind.PlusEqualsToken: 38218case SyntaxKind.MinusEqualsToken: 38219case SyntaxKind.AsteriskEqualsToken: 38220case SyntaxKind.SlashEqualsToken: 38221case SyntaxKind.PercentEqualsToken: 38222case SyntaxKind.AmpersandEqualsToken: 38223case SyntaxKind.BarEqualsToken: 38224case SyntaxKind.CaretEqualsToken: 38225case SyntaxKind.LessThanLessThanEqualsToken: 38226case SyntaxKind.GreaterThanGreaterThanEqualsToken: 38227case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 38235case SyntaxKind.SemicolonToken: 38236case SyntaxKind.None: break; 38242return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); 38251case SyntaxKind.ImplicitKeyword: 38252case SyntaxKind.ExplicitKeyword: break; 38256if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38261case SyntaxKind.CheckedKeyword: 38262case SyntaxKind.None: break; 38272case SyntaxKind.SemicolonToken: 38273case SyntaxKind.None: break; 38279return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); 38286if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38292case SyntaxKind.SemicolonToken: 38293case SyntaxKind.None: break; 38299return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); 38302public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 38306case SyntaxKind.BaseConstructorInitializer: 38307case SyntaxKind.ThisConstructorInitializer: break; 38312if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 38316case SyntaxKind.BaseKeyword: 38317case SyntaxKind.ThisKeyword: break; 38340if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 38342if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38348case SyntaxKind.SemicolonToken: 38349case SyntaxKind.None: break; 38355return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); 38363if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38368case SyntaxKind.SemicolonToken: 38369case SyntaxKind.None: break; 38375return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); 38382if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 38387var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); 38390var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); 38403if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 38406if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 38411case SyntaxKind.SemicolonToken: 38412case SyntaxKind.None: break; 38418return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); 38426if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 38432case SyntaxKind.SemicolonToken: 38433case SyntaxKind.None: break; 38439return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); 38446if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 38448if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 38452var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); 38455var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); 38464public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 38468case SyntaxKind.GetAccessorDeclaration: 38469case SyntaxKind.SetAccessorDeclaration: 38470case SyntaxKind.InitAccessorDeclaration: 38471case SyntaxKind.AddAccessorDeclaration: 38472case SyntaxKind.RemoveAccessorDeclaration: 38473case SyntaxKind.UnknownAccessorDeclaration: break; 38480case SyntaxKind.GetKeyword: 38481case SyntaxKind.SetKeyword: 38482case SyntaxKind.InitKeyword: 38483case SyntaxKind.AddKeyword: 38484case SyntaxKind.RemoveKeyword: 38485case SyntaxKind.IdentifierToken: break; 38492case SyntaxKind.SemicolonToken: 38493case SyntaxKind.None: break; 38506if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38508if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38512var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); 38515var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); 38528if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 38530if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 38534var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); 38537var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); 38553case SyntaxKind.IdentifierToken: 38554case SyntaxKind.ArgListKeyword: 38555case SyntaxKind.None: break; 38561return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); 38571var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); 38574var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); 38588return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); 38596return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); 38599public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 38603case SyntaxKind.SingleLineDocumentationCommentTrivia: 38604case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 38609if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 38622var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); 38625var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); 38639if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38644var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); 38647var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); 38663var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); 38666var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); 38679if (extensionKeyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 38682if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38686return new ExtensionMemberCrefSyntax(SyntaxKind.ExtensionMemberCref, extensionKeyword, typeArgumentList, parameters, dotToken, member); 38693if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 38697var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); 38700var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); 38713if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38718case SyntaxKind.CheckedKeyword: 38719case SyntaxKind.None: break; 38726case SyntaxKind.PlusToken: 38727case SyntaxKind.MinusToken: 38728case SyntaxKind.ExclamationToken: 38729case SyntaxKind.TildeToken: 38730case SyntaxKind.PlusPlusToken: 38731case SyntaxKind.MinusMinusToken: 38732case SyntaxKind.AsteriskToken: 38733case SyntaxKind.SlashToken: 38734case SyntaxKind.PercentToken: 38735case SyntaxKind.LessThanLessThanToken: 38736case SyntaxKind.GreaterThanGreaterThanToken: 38737case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 38738case SyntaxKind.BarToken: 38739case SyntaxKind.AmpersandToken: 38740case SyntaxKind.CaretToken: 38741case SyntaxKind.EqualsEqualsToken: 38742case SyntaxKind.ExclamationEqualsToken: 38743case SyntaxKind.LessThanToken: 38744case SyntaxKind.LessThanEqualsToken: 38745case SyntaxKind.GreaterThanToken: 38746case SyntaxKind.GreaterThanEqualsToken: 38747case SyntaxKind.FalseKeyword: 38748case SyntaxKind.TrueKeyword: 38749case SyntaxKind.PlusEqualsToken: 38750case SyntaxKind.MinusEqualsToken: 38751case SyntaxKind.AsteriskEqualsToken: 38752case SyntaxKind.SlashEqualsToken: 38753case SyntaxKind.PercentEqualsToken: 38754case SyntaxKind.AmpersandEqualsToken: 38755case SyntaxKind.BarEqualsToken: 38756case SyntaxKind.CaretEqualsToken: 38757case SyntaxKind.LessThanLessThanEqualsToken: 38758case SyntaxKind.GreaterThanGreaterThanEqualsToken: 38759case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 38764return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); 38773case SyntaxKind.ImplicitKeyword: 38774case SyntaxKind.ExplicitKeyword: break; 38778if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38783case SyntaxKind.CheckedKeyword: 38784case SyntaxKind.None: break; 38791return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); 38798if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38800if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38804var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); 38807var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); 38820if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 38822if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 38826var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); 38829var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); 38845case SyntaxKind.RefKeyword: 38846case SyntaxKind.OutKeyword: 38847case SyntaxKind.InKeyword: 38848case SyntaxKind.None: break; 38856case SyntaxKind.ReadOnlyKeyword: 38857case SyntaxKind.None: break; 38865var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); 38868var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); 38885var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); 38888var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); 38901if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 38904if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 38907return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); 38914if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 38917if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 38921var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); 38924var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); 38937if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 38940if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 38943return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); 38950if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 38954var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); 38957var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); 38970if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 38972if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 38976var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); 38979var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); 38993if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38997case SyntaxKind.SingleQuoteToken: 38998case SyntaxKind.DoubleQuoteToken: break; 39004case SyntaxKind.SingleQuoteToken: 39005case SyntaxKind.DoubleQuoteToken: break; 39010return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); 39018if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 39022case SyntaxKind.SingleQuoteToken: 39023case SyntaxKind.DoubleQuoteToken: break; 39030case SyntaxKind.SingleQuoteToken: 39031case SyntaxKind.DoubleQuoteToken: break; 39036return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); 39044if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 39048case SyntaxKind.SingleQuoteToken: 39049case SyntaxKind.DoubleQuoteToken: break; 39056case SyntaxKind.SingleQuoteToken: 39057case SyntaxKind.DoubleQuoteToken: break; 39062return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); 39071var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); 39074var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); 39087if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 39089if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 39093var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); 39096var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); 39109if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 39112if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 39115return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); 39122if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 39124if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 39128var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); 39131var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); 39144if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39146if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 39149if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39152return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); 39159if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39161if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 39164if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39167return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); 39174if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39176if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 39178if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39181return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); 39188if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39190if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 39192if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39195return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); 39202if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39204if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 39206if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39209return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); 39216if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39218if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 39220if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39223return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); 39230if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39232if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 39234if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39237return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); 39244if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39246if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 39248if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39251return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); 39258if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39261if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39264return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); 39271if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39273if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 39275if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 39277if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39280return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); 39287if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39289if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 39291if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 39293if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39296return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); 39303if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39305if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 39309case SyntaxKind.NumericLiteralToken: 39310case SyntaxKind.DefaultKeyword: 39311case SyntaxKind.HiddenKeyword: break; 39318case SyntaxKind.StringLiteralToken: 39319case SyntaxKind.None: break; 39324if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39327return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); 39334if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 39336if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 39338if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 39340if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 39342if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 39345return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); 39352if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39354if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 39357if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 39363case SyntaxKind.NumericLiteralToken: 39364case SyntaxKind.None: break; 39369if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39371if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39374return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); 39381if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39383if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 39385if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 39389case SyntaxKind.DisableKeyword: 39390case SyntaxKind.RestoreKeyword: break; 39394if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39397return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); 39404if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39406if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 39408if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 39410if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39412if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 39414if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 39416if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39419return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); 39426if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39428if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 39430if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39432if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39435return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); 39442if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39444if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 39446if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 39448if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39451return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); 39458if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39460if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 39462if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39465return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); 39472if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39474if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 39479case SyntaxKind.StringLiteralToken: 39480case SyntaxKind.None: break; 39485if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39488return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive); 39495if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39497if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 39501case SyntaxKind.EnableKeyword: 39502case SyntaxKind.DisableKeyword: 39503case SyntaxKind.RestoreKeyword: break; 39510case SyntaxKind.WarningsKeyword: 39511case SyntaxKind.AnnotationsKeyword: 39512case SyntaxKind.None: break; 39517if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39520return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
_generated\2\Syntax.xml.Syntax.Generated.cs (322)
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.UnsafeExpression"/></description></item> 2368/// <item><description><see cref="SyntaxKind.DefaultExpression"/></description></item> 2421/// <item><description><see cref="SyntaxKind.TypeOfExpression"/></description></item> 2474/// <item><description><see cref="SyntaxKind.SizeOfExpression"/></description></item> 2527/// <item><description><see cref="SyntaxKind.InvocationExpression"/></description></item> 2587/// <item><description><see cref="SyntaxKind.ElementAccessExpression"/></description></item> 2664/// <item><description><see cref="SyntaxKind.ArgumentList"/></description></item> 2724/// <item><description><see cref="SyntaxKind.BracketedArgumentList"/></description></item> 2784/// <item><description><see cref="SyntaxKind.Argument"/></description></item> 2868/// <item><description><see cref="SyntaxKind.ExpressionColon"/></description></item> 2913/// <item><description><see cref="SyntaxKind.NameColon"/></description></item> 2959/// <item><description><see cref="SyntaxKind.DeclarationExpression"/></description></item> 3016/// <item><description><see cref="SyntaxKind.CastExpression"/></description></item> 3120/// <item><description><see cref="SyntaxKind.AnonymousMethodExpression"/></description></item> 3251/// <item><description><see cref="SyntaxKind.SimpleLambdaExpression"/></description></item> 3365/// <item><description><see cref="SyntaxKind.RefExpression"/></description></item> 3408/// <item><description><see cref="SyntaxKind.ParenthesizedLambdaExpression"/></description></item> 3528/// <item><description><see cref="SyntaxKind.ObjectInitializerExpression"/></description></item> 3529/// <item><description><see cref="SyntaxKind.CollectionInitializerExpression"/></description></item> 3530/// <item><description><see cref="SyntaxKind.ArrayInitializerExpression"/></description></item> 3531/// <item><description><see cref="SyntaxKind.ComplexElementInitializerExpression"/></description></item> 3532/// <item><description><see cref="SyntaxKind.WithInitializerExpression"/></description></item> 3616/// <item><description><see cref="SyntaxKind.ImplicitObjectCreationExpression"/></description></item> 3684/// <item><description><see cref="SyntaxKind.ObjectCreationExpression"/></description></item> 3762/// <item><description><see cref="SyntaxKind.WithExpression"/></description></item> 3823/// <item><description><see cref="SyntaxKind.AnonymousObjectMemberDeclarator"/></description></item> 3881/// <item><description><see cref="SyntaxKind.AnonymousObjectCreationExpression"/></description></item> 3943/// <item><description><see cref="SyntaxKind.ArrayCreationExpression"/></description></item> 4007/// <item><description><see cref="SyntaxKind.ImplicitArrayCreationExpression"/></description></item> 4074/// <item><description><see cref="SyntaxKind.StackAllocArrayCreationExpression"/></description></item> 4136/// <item><description><see cref="SyntaxKind.ImplicitStackAllocArrayCreationExpression"/></description></item> 4190/// <item><description><see cref="SyntaxKind.CollectionExpression"/></description></item> 4253/// <item><description><see cref="SyntaxKind.ExpressionElement"/></description></item> 4292/// <item><description><see cref="SyntaxKind.SpreadElement"/></description></item> 4334/// <item><description><see cref="SyntaxKind.WithElement"/></description></item> 4396/// <item><description><see cref="SyntaxKind.QueryExpression"/></description></item> 4453/// <item><description><see cref="SyntaxKind.QueryBody"/></description></item> 4516/// <item><description><see cref="SyntaxKind.FromClause"/></description></item> 4581/// <item><description><see cref="SyntaxKind.LetClause"/></description></item> 4630/// <item><description><see cref="SyntaxKind.JoinClause"/></description></item> 4719/// <item><description><see cref="SyntaxKind.JoinIntoClause"/></description></item> 4761/// <item><description><see cref="SyntaxKind.WhereClause"/></description></item> 4803/// <item><description><see cref="SyntaxKind.OrderByClause"/></description></item> 4854/// <item><description><see cref="SyntaxKind.AscendingOrdering"/></description></item> 4855/// <item><description><see cref="SyntaxKind.DescendingOrdering"/></description></item> 4904/// <item><description><see cref="SyntaxKind.SelectClause"/></description></item> 4946/// <item><description><see cref="SyntaxKind.GroupClause"/></description></item> 5007/// <item><description><see cref="SyntaxKind.QueryContinuation"/></description></item> 5056/// <item><description><see cref="SyntaxKind.OmittedArraySizeExpression"/></description></item> 5095/// <item><description><see cref="SyntaxKind.InterpolatedStringExpression"/></description></item> 5146/// <item><description><see cref="SyntaxKind.IsPatternExpression"/></description></item> 5206/// <item><description><see cref="SyntaxKind.ThrowExpression"/></description></item> 5248/// <item><description><see cref="SyntaxKind.WhenClause"/></description></item> 5298/// <item><description><see cref="SyntaxKind.DiscardPattern"/></description></item> 5336/// <item><description><see cref="SyntaxKind.DeclarationPattern"/></description></item> 5391/// <item><description><see cref="SyntaxKind.VarPattern"/></description></item> 5433/// <item><description><see cref="SyntaxKind.RecursivePattern"/></description></item> 5511/// <item><description><see cref="SyntaxKind.PositionalPatternClause"/></description></item> 5565/// <item><description><see cref="SyntaxKind.PropertyPatternClause"/></description></item> 5619/// <item><description><see cref="SyntaxKind.Subpattern"/></description></item> 5674/// <item><description><see cref="SyntaxKind.ConstantPattern"/></description></item> 5714/// <item><description><see cref="SyntaxKind.ParenthesizedPattern"/></description></item> 5759/// <item><description><see cref="SyntaxKind.RelationalPattern"/></description></item> 5802/// <item><description><see cref="SyntaxKind.TypePattern"/></description></item> 5842/// <item><description><see cref="SyntaxKind.OrPattern"/></description></item> 5843/// <item><description><see cref="SyntaxKind.AndPattern"/></description></item> 5901/// <item><description><see cref="SyntaxKind.NotPattern"/></description></item> 5943/// <item><description><see cref="SyntaxKind.ListPattern"/></description></item> 6013/// <item><description><see cref="SyntaxKind.SlicePattern"/></description></item> 6063/// <item><description><see cref="SyntaxKind.InterpolatedStringText"/></description></item> 6102/// <item><description><see cref="SyntaxKind.Interpolation"/></description></item> 6173/// <item><description><see cref="SyntaxKind.InterpolationAlignmentClause"/></description></item> 6215/// <item><description><see cref="SyntaxKind.InterpolationFormatClause"/></description></item> 6258/// <item><description><see cref="SyntaxKind.GlobalStatement"/></description></item> 6346/// <item><description><see cref="SyntaxKind.Block"/></description></item> 6412/// <item><description><see cref="SyntaxKind.LocalFunctionStatement"/></description></item> 6544/// <item><description><see cref="SyntaxKind.LocalDeclarationStatement"/></description></item> 6639/// <item><description><see cref="SyntaxKind.VariableDeclaration"/></description></item> 6703/// <item><description><see cref="SyntaxKind.VariableDeclarator"/></description></item> 6768/// <item><description><see cref="SyntaxKind.EqualsValueClause"/></description></item> 6818/// <item><description><see cref="SyntaxKind.SingleVariableDesignation"/></description></item> 6856/// <item><description><see cref="SyntaxKind.DiscardDesignation"/></description></item> 6894/// <item><description><see cref="SyntaxKind.ParenthesizedVariableDesignation"/></description></item> 6948/// <item><description><see cref="SyntaxKind.ExpressionStatement"/></description></item> 7010/// <item><description><see cref="SyntaxKind.EmptyStatement"/></description></item> 7057/// <item><description><see cref="SyntaxKind.LabeledStatement"/></description></item> 7127/// <item><description><see cref="SyntaxKind.GotoStatement"/></description></item> 7128/// <item><description><see cref="SyntaxKind.GotoCaseStatement"/></description></item> 7129/// <item><description><see cref="SyntaxKind.GotoDefaultStatement"/></description></item> 7216/// <item><description><see cref="SyntaxKind.BreakStatement"/></description></item> 7284/// <item><description><see cref="SyntaxKind.ContinueStatement"/></description></item> 7352/// <item><description><see cref="SyntaxKind.ReturnStatement"/></description></item> 7417/// <item><description><see cref="SyntaxKind.ThrowStatement"/></description></item> 7482/// <item><description><see cref="SyntaxKind.YieldReturnStatement"/></description></item> 7483/// <item><description><see cref="SyntaxKind.YieldBreakStatement"/></description></item> 7551/// <item><description><see cref="SyntaxKind.WhileStatement"/></description></item> 7625/// <item><description><see cref="SyntaxKind.DoStatement"/></description></item> 7705/// <item><description><see cref="SyntaxKind.ForStatement"/></description></item> 7859/// <item><description><see cref="SyntaxKind.ForEachStatement"/></description></item> 7963/// <item><description><see cref="SyntaxKind.ForEachVariableStatement"/></description></item> 8069/// <item><description><see cref="SyntaxKind.UsingStatement"/></description></item> 8159/// <item><description><see cref="SyntaxKind.FixedStatement"/></description></item> 8234/// <item><description><see cref="SyntaxKind.CheckedStatement"/></description></item> 8235/// <item><description><see cref="SyntaxKind.UncheckedStatement"/></description></item> 8299/// <item><description><see cref="SyntaxKind.UnsafeStatement"/></description></item> 8363/// <item><description><see cref="SyntaxKind.LockStatement"/></description></item> 8440/// <item><description><see cref="SyntaxKind.IfStatement"/></description></item> 8539/// <item><description><see cref="SyntaxKind.ElseClause"/></description></item> 8585/// <item><description><see cref="SyntaxKind.SwitchStatement"/></description></item> 8702/// <item><description><see cref="SyntaxKind.SwitchSection"/></description></item> 8790/// <item><description><see cref="SyntaxKind.CasePatternSwitchLabel"/></description></item> 8858/// <item><description><see cref="SyntaxKind.CaseSwitchLabel"/></description></item> 8910/// <item><description><see cref="SyntaxKind.DefaultSwitchLabel"/></description></item> 8954/// <item><description><see cref="SyntaxKind.SwitchExpression"/></description></item> 9027/// <item><description><see cref="SyntaxKind.SwitchExpressionArm"/></description></item> 9091/// <item><description><see cref="SyntaxKind.TryStatement"/></description></item> 9168/// <item><description><see cref="SyntaxKind.CatchClause"/></description></item> 9235/// <item><description><see cref="SyntaxKind.CatchDeclaration"/></description></item> 9290/// <item><description><see cref="SyntaxKind.CatchFilterClause"/></description></item> 9338/// <item><description><see cref="SyntaxKind.FinallyClause"/></description></item> 9383/// <item><description><see cref="SyntaxKind.CompilationUnit"/></description></item> 9462/// <item><description><see cref="SyntaxKind.ExternAliasDirective"/></description></item> 9513/// <item><description><see cref="SyntaxKind.UsingDirective"/></description></item> 9673/// <item><description><see cref="SyntaxKind.NamespaceDeclaration"/></description></item> 9794/// <item><description><see cref="SyntaxKind.FileScopedNamespaceDeclaration"/></description></item> 9902/// <item><description><see cref="SyntaxKind.AttributeList"/></description></item> 9977/// <item><description><see cref="SyntaxKind.AttributeTargetSpecifier"/></description></item> 10021/// <item><description><see cref="SyntaxKind.Attribute"/></description></item> 10084/// <item><description><see cref="SyntaxKind.AttributeArgumentList"/></description></item> 10142/// <item><description><see cref="SyntaxKind.AttributeArgument"/></description></item> 10205/// <item><description><see cref="SyntaxKind.NameEquals"/></description></item> 10249/// <item><description><see cref="SyntaxKind.TypeParameterList"/></description></item> 10307/// <item><description><see cref="SyntaxKind.TypeParameter"/></description></item> 10460/// <item><description><see cref="SyntaxKind.ClassDeclaration"/></description></item> 10626/// <item><description><see cref="SyntaxKind.StructDeclaration"/></description></item> 10792/// <item><description><see cref="SyntaxKind.UnionDeclaration"/></description></item> 10960/// <item><description><see cref="SyntaxKind.InterfaceDeclaration"/></description></item> 11125/// <item><description><see cref="SyntaxKind.RecordDeclaration"/></description></item> 11126/// <item><description><see cref="SyntaxKind.RecordStructDeclaration"/></description></item> 11301/// <item><description><see cref="SyntaxKind.EnumDeclaration"/></description></item> 11438/// <item><description><see cref="SyntaxKind.DelegateDeclaration"/></description></item> 11550/// <item><description><see cref="SyntaxKind.EnumMemberDeclaration"/></description></item> 11627/// <item><description><see cref="SyntaxKind.ExtensionBlockDeclaration"/></description></item> 11775/// <item><description><see cref="SyntaxKind.BaseList"/></description></item> 11841/// <item><description><see cref="SyntaxKind.SimpleBaseType"/></description></item> 11881/// <item><description><see cref="SyntaxKind.PrimaryConstructorBaseType"/></description></item> 11940/// <item><description><see cref="SyntaxKind.TypeParameterConstraintClause"/></description></item> 12023/// <item><description><see cref="SyntaxKind.ConstructorConstraint"/></description></item> 12071/// <item><description><see cref="SyntaxKind.ClassConstraint"/></description></item> 12072/// <item><description><see cref="SyntaxKind.StructConstraint"/></description></item> 12123/// <item><description><see cref="SyntaxKind.TypeConstraint"/></description></item> 12164/// <item><description><see cref="SyntaxKind.DefaultConstraint"/></description></item> 12204/// <item><description><see cref="SyntaxKind.AllowsConstraintClause"/></description></item> 12266/// <item><description><see cref="SyntaxKind.RefStructConstraint"/></description></item> 12335/// <item><description><see cref="SyntaxKind.FieldDeclaration"/></description></item> 12414/// <item><description><see cref="SyntaxKind.EventFieldDeclaration"/></description></item> 12496/// <item><description><see cref="SyntaxKind.ExplicitInterfaceSpecifier"/></description></item> 12582/// <item><description><see cref="SyntaxKind.MethodDeclaration"/></description></item> 12732/// <item><description><see cref="SyntaxKind.OperatorDeclaration"/></description></item> 12878/// <item><description><see cref="SyntaxKind.ConversionOperatorDeclaration"/></description></item> 13024/// <item><description><see cref="SyntaxKind.ConstructorDeclaration"/></description></item> 13148/// <item><description><see cref="SyntaxKind.BaseConstructorInitializer"/></description></item> 13149/// <item><description><see cref="SyntaxKind.ThisConstructorInitializer"/></description></item> 13199/// <item><description><see cref="SyntaxKind.DestructorDeclaration"/></description></item> 13353/// <item><description><see cref="SyntaxKind.PropertyDeclaration"/></description></item> 13473/// <item><description><see cref="SyntaxKind.ArrowExpressionClause"/></description></item> 13515/// <item><description><see cref="SyntaxKind.EventDeclaration"/></description></item> 13625/// <item><description><see cref="SyntaxKind.IndexerDeclaration"/></description></item> 13745/// <item><description><see cref="SyntaxKind.AccessorList"/></description></item> 13792/// <item><description><see cref="SyntaxKind.GetAccessorDeclaration"/></description></item> 13793/// <item><description><see cref="SyntaxKind.SetAccessorDeclaration"/></description></item> 13794/// <item><description><see cref="SyntaxKind.InitAccessorDeclaration"/></description></item> 13795/// <item><description><see cref="SyntaxKind.AddAccessorDeclaration"/></description></item> 13796/// <item><description><see cref="SyntaxKind.RemoveAccessorDeclaration"/></description></item> 13797/// <item><description><see cref="SyntaxKind.UnknownAccessorDeclaration"/></description></item> 13918/// <item><description><see cref="SyntaxKind.ParameterList"/></description></item> 13977/// <item><description><see cref="SyntaxKind.BracketedParameterList"/></description></item> 14065/// <item><description><see cref="SyntaxKind.Parameter"/></description></item> 14161/// <item><description><see cref="SyntaxKind.FunctionPointerParameter"/></description></item> 14236/// <item><description><see cref="SyntaxKind.IncompleteMember"/></description></item> 14308/// <item><description><see cref="SyntaxKind.SkippedTokensTrivia"/></description></item> 14355/// <item><description><see cref="SyntaxKind.SingleLineDocumentationCommentTrivia"/></description></item> 14356/// <item><description><see cref="SyntaxKind.MultiLineDocumentationCommentTrivia"/></description></item> 14419/// <item><description><see cref="SyntaxKind.TypeCref"/></description></item> 14465/// <item><description><see cref="SyntaxKind.QualifiedCref"/></description></item> 14544/// <item><description><see cref="SyntaxKind.NameMemberCref"/></description></item> 14605/// <item><description><see cref="SyntaxKind.ExtensionMemberCref"/></description></item> 14683/// <item><description><see cref="SyntaxKind.IndexerMemberCref"/></description></item> 14736/// <item><description><see cref="SyntaxKind.OperatorMemberCref"/></description></item> 14802/// <item><description><see cref="SyntaxKind.ConversionOperatorMemberCref"/></description></item> 14902/// <item><description><see cref="SyntaxKind.CrefParameterList"/></description></item> 14963/// <item><description><see cref="SyntaxKind.CrefBracketedParameterList"/></description></item> 15027/// <item><description><see cref="SyntaxKind.CrefParameter"/></description></item> 15094/// <item><description><see cref="SyntaxKind.XmlElement"/></description></item> 15158/// <item><description><see cref="SyntaxKind.XmlElementStartTag"/></description></item> 15221/// <item><description><see cref="SyntaxKind.XmlElementEndTag"/></description></item> 15266/// <item><description><see cref="SyntaxKind.XmlEmptyElement"/></description></item> 15329/// <item><description><see cref="SyntaxKind.XmlName"/></description></item> 15371/// <item><description><see cref="SyntaxKind.XmlPrefix"/></description></item> 15436/// <item><description><see cref="SyntaxKind.XmlTextAttribute"/></description></item> 15500/// <item><description><see cref="SyntaxKind.XmlCrefAttribute"/></description></item> 15568/// <item><description><see cref="SyntaxKind.XmlNameAttribute"/></description></item> 15636/// <item><description><see cref="SyntaxKind.XmlText"/></description></item> 15683/// <item><description><see cref="SyntaxKind.XmlCDataSection"/></description></item> 15736/// <item><description><see cref="SyntaxKind.XmlProcessingInstruction"/></description></item> 15793/// <item><description><see cref="SyntaxKind.XmlComment"/></description></item> 15891/// <item><description><see cref="SyntaxKind.IfDirectiveTrivia"/></description></item> 15951/// <item><description><see cref="SyntaxKind.ElifDirectiveTrivia"/></description></item> 16011/// <item><description><see cref="SyntaxKind.ElseDirectiveTrivia"/></description></item> 16063/// <item><description><see cref="SyntaxKind.EndIfDirectiveTrivia"/></description></item> 16112/// <item><description><see cref="SyntaxKind.RegionDirectiveTrivia"/></description></item> 16161/// <item><description><see cref="SyntaxKind.EndRegionDirectiveTrivia"/></description></item> 16210/// <item><description><see cref="SyntaxKind.ErrorDirectiveTrivia"/></description></item> 16259/// <item><description><see cref="SyntaxKind.WarningDirectiveTrivia"/></description></item> 16308/// <item><description><see cref="SyntaxKind.BadDirectiveTrivia"/></description></item> 16357/// <item><description><see cref="SyntaxKind.DefineDirectiveTrivia"/></description></item> 16409/// <item><description><see cref="SyntaxKind.UndefDirectiveTrivia"/></description></item> 16480/// <item><description><see cref="SyntaxKind.LineDirectiveTrivia"/></description></item> 16544/// <item><description><see cref="SyntaxKind.LineDirectivePosition"/></description></item> 16594/// <item><description><see cref="SyntaxKind.LineSpanDirectiveTrivia"/></description></item> 16681/// <item><description><see cref="SyntaxKind.PragmaWarningDirectiveTrivia"/></description></item> 16749/// <item><description><see cref="SyntaxKind.PragmaChecksumDirectiveTrivia"/></description></item> 16810/// <item><description><see cref="SyntaxKind.ReferenceDirectiveTrivia"/></description></item> 16862/// <item><description><see cref="SyntaxKind.LoadDirectiveTrivia"/></description></item> 16914/// <item><description><see cref="SyntaxKind.ShebangDirectiveTrivia"/></description></item> 16963/// <item><description><see cref="SyntaxKind.IgnoredDirectiveTrivia"/></description></item> 17022/// <item><description><see cref="SyntaxKind.NullableDirectiveTrivia"/></description></item>
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)) 3405else if (node.Kind() == SyntaxKind.AwaitExpression && memberSymbol.Name == WellKnownMemberNames.GetAwaiter) 3427if (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: 426bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 428SyntaxKind operatorTokenKind = syntax.OperatorToken.Kind(); 448if (operatorTokenKind is SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken && parameterListSyntax?.Parameters.Count == 0) 472bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 476if (syntax.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword) 1143if (refKind == RefKind.Ref && parameter.ReadOnlyKeyword.IsKind(SyntaxKind.ReadOnlyKeyword)) 1189if (typeSyntax.Parent.Kind() == SyntaxKind.ConversionOperatorMemberCref) 1235return 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 (221)
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.UnsafeExpression: 768case SyntaxKind.DefaultExpression: 771case SyntaxKind.TypeOfExpression: 774case SyntaxKind.SizeOfExpression: 777case SyntaxKind.AddAssignmentExpression: 778case SyntaxKind.AndAssignmentExpression: 779case SyntaxKind.DivideAssignmentExpression: 780case SyntaxKind.ExclusiveOrAssignmentExpression: 781case SyntaxKind.LeftShiftAssignmentExpression: 782case SyntaxKind.ModuloAssignmentExpression: 783case SyntaxKind.MultiplyAssignmentExpression: 784case SyntaxKind.OrAssignmentExpression: 785case SyntaxKind.RightShiftAssignmentExpression: 786case SyntaxKind.UnsignedRightShiftAssignmentExpression: 787case SyntaxKind.SubtractAssignmentExpression: 790case SyntaxKind.CoalesceAssignmentExpression: 793case SyntaxKind.AliasQualifiedName: 794case SyntaxKind.PredefinedType: 797case SyntaxKind.QueryExpression: 800case SyntaxKind.AnonymousObjectCreationExpression: 803case SyntaxKind.QualifiedName: 806case SyntaxKind.ComplexElementInitializerExpression: 809case SyntaxKind.ArgListExpression: 812case SyntaxKind.RefTypeExpression: 815case SyntaxKind.MakeRefExpression: 818case SyntaxKind.RefValueExpression: 821case SyntaxKind.AwaitExpression: 824case SyntaxKind.OmittedArraySizeExpression: 825case SyntaxKind.OmittedTypeArgument: 826case SyntaxKind.ObjectInitializerExpression: 831case SyntaxKind.CollectionExpression: 834case SyntaxKind.NullableType: 843case SyntaxKind.InterpolatedStringExpression: 846case SyntaxKind.IsPatternExpression: 849case SyntaxKind.TupleExpression: 852case SyntaxKind.ThrowExpression: 855case SyntaxKind.RefType: 858case SyntaxKind.ScopedType: 861case SyntaxKind.RefExpression: 864case SyntaxKind.DeclarationExpression: 867case SyntaxKind.SuppressNullableWarningExpression: 870case SyntaxKind.WithExpression: 939case SyntaxKind.ConditionalExpression: // ?: 944case SyntaxKind.CoalesceExpression: // ?? 949case SyntaxKind.SwitchExpressionArm: 950case SyntaxKind.ArrowExpressionClause: 951case SyntaxKind.ParenthesizedLambdaExpression: 952case SyntaxKind.SimpleLambdaExpression: 986case SyntaxKind.SingleVariableDesignation: 992case SyntaxKind.DiscardDesignation: 996case SyntaxKind.ParenthesizedVariableDesignation: 1683SeparatedSyntaxList<TypeSyntax> typeArgumentList = node.Kind() == SyntaxKind.GenericName 1738if (!isNamedType && (hasTypeArguments || node.Kind() == SyntaxKind.GenericName)) 1944return (parent?.Kind() == SyntaxKind.Argument && 1945((ArgumentSyntax)parent).RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword); 2489if (node.Kind() == SyntaxKind.PredefinedType) 2647else if (this.ContainingType is null || node.Parent is null || (node.Parent.Kind() != SyntaxKind.SimpleMemberAccessExpression && node.Parent.Kind() != SyntaxKind.ElementAccessExpression)) 2681Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken)); 3075case SyntaxKind.PredefinedType: 3078case SyntaxKind.SimpleLambdaExpression: 3081case SyntaxKind.ParenthesizedExpression: 3084case SyntaxKind.CastExpression: 3087case SyntaxKind.SimpleMemberAccessExpression: 3088case SyntaxKind.PointerMemberAccessExpression: 3090case SyntaxKind.MemberBindingExpression: 3148case SyntaxKind.ParenthesizedLambdaExpression: 3149case SyntaxKind.SimpleLambdaExpression: 3150case SyntaxKind.AnonymousMethodExpression: 3151case SyntaxKind.InvocationExpression: 3152case SyntaxKind.ObjectCreationExpression: 3153case SyntaxKind.ImplicitObjectCreationExpression: 3154case SyntaxKind.ParenthesizedExpression: // this is never allowed in legacy compiler 3155case SyntaxKind.DeclarationExpression: 3205if (argumentSyntax.RefOrOutKeyword.Kind() != SyntaxKind.None) 3213if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.InKeyword)) 3216if (argumentSyntax.Expression.Kind() == SyntaxKind.DeclarationExpression) 3218if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.OutKeyword)) 3238case SyntaxKind.DiscardDesignation: 3261case SyntaxKind.SingleVariableDesignation: 4160if (arg.Kind() != SyntaxKind.OmittedArraySizeExpression) 4181if (dimension.Kind() != SyntaxKind.OmittedArraySizeExpression) 4308if (expression.Kind() == SyntaxKind.ArrayInitializerExpression) 4387if (expr.Kind() == SyntaxKind.ArrayInitializerExpression) 4511creationSyntax.Kind() == SyntaxKind.ArrayCreationExpression || 4512creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4515Debug.Assert(boundInitExprOpt.IsDefault || creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4545var isInferred = creationSyntax.IsKind(SyntaxKind.ImplicitArrayCreationExpression); 4580initSyntax.Parent.Kind() != SyntaxKind.EqualsValueClause || 4590if (typeSyntax.Kind() != SyntaxKind.ArrayType) 4626if (size.Kind() != SyntaxKind.OmittedArraySizeExpression) 4643if (countSyntax.Kind() != SyntaxKind.OmittedArraySizeExpression) 4713typeSyntax: node.Kind() == SyntaxKind.StackAllocArrayCreationExpression 4734if (!equalsValueClause.IsKind(SyntaxKind.EqualsValueClause)) 4741if (!variableDeclarator.IsKind(SyntaxKind.VariableDeclarator)) 4747if (!variableDeclaration.IsKind(SyntaxKind.VariableDeclaration)) 4753variableDeclaration.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) || 4754variableDeclaration.Parent.IsKind(SyntaxKind.ForStatement); 4769Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 4806bool isInferred = node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression); 4955initializerArgumentListOpt.Parent.Kind() != SyntaxKind.ThisConstructorInitializer; 4998Debug.Assert(initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer); 5105(initializerArgumentListOpt != null && initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer)); 5714else if (node.Type.Kind() == SyntaxKind.TupleType) 5809case SyntaxKind.ObjectInitializerExpression: 5813case SyntaxKind.WithInitializerExpression: 5817case SyntaxKind.CollectionInitializerExpression: 5838case SyntaxKind.ObjectInitializerExpression: 5839case SyntaxKind.CollectionInitializerExpression: 5840Debug.Assert(syntax.Parent.Parent.Kind() != SyntaxKind.WithInitializerExpression); 5860Debug.Assert(initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression || 5861initializerSyntax.Kind() == SyntaxKind.WithInitializerExpression); 5864if (initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression) 5898case SyntaxKind.SimpleAssignmentExpression: 5929case SyntaxKind.IdentifierName: 5968SyntaxKind rhsKind = namedAssignment.Right.Kind(); 5969bool isRef = rhsKind is SyntaxKind.RefExpression; 5970bool isRhsNestedInitializer = rhsKind is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression; 6001if (leftSyntax.Kind() == SyntaxKind.IdentifierName) 6045else if (leftSyntax.Kind() == SyntaxKind.ImplicitElementAccess) 6281Debug.Assert(memberInitializerSyntax.Kind() == SyntaxKind.SimpleAssignmentExpression); 6415Debug.Assert(initializerSyntax.Kind() == SyntaxKind.CollectionInitializerExpression); 6503if (elementInitializer.Kind() == SyntaxKind.ComplexElementInitializerExpression) 6569Debug.Assert(node.Kind() == SyntaxKind.ComplexElementInitializerExpression); 7544if (node.Kind() is SyntaxKind.NumericLiteralExpression) 7587if (node.Token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 7597Debug.Assert(node.Kind() == SyntaxKind.Utf8StringLiteralExpression); 7598Debug.Assert(node.Token.Kind() is SyntaxKind.Utf8StringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken); 7600if (node.Token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 7648if (node.Kind() == SyntaxKind.SimpleMemberAccessExpression) 7655Debug.Assert(node.Kind() == SyntaxKind.PointerMemberAccessExpression); 7709Debug.Assert((left.Parent is MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess && memberAccess.Expression == left) || 7837SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? 7868if (!hasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 7966var typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? ((GenericNameSyntax)right).TypeArgumentList.Arguments : default(SeparatedSyntaxList<TypeSyntax>); 8402if (!boundMethodGroup.HasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 8468(node.Kind() == SyntaxKind.AwaitExpression && plainName == WellKnownMemberNames.GetResult) || 11164var name = candidate.IsIndexer ? SyntaxFacts.GetText(SyntaxKind.ThisKeyword) : candidate.Name; 12414case SyntaxKind.ExpressionStatement: 12418case SyntaxKind.SimpleLambdaExpression: 12422case SyntaxKind.ParenthesizedLambdaExpression: 12426case SyntaxKind.ArrowExpressionClause: 12430case SyntaxKind.ForStatement: 12479while (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()) 1382WarnOnAccessOfOffDefault(node.Kind() == SyntaxKind.InvocationExpression ? 1960case SyntaxKind.QualifiedName: 1963case SyntaxKind.SimpleMemberAccessExpression: 1964case SyntaxKind.PointerMemberAccessExpression: 2486case SyntaxKind.IdentifierName: 2492case SyntaxKind.GenericName: 2498case SyntaxKind.SimpleMemberAccessExpression: 2504case SyntaxKind.BaseExpression: 2505case SyntaxKind.ThisExpression: 2514case SyntaxKind.AliasQualifiedName: 2526case SyntaxKind.ThisExpression: 2527case SyntaxKind.BaseExpression: 2528case SyntaxKind.PredefinedType: 2550this.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 (85)
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 GetUnaryAssignmentKind(SyntaxKind kind) 4656case SyntaxKind.PreDecrementExpression: 4657case SyntaxKind.PreIncrementExpression: 4658case SyntaxKind.PostDecrementExpression: 4659case SyntaxKind.PostIncrementExpression: 4661case SyntaxKind.AddressOfExpression: 4683if (node.Kind() != SyntaxKind.UnaryMinusExpression) 4688if (node.Operand != operand.Syntax || operand.Syntax.Kind() != SyntaxKind.NumericLiteralExpression) 4781Error(diagnostics, ErrorCode.ERR_BadUnaryOp, node, SyntaxFacts.GetText(SyntaxKind.IsKeyword), operand.Display);
Binder\Binder_Patterns.cs (17)
1067case SyntaxKind.DefaultLiteralExpression: 1071case SyntaxKind.ParenthesizedExpression: 1074case SyntaxKind.SuppressNullableWarningExpression: 1952if (node.Designation?.Kind() == SyntaxKind.SingleVariableDesignation) 2057if ((inputType.IsPointerOrFunctionPointer() && node.Designation.Kind() == SyntaxKind.ParenthesizedVariableDesignation) 2087case SyntaxKind.DiscardDesignation: 2092case SyntaxKind.SingleVariableDesignation: 2105node.Parent.Kind() == SyntaxKind.VarPattern ? node.Parent : node, // for `var x` use whole pattern, otherwise use designation for the syntax 2109case SyntaxKind.ParenthesizedVariableDesignation: 2311case MemberAccessExpressionSyntax { Name: IdentifierNameSyntax name } memberAccess when memberAccess.IsKind(SyntaxKind.SimpleMemberAccessExpression): 2511static BinaryOperatorKind tokenKindToBinaryOperatorKind(SyntaxKind kind) => kind switch 2513SyntaxKind.LessThanEqualsToken => BinaryOperatorKind.LessThanOrEqual, 2514SyntaxKind.LessThanToken => BinaryOperatorKind.LessThan, 2515SyntaxKind.GreaterThanToken => BinaryOperatorKind.GreaterThan, 2516SyntaxKind.GreaterThanEqualsToken => BinaryOperatorKind.GreaterThanOrEqual, 2582permitDesignations = permitDesignations && currentNode.IsKind(SyntaxKind.AndPattern); 2629bool 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) 1723case SyntaxKind.SimpleMemberAccessExpression: 1724case SyntaxKind.PointerMemberAccessExpression: 1727case SyntaxKind.IdentifierName: 1730case SyntaxKind.ElementAccessExpression: 1772case SyntaxKind.SimpleMemberAccessExpression: 1773case SyntaxKind.PointerMemberAccessExpression: 1775case SyntaxKind.QualifiedName: 1778case SyntaxKind.IdentifierName: 1780case SyntaxKind.MemberBindingExpression: 1874if (node.Kind() != SyntaxKind.ArrayInitializerExpression) 1946hasUnsafeModifier: node.Parent?.Kind() == SyntaxKind.UnsafeStatement, 2291if (sourceType.SpecialType == SpecialType.System_Double && syntax.Kind() == SyntaxKind.NumericLiteralExpression && 2494while (nodeForError.Kind() == SyntaxKind.ParenthesizedExpression) 2499if (nodeForError.Kind() == SyntaxKind.SimpleMemberAccessExpression || nodeForError.Kind() == SyntaxKind.PointerMemberAccessExpression) 3624return new BoundBlock(node, locals, ImmutableArray.Create(statement)) { WasCompilerGenerated = node.Kind() != SyntaxKind.ArrowExpressionClause }; 3629return IsValidStatementExpression(expressionSyntax, expression) || expressionSyntax.Kind() == SyntaxKind.ThrowExpression; 3693Debug.Assert(body.Kind() != SyntaxKind.RefExpression); 3719if (method.Kind() == SyntaxKind.ConstructorDeclaration) 3772Debug.Assert(typeDecl.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration); 3815bool thisInitializer = initializer?.IsKind(SyntaxKind.ThisConstructorInitializer) == true; 4001if (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)
199Debug.Assert((node.Kind() == SyntaxKind.SizeOfExpression) == ((object?)sizeOfTypeOpt != null), "Should have a type for (only) sizeof expressions.");
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 && 140case GotoStatementSyntax { RawKind: (int)SyntaxKind.GotoStatement }: 164!(expression.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 231case MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess when memberAccess.Expression == id: 376case SyntaxKind.SelectClause: 387case SyntaxKind.GroupClause: 419case SyntaxKind.WhereClause: 421case SyntaxKind.JoinClause: 423case SyntaxKind.OrderByClause: 425case SyntaxKind.FromClause: 427case SyntaxKind.LetClause:
Binder\Binder.ValueChecks.cs (3)
743Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 1282!parenthesized.Expression.IsKind(SyntaxKind.ParenthesizedExpression) && 1293return parenthesized.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.SubtractExpression } binary &&
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_CheckOrReachability.cs (3)
178if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 195if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 284return syntax.Kind() == SyntaxKind.NotPattern;
Binder\DecisionDagBuilder.cs (2)
155if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 3507if (e.Syntax.IsKind(SyntaxKind.ListPattern))
Binder\EarlyWellKnownAttributeBinder.cs (49)
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: 110case SyntaxKind.UnsafeExpression: 113case SyntaxKind.DefaultExpression: 116case SyntaxKind.UnaryPlusExpression: 117case SyntaxKind.UnaryMinusExpression: 118case SyntaxKind.LogicalNotExpression: 119case SyntaxKind.BitwiseNotExpression: 122case SyntaxKind.AddExpression: 123case SyntaxKind.MultiplyExpression: 124case SyntaxKind.SubtractExpression: 125case SyntaxKind.DivideExpression: 126case SyntaxKind.ModuloExpression: 127case SyntaxKind.LeftShiftExpression: 128case SyntaxKind.RightShiftExpression: 129case SyntaxKind.UnsignedRightShiftExpression: 130case SyntaxKind.BitwiseAndExpression: 131case SyntaxKind.BitwiseOrExpression: 132case SyntaxKind.ExclusiveOrExpression: 133case SyntaxKind.LogicalAndExpression: 134case SyntaxKind.LogicalOrExpression: 135case SyntaxKind.EqualsExpression: 136case SyntaxKind.NotEqualsExpression: 137case SyntaxKind.GreaterThanExpression: 138case SyntaxKind.LessThanExpression: 139case SyntaxKind.GreaterThanOrEqualExpression: 140case SyntaxKind.LessThanOrEqualExpression: 141case SyntaxKind.InvocationExpression: // To support nameof(); anything else will be a compile-time error 142case 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); 693Binder binder = _enclosing.WithCheckedOrUncheckedRegion(@checked: node.Kind() == SyntaxKind.CheckedStatement); 767case SyntaxKind.CasePatternSwitchLabel: 777case SyntaxKind.CaseSwitchLabel: 1054case SyntaxKind.LocalDeclarationStatement: 1055case SyntaxKind.LabeledStatement: 1056case SyntaxKind.LocalFunctionStatement: 1060case SyntaxKind.ExpressionStatement: 1061case SyntaxKind.LockStatement: 1062case SyntaxKind.IfStatement: 1063case SyntaxKind.YieldReturnStatement: 1064case SyntaxKind.ReturnStatement: 1065case SyntaxKind.ThrowStatement: 1070case SyntaxKind.SwitchStatement: 1119if (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_Patterns.cs (4)
104if (!label.HasErrors && isSubsumed(label, reachableLabels) && label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 246case SyntaxKind.CaseSwitchLabel: 259case SyntaxKind.DefaultSwitchLabel: 277case SyntaxKind.CasePatternSwitchLabel:
Binder\SwitchBinder.cs (10)
103SyntaxKind labelKind = label.IdentifierNodeOrToken.Kind(); 104if (labelKind == SyntaxKind.IdentifierToken) 116else 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\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) 397case SyntaxKind.SwitchStatement: 406case SyntaxKind.ForStatement: 422case SyntaxKind.ForEachStatement: 423case SyntaxKind.ForEachVariableStatement: 425var start = stmt.Kind() == SyntaxKind.ForEachVariableStatement ? foreachStmt.InKeyword : foreachStmt.OpenParenToken; 449if (expression.Kind() == SyntaxKind.DeclarationExpression) 858else if (paramList.Parent.Kind() == SyntaxKind.LocalFunctionStatement) 926if (node.Kind() != SyntaxKind.AwaitExpression) 938if (node.UsingKeyword.IsKind(SyntaxKind.None) || node.AwaitKeyword.IsKind(SyntaxKind.None)) 950if (node.AwaitKeyword.IsKind(SyntaxKind.None)) 1378if (bindableParent != null && bindableParent.Kind() == SyntaxKind.SimpleMemberAccessExpression && ((MemberAccessExpressionSyntax)bindableParent).Expression == bindableNode) 1593case SyntaxKind.ThisConstructorInitializer: 1594case SyntaxKind.BaseConstructorInitializer: 1595case SyntaxKind.PrimaryConstructorBaseType: 1597case SyntaxKind.ArrowExpressionClause: 1600if (current.Parent == null || current.Parent.Kind() != SyntaxKind.LocalFunctionStatement) 2212case SyntaxKind.GetAccessorDeclaration: 2213case SyntaxKind.SetAccessorDeclaration: 2214case SyntaxKind.InitAccessorDeclaration: 2215case SyntaxKind.AddAccessorDeclaration: 2216case SyntaxKind.RemoveAccessorDeclaration: 2217case SyntaxKind.MethodDeclaration: 2218case SyntaxKind.ConstructorDeclaration: 2219case SyntaxKind.DestructorDeclaration: 2220case SyntaxKind.OperatorDeclaration: 2221case SyntaxKind.ConversionOperatorDeclaration: 2222case SyntaxKind.GlobalStatement: 2223case SyntaxKind.Subpattern: 2225case SyntaxKind.PositionalPatternClause: 2246case PostfixUnaryExpressionSyntax { RawKind: (int)SyntaxKind.SuppressNullableWarningExpression } n: 2267case SyntaxKind.IdentifierName: 2268case SyntaxKind.GenericName: 2277case SyntaxKind.AnonymousObjectMemberDeclarator: 2280case SyntaxKind.VariableDeclarator: // declarators are mapped in SyntaxBinder 2286Debug.Assert(parent.Kind() == SyntaxKind.VariableDeclaration); 2288if (grandparent != null && grandparent.Kind() == SyntaxKind.LocalDeclarationStatement && 2350case SyntaxKind.ParenthesizedExpression: 2351case SyntaxKind.RefExpression: 2352case SyntaxKind.RefType: 2353case SyntaxKind.ScopedType: 2373case { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, Parent.RawKind: (int)SyntaxKind.InvocationExpression }: 2379case { 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_RegionAnalysisContext.cs (1)
22while (expression.Kind() == SyntaxKind.ParenthesizedExpression)
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);
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)
2207case GotoStatementSyntax { RawKind: (int)SyntaxKind.GotoStatement }: 2217!(expression.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 2249assignment.Parent?.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 2257!(id.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 2304if (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) 7513if (syntax.Kind() != SyntaxKind.InvocationExpression) 7530return 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)
645case SyntaxKind.ParenthesizedLambdaExpression: 648if (lambdaSyntax.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword) 652else if (lambdaSyntax.Body.Kind() == SyntaxKind.Block) 656else if (lambdaSyntax.Body.Kind() == SyntaxKind.RefExpression) 663case SyntaxKind.SimpleLambdaExpression: 666if (lambdaSyntax.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword) 670else if (lambdaSyntax.Body.Kind() == SyntaxKind.Block) 674else if (lambdaSyntax.Body.Kind() == SyntaxKind.RefExpression) 681case 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_SequencePoints.cs (7)
98case SyntaxKind.EventFieldDeclaration: 99case SyntaxKind.FieldDeclaration: 106case SyntaxKind.LocalDeclarationStatement: 110Debug.Assert(!modifiers.Any(SyntaxKind.ConstKeyword)); // const locals don't have a sequence point 120case SyntaxKind.UsingStatement: 121case SyntaxKind.FixedStatement: 122case SyntaxKind.ForStatement:
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\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_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\LocalRewriter\LocalRewriter.cs (4)
872if (syntax.IsKind(SyntaxKind.Parameter)) 878if (syntax is ExpressionSyntax { Parent: { } parent } && parent.Kind() == SyntaxKind.EqualsValueClause) // Should be the initial value. 883case SyntaxKind.VariableDeclarator: 884case SyntaxKind.PropertyDeclaration:
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
589loweredInput.Syntax.Kind() == SyntaxKind.TupleExpression &&
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_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\LanguageParser.cs (2292)
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); 2649case SyntaxKind.UnsafeKeyword: 2650if (this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 2654else if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2660case SyntaxKind.FixedKeyword: 2661if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2667case SyntaxKind.DelegateKeyword: 2677case SyntaxKind.NewKeyword: 2693if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2706this.AddError(SyntaxFactory.MissingToken(SyntaxKind.VoidKeyword), ErrorCode.ERR_MemberNeedsType)); 2727if (this.CurrentToken.Kind == SyntaxKind.ConstKeyword) 2740if (this.CurrentToken.Kind == SyntaxKind.EventKeyword) 2746if (this.CurrentToken.Kind == SyntaxKind.FixedKeyword) 2758if (this.CurrentToken.Kind == SyntaxKind.NamespaceKeyword) 2776if ((!haveAttributes || !IsScript) && !haveModifiers && (type.Kind == SyntaxKind.RefType || !IsOperatorStart(out _, advanceParser: false))) 2780if (this.CurrentToken.Kind is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken && 2868!type.IsMissing && type.Kind != SyntaxKind.RefType && 3002case SyntaxKind.LocalFunctionStatement: 3003case SyntaxKind.ExpressionStatement when 3007statement is ExpressionStatementSyntax { Expression.Kind: SyntaxKind.IdentifierName, SemicolonToken.IsMissing: true }: 3011case SyntaxKind.LocalDeclarationStatement: 3021if (CurrentToken.Kind == SyntaxKind.UsingKeyword) 3026if (CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3042this.CurrentToken.ContextualKind is not (SyntaxKind.PartialKeyword or SyntaxKind.AsyncKeyword or SyntaxKind.RequiredKeyword or SyntaxKind.FileKeyword or SyntaxKind.ClosedKeyword or SyntaxKind.SafeKeyword) && 3065SyntaxKind parentKind, 3082if (attributes.Count == 0 && modifiers.Count == 0 && type.IsMissing && type.Kind != SyntaxKind.RefType) 3094else if (parentKind is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration || 3095parentKind == SyntaxKind.CompilationUnit && !IsScript) 3172if (type.Kind != SyntaxKind.RefType && 3175|| this.CurrentToken.Kind is not SyntaxKind.OpenParenToken and not SyntaxKind.OpenBraceToken and not SyntaxKind.EqualsGreaterThanToken) && 3200if (identifierOrThisOpt?.Kind == SyntaxKind.ThisKeyword) 3221var kind = this.PeekToken(index).Kind; 3224if (kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken) 3228if (kind is SyntaxKind.SemicolonToken) 3231if (kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken) 3239internal MemberDeclarationSyntax ParseMemberDeclaration(SyntaxKind parentKind) 3254private MemberDeclarationSyntax ParseMemberDeclarationCore(SyntaxKind parentKind) 3258Debug.Assert(parentKind != SyntaxKind.CompilationUnit); 3283if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 3289if (this.CurrentToken.Kind == SyntaxKind.TildeToken) 3295if (this.CurrentToken.Kind == SyntaxKind.ConstKeyword) 3301if (this.CurrentToken.Kind == SyntaxKind.EventKeyword) 3307if (this.CurrentToken.Kind == SyntaxKind.FixedKeyword) 3347if (type.Kind != SyntaxKind.RefType) 3415return this.CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword && 3416(IsFeatureEnabled(MessageID.IDS_FeatureExtensions) || this.PeekToken(1).Kind == SyntaxKind.LessThanToken); 3427if (type.Kind != SyntaxKind.IdentifierName) 3430if (identifierOrThisOpt.Kind != SyntaxKind.IdentifierToken) 3434var contextualKind = identifier.ContextualKind; 3435if (contextualKind != SyntaxKind.AsyncKeyword || 3447if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 3452if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3475case SyntaxKind.DotToken: // Goo. explicit 3476case SyntaxKind.ColonColonToken: // Goo:: explicit 3477case SyntaxKind.LessThanToken: // Goo< explicit or generic method 3478case SyntaxKind.OpenBraceToken: // Goo { property 3479case SyntaxKind.EqualsGreaterThanToken: // Goo => property 3481case SyntaxKind.OpenParenToken: // Goo( method 3490return this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword or SyntaxKind.OperatorKeyword; 3512if (token.Kind != SyntaxKind.None) 3548var currentTokenKind = this.CurrentToken.Kind; 3549var shouldParse = currentTokenKind is SyntaxKind.ColonToken || 3550(currentTokenKind is SyntaxKind.EqualsGreaterThanToken && 3551this.PeekToken(1).Kind is SyntaxKind.ThisKeyword or SyntaxKind.BaseKeyword && 3552this.PeekToken(2).Kind is SyntaxKind.OpenParenToken); 3565Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ColonToken or SyntaxKind.EqualsGreaterThanToken); 3566var colon = this.EatTokenAsKind(SyntaxKind.ColonToken); 3568var token = this.CurrentToken.Kind is SyntaxKind.BaseKeyword or SyntaxKind.ThisKeyword 3570: this.EatToken(SyntaxKind.ThisKeyword, ErrorCode.ERR_ThisOrBaseExpected); 3572var argumentList = this.CurrentToken.Kind == SyntaxKind.OpenParenToken 3575this.EatToken(SyntaxKind.OpenParenToken, reportError: !token.ContainsDiagnostics), 3577this.EatToken(SyntaxKind.CloseParenToken, reportError: !token.ContainsDiagnostics)); 3580token.Kind == SyntaxKind.BaseKeyword 3581? SyntaxKind.BaseConstructorInitializer 3582: SyntaxKind.ThisConstructorInitializer, 3590Debug.Assert(this.CurrentToken.Kind == SyntaxKind.TildeToken); 3591var tilde = this.EatToken(SyntaxKind.TildeToken); 3595this.EatToken(SyntaxKind.OpenParenToken), 3597this.EatToken(SyntaxKind.CloseParenToken)); 3616if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 3620semicolon = this.EatToken(SyntaxKind.SemicolonToken); 3624blockBody = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 3628expressionBody = this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 3636semicolon = this.EatToken(SyntaxKind.SemicolonToken); 3639else if (parseSemicolonAfterBlock && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 3651if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 3657if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 3663if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 3679=> this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken; 3683return this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken; 3687=> this.CurrentToken.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken; 3690=> this.CurrentToken.Kind == (errored ? SyntaxKind.CloseParenToken : SyntaxKind.GreaterThanToken); 3693=> this.CurrentToken.Kind == SyntaxKind.CloseBracketToken; 3710if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 3715else if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 3737using var _ = new ParserSyntaxContextResetter(this, isInAsyncContext: modifiers.Any((int)SyntaxKind.AsyncKeyword)); 3767case SyntaxKind.OpenParenToken: 3768case SyntaxKind.OpenBraceToken: 3769case SyntaxKind.SemicolonToken: 3784if (this.CurrentToken.Kind is not (SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)) 3786SyntaxKind separatorKind = SyntaxKind.None; 3788if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 3798if (this.CurrentToken.Kind == SyntaxKind.OperatorKeyword) 3812(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.Kind != SyntaxKind.OpenParenToken)) 3823separatorKind = SyntaxKind.None; 3840if (this.CurrentToken.Kind != SyntaxKind.OperatorKeyword || 3841(haveExplicitInterfaceName && separatorKind is not SyntaxKind.DotToken)) 3845else if (this.PeekToken(1).Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword) 3862var style = this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword 3864: this.EatToken(SyntaxKind.ExplicitKeyword); 3872if (!style.IsMissing && explicitInterfaceOpt is not null && this.CurrentToken.Kind != SyntaxKind.OperatorKeyword && style.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 3878opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3890SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken), 3892SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken)), 3895semicolonToken: SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken)); 3898opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3904bool couldBeParameterList = this.CurrentToken.Kind == SyntaxKind.OpenParenToken; 3909this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 3940if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 3957if (this.CurrentToken.Kind == SyntaxKind.OperatorKeyword) 3967(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.Kind != SyntaxKind.OpenParenToken); 3974if (separator?.Kind == SyntaxKind.ColonColonToken) 3977separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 3994if (separator.Kind != SyntaxKind.DotToken) 3996separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 3997separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 4006if (CurrentToken.Kind == SyntaxKind.UncheckedKeyword) 4014return TryEatToken(SyntaxKind.CheckedKeyword); 4026if (firstToken.Kind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && 4027this.PeekToken(1).Kind is SyntaxKind.OperatorKeyword) 4052var opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 4067if (this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 4071opToken = this.ConvertToMissingWithTrailingTrivia(this.EatToken(), SyntaxKind.PlusToken); 4078SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken)); 4084type = this.AddError(type, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken)); 4100if (opToken.Kind == SyntaxKind.GreaterThanToken) 4104if (tk.Kind == SyntaxKind.GreaterThanToken) 4111if (tk.Kind == SyntaxKind.GreaterThanToken && 4115opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanToken, opToken2.GetTrailingTrivia()); 4118else if (tk.Kind == SyntaxKind.GreaterThanEqualsToken && 4122opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, opToken2.GetTrailingTrivia()); 4127opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanToken, opToken2.GetTrailingTrivia()); 4132else if (tk.Kind == SyntaxKind.GreaterThanEqualsToken && 4136opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanEqualsToken, opToken2.GetTrailingTrivia()); 4141var opKind = opToken.Kind; 4174if (opKind is not (SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken) || paramList.Parameters.Count != 0) 4195if (!(opKind == SyntaxKind.IsKeyword || 4200opToken = ConvertToMissingWithTrailingTrivia(opToken, SyntaxKind.PlusToken); 4225Debug.Assert(thisKeyword.Kind == SyntaxKind.ThisKeyword); 4241if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 4244semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4249if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 4258if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 4262semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4293if (this.CurrentToken.Kind is SyntaxKind.SemicolonToken) 4295identifier = AddTrailingSkippedSyntax(identifier, this.EatTokenEvenWithIncorrectKind(SyntaxKind.OpenBraceToken)); 4301var accessorList = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 4309if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 4315else if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 4317var equals = this.EatToken(SyntaxKind.EqualsToken); 4325semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4327else if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 4402var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 4412if (this.CurrentToken.Kind == SyntaxKind.CloseBraceToken) 4434this.EatToken(SyntaxKind.CloseBraceToken)); 4440this.EatToken(SyntaxKind.EqualsGreaterThanToken), 4447var refKeyword = this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 4458static p => p.CurrentToken.Kind != SyntaxKind.CloseBraceToken && !p.IsPossibleAccessor(), 4465return this.CurrentToken.Kind == SyntaxKind.IdentifierToken 4467|| SyntaxFacts.GetAccessorDeclarationKind(this.CurrentToken.ContextualKind) != SyntaxKind.None 4468|| this.CurrentToken.Kind == SyntaxKind.OpenBraceToken // for accessor blocks w/ missing keyword 4469|| this.CurrentToken.Kind == SyntaxKind.SemicolonToken // for empty body accessors w/ missing keyword 4503if (token.Kind is SyntaxKind.CloseBraceToken or SyntaxKind.EndOfFileToken) 4512case SyntaxKind.GetKeyword: 4513case SyntaxKind.SetKeyword: 4514case SyntaxKind.InitKeyword: 4515case SyntaxKind.AddKeyword: 4516case SyntaxKind.RemoveKeyword: 4533Func<LanguageParser, SyntaxKind, bool> abortFunction, 4534SyntaxKind expected, 4535SyntaxKind closeKind = SyntaxKind.None) 4575Func<LanguageParser, SyntaxKind, bool> abortFunction, 4576SyntaxKind expected, 4577SyntaxKind closeKind, 4623Func<LanguageParser, SyntaxKind, bool> abortFunction, 4624SyntaxKind expected, 4625SyntaxKind closeKind, 4688var accessorName = this.EatToken(SyntaxKind.IdentifierToken, 4690var accessorKind = GetAccessorKind(accessorName); 4695if (accessorKind == SyntaxKind.UnknownAccessorDeclaration) 4721bool currentTokenIsSemicolon = this.CurrentToken.Kind == SyntaxKind.SemicolonToken; 4722bool currentTokenIsArrow = this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken; 4723bool currentTokenIsOpenBraceToken = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken; 4743if (accessorKind != SyntaxKind.UnknownAccessorDeclaration) 4774=> this.EatToken(SyntaxKind.SemicolonToken, 4779private static SyntaxKind GetAccessorKind(SyntaxToken accessorName) 4783SyntaxKind.GetKeyword => SyntaxKind.GetAccessorDeclaration, 4784SyntaxKind.SetKeyword => SyntaxKind.SetAccessorDeclaration, 4785SyntaxKind.InitKeyword => SyntaxKind.InitAccessorDeclaration, 4786SyntaxKind.AddKeyword => SyntaxKind.AddAccessorDeclaration, 4787SyntaxKind.RemoveKeyword => SyntaxKind.RemoveAccessorDeclaration, 4788_ => SyntaxKind.UnknownAccessorDeclaration, 4799var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, forExtensionOrUnion); 4810var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, forExtensionOrUnion: false); 4873SyntaxKind openKind, 4874SyntaxKind closeKind, 4902LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 4905static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleParameter(), 4913return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken; 4920case SyntaxKind.OpenBracketToken: // attribute 4921case SyntaxKind.ArgListKeyword: 4922case SyntaxKind.OpenParenToken: // tuple 4923case SyntaxKind.DelegateKeyword when IsFunctionPointerStart(): // Function pointer type 4926case SyntaxKind.IdentifierToken: 4954if (parent.Kind() == SyntaxKind.SimpleLambdaExpression) 4960if (grandparent != null && grandparent.Kind() == SyntaxKind.ParenthesizedLambdaExpression) 4962Debug.Assert(parent.Kind() == SyntaxKind.ParameterList); 4970if (!identifierIsOptional && parameter.Identifier.Kind() == SyntaxKind.None) 4992if (this.CurrentToken.Kind == SyntaxKind.ArgListKeyword) 4997attributes, modifiers.ToList(), type: null, this.EatToken(SyntaxKind.ArgListKeyword), @default: null); 5003if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && IsCurrentTokenWhereOfConstraintClause()) 5010identifier = identifierIsOptional && this.CurrentToken.Kind != SyntaxKind.IdentifierToken 5016if (identifier is not null && this.CurrentToken.Kind is SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 5023var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 5039=> IsParameterModifierExcludingScoped(token) || token.ContextualKind == SyntaxKind.ScopedKeyword; 5045case SyntaxKind.ThisKeyword: 5046case SyntaxKind.RefKeyword: 5047case SyntaxKind.OutKeyword: 5048case SyntaxKind.InKeyword: 5049case SyntaxKind.ParamsKeyword: 5050case SyntaxKind.ReadOnlyKeyword: 5079modifiers.Add(this.EatContextualToken(SyntaxKind.ScopedKeyword)); 5093if (this.PeekToken(1).Kind is not (SyntaxKind.CloseParenToken or SyntaxKind.CommaToken or SyntaxKind.EqualsToken)) 5095modifiers.Add(this.EatContextualToken(SyntaxKind.ScopedKeyword)); 5109SyntaxKind parentKind) 5111Debug.Assert(this.CurrentToken.Kind == SyntaxKind.FixedKeyword); 5121this.EatToken(SyntaxKind.SemicolonToken)); 5127SyntaxKind parentKind) 5129Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EventKeyword); 5134return IsFieldDeclaration(isEvent: true, isGlobalScriptLevel: parentKind == SyntaxKind.CompilationUnit) 5153if (explicitInterfaceOpt != null && this.CurrentToken.Kind is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken) 5166SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 5168SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)), 5178else if (identifierOrThisOpt.Kind != SyntaxKind.IdentifierToken) 5180Debug.Assert(identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword); 5181identifier = ConvertToMissingWithTrailingTrivia(identifierOrThisOpt, SyntaxKind.IdentifierToken); 5189Debug.Assert(identifier.Kind == SyntaxKind.IdentifierToken); 5205if (explicitInterfaceOpt != null && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5207semicolon = this.EatToken(SyntaxKind.SemicolonToken); 5232if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5246SyntaxKind parentKind) 5251if (modifiers is [.., SyntaxToken { Kind: SyntaxKind.ScopedKeyword } scopedKeyword]) 5261this.EatToken(SyntaxKind.SemicolonToken)); 5269SyntaxKind parentKind) 5285if (this.CurrentToken.Kind == SyntaxKind.DotToken) 5296this.EatToken(SyntaxKind.SemicolonToken)); 5301return this.CurrentToken.Kind == SyntaxKind.SemicolonToken; 5305TypeSyntax type, VariableFlags flags, SyntaxKind parentKind) 5310parentKind is not SyntaxKind.NamespaceDeclaration and not SyntaxKind.FileScopedNamespaceDeclaration && 5311(parentKind != SyntaxKind.CompilationUnit || IsScript); 5366if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5370else if (stopOnCloseParen && this.CurrentToken.Kind == SyntaxKind.CloseParenToken) 5374else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 5389if (flags.HasFlag(VariableFlags.ForStatement) && this.PeekToken(1).Kind != SyntaxKind.SemicolonToken) 5393this.PeekToken(2).Kind is SyntaxKind.CommaToken or SyntaxKind.EqualsToken or SyntaxKind.SemicolonToken; 5399variables.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 5412else if (!variableDeclarationsExpected || this.SkipBadVariableListTokens(variables, SyntaxKind.CommaToken) == PostSkipAction.Abort) 5419private PostSkipAction SkipBadVariableListTokens(SeparatedSyntaxListBuilder<VariableDeclaratorSyntax> list, SyntaxKind expected) 5424static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 5425static (p, _) => p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 5445case SyntaxKind.FieldDeclaration: 5447case SyntaxKind.MethodDeclaration: 5449case SyntaxKind.ConstructorDeclaration: 5451case SyntaxKind.DestructorDeclaration: 5453case SyntaxKind.PropertyDeclaration: 5455case SyntaxKind.EventFieldDeclaration: 5457case SyntaxKind.AddAccessorDeclaration: 5458case SyntaxKind.RemoveAccessorDeclaration: 5459case SyntaxKind.GetAccessorDeclaration: 5460case SyntaxKind.SetAccessorDeclaration: 5461case SyntaxKind.InitAccessorDeclaration: 5463case SyntaxKind.ClassDeclaration: 5464case SyntaxKind.StructDeclaration: 5465case SyntaxKind.UnionDeclaration: 5466case SyntaxKind.InterfaceDeclaration: 5467case SyntaxKind.RecordDeclaration: 5468case SyntaxKind.RecordStructDeclaration: 5470case SyntaxKind.DelegateDeclaration: 5493if (mods.Any(SyntaxKind.FixedKeyword)) 5498if (mods.Any(SyntaxKind.ConstKeyword)) 5503if (parent != null && (parent.Kind() == SyntaxKind.VariableDeclaration || parent.Kind() == SyntaxKind.LocalDeclarationStatement)) 5518SyntaxKind oldKind; 5523&& (oldKind = GetOldParent(old).Kind()) != SyntaxKind.VariableDeclaration // or in a method body 5524&& oldKind != SyntaxKind.LocalDeclarationStatement; 5580var currentTokenKind = this.CurrentToken.Kind; 5581if (currentTokenKind == SyntaxKind.IdentifierToken && !parentType.IsMissing) 5583var isAfterNewLine = parentType.GetLastToken().TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia); 5594currentTokenKind != SyntaxKind.EqualsToken && 5597if (currentTokenKind is SyntaxKind.DotToken or SyntaxKind.OpenParenToken or SyntaxKind.MinusGreaterThanToken || 5600var isPossibleLocalFunctionToken = currentTokenKind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken; 5643case SyntaxKind.EqualsToken: 5652var refKeyword = isLocalOrField && !isConst && this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 5662case SyntaxKind.LessThanToken: 5673case SyntaxKind.OpenParenToken: 5691case SyntaxKind.OpenBracketToken: 5710bool isOmitted = expression.Kind == SyntaxKind.OmittedArraySizeExpression; 5729if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5731goto case SyntaxKind.EqualsToken; 5747Debug.Assert(this.CurrentToken.Kind != SyntaxKind.EqualsToken); 5754this.EatToken(SyntaxKind.EqualsToken), 5764if (parentType.Kind == SyntaxKind.ArrayType) 5771goto case SyntaxKind.OpenBracketToken; 5787if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5801this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 5802this.PeekToken(1).Kind is SyntaxKind.IdentifierToken or SyntaxKind.CommaToken or SyntaxKind.EqualsToken or SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.EndOfFileToken; 5826Debug.Assert(this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken); 5834(this.CurrentToken.Kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken || 5835this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword)) 5847case SyntaxKind.CommaToken: 5848case SyntaxKind.SemicolonToken: 5857return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 5864return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.IsPossibleExpression(); 5867private FieldDeclarationSyntax ParseConstantFieldDeclaration(SyntaxList<AttributeListSyntax> attributes, SyntaxListBuilder modifiers, SyntaxKind parentKind) 5869modifiers.Add(this.EatToken(SyntaxKind.ConstKeyword)); 5878this.EatToken(SyntaxKind.SemicolonToken)); 5883Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 5885var delegateToken = this.EatToken(SyntaxKind.DelegateKeyword); 5894if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 5911this.EatToken(SyntaxKind.SemicolonToken)); 5916Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EnumKeyword); 5918var enumToken = this.EatToken(SyntaxKind.EnumKeyword); 5931if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 5933var colon = this.EatToken(SyntaxKind.ColonToken); 5947if (CurrentToken.Kind == SyntaxKind.SemicolonToken) 5949semicolon = EatToken(SyntaxKind.SemicolonToken); 5955openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 5964SyntaxKind.CloseBraceToken, 5973closeBrace = this.EatToken(SyntaxKind.CloseBraceToken); 5974semicolon = TryEatToken(SyntaxKind.SemicolonToken); 5989LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<EnumMemberDeclarationSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 5992static p => p.CurrentToken.Kind is not SyntaxKind.CommaToken and not SyntaxKind.SemicolonToken && !p.IsPossibleEnumMemberDeclaration(), 6000if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.EnumMemberDeclaration) 6008if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 6012this.EatToken(SyntaxKind.EqualsToken), 6013this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseBraceToken 6023return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken || this.IsTrueIdentifier(); 6028return this.CurrentToken.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken; 6044return SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken); 6067if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 6087token.Kind == SyntaxKind.IdentifierToken && 6093if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.IdentifierName) 6107var ctk = this.CurrentToken.Kind; 6108if (ctk == SyntaxKind.IdentifierToken) 6125if (this.IsInAsync && identifierToken.ContextualKind == SyntaxKind.AwaitKeyword) 6145if (this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword) 6158return CurrentToken.ContextualKind == SyntaxKind.FieldKeyword && 6165if (this.CurrentToken.Kind != SyntaxKind.LessThanToken) 6173var open = this.EatToken(SyntaxKind.LessThanToken); 6176SyntaxKind.GreaterThanToken, 6189this.EatToken(SyntaxKind.GreaterThanToken)); 6192LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<TypeParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 6195static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 6208if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 6217if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 6236this.CurrentToken.Kind is SyntaxKind.InKeyword or SyntaxKind.OutKeyword ? EatToken() : null, 6253if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) 6263Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6288if (this.CurrentToken.Kind != SyntaxKind.LessThanToken) 6336Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6340case SyntaxKind.OpenParenToken: 6341case SyntaxKind.CloseParenToken: 6342case SyntaxKind.CloseBracketToken: 6343case SyntaxKind.CloseBraceToken: 6344case SyntaxKind.ColonToken: 6345case SyntaxKind.SemicolonToken: 6346case SyntaxKind.CommaToken: 6347case SyntaxKind.DotToken: 6348case SyntaxKind.QuestionToken: 6349case SyntaxKind.EqualsEqualsToken: 6350case SyntaxKind.ExclamationEqualsToken: 6351case SyntaxKind.BarToken: 6352case SyntaxKind.CaretToken: 6356case SyntaxKind.AmpersandAmpersandToken: // e.g. `e is A<B> && e` 6357case SyntaxKind.BarBarToken: // e.g. `e is A<B> || e` 6358case SyntaxKind.AmpersandToken: // e.g. `e is A<B> & e` 6359case SyntaxKind.OpenBracketToken: // e.g. `e is A<B>[]` 6360case SyntaxKind.LessThanToken: // e.g. `e is A<B> < C` 6361case SyntaxKind.LessThanEqualsToken: // e.g. `e is A<B> <= C` 6362case SyntaxKind.GreaterThanEqualsToken: // e.g. `e is A<B> >= C` 6363case SyntaxKind.IsKeyword: // e.g. `e is A<B> is bool` 6364case SyntaxKind.AsKeyword: // e.g. `e is A<B> as bool` 6368case SyntaxKind.OpenBraceToken: // e.g. `e is A<B> {}` 6372case SyntaxKind.GreaterThanToken when ((options & NameOptions.AfterIs) != 0) && this.PeekToken(1).Kind != SyntaxKind.GreaterThanToken: 6382case SyntaxKind.IdentifierToken: 6393(options & NameOptions.AfterTupleComma) != 0 && this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken || 6394(options & NameOptions.FirstElementOfPossibleTupleLiteral) != 0 && this.PeekToken(1).Kind == SyntaxKind.CommaToken) 6402case SyntaxKind.EndOfFileToken: // e.g. `e is A<B>` 6406case SyntaxKind.EqualsGreaterThanToken: // e.g. `e switch { A<B> => 1 }` 6420Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6430while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6433Debug.Assert(start.Kind == SyntaxKind.LessThanToken); 6434Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6447if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 6453if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 6462if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6497isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 6524isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 6546isDefinitelyTypeArgumentList = this.CurrentToken.Kind == SyntaxKind.CommaToken; 6564while (this.CurrentToken.Kind == SyntaxKind.CommaToken); 6566if (this.CurrentToken.Kind != SyntaxKind.GreaterThanToken) 6572if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken) 6574greaterThanToken = this.EatToken(SyntaxKind.GreaterThanToken); 6581if (lastScannedType is ScanTypeFlags.TupleType && this.CurrentToken.Kind is SyntaxKind.OpenParenToken) 6583greaterThanToken = this.EatToken(SyntaxKind.GreaterThanToken); 6594isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CloseParenToken; 6606Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6608open = this.EatToken(SyntaxKind.LessThanToken); 6614var omittedTypeArgumentInstance = _syntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 6616while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6618types.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 6622close = this.EatToken(SyntaxKind.GreaterThanToken); 6633if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 6649if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1))) 6658if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken 6659&& this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 6664if (this.CurrentToken.Kind == SyntaxKind.CommaToken || this.IsPossibleType()) 6666types.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 6669else if (this.SkipBadTypeArgumentListTokens(types, SyntaxKind.CommaToken) == PostSkipAction.Abort) 6675close = this.EatToken(SyntaxKind.GreaterThanToken); 6679var contextualKind = SyntaxFacts.GetContextualKeywordKind(token.ValueText); 6683case SyntaxKind.OrKeyword: 6685case SyntaxKind.AndKeyword: 6697case SyntaxKind.OpenParenToken: 6700case SyntaxKind.LessThanToken: 6702case SyntaxKind.CloseParenToken: 6704case SyntaxKind.SemicolonToken: 6706case SyntaxKind.OpenBraceToken: 6711case SyntaxKind.CloseBraceToken: 6715case SyntaxKind.EqualsToken: 6717case SyntaxKind.EqualsGreaterThanToken: 6719case SyntaxKind.ThisKeyword: 6721case SyntaxKind.OperatorKeyword: 6729private PostSkipAction SkipBadTypeArgumentListTokens(SeparatedSyntaxListBuilder<TypeSyntax> list, SyntaxKind expected) 6734static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleType(), 6735static (p, _) => p.CurrentToken.Kind == SyntaxKind.GreaterThanToken, 6743if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 6759var varianceToken = this.CurrentToken.Kind is SyntaxKind.InKeyword or SyntaxKind.OutKeyword 6786this.CurrentToken.Kind is not SyntaxKind.CommaToken and not SyntaxKind.GreaterThanToken && 6787this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken) 6808=> this.CurrentToken.Kind == SyntaxKind.GreaterThanToken; 6812Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6814while (this.PeekToken(n).Kind == SyntaxKind.CommaToken) 6817return this.PeekToken(n).Kind == SyntaxKind.GreaterThanToken; 6850if (this.CurrentToken.Kind == SyntaxKind.ThisKeyword) 6876if (separator != null && separator.Kind == SyntaxKind.ColonColonToken) 6879separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6895if (separator.Kind != SyntaxKind.DotToken) 6897separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 6898separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6901if (isEvent && this.CurrentToken.Kind is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken) 6934if (separator.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 6972separator = this.CurrentToken.Kind == SyntaxKind.ColonColonToken 6974: this.EatToken(SyntaxKind.DotToken); 6985if (this.CurrentToken.Kind == SyntaxKind.ColonColonToken) 6989separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6993separator = this.EatToken(SyntaxKind.DotToken); 7014if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 7050if (separator != null && separator.Kind == SyntaxKind.ColonColonToken) 7053separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7077if (separator.Kind != SyntaxKind.DotToken) 7079separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 7080separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7090return this.CurrentToken.Kind == SyntaxKind.ColonColonToken 7102if (this.PeekToken(1).Kind == SyntaxKind.ThisKeyword) 7119Debug.Assert(separator.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken); 7124case SyntaxKind.DotToken: 7127case SyntaxKind.ColonColonToken: 7128if (left.Kind != SyntaxKind.IdentifierName) 7139separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7144if (identifierLeft.Identifier.ContextualKind == SyntaxKind.GlobalKeyword) 7159private SyntaxToken ConvertToMissingWithTrailingTrivia(SyntaxToken token, SyntaxKind expectedKind) 7220var tk = this.CurrentToken.Kind; 7241if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken || !this.IsTrueIdentifier()) 7248if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) 7263if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 7268if (this.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword) 7275if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken or SyntaxKind.ColonColonToken) 7278if (this.CurrentToken.Kind is SyntaxKind.ColonColonToken) 7292Debug.Assert(this.CurrentToken.Kind is SyntaxKind.IdentifierToken); 7295isAlias = this.PeekToken(1).Kind == SyntaxKind.ColonColonToken; 7338else if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 7343if (result == ScanTypeFlags.NotType || mode == ParseTypeMode.DefinitePattern && this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 7365case SyntaxKind.QuestionToken 7366when lastTokenOfType.Kind is not SyntaxKind.QuestionToken // don't allow `Type??` 7367and not SyntaxKind.AsteriskToken: // don't allow `Type*?` 7371case SyntaxKind.AsteriskToken: 7401case SyntaxKind.OpenBracketToken: 7404while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7409if (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7442if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7460while (this.CurrentToken.Kind == SyntaxKind.CommaToken); 7462if (this.CurrentToken.Kind == SyntaxKind.CloseParenToken) 7479_ = EatToken(SyntaxKind.DelegateKeyword); 7480lastTokenOfType = EatToken(SyntaxKind.AsteriskToken); 7484if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 7489case { ContextualKind: SyntaxKind.ManagedKeyword }: 7490case { ContextualKind: SyntaxKind.UnmanagedKeyword }: 7492case var _ when peek1.Kind == SyntaxKind.OpenBracketToken: 7502if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 7504lastTokenOfType = EatToken(SyntaxKind.OpenBracketToken); 7512lastTokenOfType = TryEatToken(SyntaxKind.IdentifierToken) ?? lastTokenOfType; 7519Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 7523lastTokenOfType = TryEatToken(SyntaxKind.CloseBracketToken) ?? lastTokenOfType; 7542var validStartingToken = EatToken().Kind == SyntaxKind.LessThanToken; 7562_ = EatToken(SyntaxKind.CommaToken); 7572if (!validStartingToken && CurrentToken.Kind == SyntaxKind.CloseParenToken) 7574lastTokenOfType = EatTokenAsKind(SyntaxKind.GreaterThanToken); 7578lastTokenOfType = EatToken(SyntaxKind.GreaterThanToken); 7586isNotExpectedFunction: static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 7588expected: SyntaxKind.CommaToken, 7589closeKind: SyntaxKind.None, 7595private static bool IsPredefinedType(SyntaxKind keyword) 7607if (this.CurrentToken.Kind == SyntaxKind.VoidKeyword && this.PeekToken(1).Kind != SyntaxKind.AsteriskToken) 7632if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 7636this.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword ? this.EatToken() : null, 7682case SyntaxKind.QuestionToken: 7694case SyntaxKind.AsteriskToken: 7720case SyntaxKind.OpenBracketToken: 7728while (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 7749Debug.Assert(this.CurrentToken.Kind == SyntaxKind.QuestionToken); 7755if (typeParsedSoFar.Kind is SyntaxKind.NullableType or SyntaxKind.PointerType) 7772if (mode == ParseTypeMode.AfterIs && this.CurrentToken.Kind is SyntaxKind.OpenBracketToken) 7785case SyntaxKind.CommaToken: 7791case SyntaxKind.CloseBracketToken: 7799return this.CurrentToken.Kind != SyntaxKind.ColonToken; 7835if (this.CurrentToken.ContextualKind is SyntaxKind.AsyncKeyword or SyntaxKind.AwaitKeyword or SyntaxKind.FromKeyword) 7841if (nextToken.ContextualKind == SyntaxKind.WithKeyword) 7844var nextTokenKind = nextToken.Kind; 7861if (nextTokenKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseBraceToken) 7866if (nextTokenKind == SyntaxKind.OpenBraceToken) 7871if (nextTokenKind == SyntaxKind.CommaToken) 7875if (nextTokenKind == SyntaxKind.SemicolonToken) 7880if (nextTokenKind == SyntaxKind.EndOfFileToken) 7889if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken) 7898this.CurrentToken.Kind is SyntaxKind.OpenParenToken or // ctor parameters 7899SyntaxKind.OpenBracketToken or // array type 7900SyntaxKind.OpenBraceToken; // object initializer 7914case SyntaxKind.AsteriskToken: 7916case SyntaxKind.OpenBracketToken: 7928var open = this.EatToken(SyntaxKind.OpenBracketToken); 7931var omittedArraySizeExpressionInstance = _syntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 7933while (IsMakingProgress(ref lastTokenPosition) && this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7935if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7948if (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7950list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 7953else if (this.SkipBadArrayRankSpecifierTokens(ref open, list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 7973if (list[i].RawKind == (int)SyntaxKind.OmittedArraySizeExpression) 7981this.EatToken(SyntaxKind.CloseBracketToken)); 7986var open = this.EatToken(SyntaxKind.OpenParenToken); 7989if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 7993while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7995list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 8007list.AddSeparator(SyntaxFactory.MissingToken(SyntaxKind.CommaToken)); 8015this.EatToken(SyntaxKind.CloseParenToken)); 8025private PostSkipAction SkipBadArrayRankSpecifierTokens(ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expected) 8028static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 8029static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseBracketToken, 8039if (token.Kind == SyntaxKind.VoidKeyword && this.CurrentToken.Kind != SyntaxKind.AsteriskToken) 8048if (IsTrueIdentifier() || this.CurrentToken.Kind == SyntaxKind.ColonColonToken) 8053if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 8071var @delegate = EatToken(SyntaxKind.DelegateKeyword); 8072var asterisk = EatToken(SyntaxKind.AsteriskToken); 8078var lessThanTokenError = CreateMissingToken(SyntaxKind.LessThanToken, SyntaxKind.None); 8093TryEatToken(SyntaxKind.GreaterThanToken) ?? SyntaxFactory.MissingToken(SyntaxKind.GreaterThanToken))); 8096var lessThanToken = EatTokenAsKind(SyntaxKind.LessThanToken); 8119Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8120types.AddSeparator(EatToken(SyntaxKind.CommaToken)); 8130lessThanToken.IsMissing && CurrentToken.Kind == SyntaxKind.CloseParenToken 8131? EatTokenAsKind(SyntaxKind.GreaterThanToken) 8132: EatToken(SyntaxKind.GreaterThanToken))); 8145isNotExpectedFunction: static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 8148expected: SyntaxKind.CommaToken); 8153if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 8159case { ContextualKind: SyntaxKind.ManagedKeyword }: 8160case { ContextualKind: SyntaxKind.UnmanagedKeyword }: 8166managedSpecifier = EatTokenAsKind(SyntaxKind.ManagedKeyword); 8169case var _ when peek1.Kind == SyntaxKind.OpenBracketToken: 8171managedSpecifier = EatTokenAsKind(SyntaxKind.UnmanagedKeyword); 8181if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 8183var openBracket = EatToken(SyntaxKind.OpenBracketToken); 8192callingConventionModifiers.Add(SyntaxFactory.FunctionPointerUnmanagedCallingConvention(EatToken(SyntaxKind.IdentifierToken))); 8199Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8200callingConventionModifiers.AddSeparator(EatToken(SyntaxKind.CommaToken)); 8203var closeBracket = EatToken(SyntaxKind.CloseBracketToken); 8215if (managedSpecifier.Kind == SyntaxKind.ManagedKeyword && unmanagedCallingConventions != null) 8229=> CurrentToken.Kind == SyntaxKind.DelegateKeyword && PeekToken(1).Kind == SyntaxKind.AsteriskToken; 8234=> token.Kind == SyntaxKind.LessThanToken || token.Kind == SyntaxKind.OpenParenToken; 8240while (this.CurrentToken.Kind == SyntaxKind.AsteriskToken) 8252static @this => SyntaxFactory.EmptyStatement(attributeLists: default, SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken))); 8260if (this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 8274while (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 8285is SyntaxKind.DotToken 8286or SyntaxKind.QuestionToken 8287or SyntaxKind.ExclamationToken 8288or SyntaxKind.PlusPlusToken 8289or SyntaxKind.MinusMinusToken 8290or SyntaxKind.MinusGreaterThanToken; 8299|| (this.CurrentToken.ContextualKind is SyntaxKind.SwitchKeyword or SyntaxKind.WithKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken); 8303this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 8364case SyntaxKind.FixedKeyword: 8366case SyntaxKind.BreakKeyword: 8368case SyntaxKind.ContinueKeyword: 8370case SyntaxKind.TryKeyword: 8371case SyntaxKind.CatchKeyword: 8372case SyntaxKind.FinallyKeyword: 8374case SyntaxKind.CheckedKeyword: 8375case SyntaxKind.UncheckedKeyword: 8377case SyntaxKind.DoKeyword: 8379case SyntaxKind.ForKeyword: 8381case SyntaxKind.ForEachKeyword: 8383case SyntaxKind.GotoKeyword: 8385case SyntaxKind.IfKeyword: 8387case SyntaxKind.ElseKeyword: 8390case SyntaxKind.LockKeyword: 8392case SyntaxKind.ReturnKeyword: 8394case SyntaxKind.SwitchKeyword: 8395case SyntaxKind.CaseKeyword: // error recovery case. 8397case SyntaxKind.ThrowKeyword: 8399case SyntaxKind.UnsafeKeyword: 8404case SyntaxKind.UsingKeyword: 8406case SyntaxKind.WhileKeyword: 8408case SyntaxKind.OpenBraceToken: 8410case SyntaxKind.SemicolonToken: 8412case SyntaxKind.IdentifierToken: 8458bool beginsWithAwait = this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword; 8493if (this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && 8494this.PeekToken(1).Kind == SyntaxKind.ForEachKeyword) 8496return this.ParseForEachStatement(attributes, this.EatContextualToken(SyntaxKind.AwaitKeyword)); 8500if (PeekToken(2).Kind == SyntaxKind.OpenParenToken) 8503return this.ParseUsingStatement(attributes, this.EatContextualToken(SyntaxKind.AwaitKeyword)); 8527=> PeekToken(1).Kind == SyntaxKind.OpenParenToken ? ParseUsingStatement(attributes) : ParseLocalDeclarationStatement(attributes); 8534SyntaxKind.OpenParenToken => ParseExpressionStatementOrLocalFunctionStartingWithUnsafe(attributes), 8535SyntaxKind.OpenBraceToken => ParseUnsafeStatement(attributes), 8555=> CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && PeekToken(1).Kind == SyntaxKind.UsingKeyword; 8559return this.PeekToken(1).Kind == SyntaxKind.ColonToken && this.IsTrueIdentifier(); 8564return this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword && 8565this.PeekToken(1).Kind is SyntaxKind.ReturnKeyword or SyntaxKind.BreakKeyword; 8574var tk = this.CurrentToken.Kind; 8575if (tk == SyntaxKind.RefKeyword || 8578this.PeekToken(1).Kind is not SyntaxKind.DotToken // e.g. `int.Parse()` is an expression 8579and not SyntaxKind.OpenParenToken)) // e.g. `int (x, y)` is an error decl expression 8585if (tk == SyntaxKind.UsingKeyword) 8587Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8593Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8606&& (tk is not (SyntaxKind.AsyncKeyword or SyntaxKind.SafeKeyword or SyntaxKind.ScopedKeyword) || ShouldContextualKeywordBeTreatedAsModifier(parsingStatementNotDeclaration: true)); 8638var tk = this.CurrentToken.ContextualKind; 8640if (tk == SyntaxKind.IdentifierToken) 8643if (token1.Kind == SyntaxKind.DotToken && 8644token1.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 8646if (PeekToken(2).Kind == SyntaxKind.IdentifierToken && 8647PeekToken(3).Kind == SyntaxKind.IdentifierToken) 8662var token4Kind = PeekToken(4).Kind; 8663if (token4Kind != SyntaxKind.SemicolonToken && 8664token4Kind != SyntaxKind.EqualsToken && 8665token4Kind != SyntaxKind.CommaToken && 8666token4Kind != SyntaxKind.OpenParenToken && 8667token4Kind != SyntaxKind.LessThanToken) 8682if (st == ScanTypeFlags.MustBeType && this.CurrentToken.Kind is not SyntaxKind.DotToken and not SyntaxKind.OpenParenToken) 8692if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 8721if (this.CurrentToken.Kind != SyntaxKind.UsingKeyword) 8726var tk = PeekToken(1).Kind; 8728if (tk == SyntaxKind.RefKeyword) 8735if (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. 8755if (tk == SyntaxKind.StaticKeyword) 8787if (this.CurrentToken.Kind is SyntaxKind.OpenBraceToken) 8793if (identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword) 8808if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 8815if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 8824return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.SemicolonToken; 8842if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 8849if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 8874if (parameter.Modifiers[i].Kind == SyntaxKind.ParamsKeyword) 8884if (parameter.Identifier.Kind == SyntaxKind.ArgListKeyword) 8889else if (parameter.Type.Kind == SyntaxKind.NullableType) 8909else if (parameter.Type.Kind == SyntaxKind.IdentifierName && 8910((IdentifierNameSyntax)parameter.Type).Identifier.ContextualKind == SyntaxKind.FromKeyword) 8941Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 8946if (nextToken.Kind == SyntaxKind.OpenBraceToken) 8952if (nextToken.Kind != SyntaxKind.OpenParenToken) 8969Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 8978if (scanResult == ScanTypeFlags.TupleType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 8989Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 8998case SyntaxKind.OpenBraceToken: 8999case SyntaxKind.OpenBracketToken: 9024if (SyntaxFacts.GetBaseTypeDeclarationKind(nextToken.Kind) != SyntaxKind.None) 9080case SyntaxKind.DotToken: 9081case SyntaxKind.AsteriskToken: 9082case SyntaxKind.QuestionToken: 9083case SyntaxKind.OpenBracketToken: 9084case SyntaxKind.LessThanToken: 9085case SyntaxKind.ColonColonToken: 9088case SyntaxKind.OpenParenToken: 9100case SyntaxKind.IdentifierToken: 9103case SyntaxKind.ThisKeyword: 9127this.CurrentNodeKind == SyntaxKind.Block && 9134CSharpSyntaxNode openBrace = isAccessorBody && this.CurrentToken.Kind != SyntaxKind.OpenBraceToken 9136SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 9140: this.EatToken(SyntaxKind.OpenBraceToken); 9152this.EatToken(SyntaxKind.CloseBraceToken)); 9168if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.Block && attributes.Count == 0) 9171CSharpSyntaxNode openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 9180this.EatToken(SyntaxKind.CloseBraceToken)); 9215while (this.CurrentToken.Kind is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken 9230var action = this.SkipBadStatementListTokens(statements, SyntaxKind.CloseBraceToken, out trailingTrivia); 9247return this.CurrentToken.Kind == SyntaxKind.SemicolonToken 9251private PostSkipAction SkipBadStatementListTokens(SyntaxListBuilder<StatementSyntax> statements, SyntaxKind expected, out GreenNode trailingTrivia) 9259static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseBraceToken, 9261closeKind: SyntaxKind.None, 9267var tk = this.CurrentToken.Kind; 9271case SyntaxKind.FixedKeyword: 9272case SyntaxKind.BreakKeyword: 9273case SyntaxKind.ContinueKeyword: 9274case SyntaxKind.TryKeyword: 9275case SyntaxKind.ConstKeyword: 9276case SyntaxKind.DoKeyword: 9277case SyntaxKind.ForKeyword: 9278case SyntaxKind.ForEachKeyword: 9279case SyntaxKind.GotoKeyword: 9280case SyntaxKind.IfKeyword: 9281case SyntaxKind.ElseKeyword: 9282case SyntaxKind.LockKeyword: 9283case SyntaxKind.ReturnKeyword: 9284case SyntaxKind.UnsafeKeyword: 9285case SyntaxKind.UsingKeyword: 9286case SyntaxKind.WhileKeyword: 9287case SyntaxKind.VolatileKeyword: 9288case SyntaxKind.ExternKeyword: 9289case SyntaxKind.CaseKeyword: // for parsing an errant case without a switch. 9304var tk = this.CurrentToken.Kind; 9307case SyntaxKind.CheckedKeyword: 9308case SyntaxKind.UncheckedKeyword: 9309case SyntaxKind.ThrowKeyword: 9310case SyntaxKind.SwitchKeyword: 9311case SyntaxKind.OpenBraceToken: 9312case SyntaxKind.SemicolonToken: 9313case SyntaxKind.StaticKeyword: 9314case SyntaxKind.ReadOnlyKeyword: 9315case SyntaxKind.RefKeyword: 9316case SyntaxKind.OpenBracketToken: 9319case SyntaxKind.IdentifierToken: 9330var @fixed = this.EatToken(SyntaxKind.FixedKeyword); 9331var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9343this.EatToken(SyntaxKind.CloseParenToken), 9349return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken; 9369return SyntaxFactory.EmptyStatement(attributeLists: default, EatToken(SyntaxKind.SemicolonToken)); 9375if (statement.Kind == SyntaxKind.ExpressionStatement && 9398this.EatToken(SyntaxKind.BreakKeyword), 9400this.EatToken(SyntaxKind.SemicolonToken)); 9407this.EatToken(SyntaxKind.ContinueKeyword), 9409this.EatToken(SyntaxKind.SemicolonToken)); 9414Debug.Assert(this.CurrentToken.Kind is SyntaxKind.TryKeyword or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9417var @try = this.EatToken(SyntaxKind.TryKeyword); 9427Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9441if (this.CurrentToken.Kind == SyntaxKind.CatchKeyword) 9444while (this.CurrentToken.Kind == SyntaxKind.CatchKeyword) 9450if (this.CurrentToken.Kind == SyntaxKind.FinallyKeyword) 9464SyntaxFactory.MissingToken(SyntaxKind.FinallyKeyword), 9478SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 9480SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)); 9485return this.CurrentToken.Kind is SyntaxKind.CloseBraceToken or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword; 9490Debug.Assert(this.CurrentToken.Kind == SyntaxKind.CatchKeyword); 9497if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 9511var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9517var keywordKind = this.CurrentToken.ContextualKind; 9518if (keywordKind == SyntaxKind.WhenKeyword || keywordKind == SyntaxKind.IfKeyword) 9520var whenKeyword = this.EatContextualToken(SyntaxKind.WhenKeyword); 9521if (keywordKind == SyntaxKind.IfKeyword) 9532var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9536var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9549return this.CurrentToken.Kind is SyntaxKind.CloseParenToken 9550or SyntaxKind.OpenBraceToken 9551or SyntaxKind.CloseBraceToken 9552or SyntaxKind.CatchKeyword 9553or SyntaxKind.FinallyKeyword; 9558return this.CurrentToken.Kind is SyntaxKind.CloseParenToken 9559or SyntaxKind.OpenBraceToken 9560or SyntaxKind.CloseBraceToken 9561or SyntaxKind.CatchKeyword 9562or SyntaxKind.FinallyKeyword; 9566return this.CurrentToken.Kind is SyntaxKind.CloseBraceToken 9567or SyntaxKind.CatchKeyword 9568or SyntaxKind.FinallyKeyword; 9573Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 9575if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 9590Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DoKeyword); 9591var @do = this.EatToken(SyntaxKind.DoKeyword); 9593var @while = this.EatToken(SyntaxKind.WhileKeyword); 9594var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9608this.EatToken(SyntaxKind.CloseParenToken), 9609this.EatToken(SyntaxKind.SemicolonToken)); 9614return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken; 9631Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9633if (this.EatToken().Kind == SyntaxKind.OpenParenToken && 9635this.EatToken().Kind == SyntaxKind.IdentifierToken && 9636this.EatToken().Kind == SyntaxKind.InKeyword) 9652Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9657var forToken = this.EatToken(SyntaxKind.ForKeyword); 9658var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9662var condition = this.CurrentToken.Kind is not SyntaxKind.SemicolonToken and not SyntaxKind.CommaToken 9671var incrementors = this.CurrentToken.Kind != SyntaxKind.CloseParenToken 9700if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword) 9702if (this.PeekToken(1).Kind == SyntaxKind.RefKeyword) 9709isDeclaration = ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; 9713else if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 9730else if (this.CurrentToken.Kind != SyntaxKind.SemicolonToken) 9745=> this.CurrentToken.Kind is SyntaxKind.CommaToken 9746? this.EatTokenAsKind(SyntaxKind.SemicolonToken) 9747: this.EatToken(SyntaxKind.SemicolonToken); 9753while (this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.CommaToken) 9754skippedTokens.Add(this.EatTokenEvenWithIncorrectKind(SyntaxKind.CloseParenToken)); 9756var result = this.EatToken(SyntaxKind.CloseParenToken); 9766SyntaxKind.CloseParenToken, 9775LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 9777if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken) 9781static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 9782static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 9789return this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken; 9796Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForEachKeyword || this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9807if (this.CurrentToken.Kind == SyntaxKind.ForKeyword) 9810skippedForToken = this.AddError(skippedForToken, ErrorCode.ERR_SyntaxError, SyntaxFacts.GetText(SyntaxKind.ForEachKeyword)); 9811@foreach = ConvertToMissingWithTrailingTrivia(skippedForToken, SyntaxKind.ForEachKeyword); 9815@foreach = this.EatToken(SyntaxKind.ForEachKeyword); 9818var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9821var @in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected); 9828var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9833if (decl.designation.Kind != SyntaxKind.ParenthesizedVariableDesignation) 9839case SyntaxKind.SingleVariableDesignation: 9842case SyntaxKind.DiscardDesignation: 9845Debug.Assert(discard.Kind == SyntaxKind.UnderscoreToken); 9846identifier = SyntaxToken.WithValue(SyntaxKind.IdentifierToken, discard.LeadingTrivia.Node, discard.Text, discard.ValueText, discard.TrailingTrivia.Node); 9901if (this.IsInAsync && this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword) 9909if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword) 9912if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 9917if (this.PeekToken(1).Kind == SyntaxKind.CommaToken) 9925if (this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken) 9959return this.CurrentToken.Kind == SyntaxKind.CommaToken; 9961return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken; 9981case SyntaxKind.DotToken: 9982case SyntaxKind.ColonColonToken: 9983case SyntaxKind.OpenBracketToken: 9984case SyntaxKind.AsteriskToken: 9985case SyntaxKind.QuestionToken: 9986case SyntaxKind.LessThanToken: 9997case SyntaxKind.DeclarationExpression: 10000case SyntaxKind.TupleExpression: 10003case SyntaxKind.IdentifierName: 10005return ((IdentifierNameSyntax)variable).Identifier.ContextualKind == SyntaxKind.UnderscoreToken; 10013Debug.Assert(this.CurrentToken.Kind == SyntaxKind.GotoKeyword); 10015var @goto = this.EatToken(SyntaxKind.GotoKeyword); 10019SyntaxKind kind; 10021if (this.CurrentToken.Kind is SyntaxKind.CaseKeyword or SyntaxKind.DefaultKeyword) 10024if (caseOrDefault.Kind == SyntaxKind.CaseKeyword) 10026kind = SyntaxKind.GotoCaseStatement; 10031kind = SyntaxKind.GotoDefaultStatement; 10036kind = SyntaxKind.GotoStatement; 10041kind, attributes, @goto, caseOrDefault, arg, this.EatToken(SyntaxKind.SemicolonToken)); 10049if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 10060if (this.CurrentToken.Kind == SyntaxKind.CloseParenToken && 10061this.PeekToken(1).Kind != SyntaxKind.EqualsGreaterThanToken && 10079Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IfKeyword); 10086var ifKeyword = this.EatToken(SyntaxKind.IfKeyword); 10087var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10089var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 10092var elseKeyword = this.CurrentToken.Kind != SyntaxKind.ElseKeyword ? 10094this.EatToken(SyntaxKind.ElseKeyword); 10103if (this.CurrentToken.Kind != SyntaxKind.IfKeyword) 10144Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ElseKeyword); 10148this.EatToken(SyntaxKind.IfKeyword, ErrorCode.ERR_ElseCannotStartStatement), 10149this.EatToken(SyntaxKind.OpenParenToken), 10151this.EatToken(SyntaxKind.CloseParenToken), 10158return this.CurrentToken.Kind != SyntaxKind.ElseKeyword 10161this.EatToken(SyntaxKind.ElseKeyword), 10167Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LockKeyword); 10170this.EatToken(SyntaxKind.LockKeyword), 10171this.EatToken(SyntaxKind.OpenParenToken), 10173this.EatToken(SyntaxKind.CloseParenToken), 10179Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ReturnKeyword); 10182this.EatToken(SyntaxKind.ReturnKeyword), 10183this.CurrentToken.Kind != SyntaxKind.SemicolonToken ? this.ParsePossibleRefExpression() : null, 10184this.EatToken(SyntaxKind.SemicolonToken)); 10189Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword); 10194SyntaxKind kind; 10196if (this.CurrentToken.Kind == SyntaxKind.BreakKeyword) 10198kind = SyntaxKind.YieldBreakStatement; 10203kind = SyntaxKind.YieldReturnStatement; 10204returnOrBreak = this.EatToken(SyntaxKind.ReturnKeyword); 10205if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 10221this.EatToken(SyntaxKind.SemicolonToken)); 10226Debug.Assert(this.CurrentToken.Kind is SyntaxKind.SwitchKeyword or SyntaxKind.CaseKeyword); 10242this.EatToken(SyntaxKind.CloseBraceToken)); 10251if (this.CurrentToken.Kind is SyntaxKind.CaseKeyword) 10255switchKeyword = EatToken(SyntaxKind.SwitchKeyword); 10256openParen = SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken); 10258closeParen = SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken); 10259openBrace = SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken); 10263switchKeyword = this.EatToken(SyntaxKind.SwitchKeyword); 10265if (expression.Kind == SyntaxKind.ParenthesizedExpression) 10274else if (expression.Kind == SyntaxKind.TupleExpression) 10284openParen = SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken); 10286closeParen = SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken); 10289openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 10296return this.CurrentToken.Kind == SyntaxKind.CaseKeyword || 10297(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword && this.PeekToken(1).Kind != SyntaxKind.OpenParenToken); 10311if (this.CurrentToken.Kind == SyntaxKind.CaseKeyword) 10315if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 10320this.EatToken(SyntaxKind.ColonToken)); 10327if (this.CurrentToken.ContextualKind == SyntaxKind.WhenKeyword && node is ExpressionSyntax ex) 10330if (node.Kind == SyntaxKind.DiscardPattern) 10339this.EatToken(SyntaxKind.ColonToken)); 10346this.EatToken(SyntaxKind.ColonToken)); 10352Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword); 10354this.EatToken(SyntaxKind.DefaultKeyword), 10355this.EatToken(SyntaxKind.ColonToken)); 10374Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ThrowKeyword); 10377this.EatToken(SyntaxKind.ThrowKeyword), 10378this.CurrentToken.Kind != SyntaxKind.SemicolonToken ? this.ParseExpressionCore() : null, 10379this.EatToken(SyntaxKind.SemicolonToken)); 10384Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UnsafeKeyword); 10387this.EatToken(SyntaxKind.UnsafeKeyword), 10393var @using = this.EatToken(SyntaxKind.UsingKeyword); 10394var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10410this.EatToken(SyntaxKind.CloseParenToken), 10452if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 10466case SyntaxKind.CommaToken: 10467case SyntaxKind.CloseParenToken: 10472case SyntaxKind.EqualsToken: 10479if (this.CurrentToken.Kind == SyntaxKind.ColonToken && 10480declaration.Type.Kind == SyntaxKind.NullableType && 10511bool condition1 = st == ScanTypeFlags.MustBeType && this.CurrentToken.Kind != SyntaxKind.DotToken; 10512bool condition2 = st != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; 10513bool condition3 = st == ScanTypeFlags.NonGenericTypeOrExpression || this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 10520Debug.Assert(this.CurrentToken.Kind == SyntaxKind.WhileKeyword); 10523this.EatToken(SyntaxKind.WhileKeyword), 10524this.EatToken(SyntaxKind.OpenParenToken), 10526this.EatToken(SyntaxKind.CloseParenToken), 10534Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10539this.EatToken(SyntaxKind.ColonToken), 10540this.ParsePossiblyAttributedStatement() ?? SyntaxFactory.EmptyStatement(attributeLists: default, EatToken(SyntaxKind.SemicolonToken))); 10552awaitKeyword = this.EatContextualToken(SyntaxKind.AwaitKeyword); 10555else if (this.CurrentToken.Kind == SyntaxKind.UsingKeyword) 10638this.EatToken(SyntaxKind.SemicolonToken)); 10651if (this.CurrentToken.ContextualKind != SyntaxKind.ScopedKeyword) 10663var scopedKeyword = this.EatContextualToken(SyntaxKind.ScopedKeyword); 10685return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 10687else if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 10701? this.EatContextualToken(SyntaxKind.ScopedKeyword) 10712if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 10714var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10720done = (this.CurrentToken.Kind == SyntaxKind.CloseParenToken); 10725listOfDesignations.AddSeparator(EatToken(SyntaxKind.CommaToken)); 10733if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 10735listOfDesignations.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 10747this.EatToken(SyntaxKind.CloseParenToken)); 10763return CurrentToken.ContextualKind == SyntaxKind.UnderscoreToken 10764? _syntaxFactory.DiscardDesignation(this.EatContextualToken(SyntaxKind.UnderscoreToken)) 10765: _syntaxFactory.SingleVariableDesignation(this.EatToken(SyntaxKind.IdentifierToken)); 10770if (this.CurrentToken.ContextualKind != SyntaxKind.WhenKeyword) 10776this.EatContextualToken(SyntaxKind.WhenKeyword), 10825if (mods.Any((int)SyntaxKind.ConstKeyword)) 10844if (allowLocalFunctions && localFunction == null && type is PredefinedTypeSyntax { Keyword.Kind: SyntaxKind.VoidKeyword }) 10856case SyntaxKind.SemicolonToken: 10857case SyntaxKind.ColonToken: 10866SyntaxKind k; 10870if (k is SyntaxKind.AsyncKeyword or SyntaxKind.SafeKeyword) 10889else if (k is SyntaxKind.ReadOnlyKeyword or SyntaxKind.VolatileKeyword) 10904Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken); 10918if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 10932private static bool IsDeclarationModifier(SyntaxKind kind) 10936case SyntaxKind.ConstKeyword: 10937case SyntaxKind.StaticKeyword: 10938case SyntaxKind.ReadOnlyKeyword: 10939case SyntaxKind.VolatileKeyword: 10946private static bool IsAdditionalLocalFunctionModifier(SyntaxKind kind) 10950case SyntaxKind.StaticKeyword: 10951case SyntaxKind.AsyncKeyword: 10952case SyntaxKind.UnsafeKeyword: 10953case SyntaxKind.SafeKeyword: 10954case SyntaxKind.ExternKeyword: 10957case SyntaxKind.PublicKeyword: 10958case SyntaxKind.InternalKeyword: 10959case SyntaxKind.ProtectedKeyword: 10960case SyntaxKind.PrivateKeyword: 10968private static bool IsAccessibilityModifier(SyntaxKind kind) 10974case SyntaxKind.PublicKeyword: 10975case SyntaxKind.InternalKeyword: 10976case SyntaxKind.ProtectedKeyword: 10977case SyntaxKind.PrivateKeyword: 11003if (type.Kind == SyntaxKind.IdentifierName) 11006forceLocalFunc = id.ContextualKind != SyntaxKind.AwaitKeyword; 11015case SyntaxKind.AsyncKeyword: 11018case SyntaxKind.UnsafeKeyword: 11021case SyntaxKind.SafeKeyword: 11024case SyntaxKind.ReadOnlyKeyword: 11025case SyntaxKind.VolatileKeyword: 11027case SyntaxKind.StaticKeyword: 11029case SyntaxKind.ExternKeyword: 11051using var _ = new ParserSyntaxContextResetter(this, isInAsyncContext: modifiers.Any((int)SyntaxKind.AsyncKeyword)); 11070if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 11109if (IsScript && this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) 11111semicolon = SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken); 11117semicolon = this.EatToken(SyntaxKind.SemicolonToken); 11153SyntaxKind tk = this.CurrentToken.Kind; 11156case SyntaxKind.TypeOfKeyword: 11157case SyntaxKind.DefaultKeyword: 11158case SyntaxKind.SizeOfKeyword: 11159case SyntaxKind.MakeRefKeyword: 11160case SyntaxKind.RefTypeKeyword: 11161case SyntaxKind.CheckedKeyword: 11162case SyntaxKind.UncheckedKeyword: 11163case SyntaxKind.UnsafeKeyword: 11164case SyntaxKind.RefValueKeyword: 11165case SyntaxKind.ArgListKeyword: 11166case SyntaxKind.BaseKeyword: 11167case SyntaxKind.FalseKeyword: 11168case SyntaxKind.ThisKeyword: 11169case SyntaxKind.TrueKeyword: 11170case SyntaxKind.NullKeyword: 11171case SyntaxKind.OpenParenToken: 11172case SyntaxKind.NumericLiteralToken: 11173case SyntaxKind.StringLiteralToken: 11174case SyntaxKind.Utf8StringLiteralToken: 11175case SyntaxKind.SingleLineRawStringLiteralToken: 11176case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 11177case SyntaxKind.MultiLineRawStringLiteralToken: 11178case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 11179case SyntaxKind.InterpolatedStringToken: 11180case SyntaxKind.InterpolatedStringStartToken: 11181case SyntaxKind.InterpolatedVerbatimStringStartToken: 11182case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 11183case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 11184case SyntaxKind.CharacterLiteralToken: 11185case SyntaxKind.NewKeyword: 11186case SyntaxKind.DelegateKeyword: 11187case SyntaxKind.ColonColonToken: // bad aliased name 11188case SyntaxKind.ThrowKeyword: 11189case SyntaxKind.StackAllocKeyword: 11190case SyntaxKind.RefKeyword: 11191case SyntaxKind.OpenBracketToken: // attributes on a lambda, or a collection expression. 11193case SyntaxKind.DotToken when IsAtDotDotToken(): 11195case SyntaxKind.StaticKeyword: 11197case SyntaxKind.IdentifierToken: 11200return this.IsTrueIdentifier() || this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword; 11209private static bool IsInvalidSubExpression(SyntaxKind kind) 11213case SyntaxKind.BreakKeyword: 11214case SyntaxKind.CaseKeyword: 11215case SyntaxKind.CatchKeyword: 11216case SyntaxKind.ConstKeyword: 11217case SyntaxKind.ContinueKeyword: 11218case SyntaxKind.DoKeyword: 11219case SyntaxKind.FinallyKeyword: 11220case SyntaxKind.ForKeyword: 11221case SyntaxKind.ForEachKeyword: 11222case SyntaxKind.GotoKeyword: 11223case SyntaxKind.IfKeyword: 11224case SyntaxKind.ElseKeyword: 11225case SyntaxKind.LockKeyword: 11226case SyntaxKind.ReturnKeyword: 11227case SyntaxKind.SwitchKeyword: 11228case SyntaxKind.TryKeyword: 11229case SyntaxKind.UsingKeyword: 11230case SyntaxKind.WhileKeyword: 11237internal static bool IsRightAssociative(SyntaxKind op) 11241case SyntaxKind.SimpleAssignmentExpression: 11242case SyntaxKind.AddAssignmentExpression: 11243case SyntaxKind.SubtractAssignmentExpression: 11244case SyntaxKind.MultiplyAssignmentExpression: 11245case SyntaxKind.DivideAssignmentExpression: 11246case SyntaxKind.ModuloAssignmentExpression: 11247case SyntaxKind.AndAssignmentExpression: 11248case SyntaxKind.ExclusiveOrAssignmentExpression: 11249case SyntaxKind.OrAssignmentExpression: 11250case SyntaxKind.LeftShiftAssignmentExpression: 11251case SyntaxKind.RightShiftAssignmentExpression: 11252case SyntaxKind.UnsignedRightShiftAssignmentExpression: 11253case SyntaxKind.CoalesceAssignmentExpression: 11254case SyntaxKind.CoalesceExpression: 11287private static Precedence GetPrecedence(SyntaxKind op) 11291case SyntaxKind.QueryExpression: 11293case SyntaxKind.ParenthesizedLambdaExpression: 11294case SyntaxKind.SimpleLambdaExpression: 11295case SyntaxKind.AnonymousMethodExpression: 11297case SyntaxKind.SimpleAssignmentExpression: 11298case SyntaxKind.AddAssignmentExpression: 11299case SyntaxKind.SubtractAssignmentExpression: 11300case SyntaxKind.MultiplyAssignmentExpression: 11301case SyntaxKind.DivideAssignmentExpression: 11302case SyntaxKind.ModuloAssignmentExpression: 11303case SyntaxKind.AndAssignmentExpression: 11304case SyntaxKind.ExclusiveOrAssignmentExpression: 11305case SyntaxKind.OrAssignmentExpression: 11306case SyntaxKind.LeftShiftAssignmentExpression: 11307case SyntaxKind.RightShiftAssignmentExpression: 11308case SyntaxKind.UnsignedRightShiftAssignmentExpression: 11309case SyntaxKind.CoalesceAssignmentExpression: 11311case SyntaxKind.CoalesceExpression: 11312case SyntaxKind.ThrowExpression: 11314case SyntaxKind.LogicalOrExpression: 11316case SyntaxKind.LogicalAndExpression: 11318case SyntaxKind.BitwiseOrExpression: 11320case SyntaxKind.ExclusiveOrExpression: 11322case SyntaxKind.BitwiseAndExpression: 11324case SyntaxKind.EqualsExpression: 11325case SyntaxKind.NotEqualsExpression: 11327case SyntaxKind.LessThanExpression: 11328case SyntaxKind.LessThanOrEqualExpression: 11329case SyntaxKind.GreaterThanExpression: 11330case SyntaxKind.GreaterThanOrEqualExpression: 11331case SyntaxKind.IsExpression: 11332case SyntaxKind.AsExpression: 11333case SyntaxKind.IsPatternExpression: 11335case SyntaxKind.SwitchExpression: 11336case SyntaxKind.WithExpression: 11338case SyntaxKind.LeftShiftExpression: 11339case SyntaxKind.RightShiftExpression: 11340case SyntaxKind.UnsignedRightShiftExpression: 11342case SyntaxKind.AddExpression: 11343case SyntaxKind.SubtractExpression: 11345case SyntaxKind.MultiplyExpression: 11346case SyntaxKind.DivideExpression: 11347case SyntaxKind.ModuloExpression: 11349case SyntaxKind.UnaryPlusExpression: 11350case SyntaxKind.UnaryMinusExpression: 11351case SyntaxKind.BitwiseNotExpression: 11352case SyntaxKind.LogicalNotExpression: 11353case SyntaxKind.PreIncrementExpression: 11354case SyntaxKind.PreDecrementExpression: 11355case SyntaxKind.TypeOfExpression: 11356case SyntaxKind.SizeOfExpression: 11357case SyntaxKind.CheckedExpression: 11358case SyntaxKind.UncheckedExpression: 11359case SyntaxKind.UnsafeExpression: 11360case SyntaxKind.MakeRefExpression: 11361case SyntaxKind.RefValueExpression: 11362case SyntaxKind.RefTypeExpression: 11363case SyntaxKind.AwaitExpression: 11364case SyntaxKind.IndexExpression: 11366case SyntaxKind.CastExpression: 11368case SyntaxKind.PointerIndirectionExpression: 11370case SyntaxKind.AddressOfExpression: 11372case SyntaxKind.RangeExpression: 11374case SyntaxKind.ConditionalExpression: 11376case SyntaxKind.AliasQualifiedName: 11377case SyntaxKind.AnonymousObjectCreationExpression: 11378case SyntaxKind.ArgListExpression: 11379case SyntaxKind.ArrayCreationExpression: 11380case SyntaxKind.BaseExpression: 11381case SyntaxKind.CharacterLiteralExpression: 11382case SyntaxKind.CollectionExpression: 11383case SyntaxKind.ConditionalAccessExpression: 11384case SyntaxKind.DeclarationExpression: 11385case SyntaxKind.DefaultExpression: 11386case SyntaxKind.DefaultLiteralExpression: 11387case SyntaxKind.ElementAccessExpression: 11388case SyntaxKind.FalseLiteralExpression: 11389case SyntaxKind.FieldExpression: 11390case SyntaxKind.GenericName: 11391case SyntaxKind.IdentifierName: 11392case SyntaxKind.ImplicitArrayCreationExpression: 11393case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 11394case SyntaxKind.ImplicitObjectCreationExpression: 11395case SyntaxKind.InterpolatedStringExpression: 11396case SyntaxKind.InvocationExpression: 11397case SyntaxKind.NullLiteralExpression: 11398case SyntaxKind.NumericLiteralExpression: 11399case SyntaxKind.ObjectCreationExpression: 11400case SyntaxKind.ParenthesizedExpression: 11401case SyntaxKind.PointerMemberAccessExpression: 11402case SyntaxKind.PostDecrementExpression: 11403case SyntaxKind.PostIncrementExpression: 11404case SyntaxKind.PredefinedType: 11405case SyntaxKind.RefExpression: 11406case SyntaxKind.SimpleMemberAccessExpression: 11407case SyntaxKind.StackAllocArrayCreationExpression: 11408case SyntaxKind.StringLiteralExpression: 11409case SyntaxKind.Utf8StringLiteralExpression: 11410case SyntaxKind.SuppressNullableWarningExpression: 11411case SyntaxKind.ThisExpression: 11412case SyntaxKind.TrueLiteralExpression: 11413case SyntaxKind.TupleExpression: 11420private static bool IsExpectedPrefixUnaryOperator(SyntaxKind kind) 11422return SyntaxFacts.IsPrefixUnaryExpression(kind) && kind is not SyntaxKind.RefKeyword and not SyntaxKind.OutKeyword; 11425private static bool IsExpectedBinaryOperator(SyntaxKind kind) 11430private static bool IsExpectedAssignmentOperator(SyntaxKind kind) 11437return (this.IsScript || this.IsInAsync) && this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword; 11442if (this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword) 11456case SyntaxKind.IdentifierToken: 11457return next.ContextualKind != SyntaxKind.WithKeyword; 11460case SyntaxKind.NewKeyword: 11461case SyntaxKind.ThisKeyword: 11462case SyntaxKind.BaseKeyword: 11463case SyntaxKind.DelegateKeyword: 11464case SyntaxKind.TypeOfKeyword: 11465case SyntaxKind.CheckedKeyword: 11466case SyntaxKind.UncheckedKeyword: 11467case SyntaxKind.DefaultKeyword: 11470case SyntaxKind.TrueKeyword: 11471case SyntaxKind.FalseKeyword: 11472case SyntaxKind.StringLiteralToken: 11473case SyntaxKind.SingleLineRawStringLiteralToken: 11474case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 11475case SyntaxKind.MultiLineRawStringLiteralToken: 11476case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 11477case SyntaxKind.InterpolatedStringToken: 11478case SyntaxKind.Utf8StringLiteralToken: 11479case SyntaxKind.InterpolatedStringStartToken: 11480case SyntaxKind.InterpolatedVerbatimStringStartToken: 11481case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 11482case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 11483case SyntaxKind.NumericLiteralToken: 11484case SyntaxKind.NullKeyword: 11485case SyntaxKind.CharacterLiteralToken: 11520var tk = this.CurrentToken.Kind; 11532var opKind = SyntaxFacts.GetPrefixUnaryExpression(tk); 11555this.EatContextualToken(SyntaxKind.AwaitKeyword), 11556this.ParseSubExpression(GetPrecedence(SyntaxKind.AwaitExpression))); 11562if (this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword && IsInQuery) 11572if (tk == SyntaxKind.ThrowKeyword) 11616if (this.CurrentToken.Kind == SyntaxKind.QuestionToken && precedence <= Precedence.Conditional) 11629if (operatorTokenKind == SyntaxKind.None) 11662leftOperand.Kind == SyntaxKind.IsPatternExpression ? ErrorCode.ERR_UnexpectedToken : ErrorCode.WRN_PrecedenceInversion, 11666if (operatorExpressionKind == SyntaxKind.AsExpression) 11672if (operatorExpressionKind == SyntaxKind.IsExpression) 11675if (operatorExpressionKind == SyntaxKind.SwitchExpression) 11678if (operatorExpressionKind == SyntaxKind.WithExpression) 11681if (operatorExpressionKind == SyntaxKind.RangeExpression) 11714if (this.CurrentToken.Kind != SyntaxKind.ColonToken && 11732if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 11744if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken && this.lexer.InterpolationFollowedByColon) 11754SyntaxFactory.MissingToken(SyntaxKind.ColonToken), 11755_syntaxFactory.IdentifierName(SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))); 11764this.EatToken(SyntaxKind.ColonToken), 11778conditionalExpression.WhenTrue.GetFirstToken().Kind == SyntaxKind.OpenBracketToken) 11797private (SyntaxKind operatorTokenKind, SyntaxKind operatorExpressionKind) GetExpressionOperatorTokenKindAndExpressionKind() 11804var token1Kind = token1.ContextualKind; 11808return (SyntaxKind.DotDotToken, SyntaxKind.RangeExpression); 11813if (token1Kind == SyntaxKind.GreaterThanToken 11814&& this.PeekToken(1) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token2 11817if (token2.Kind == SyntaxKind.GreaterThanToken) 11819if (this.PeekToken(2) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token3 11823token1Kind = token3.Kind == SyntaxKind.GreaterThanToken 11824? SyntaxKind.GreaterThanGreaterThanGreaterThanToken 11825: SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 11830token1Kind = SyntaxKind.GreaterThanGreaterThanToken; 11836token1Kind = SyntaxKind.GreaterThanGreaterThanEqualsToken; 11846if (token1Kind == SyntaxKind.SwitchKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11847return (token1Kind, SyntaxKind.SwitchExpression); 11849if (token1Kind == SyntaxKind.WithKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11850return (token1Kind, SyntaxKind.WithExpression); 11854return (SyntaxKind.None, SyntaxKind.None); 11857private SyntaxToken EatExpressionOperatorToken(SyntaxKind operatorTokenKind) 11861if (operatorTokenKind is SyntaxKind.DotDotToken) 11864if (operatorTokenKind is SyntaxKind.GreaterThanGreaterThanToken or SyntaxKind.GreaterThanGreaterThanEqualsToken) 11877else if (operatorTokenKind is SyntaxKind.GreaterThanGreaterThanGreaterThanToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) 11898private AssignmentExpressionSyntax ParseAssignmentExpression(SyntaxKind operatorExpressionKind, ExpressionSyntax leftOperand, SyntaxToken operatorToken) 11905if (operatorExpressionKind == SyntaxKind.SimpleAssignmentExpression && CurrentToken.Kind == SyntaxKind.RefKeyword && 11922/// <summary>Check if we're currently at a .. sequence that can then be parsed out as a <see cref="SyntaxKind.DotDotToken"/>.</summary> 11925if (this.CurrentToken.Kind != SyntaxKind.DotToken) 11929return nextToken.Kind == SyntaxKind.DotToken && NoTriviaBetween(this.CurrentToken, nextToken); 11933=> token1.Kind == SyntaxKind.DotToken && 11934token2.Kind == SyntaxKind.DotToken && 11937/// <summary>Consume the next two tokens as a <see cref="SyntaxKind.DotDotToken"/>. Note: if three dot tokens 11946var dotDotToken = SyntaxFactory.Token(token1.GetLeadingTrivia(), SyntaxKind.DotDotToken, token2.GetTrailingTrivia()); 11947if (this.CurrentToken is { Kind: SyntaxKind.DotToken } token3 && 11964if (this.PeekToken(1) is not { Kind: SyntaxKind.DotToken } token4 || 11979? EatContextualToken(SyntaxKind.ScopedKeyword) 11991this.EatToken(SyntaxKind.ThrowKeyword), 12001TypeSyntax type => _syntaxFactory.BinaryExpression(SyntaxKind.IsExpression, leftOperand, opToken, type), 12017var tk = this.CurrentToken.Kind; 12020case SyntaxKind.TypeOfKeyword: 12022case SyntaxKind.DefaultKeyword: 12024case SyntaxKind.SizeOfKeyword: 12026case SyntaxKind.MakeRefKeyword: 12028case SyntaxKind.RefTypeKeyword: 12030case SyntaxKind.CheckedKeyword: 12031case SyntaxKind.UncheckedKeyword: 12033case SyntaxKind.UnsafeKeyword: 12035case SyntaxKind.RefValueKeyword: 12037case SyntaxKind.ColonColonToken: 12042case SyntaxKind.EqualsGreaterThanToken: 12044case SyntaxKind.StaticKeyword: 12057case SyntaxKind.IdentifierToken: 12073else if (IsCurrentTokenFieldInKeywordContext() && PeekToken(1).Kind != SyntaxKind.ColonColonToken) 12075return _syntaxFactory.FieldExpression(this.EatContextualToken(SyntaxKind.FieldKeyword)); 12087case SyntaxKind.OpenBracketToken: 12091case SyntaxKind.ThisKeyword: 12093case SyntaxKind.BaseKeyword: 12096case SyntaxKind.ArgListKeyword: 12097case SyntaxKind.FalseKeyword: 12098case SyntaxKind.TrueKeyword: 12099case SyntaxKind.NullKeyword: 12100case SyntaxKind.NumericLiteralToken: 12101case SyntaxKind.StringLiteralToken: 12102case SyntaxKind.Utf8StringLiteralToken: 12103case SyntaxKind.CharacterLiteralToken: 12105case SyntaxKind.InterpolatedStringStartToken: 12106case SyntaxKind.InterpolatedVerbatimStringStartToken: 12107case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 12108case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 12110case SyntaxKind.InterpolatedStringToken: 12112case SyntaxKind.SingleLineRawStringLiteralToken: 12113case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 12114case SyntaxKind.MultiLineRawStringLiteralToken: 12115case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 12117case SyntaxKind.OpenParenToken: 12123case SyntaxKind.NewKeyword: 12125case SyntaxKind.StackAllocKeyword: 12127case SyntaxKind.DelegateKeyword: 12132case SyntaxKind.RefKeyword: 12152if (this.CurrentToken.Kind != SyntaxKind.DotToken || tk == SyntaxKind.VoidKeyword) 12163if (tk == SyntaxKind.EndOfFileToken) 12204case SyntaxKind.OpenParenToken: 12208case SyntaxKind.OpenBracketToken: 12212case SyntaxKind.PlusPlusToken: 12213case SyntaxKind.MinusMinusToken: 12217case SyntaxKind.ColonColonToken: 12218if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken) 12221SyntaxKind.SimpleMemberAccessExpression, 12224this.ConvertToMissingWithTrailingTrivia(this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedAliasedName), SyntaxKind.DotToken), 12230expr = AddTrailingSkippedSyntax(expr, this.EatTokenEvenWithIncorrectKind(SyntaxKind.DotToken)); 12235case SyntaxKind.MinusGreaterThanToken: 12236expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.PointerMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 12239case SyntaxKind.DotToken when !IsAtDotDotToken(): 12249if (this.CurrentToken.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia) && 12250this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 12251this.PeekToken(2).ContextualKind == SyntaxKind.IdentifierToken) 12254SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), 12258expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 12261case SyntaxKind.QuestionToken: 12270case SyntaxKind.ExclamationToken: 12271expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, this.EatToken()); 12283Debug.Assert(this.CurrentToken.Kind == SyntaxKind.BaseKeyword); 12306this.CurrentToken.Kind == SyntaxKind.OpenParenToken && ScanDesignator() && 12307this.CurrentToken.Kind == SyntaxKind.EqualsToken; 12314case SyntaxKind.IdentifierToken: 12322case SyntaxKind.OpenParenToken: 12333case SyntaxKind.CommaToken: 12335case SyntaxKind.CloseParenToken: 12351while (this.PeekToken(tokenIndex).Kind == SyntaxKind.StaticKeyword || 12352this.PeekToken(tokenIndex).ContextualKind == SyntaxKind.AsyncKeyword) 12357return this.PeekToken(tokenIndex).Kind == SyntaxKind.DelegateKeyword && 12358this.PeekToken(tokenIndex + 1).Kind != SyntaxKind.AsteriskToken; 12405if (this.CurrentToken.Kind == SyntaxKind.QuestionToken) 12408var nextTokenKind = nextToken.Kind; 12413if (nextTokenKind == SyntaxKind.DotToken && !IsAtDotDotToken(nextToken, this.PeekToken(2))) 12425bool isStartOfElementBindingExpression(SyntaxKind nextTokenKind) 12427if (nextTokenKind != SyntaxKind.OpenBracketToken) 12444return this.CurrentToken.Kind != SyntaxKind.ColonToken; 12457while (this.CurrentToken.Kind == SyntaxKind.ExclamationToken) 12458expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, EatToken()); 12495SyntaxKind.OpenParenToken 12497SyntaxKind.OpenBracketToken 12499SyntaxKind.DotToken 12500=> _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)), 12509if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.ArgumentList) 12518openKind: SyntaxKind.OpenParenToken, 12519closeKind: SyntaxKind.CloseParenToken); 12525if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.BracketedArgumentList) 12534openKind: SyntaxKind.OpenBracketToken, 12535closeKind: SyntaxKind.CloseBracketToken); 12543SyntaxKind openKind, 12544SyntaxKind closeKind) 12546Debug.Assert(openKind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken); 12547Debug.Assert(closeKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken); 12548Debug.Assert((openKind == SyntaxKind.OpenParenToken) == (closeKind == SyntaxKind.CloseParenToken)); 12549bool isIndexer = openKind == SyntaxKind.OpenBracketToken; 12552openToken = this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken 12559if (this.CurrentToken.Kind != closeKind && this.CurrentToken.Kind != SyntaxKind.SemicolonToken) 12566SyntaxKind.CloseBracketToken, 12578SyntaxKind.CloseParenToken, 12603closeToken = this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken 12610LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 12612if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken) 12616static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleArgumentExpression(), 12617static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 12624return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken; 12632private static bool IsValidArgumentRefKindKeyword(SyntaxKind kind) 12636case SyntaxKind.RefKeyword: 12637case SyntaxKind.OutKeyword: 12638case SyntaxKind.InKeyword: 12647var nameColon = this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.ColonToken 12650this.EatToken(SyntaxKind.ColonToken)) 12656!(this.CurrentToken.Kind == SyntaxKind.RefKeyword && 12664if (isIndexer && this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseBracketToken) 12668else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12680expression = refKindKeyword?.Kind == SyntaxKind.OutKeyword 12692this.EatToken(SyntaxKind.OpenParenToken), 12694this.EatToken(SyntaxKind.CloseParenToken)); 12700if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 12704this.EatToken(SyntaxKind.OpenParenToken), 12706this.EatToken(SyntaxKind.CloseParenToken)); 12710return _syntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression, keyword); 12718this.EatToken(SyntaxKind.OpenParenToken), 12720this.EatToken(SyntaxKind.CloseParenToken)); 12727this.EatToken(SyntaxKind.OpenParenToken), 12729this.EatToken(SyntaxKind.CloseParenToken)); 12736this.EatToken(SyntaxKind.OpenParenToken), 12738this.EatToken(SyntaxKind.CloseParenToken)); 12744Debug.Assert(checkedOrUnchecked.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 12745var kind = checkedOrUnchecked.Kind == SyntaxKind.CheckedKeyword ? SyntaxKind.CheckedExpression : SyntaxKind.UncheckedExpression; 12750this.EatToken(SyntaxKind.OpenParenToken), 12752this.EatToken(SyntaxKind.CloseParenToken)); 12758this.EatToken(SyntaxKind.UnsafeKeyword), 12759this.EatToken(SyntaxKind.OpenParenToken), 12761this.EatToken(SyntaxKind.CloseParenToken)); 12767this.EatToken(SyntaxKind.RefValueKeyword), 12768this.EatToken(SyntaxKind.OpenParenToken), 12770this.EatToken(SyntaxKind.CommaToken), 12772this.EatToken(SyntaxKind.CloseParenToken)); 12787Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12805token.Kind is SyntaxKind.CommaToken || 12811return token.Kind == SyntaxKind.CloseParenToken && 12812this.PeekToken(index).Kind == SyntaxKind.EqualsGreaterThanToken; 12818Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12860var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 12870if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 12880case SyntaxKind.CommaToken: 12883case SyntaxKind.CloseParenToken: 12884return this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken; 12894Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 12909this.EatToken(SyntaxKind.OpenParenToken), 12911this.EatToken(SyntaxKind.CloseParenToken), 12918var openParen = this.EatToken(SyntaxKind.OpenParenToken); 12922if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12930if (expression.Kind == SyntaxKind.IdentifierName && this.CurrentToken.Kind == SyntaxKind.ColonToken) 12943this.EatToken(SyntaxKind.CloseParenToken)); 12951while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12953list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 12956var argument = expression.Kind != SyntaxKind.IdentifierName || this.CurrentToken.Kind != SyntaxKind.ColonToken 12968list.AddSeparator(SyntaxFactory.MissingToken(SyntaxKind.CommaToken)); 12977this.EatToken(SyntaxKind.CloseParenToken)); 12984if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 12997if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 13004if (forPattern && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 13016if (inSwitchArmPattern && this.CurrentToken.ContextualKind == SyntaxKind.WhenKeyword) 13040SyntaxKind.PlusToken or 13041SyntaxKind.MinusToken or 13042SyntaxKind.AmpersandToken or 13043SyntaxKind.AsteriskToken 13047SyntaxKind.DotToken when IsAtDotDotToken() 13063return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken || CanFollowCast(this.CurrentToken.Kind); 13069if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && 13070this.PeekToken(1).Kind == SyntaxKind.CloseBracketToken) 13109return this.CurrentToken.ContextualKind is SyntaxKind.OrKeyword or SyntaxKind.AndKeyword; 13130if (token1.Kind == SyntaxKind.EqualsGreaterThanToken) 13138if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 13154if (this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 13159else if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13160this.PeekToken(1).Kind == SyntaxKind.StaticKeyword) 13173if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 13183if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13191if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 13192this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13202if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13211if (st == ScanTypeFlags.NotType || this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13228if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 13229this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13236if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13245private static bool CanFollowCast(SyntaxKind kind) 13249case SyntaxKind.AsKeyword: 13250case SyntaxKind.IsKeyword: 13251case SyntaxKind.SemicolonToken: 13252case SyntaxKind.CloseParenToken: 13253case SyntaxKind.CloseBracketToken: 13254case SyntaxKind.OpenBraceToken: 13255case SyntaxKind.CloseBraceToken: 13256case SyntaxKind.CommaToken: 13257case SyntaxKind.EqualsToken: 13258case SyntaxKind.PlusEqualsToken: 13259case SyntaxKind.MinusEqualsToken: 13260case SyntaxKind.AsteriskEqualsToken: 13261case SyntaxKind.SlashEqualsToken: 13262case SyntaxKind.PercentEqualsToken: 13263case SyntaxKind.AmpersandEqualsToken: 13264case SyntaxKind.CaretEqualsToken: 13265case SyntaxKind.BarEqualsToken: 13266case SyntaxKind.LessThanLessThanEqualsToken: 13267case SyntaxKind.GreaterThanGreaterThanEqualsToken: 13268case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 13269case SyntaxKind.QuestionToken: 13270case SyntaxKind.ColonToken: 13271case SyntaxKind.BarBarToken: 13272case SyntaxKind.AmpersandAmpersandToken: 13273case SyntaxKind.BarToken: 13274case SyntaxKind.CaretToken: 13275case SyntaxKind.AmpersandToken: 13276case SyntaxKind.EqualsEqualsToken: 13277case SyntaxKind.ExclamationEqualsToken: 13278case SyntaxKind.LessThanToken: 13279case SyntaxKind.LessThanEqualsToken: 13280case SyntaxKind.GreaterThanToken: 13281case SyntaxKind.GreaterThanEqualsToken: 13282case SyntaxKind.QuestionQuestionEqualsToken: 13283case SyntaxKind.LessThanLessThanToken: 13284case SyntaxKind.GreaterThanGreaterThanToken: 13285case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 13286case SyntaxKind.PlusToken: 13287case SyntaxKind.MinusToken: 13288case SyntaxKind.AsteriskToken: 13289case SyntaxKind.SlashToken: 13290case SyntaxKind.PercentToken: 13291case SyntaxKind.PlusPlusToken: 13292case SyntaxKind.MinusMinusToken: 13293case SyntaxKind.OpenBracketToken: 13294case SyntaxKind.DotToken: 13295case SyntaxKind.MinusGreaterThanToken: 13296case SyntaxKind.QuestionQuestionToken: 13297case SyntaxKind.EndOfFileToken: 13298case SyntaxKind.SwitchKeyword: 13299case SyntaxKind.EqualsGreaterThanToken: 13308Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 13327Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 13328var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13331SyntaxKind.CloseBracketToken, 13342this.EatToken(SyntaxKind.CloseBracketToken)); 13345LanguageParser @this, ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<CollectionElementSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13348static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleCollectionElement(), 13363if (this.CurrentToken.ContextualKind == SyntaxKind.WithKeyword && 13364this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 13366return _syntaxFactory.WithElement(this.EatContextualToken(SyntaxKind.WithKeyword), this.ParseParenthesizedArgumentList()); 13381return this.CurrentToken.Kind == SyntaxKind.NewKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 13387var @new = this.EatToken(SyntaxKind.NewKeyword); 13389Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBraceToken); 13391var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13394SyntaxKind.CloseBraceToken, 13406this.EatToken(SyntaxKind.CloseBraceToken)); 13426return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken; 13431return IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 13436return IsTrueIdentifier() && this.PeekToken(1).Kind is SyntaxKind.EqualsToken or SyntaxKind.ColonToken; 13441return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken; 13446SyntaxToken @new = this.EatToken(SyntaxKind.NewKeyword); 13454if (type.Kind == SyntaxKind.ArrayType) 13457if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 13467if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13472if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 13481this.EatToken(SyntaxKind.OpenParenToken, ErrorCode.ERR_BadNewExpr, reportError: type?.ContainsDiagnostics == false), 13483SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken)); 13494if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13507case SyntaxKind.QuestionToken: // e.g. `new(a, b)?()` 13508case SyntaxKind.OpenBracketToken: // e.g. `new(a, b)[]` 13509case SyntaxKind.OpenParenToken: // e.g. `new(a, b)()` for better error recovery 13521var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13524SyntaxKind.CloseBraceToken, 13536SyntaxKind.WithInitializerExpression, 13539this.EatToken(SyntaxKind.CloseBraceToken))); 13546var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13550SyntaxKind.CloseBraceToken, 13558var kind = isObjectInitializer(initializers) ? SyntaxKind.ObjectInitializerExpression : SyntaxKind.CollectionInitializerExpression; 13564this.EatToken(SyntaxKind.CloseBraceToken)); 13578Kind: SyntaxKind.SimpleAssignmentExpression, 13579Left.Kind: SyntaxKind.IdentifierName or SyntaxKind.ImplicitElementAccess, 13620LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13624static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 13632SyntaxKind.SimpleAssignmentExpression, 13634this.CurrentToken.Kind == SyntaxKind.ColonToken 13635? this.EatTokenAsKind(SyntaxKind.EqualsToken) 13636: this.EatToken(SyntaxKind.EqualsToken), 13637this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 13645SyntaxKind.SimpleAssignmentExpression, 13647this.EatToken(SyntaxKind.EqualsToken), 13648this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 13655var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13659SyntaxKind.CloseBraceToken, 13668SyntaxKind.ComplexElementInitializerExpression, 13671this.EatToken(SyntaxKind.CloseBraceToken)); 13676Debug.Assert(this.CurrentToken.Kind is SyntaxKind.NewKeyword or SyntaxKind.StackAllocKeyword); 13677return this.PeekToken(1).Kind == SyntaxKind.OpenBracketToken; 13682var @new = this.EatToken(SyntaxKind.NewKeyword); 13683var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13703if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 13716this.EatToken(SyntaxKind.CloseBracketToken), 13722var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13725SyntaxKind.CloseBraceToken, 13734SyntaxKind.ArrayInitializerExpression, 13737this.EatToken(SyntaxKind.CloseBraceToken)); 13740LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13743static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleVariableInitializer(), 13758var @stackalloc = this.EatToken(SyntaxKind.StackAllocKeyword); 13759var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13770if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 13783this.EatToken(SyntaxKind.CloseBracketToken), 13790this.EatToken(SyntaxKind.StackAllocKeyword), 13792this.CurrentToken.Kind == SyntaxKind.OpenBraceToken ? this.ParseArrayInitializer() : null); 13799isInAsyncContext: this.IsInAsync || modifiers.Any((int)SyntaxKind.AsyncKeyword), 13806var @delegate = this.EatToken(SyntaxKind.DelegateKeyword); 13809if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13822if (this.CurrentToken.Kind != SyntaxKind.OpenBraceToken) 13825var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13834SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)), 13853if (this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 13855modifiers.Add(this.EatToken(SyntaxKind.StaticKeyword)); 13859if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13862modifiers.Add(this.EatContextualToken(SyntaxKind.AsyncKeyword)); 13874Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword); 13878case SyntaxKind.OpenParenToken: 13879case SyntaxKind.IdentifierToken: 13880case SyntaxKind.StaticKeyword: 13881case SyntaxKind.RefKeyword: 13882case SyntaxKind.DelegateKeyword: 13899if (this.CurrentToken.Kind == SyntaxKind.ColonToken && 13916isInAsyncContext: this.IsInAsync || modifiers.Any((int)SyntaxKind.AsyncKeyword), 13927if (CurrentToken.Kind != SyntaxKind.OpenParenToken) 13934if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13937var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13947var identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13948? this.EatTokenAsKind(SyntaxKind.IdentifierToken) 13952var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13964=> CurrentToken.Kind == SyntaxKind.OpenBraceToken 13970var openParen = this.EatToken(SyntaxKind.OpenParenToken); 13976SyntaxKind.CloseParenToken, 13989this.EatToken(SyntaxKind.CloseParenToken)); 13992LanguageParser @this, ref SyntaxToken openParen, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13995static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleLambdaParameter(), 14005case SyntaxKind.ParamsKeyword: 14006case SyntaxKind.ReadOnlyKeyword: 14007case SyntaxKind.RefKeyword: 14008case SyntaxKind.OutKeyword: 14009case SyntaxKind.InKeyword: 14010case SyntaxKind.OpenParenToken: // tuple 14011case SyntaxKind.OpenBracketToken: // attribute 14014case SyntaxKind.IdentifierToken: 14017case SyntaxKind.DelegateKeyword: 14044var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 14065if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 14088is not SyntaxKind.CommaToken 14089and not SyntaxKind.CloseParenToken 14090and not SyntaxKind.EqualsGreaterThanToken 14091and not SyntaxKind.OpenBraceToken 14092and not SyntaxKind.EqualsToken) 14113case SyntaxKind.OnKeyword: 14114case SyntaxKind.EqualsKeyword: 14115case SyntaxKind.AscendingKeyword: 14116case SyntaxKind.DescendingKeyword: 14117case SyntaxKind.ByKeyword: 14128case SyntaxKind.FromKeyword: 14129case SyntaxKind.JoinKeyword: 14130case SyntaxKind.IntoKeyword: 14131case SyntaxKind.WhereKeyword: 14132case SyntaxKind.OrderByKeyword: 14133case SyntaxKind.GroupKeyword: 14134case SyntaxKind.SelectKeyword: 14135case SyntaxKind.LetKeyword: 14144return this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword && 14152var pk1 = this.PeekToken(1).Kind; 14158if (pk1 == SyntaxKind.IdentifierToken) 14160var pk2 = this.PeekToken(2).Kind; 14161if (pk2 == SyntaxKind.InKeyword) 14168if (pk2 is SyntaxKind.SemicolonToken or // from x; 14169SyntaxKind.CommaToken or // from x, y; 14170SyntaxKind.EqualsToken) // from x = null; 14180if (pk2 is SyntaxKind.OpenParenToken or SyntaxKind.OpenBraceToken) 14197return this.ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind is SyntaxKind.IdentifierToken or SyntaxKind.InKeyword; 14208: this.AddError(fromClause, ErrorCode.WRN_PrecedenceInversion, SyntaxFacts.GetText(SyntaxKind.FromKeyword)), 14221case SyntaxKind.FromKeyword: 14224case SyntaxKind.JoinKeyword: 14227case SyntaxKind.LetKeyword: 14230case SyntaxKind.WhereKeyword: 14233case SyntaxKind.OrderByKeyword: 14244SyntaxKind.SelectKeyword => this.ParseSelectClause(), 14245SyntaxKind.GroupKeyword => this.ParseGroupClause(), 14247this.EatToken(SyntaxKind.SelectKeyword, ErrorCode.ERR_ExpectedSelectOrGroup), 14254this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword 14261Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword); 14262var @from = this.EatContextualToken(SyntaxKind.FromKeyword); 14264var type = this.PeekToken(1).Kind != SyntaxKind.InKeyword 14269if (this.PeekToken(1).ContextualKind == SyntaxKind.InKeyword && 14270(this.CurrentToken.Kind != SyntaxKind.IdentifierToken || SyntaxFacts.IsQueryContextualKeyword(this.CurrentToken.ContextualKind))) 14276name = WithAdditionalDiagnostics(name, this.GetExpectedTokenError(SyntaxKind.IdentifierToken, name.ContextualKind, name.GetLeadingTriviaWidth(), name.Width)); 14277name = this.ConvertToMissingWithTrailingTrivia(name, SyntaxKind.IdentifierToken); 14288this.EatToken(SyntaxKind.InKeyword), 14294Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.JoinKeyword); 14296joinKeyword: this.EatContextualToken(SyntaxKind.JoinKeyword), 14297type: this.PeekToken(1).Kind != SyntaxKind.InKeyword 14301inKeyword: this.EatToken(SyntaxKind.InKeyword), 14303onKeyword: this.EatContextualToken(SyntaxKind.OnKeyword, ErrorCode.ERR_ExpectedContextualKeywordOn), 14305equalsKeyword: this.EatContextualToken(SyntaxKind.EqualsKeyword, ErrorCode.ERR_ExpectedContextualKeywordEquals), 14307into: this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword 14314Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.LetKeyword); 14316this.EatContextualToken(SyntaxKind.LetKeyword), 14318SyntaxFacts.IsReservedKeyword(this.CurrentToken.Kind) && this.PeekToken(1).Kind == SyntaxKind.EqualsToken 14319? this.EatTokenAsKind(SyntaxKind.IdentifierToken) 14321this.EatToken(SyntaxKind.EqualsToken), 14327Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword); 14329this.EatContextualToken(SyntaxKind.WhereKeyword), 14335Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.OrderByKeyword); 14336var @orderby = this.EatContextualToken(SyntaxKind.OrderByKeyword); 14343while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 14345if (this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken) 14349else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 14351list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 14355else if (skipBadOrderingListTokens(list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 14365PostSkipAction skipBadOrderingListTokens(SeparatedSyntaxListBuilder<OrderingSyntax> list, SyntaxKind expected) 14370static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 14371static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseParenToken 14372|| p.CurrentToken.Kind == SyntaxKind.SemicolonToken 14382SyntaxKind kind = SyntaxKind.AscendingOrdering; 14384if (this.CurrentToken.ContextualKind is SyntaxKind.AscendingKeyword or SyntaxKind.DescendingKeyword) 14387if (direction.Kind == SyntaxKind.DescendingKeyword) 14389kind = SyntaxKind.DescendingOrdering; 14398Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.SelectKeyword); 14400this.EatContextualToken(SyntaxKind.SelectKeyword), 14406Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.GroupKeyword); 14408this.EatContextualToken(SyntaxKind.GroupKeyword), 14410this.EatContextualToken(SyntaxKind.ByKeyword, ErrorCode.ERR_ExpectedContextualKeywordBy), 14416Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword); 14418this.EatContextualToken(SyntaxKind.IntoKeyword), 14477LanguageParser parser, ref SyntaxToken openToken, SeparatedSyntaxListBuilder<TNode> builder, SyntaxKind expectedKind, SyntaxKind closeTokenKind) where TNode : GreenNode; 14510SyntaxKind closeTokenKind, 14532SyntaxKind closeTokenKind, 14543var separatorTokenKind = SyntaxKind.CommaToken; 14575nodes.AddSeparator(this.CurrentToken.Kind == SyntaxKind.SemicolonToken 14602else if (skipBadTokens(this, ref openToken, nodes, SyntaxKind.IdentifierToken, closeTokenKind) == PostSkipAction.Continue) 14622if (allowSemicolonAsSeparator && this.CurrentToken.Kind is SyntaxKind.SemicolonToken) 14711if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) return node; 14713while (this.CurrentToken.Kind != SyntaxKind.EndOfFileToken)
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\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\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: 120goto case SyntaxKind.InterfaceDeclaration; 122case SyntaxKind.InterfaceDeclaration: 123case SyntaxKind.ExtensionBlockDeclaration: 140case SyntaxKind.EnumDeclaration: 156case SyntaxKind.EnumMemberDeclaration: 168case SyntaxKind.DelegateDeclaration: 182case SyntaxKind.EventDeclaration: 199case SyntaxKind.EventFieldDeclaration: 200case SyntaxKind.FieldDeclaration: 218case SyntaxKind.ArrowExpressionClause: 229case SyntaxKind.PropertyDeclaration: 253case SyntaxKind.IndexerDeclaration: 278case SyntaxKind.AddAccessorDeclaration: 279case SyntaxKind.RemoveAccessorDeclaration: 280case SyntaxKind.GetAccessorDeclaration: 281case SyntaxKind.SetAccessorDeclaration: 282case SyntaxKind.InitAccessorDeclaration: 294case SyntaxKind.ConstructorDeclaration: 295case SyntaxKind.ConversionOperatorDeclaration: 296case SyntaxKind.DestructorDeclaration: 297case SyntaxKind.MethodDeclaration: 298case SyntaxKind.OperatorDeclaration: 327case SyntaxKind.CompilationUnit: 427case SyntaxKind.ArrowExpressionClause: 430case SyntaxKind.MethodDeclaration: 433case SyntaxKind.OperatorDeclaration: 436case SyntaxKind.ConversionOperatorDeclaration: 439case SyntaxKind.PropertyDeclaration: 442case SyntaxKind.IndexerDeclaration: 445case SyntaxKind.ConstructorDeclaration: 448case SyntaxKind.DestructorDeclaration:
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))
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);
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)
280if (arglistToken.Kind() == SyntaxKind.ArgListKeyword)
Symbols\Source\SourceEventSymbol.cs (7)
163case SyntaxKind.EventDeclaration: 165case SyntaxKind.VariableDeclarator: 670diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 675diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword)); 891(MemberSyntax?.Modifiers).GetModifierLocation(SyntaxKind.ExternKeyword, location)); 897(MemberSyntax?.Modifiers).GetModifierLocation(SyntaxKind.UnsafeKeyword, location), 981(MemberSyntax?.Modifiers).GetModifierLocation(SyntaxKind.SafeKeyword, GetFirstLocation()));
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) 2544diagnostics.Add(ErrorCode.ERR_MemberAlreadyExists, indexer.GetFirstLocation(), SyntaxFacts.GetText(SyntaxKind.ThisKeyword), containerForDiagnostics); 3253case SyntaxKind.FieldDeclaration: 3256!ContainsModifier(fieldDecl.Modifiers, SyntaxKind.StaticKeyword) && 3257!ContainsModifier(fieldDecl.Modifiers, SyntaxKind.ConstKeyword); 3258case SyntaxKind.PropertyDeclaration: 3262!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.StaticKeyword) && 3263!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.AbstractKeyword) && 3264!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.ExternKeyword) && 3265!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.PartialKeyword) && 3268case SyntaxKind.EventFieldDeclaration: 3272!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.StaticKeyword) && 3273!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.AbstractKeyword) && 3274!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.ExternKeyword); 3287private static bool ContainsModifier(SyntaxTokenList modifiers, SyntaxKind modifier) 4075case SyntaxKind.EnumDeclaration: 4079case SyntaxKind.DelegateDeclaration: 4083case SyntaxKind.NamespaceDeclaration: 4084case SyntaxKind.FileScopedNamespaceDeclaration: 4089case SyntaxKind.CompilationUnit: 4093case SyntaxKind.InterfaceDeclaration: 4097case SyntaxKind.ClassDeclaration: 4098case SyntaxKind.StructDeclaration: 4099case SyntaxKind.UnionDeclaration: 4100case SyntaxKind.RecordDeclaration: 4101case SyntaxKind.RecordStructDeclaration: 4102case SyntaxKind.ExtensionBlockDeclaration: 4128if (syntax.Kind() is SyntaxKind.UnionDeclaration) 4925&& type.Kind() is (SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.UnionDeclaration)); 5813case SyntaxKind.FieldDeclaration: 5859case SyntaxKind.MethodDeclaration: 5872case SyntaxKind.ConstructorDeclaration: 5883if (constructorSyntax.Initializer?.Kind() != SyntaxKind.ThisConstructorInitializer) 5890case SyntaxKind.DestructorDeclaration: 5907case SyntaxKind.PropertyDeclaration: 5957case SyntaxKind.EventFieldDeclaration: 6009case SyntaxKind.EventDeclaration: 6028case SyntaxKind.IndexerDeclaration: 6044case SyntaxKind.ConversionOperatorDeclaration: 6058case SyntaxKind.OperatorDeclaration: 6072case SyntaxKind.GlobalStatement: 6081while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 6088case SyntaxKind.LocalDeclarationStatement: 6100case SyntaxKind.ExpressionStatement: 6101case SyntaxKind.IfStatement: 6102case SyntaxKind.YieldReturnStatement: 6103case SyntaxKind.ReturnStatement: 6104case SyntaxKind.ThrowStatement: 6105case SyntaxKind.SwitchStatement: 6106case SyntaxKind.LockStatement: 6131m.Kind() is SyntaxKind.NamespaceDeclaration or 6132SyntaxKind.FileScopedNamespaceDeclaration or 6133SyntaxKind.IncompleteMember); 6146var 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), 242if (modifier.IsKind(SyntaxKind.FixedKeyword)) 280diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, SyntaxFacts.GetText(SyntaxKind.RequiredKeyword)); 500diagnostics.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)
304SyntaxKind syntaxKind = SyntaxFacts.GetOperatorKind(target.Name); 306return 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_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\SourceNamedTypeSymbol.cs (30)
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: 2132sourceField.ModifiersTokenList.GetModifierLocation(SyntaxKind.SafeKeyword, field.GetFirstLocation()));
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)
349{ MethodKind: MethodKind.PropertyGet, IsInitOnly: false } => SyntaxFacts.GetText(SyntaxKind.GetKeyword), 350{ MethodKind: MethodKind.PropertySet, IsInitOnly: false } => SyntaxFacts.GetText(SyntaxKind.SetKeyword), 351{ MethodKind: MethodKind.PropertySet, IsInitOnly: true } => SyntaxFacts.GetText(SyntaxKind.InitKeyword), 507if (node.ArgumentList?.Arguments is not [{ NameColon: null, NameEquals: null, Expression: LiteralExpressionSyntax { RawKind: (int)SyntaxKind.StringLiteralExpression } }]) 1057(Syntax?.Modifiers).GetModifierLocation(SyntaxKind.ExternKeyword, GetFirstLocation())); 1063(Syntax?.Modifiers).GetModifierLocation(SyntaxKind.UnsafeKeyword, GetFirstLocation()), 1102(Syntax?.Modifiers).GetModifierLocation(SyntaxKind.SafeKeyword, GetFirstLocation())); 1156diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 1161diagnostics.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)
513if (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 (1028)
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.UnsafeKeyword: 580return SyntaxKind.UnsafeExpression; 581case SyntaxKind.DefaultKeyword: 582return SyntaxKind.DefaultExpression; 583case SyntaxKind.TypeOfKeyword: 584return SyntaxKind.TypeOfExpression; 585case SyntaxKind.SizeOfKeyword: 586return SyntaxKind.SizeOfExpression; 588return SyntaxKind.None; 592public static bool IsLiteralExpression(SyntaxKind token) 594return GetLiteralExpression(token) != SyntaxKind.None; 597public static SyntaxKind GetLiteralExpression(SyntaxKind token) 601SyntaxKind.StringLiteralToken => SyntaxKind.StringLiteralExpression, 602SyntaxKind.Utf8StringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 603SyntaxKind.SingleLineRawStringLiteralToken => SyntaxKind.StringLiteralExpression, 604SyntaxKind.Utf8SingleLineRawStringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 605SyntaxKind.MultiLineRawStringLiteralToken => SyntaxKind.StringLiteralExpression, 606SyntaxKind.Utf8MultiLineRawStringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 607SyntaxKind.CharacterLiteralToken => SyntaxKind.CharacterLiteralExpression, 608SyntaxKind.NumericLiteralToken => SyntaxKind.NumericLiteralExpression, 609SyntaxKind.NullKeyword => SyntaxKind.NullLiteralExpression, 610SyntaxKind.TrueKeyword => SyntaxKind.TrueLiteralExpression, 611SyntaxKind.FalseKeyword => SyntaxKind.FalseLiteralExpression, 612SyntaxKind.ArgListKeyword => SyntaxKind.ArgListExpression, 613_ => SyntaxKind.None, 617public static bool IsInstanceExpression(SyntaxKind token) 619return GetInstanceExpression(token) != SyntaxKind.None; 622public static SyntaxKind GetInstanceExpression(SyntaxKind token) 626case SyntaxKind.ThisKeyword: 627return SyntaxKind.ThisExpression; 628case SyntaxKind.BaseKeyword: 629return SyntaxKind.BaseExpression; 631return SyntaxKind.None; 635public static bool IsBinaryExpression(SyntaxKind token) 637return GetBinaryExpression(token) != SyntaxKind.None; 640public static bool IsBinaryExpressionOperatorToken(SyntaxKind token) 642return GetBinaryExpression(token) != SyntaxKind.None; 645public static SyntaxKind GetBinaryExpression(SyntaxKind token) 649case SyntaxKind.QuestionQuestionToken: 650return SyntaxKind.CoalesceExpression; 651case SyntaxKind.IsKeyword: 652return SyntaxKind.IsExpression; 653case SyntaxKind.AsKeyword: 654return SyntaxKind.AsExpression; 655case SyntaxKind.BarToken: 656return SyntaxKind.BitwiseOrExpression; 657case SyntaxKind.CaretToken: 658return SyntaxKind.ExclusiveOrExpression; 659case SyntaxKind.AmpersandToken: 660return SyntaxKind.BitwiseAndExpression; 661case SyntaxKind.EqualsEqualsToken: 662return SyntaxKind.EqualsExpression; 663case SyntaxKind.ExclamationEqualsToken: 664return SyntaxKind.NotEqualsExpression; 665case SyntaxKind.LessThanToken: 666return SyntaxKind.LessThanExpression; 667case SyntaxKind.LessThanEqualsToken: 668return SyntaxKind.LessThanOrEqualExpression; 669case SyntaxKind.GreaterThanToken: 670return SyntaxKind.GreaterThanExpression; 671case SyntaxKind.GreaterThanEqualsToken: 672return SyntaxKind.GreaterThanOrEqualExpression; 673case SyntaxKind.LessThanLessThanToken: 674return SyntaxKind.LeftShiftExpression; 675case SyntaxKind.GreaterThanGreaterThanToken: 676return SyntaxKind.RightShiftExpression; 677case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 678return SyntaxKind.UnsignedRightShiftExpression; 679case SyntaxKind.PlusToken: 680return SyntaxKind.AddExpression; 681case SyntaxKind.MinusToken: 682return SyntaxKind.SubtractExpression; 683case SyntaxKind.AsteriskToken: 684return SyntaxKind.MultiplyExpression; 685case SyntaxKind.SlashToken: 686return SyntaxKind.DivideExpression; 687case SyntaxKind.PercentToken: 688return SyntaxKind.ModuloExpression; 689case SyntaxKind.AmpersandAmpersandToken: 690return SyntaxKind.LogicalAndExpression; 691case SyntaxKind.BarBarToken: 692return SyntaxKind.LogicalOrExpression; 694return SyntaxKind.None; 698public static bool IsAssignmentExpression(SyntaxKind kind) 702case SyntaxKind.CoalesceAssignmentExpression: 703case SyntaxKind.OrAssignmentExpression: 704case SyntaxKind.AndAssignmentExpression: 705case SyntaxKind.ExclusiveOrAssignmentExpression: 706case SyntaxKind.LeftShiftAssignmentExpression: 707case SyntaxKind.RightShiftAssignmentExpression: 708case SyntaxKind.UnsignedRightShiftAssignmentExpression: 709case SyntaxKind.AddAssignmentExpression: 710case SyntaxKind.SubtractAssignmentExpression: 711case SyntaxKind.MultiplyAssignmentExpression: 712case SyntaxKind.DivideAssignmentExpression: 713case SyntaxKind.ModuloAssignmentExpression: 714case SyntaxKind.SimpleAssignmentExpression: 721public static bool IsAssignmentExpressionOperatorToken(SyntaxKind token) 725case SyntaxKind.QuestionQuestionEqualsToken: 726case SyntaxKind.BarEqualsToken: 727case SyntaxKind.AmpersandEqualsToken: 728case SyntaxKind.CaretEqualsToken: 729case SyntaxKind.LessThanLessThanEqualsToken: 730case SyntaxKind.GreaterThanGreaterThanEqualsToken: 731case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 732case SyntaxKind.PlusEqualsToken: 733case SyntaxKind.MinusEqualsToken: 734case SyntaxKind.AsteriskEqualsToken: 735case SyntaxKind.SlashEqualsToken: 736case SyntaxKind.PercentEqualsToken: 737case SyntaxKind.EqualsToken: 744public static SyntaxKind GetAssignmentExpression(SyntaxKind token) 748case SyntaxKind.BarEqualsToken: 749return SyntaxKind.OrAssignmentExpression; 750case SyntaxKind.AmpersandEqualsToken: 751return SyntaxKind.AndAssignmentExpression; 752case SyntaxKind.CaretEqualsToken: 753return SyntaxKind.ExclusiveOrAssignmentExpression; 754case SyntaxKind.LessThanLessThanEqualsToken: 755return SyntaxKind.LeftShiftAssignmentExpression; 756case SyntaxKind.GreaterThanGreaterThanEqualsToken: 757return SyntaxKind.RightShiftAssignmentExpression; 758case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 759return SyntaxKind.UnsignedRightShiftAssignmentExpression; 760case SyntaxKind.PlusEqualsToken: 761return SyntaxKind.AddAssignmentExpression; 762case SyntaxKind.MinusEqualsToken: 763return SyntaxKind.SubtractAssignmentExpression; 764case SyntaxKind.AsteriskEqualsToken: 765return SyntaxKind.MultiplyAssignmentExpression; 766case SyntaxKind.SlashEqualsToken: 767return SyntaxKind.DivideAssignmentExpression; 768case SyntaxKind.PercentEqualsToken: 769return SyntaxKind.ModuloAssignmentExpression; 770case SyntaxKind.EqualsToken: 771return SyntaxKind.SimpleAssignmentExpression; 772case SyntaxKind.QuestionQuestionEqualsToken: 773return SyntaxKind.CoalesceAssignmentExpression; 775return SyntaxKind.None; 779public static SyntaxKind GetCheckStatement(SyntaxKind keyword) 783case SyntaxKind.CheckedKeyword: 784return SyntaxKind.CheckedStatement; 785case SyntaxKind.UncheckedKeyword: 786return SyntaxKind.UncheckedStatement; 788return SyntaxKind.None; 792public static SyntaxKind GetAccessorDeclarationKind(SyntaxKind keyword) 796case SyntaxKind.GetKeyword: 797return SyntaxKind.GetAccessorDeclaration; 798case SyntaxKind.SetKeyword: 799return SyntaxKind.SetAccessorDeclaration; 800case SyntaxKind.InitKeyword: 801return SyntaxKind.InitAccessorDeclaration; 802case SyntaxKind.AddKeyword: 803return SyntaxKind.AddAccessorDeclaration; 804case SyntaxKind.RemoveKeyword: 805return SyntaxKind.RemoveAccessorDeclaration; 807return SyntaxKind.None; 811public static bool IsAccessorDeclaration(SyntaxKind kind) 815case SyntaxKind.GetAccessorDeclaration: 816case SyntaxKind.SetAccessorDeclaration: 817case SyntaxKind.InitAccessorDeclaration: 818case SyntaxKind.AddAccessorDeclaration: 819case SyntaxKind.RemoveAccessorDeclaration: 826public static bool IsAccessorDeclarationKeyword(SyntaxKind keyword) 830case SyntaxKind.GetKeyword: 831case SyntaxKind.SetKeyword: 832case SyntaxKind.InitKeyword: 833case SyntaxKind.AddKeyword: 834case SyntaxKind.RemoveKeyword: 841public static SyntaxKind GetSwitchLabelKind(SyntaxKind keyword) 845case SyntaxKind.CaseKeyword: 846return SyntaxKind.CaseSwitchLabel; 847case SyntaxKind.DefaultKeyword: 848return SyntaxKind.DefaultSwitchLabel; 850return SyntaxKind.None; 854public static SyntaxKind GetBaseTypeDeclarationKind(SyntaxKind kind) 856return kind == SyntaxKind.EnumKeyword ? SyntaxKind.EnumDeclaration : GetTypeDeclarationKind(kind); 859public static SyntaxKind GetTypeDeclarationKind(SyntaxKind kind) 863case SyntaxKind.ClassKeyword: 864return SyntaxKind.ClassDeclaration; 865case SyntaxKind.StructKeyword: 866return SyntaxKind.StructDeclaration; 867case SyntaxKind.UnionKeyword: 868return SyntaxKind.UnionDeclaration; 869case SyntaxKind.InterfaceKeyword: 870return SyntaxKind.InterfaceDeclaration; 871case SyntaxKind.RecordKeyword: 872return SyntaxKind.RecordDeclaration; 873case SyntaxKind.ExtensionKeyword: 874return SyntaxKind.ExtensionBlockDeclaration; 876return SyntaxKind.None; 880public static SyntaxKind GetKeywordKind(string text) 885return SyntaxKind.BoolKeyword; 887return SyntaxKind.ByteKeyword; 889return SyntaxKind.SByteKeyword; 891return SyntaxKind.ShortKeyword; 893return SyntaxKind.UShortKeyword; 895return SyntaxKind.IntKeyword; 897return SyntaxKind.UIntKeyword; 899return SyntaxKind.LongKeyword; 901return SyntaxKind.ULongKeyword; 903return SyntaxKind.DoubleKeyword; 905return SyntaxKind.FloatKeyword; 907return SyntaxKind.DecimalKeyword; 909return SyntaxKind.StringKeyword; 911return SyntaxKind.CharKeyword; 913return SyntaxKind.VoidKeyword; 915return SyntaxKind.ObjectKeyword; 917return SyntaxKind.TypeOfKeyword; 919return SyntaxKind.SizeOfKeyword; 921return SyntaxKind.NullKeyword; 923return SyntaxKind.TrueKeyword; 925return SyntaxKind.FalseKeyword; 927return SyntaxKind.IfKeyword; 929return SyntaxKind.ElseKeyword; 931return SyntaxKind.WhileKeyword; 933return SyntaxKind.ForKeyword; 935return SyntaxKind.ForEachKeyword; 937return SyntaxKind.DoKeyword; 939return SyntaxKind.SwitchKeyword; 941return SyntaxKind.CaseKeyword; 943return SyntaxKind.DefaultKeyword; 945return SyntaxKind.LockKeyword; 947return SyntaxKind.TryKeyword; 949return SyntaxKind.ThrowKeyword; 951return SyntaxKind.CatchKeyword; 953return SyntaxKind.FinallyKeyword; 955return SyntaxKind.GotoKeyword; 957return SyntaxKind.BreakKeyword; 959return SyntaxKind.ContinueKeyword; 961return SyntaxKind.ReturnKeyword; 963return SyntaxKind.PublicKeyword; 965return SyntaxKind.PrivateKeyword; 967return SyntaxKind.InternalKeyword; 969return SyntaxKind.ProtectedKeyword; 971return SyntaxKind.StaticKeyword; 973return SyntaxKind.ReadOnlyKeyword; 975return SyntaxKind.SealedKeyword; 977return SyntaxKind.ConstKeyword; 979return SyntaxKind.FixedKeyword; 981return SyntaxKind.StackAllocKeyword; 983return SyntaxKind.VolatileKeyword; 985return SyntaxKind.NewKeyword; 987return SyntaxKind.OverrideKeyword; 989return SyntaxKind.AbstractKeyword; 991return SyntaxKind.VirtualKeyword; 993return SyntaxKind.EventKeyword; 995return SyntaxKind.ExternKeyword; 997return SyntaxKind.RefKeyword; 999return SyntaxKind.OutKeyword; 1001return SyntaxKind.InKeyword; 1003return SyntaxKind.IsKeyword; 1005return SyntaxKind.AsKeyword; 1007return SyntaxKind.ParamsKeyword; 1009return SyntaxKind.ArgListKeyword; 1011return SyntaxKind.MakeRefKeyword; 1013return SyntaxKind.RefTypeKeyword; 1015return SyntaxKind.RefValueKeyword; 1017return SyntaxKind.ThisKeyword; 1019return SyntaxKind.BaseKeyword; 1021return SyntaxKind.NamespaceKeyword; 1023return SyntaxKind.UsingKeyword; 1025return SyntaxKind.ClassKeyword; 1027return SyntaxKind.StructKeyword; 1029return SyntaxKind.InterfaceKeyword; 1031return SyntaxKind.EnumKeyword; 1033return SyntaxKind.DelegateKeyword; 1035return SyntaxKind.CheckedKeyword; 1037return SyntaxKind.UncheckedKeyword; 1039return SyntaxKind.UnsafeKeyword; 1041return SyntaxKind.OperatorKeyword; 1043return SyntaxKind.ImplicitKeyword; 1045return SyntaxKind.ExplicitKeyword; 1047return SyntaxKind.None; 1051public static SyntaxKind GetOperatorKind(string operatorMetadataName) 1057return SyntaxKind.PlusToken; 1059case WellKnownMemberNames.BitwiseAndOperatorName: return SyntaxKind.AmpersandToken; 1060case WellKnownMemberNames.BitwiseOrOperatorName: return SyntaxKind.BarToken; 1067return SyntaxKind.MinusMinusToken; 1071return SyntaxKind.SlashToken; 1073case WellKnownMemberNames.EqualityOperatorName: return SyntaxKind.EqualsEqualsToken; 1074case WellKnownMemberNames.ExclusiveOrOperatorName: return SyntaxKind.CaretToken; 1078return SyntaxKind.ExplicitKeyword; 1081case WellKnownMemberNames.FalseOperatorName: return SyntaxKind.FalseKeyword; 1082case WellKnownMemberNames.GreaterThanOperatorName: return SyntaxKind.GreaterThanToken; 1083case WellKnownMemberNames.GreaterThanOrEqualOperatorName: return SyntaxKind.GreaterThanEqualsToken; 1084case WellKnownMemberNames.ImplicitConversionName: return SyntaxKind.ImplicitKeyword; 1090return SyntaxKind.PlusPlusToken; 1092case WellKnownMemberNames.InequalityOperatorName: return SyntaxKind.ExclamationEqualsToken; 1094case WellKnownMemberNames.LeftShiftOperatorName: return SyntaxKind.LessThanLessThanToken; 1095case WellKnownMemberNames.LessThanOperatorName: return SyntaxKind.LessThanToken; 1096case WellKnownMemberNames.LessThanOrEqualOperatorName: return SyntaxKind.LessThanEqualsToken; 1098case WellKnownMemberNames.LogicalNotOperatorName: return SyntaxKind.ExclamationToken; 1099case WellKnownMemberNames.ModulusOperatorName: return SyntaxKind.PercentToken; 1103return SyntaxKind.AsteriskToken; 1105case WellKnownMemberNames.OnesComplementOperatorName: return SyntaxKind.TildeToken; 1106case WellKnownMemberNames.RightShiftOperatorName: return SyntaxKind.GreaterThanGreaterThanToken; 1107case WellKnownMemberNames.UnsignedRightShiftOperatorName: return SyntaxKind.GreaterThanGreaterThanGreaterThanToken; 1111return SyntaxKind.MinusToken; 1113case WellKnownMemberNames.TrueOperatorName: return SyntaxKind.TrueKeyword; 1117return SyntaxKind.MinusToken; 1119case WellKnownMemberNames.UnaryPlusOperatorName: return SyntaxKind.PlusToken; 1123return SyntaxKind.PlusEqualsToken; 1127return SyntaxKind.SlashEqualsToken; 1131return SyntaxKind.AsteriskEqualsToken; 1135return SyntaxKind.MinusEqualsToken; 1137case WellKnownMemberNames.ModulusAssignmentOperatorName: return SyntaxKind.PercentEqualsToken; 1139case WellKnownMemberNames.BitwiseAndAssignmentOperatorName: return SyntaxKind.AmpersandEqualsToken; 1141case WellKnownMemberNames.BitwiseOrAssignmentOperatorName: return SyntaxKind.BarEqualsToken; 1143case WellKnownMemberNames.ExclusiveOrAssignmentOperatorName: return SyntaxKind.CaretEqualsToken; 1145case WellKnownMemberNames.LeftShiftAssignmentOperatorName: return SyntaxKind.LessThanLessThanEqualsToken; 1147case WellKnownMemberNames.RightShiftAssignmentOperatorName: return SyntaxKind.GreaterThanGreaterThanEqualsToken; 1149case WellKnownMemberNames.UnsignedRightShiftAssignmentOperatorName: return SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 1152return SyntaxKind.None; 1181public static SyntaxKind GetPreprocessorKeywordKind(string text) 1186return SyntaxKind.TrueKeyword; 1188return SyntaxKind.FalseKeyword; 1190return SyntaxKind.DefaultKeyword; 1192return SyntaxKind.IfKeyword; 1194return SyntaxKind.ElseKeyword; 1196return SyntaxKind.ElifKeyword; 1198return SyntaxKind.EndIfKeyword; 1200return SyntaxKind.RegionKeyword; 1202return SyntaxKind.EndRegionKeyword; 1204return SyntaxKind.DefineKeyword; 1206return SyntaxKind.UndefKeyword; 1208return SyntaxKind.WarningKeyword; 1210return SyntaxKind.ErrorKeyword; 1212return SyntaxKind.LineKeyword; 1214return SyntaxKind.PragmaKeyword; 1216return SyntaxKind.HiddenKeyword; 1218return SyntaxKind.ChecksumKeyword; 1220return SyntaxKind.DisableKeyword; 1222return SyntaxKind.RestoreKeyword; 1224return SyntaxKind.ReferenceKeyword; 1226return SyntaxKind.LoadKeyword; 1228return SyntaxKind.NullableKeyword; 1230return SyntaxKind.EnableKeyword; 1232return SyntaxKind.WarningsKeyword; 1234return SyntaxKind.AnnotationsKeyword; 1236return SyntaxKind.None; 1240public static IEnumerable<SyntaxKind> GetContextualKeywordKinds() 1242for (int i = (int)SyntaxKind.YieldKeyword; i <= (int)SyntaxKind.SafeKeyword; i++) 1247Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1248yield return (SyntaxKind)i; 1253public static bool IsContextualKeyword(SyntaxKind kind) 1257case SyntaxKind.YieldKeyword: 1258case SyntaxKind.PartialKeyword: 1259case SyntaxKind.FromKeyword: 1260case SyntaxKind.GroupKeyword: 1261case SyntaxKind.JoinKeyword: 1262case SyntaxKind.IntoKeyword: 1263case SyntaxKind.LetKeyword: 1264case SyntaxKind.ByKeyword: 1265case SyntaxKind.WhereKeyword: 1266case SyntaxKind.SelectKeyword: 1267case SyntaxKind.GetKeyword: 1268case SyntaxKind.SetKeyword: 1269case SyntaxKind.AddKeyword: 1270case SyntaxKind.RemoveKeyword: 1271case SyntaxKind.OrderByKeyword: 1272case SyntaxKind.AliasKeyword: 1273case SyntaxKind.OnKeyword: 1274case SyntaxKind.EqualsKeyword: 1275case SyntaxKind.AscendingKeyword: 1276case SyntaxKind.DescendingKeyword: 1277case SyntaxKind.AssemblyKeyword: 1278case SyntaxKind.ModuleKeyword: 1279case SyntaxKind.TypeKeyword: 1280case SyntaxKind.GlobalKeyword: 1281case SyntaxKind.FieldKeyword: 1282case SyntaxKind.MethodKeyword: 1283case SyntaxKind.ParamKeyword: 1284case SyntaxKind.PropertyKeyword: 1285case SyntaxKind.TypeVarKeyword: 1286case SyntaxKind.NameOfKeyword: 1287case SyntaxKind.AsyncKeyword: 1288case SyntaxKind.AwaitKeyword: 1289case SyntaxKind.WhenKeyword: 1290case SyntaxKind.UnderscoreToken: 1291case SyntaxKind.VarKeyword: 1292case SyntaxKind.OrKeyword: 1293case SyntaxKind.AndKeyword: 1294case SyntaxKind.NotKeyword: 1295case SyntaxKind.WithKeyword: 1296case SyntaxKind.InitKeyword: 1297case SyntaxKind.RecordKeyword: 1298case SyntaxKind.ManagedKeyword: 1299case SyntaxKind.UnmanagedKeyword: 1300case SyntaxKind.RequiredKeyword: 1301case SyntaxKind.ScopedKeyword: 1302case SyntaxKind.FileKeyword: 1303case SyntaxKind.AllowsKeyword: 1304case SyntaxKind.ExtensionKeyword: 1305case SyntaxKind.UnionKeyword: 1306case SyntaxKind.ClosedKeyword: 1307case SyntaxKind.SafeKeyword: 1314public static bool IsQueryContextualKeyword(SyntaxKind kind) 1318case SyntaxKind.FromKeyword: 1319case SyntaxKind.WhereKeyword: 1320case SyntaxKind.SelectKeyword: 1321case SyntaxKind.GroupKeyword: 1322case SyntaxKind.IntoKeyword: 1323case SyntaxKind.OrderByKeyword: 1324case SyntaxKind.JoinKeyword: 1325case SyntaxKind.LetKeyword: 1326case SyntaxKind.OnKeyword: 1327case SyntaxKind.EqualsKeyword: 1328case SyntaxKind.ByKeyword: 1329case SyntaxKind.AscendingKeyword: 1330case SyntaxKind.DescendingKeyword: 1337public static SyntaxKind GetContextualKeywordKind(string text) 1342return SyntaxKind.YieldKeyword; 1344return SyntaxKind.PartialKeyword; 1346return SyntaxKind.FromKeyword; 1348return SyntaxKind.GroupKeyword; 1350return SyntaxKind.JoinKeyword; 1352return SyntaxKind.IntoKeyword; 1354return SyntaxKind.LetKeyword; 1356return SyntaxKind.ByKeyword; 1358return SyntaxKind.WhereKeyword; 1360return SyntaxKind.SelectKeyword; 1362return SyntaxKind.GetKeyword; 1364return SyntaxKind.SetKeyword; 1366return SyntaxKind.AddKeyword; 1368return SyntaxKind.RemoveKeyword; 1370return SyntaxKind.OrderByKeyword; 1372return SyntaxKind.AliasKeyword; 1374return SyntaxKind.OnKeyword; 1376return SyntaxKind.EqualsKeyword; 1378return SyntaxKind.AscendingKeyword; 1380return SyntaxKind.DescendingKeyword; 1382return SyntaxKind.AssemblyKeyword; 1384return SyntaxKind.ModuleKeyword; 1386return SyntaxKind.TypeKeyword; 1388return SyntaxKind.FieldKeyword; 1390return SyntaxKind.MethodKeyword; 1392return SyntaxKind.ParamKeyword; 1394return SyntaxKind.PropertyKeyword; 1396return SyntaxKind.TypeVarKeyword; 1398return SyntaxKind.GlobalKeyword; 1400return SyntaxKind.AsyncKeyword; 1402return SyntaxKind.AwaitKeyword; 1404return SyntaxKind.WhenKeyword; 1406return SyntaxKind.NameOfKeyword; 1408return SyntaxKind.UnderscoreToken; 1410return SyntaxKind.VarKeyword; 1412return SyntaxKind.AndKeyword; 1414return SyntaxKind.OrKeyword; 1416return SyntaxKind.NotKeyword; 1418return SyntaxKind.WithKeyword; 1420return SyntaxKind.InitKeyword; 1422return SyntaxKind.RecordKeyword; 1424return SyntaxKind.ManagedKeyword; 1426return SyntaxKind.UnmanagedKeyword; 1428return SyntaxKind.RequiredKeyword; 1430return SyntaxKind.ScopedKeyword; 1432return SyntaxKind.FileKeyword; 1434return SyntaxKind.AllowsKeyword; 1436return SyntaxKind.ExtensionKeyword; 1438return SyntaxKind.UnionKeyword; 1440return SyntaxKind.ClosedKeyword; 1442return SyntaxKind.SafeKeyword; 1444return SyntaxKind.None; 1448public static string GetText(SyntaxKind kind) 1452case SyntaxKind.TildeToken: 1454case SyntaxKind.ExclamationToken: 1456case SyntaxKind.DollarToken: 1458case SyntaxKind.PercentToken: 1460case SyntaxKind.CaretToken: 1462case SyntaxKind.AmpersandToken: 1464case SyntaxKind.AsteriskToken: 1466case SyntaxKind.OpenParenToken: 1468case SyntaxKind.CloseParenToken: 1470case SyntaxKind.MinusToken: 1472case SyntaxKind.PlusToken: 1474case SyntaxKind.EqualsToken: 1476case SyntaxKind.OpenBraceToken: 1478case SyntaxKind.CloseBraceToken: 1480case SyntaxKind.OpenBracketToken: 1482case SyntaxKind.CloseBracketToken: 1484case SyntaxKind.BarToken: 1486case SyntaxKind.BackslashToken: 1488case SyntaxKind.ColonToken: 1490case SyntaxKind.SemicolonToken: 1492case SyntaxKind.DoubleQuoteToken: 1494case SyntaxKind.SingleQuoteToken: 1496case SyntaxKind.LessThanToken: 1498case SyntaxKind.CommaToken: 1500case SyntaxKind.GreaterThanToken: 1502case SyntaxKind.DotToken: 1504case SyntaxKind.QuestionToken: 1506case SyntaxKind.HashToken: 1508case SyntaxKind.SlashToken: 1510case SyntaxKind.SlashGreaterThanToken: 1512case SyntaxKind.LessThanSlashToken: 1514case SyntaxKind.XmlCommentStartToken: 1516case SyntaxKind.XmlCommentEndToken: 1518case SyntaxKind.XmlCDataStartToken: 1520case SyntaxKind.XmlCDataEndToken: 1522case SyntaxKind.XmlProcessingInstructionStartToken: 1524case SyntaxKind.XmlProcessingInstructionEndToken: 1528case SyntaxKind.BarBarToken: 1530case SyntaxKind.AmpersandAmpersandToken: 1532case SyntaxKind.MinusMinusToken: 1534case SyntaxKind.PlusPlusToken: 1536case SyntaxKind.ColonColonToken: 1538case SyntaxKind.QuestionQuestionToken: 1540case SyntaxKind.MinusGreaterThanToken: 1542case SyntaxKind.ExclamationEqualsToken: 1544case SyntaxKind.EqualsEqualsToken: 1546case SyntaxKind.EqualsGreaterThanToken: 1548case SyntaxKind.LessThanEqualsToken: 1550case SyntaxKind.LessThanLessThanToken: 1552case SyntaxKind.LessThanLessThanEqualsToken: 1554case SyntaxKind.GreaterThanEqualsToken: 1556case SyntaxKind.GreaterThanGreaterThanToken: 1558case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1560case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1562case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1564case SyntaxKind.SlashEqualsToken: 1566case SyntaxKind.AsteriskEqualsToken: 1568case SyntaxKind.BarEqualsToken: 1570case SyntaxKind.AmpersandEqualsToken: 1572case SyntaxKind.PlusEqualsToken: 1574case SyntaxKind.MinusEqualsToken: 1576case SyntaxKind.CaretEqualsToken: 1578case SyntaxKind.PercentEqualsToken: 1580case SyntaxKind.QuestionQuestionEqualsToken: 1582case SyntaxKind.DotDotToken: 1586case SyntaxKind.BoolKeyword: 1588case SyntaxKind.ByteKeyword: 1590case SyntaxKind.SByteKeyword: 1592case SyntaxKind.ShortKeyword: 1594case SyntaxKind.UShortKeyword: 1596case SyntaxKind.IntKeyword: 1598case SyntaxKind.UIntKeyword: 1600case SyntaxKind.LongKeyword: 1602case SyntaxKind.ULongKeyword: 1604case SyntaxKind.DoubleKeyword: 1606case SyntaxKind.FloatKeyword: 1608case SyntaxKind.DecimalKeyword: 1610case SyntaxKind.StringKeyword: 1612case SyntaxKind.CharKeyword: 1614case SyntaxKind.VoidKeyword: 1616case SyntaxKind.ObjectKeyword: 1618case SyntaxKind.TypeOfKeyword: 1620case SyntaxKind.SizeOfKeyword: 1622case SyntaxKind.NullKeyword: 1624case SyntaxKind.TrueKeyword: 1626case SyntaxKind.FalseKeyword: 1628case SyntaxKind.IfKeyword: 1630case SyntaxKind.ElseKeyword: 1632case SyntaxKind.WhileKeyword: 1634case SyntaxKind.ForKeyword: 1636case SyntaxKind.ForEachKeyword: 1638case SyntaxKind.DoKeyword: 1640case SyntaxKind.SwitchKeyword: 1642case SyntaxKind.CaseKeyword: 1644case SyntaxKind.DefaultKeyword: 1646case SyntaxKind.TryKeyword: 1648case SyntaxKind.CatchKeyword: 1650case SyntaxKind.FinallyKeyword: 1652case SyntaxKind.LockKeyword: 1654case SyntaxKind.GotoKeyword: 1656case SyntaxKind.BreakKeyword: 1658case SyntaxKind.ContinueKeyword: 1660case SyntaxKind.ReturnKeyword: 1662case SyntaxKind.ThrowKeyword: 1664case SyntaxKind.PublicKeyword: 1666case SyntaxKind.PrivateKeyword: 1668case SyntaxKind.InternalKeyword: 1670case SyntaxKind.ProtectedKeyword: 1672case SyntaxKind.StaticKeyword: 1674case SyntaxKind.ReadOnlyKeyword: 1676case SyntaxKind.SealedKeyword: 1678case SyntaxKind.ConstKeyword: 1680case SyntaxKind.FixedKeyword: 1682case SyntaxKind.StackAllocKeyword: 1684case SyntaxKind.VolatileKeyword: 1686case SyntaxKind.NewKeyword: 1688case SyntaxKind.OverrideKeyword: 1690case SyntaxKind.AbstractKeyword: 1692case SyntaxKind.VirtualKeyword: 1694case SyntaxKind.EventKeyword: 1696case SyntaxKind.ExternKeyword: 1698case SyntaxKind.RefKeyword: 1700case SyntaxKind.OutKeyword: 1702case SyntaxKind.InKeyword: 1704case SyntaxKind.IsKeyword: 1706case SyntaxKind.AsKeyword: 1708case SyntaxKind.ParamsKeyword: 1710case SyntaxKind.ArgListKeyword: 1712case SyntaxKind.MakeRefKeyword: 1714case SyntaxKind.RefTypeKeyword: 1716case SyntaxKind.RefValueKeyword: 1718case SyntaxKind.ThisKeyword: 1720case SyntaxKind.BaseKeyword: 1722case SyntaxKind.NamespaceKeyword: 1724case SyntaxKind.UsingKeyword: 1726case SyntaxKind.ClassKeyword: 1728case SyntaxKind.StructKeyword: 1730case SyntaxKind.InterfaceKeyword: 1732case SyntaxKind.EnumKeyword: 1734case SyntaxKind.DelegateKeyword: 1736case SyntaxKind.CheckedKeyword: 1738case SyntaxKind.UncheckedKeyword: 1740case SyntaxKind.UnsafeKeyword: 1742case SyntaxKind.OperatorKeyword: 1744case SyntaxKind.ImplicitKeyword: 1746case SyntaxKind.ExplicitKeyword: 1748case SyntaxKind.ElifKeyword: 1750case SyntaxKind.EndIfKeyword: 1752case SyntaxKind.RegionKeyword: 1754case SyntaxKind.EndRegionKeyword: 1756case SyntaxKind.DefineKeyword: 1758case SyntaxKind.UndefKeyword: 1760case SyntaxKind.WarningKeyword: 1762case SyntaxKind.ErrorKeyword: 1764case SyntaxKind.LineKeyword: 1766case SyntaxKind.PragmaKeyword: 1768case SyntaxKind.HiddenKeyword: 1770case SyntaxKind.ChecksumKeyword: 1772case SyntaxKind.DisableKeyword: 1774case SyntaxKind.RestoreKeyword: 1776case SyntaxKind.ReferenceKeyword: 1778case SyntaxKind.LoadKeyword: 1780case SyntaxKind.NullableKeyword: 1782case SyntaxKind.EnableKeyword: 1784case SyntaxKind.WarningsKeyword: 1786case SyntaxKind.AnnotationsKeyword: 1790case SyntaxKind.YieldKeyword: 1792case SyntaxKind.PartialKeyword: 1794case SyntaxKind.FromKeyword: 1796case SyntaxKind.GroupKeyword: 1798case SyntaxKind.JoinKeyword: 1800case SyntaxKind.IntoKeyword: 1802case SyntaxKind.LetKeyword: 1804case SyntaxKind.ByKeyword: 1806case SyntaxKind.WhereKeyword: 1808case SyntaxKind.SelectKeyword: 1810case SyntaxKind.GetKeyword: 1812case SyntaxKind.SetKeyword: 1814case SyntaxKind.AddKeyword: 1816case SyntaxKind.RemoveKeyword: 1818case SyntaxKind.OrderByKeyword: 1820case SyntaxKind.AliasKeyword: 1822case SyntaxKind.OnKeyword: 1824case SyntaxKind.EqualsKeyword: 1826case SyntaxKind.AscendingKeyword: 1828case SyntaxKind.DescendingKeyword: 1830case SyntaxKind.AssemblyKeyword: 1832case SyntaxKind.ModuleKeyword: 1834case SyntaxKind.TypeKeyword: 1836case SyntaxKind.FieldKeyword: 1838case SyntaxKind.MethodKeyword: 1840case SyntaxKind.ParamKeyword: 1842case SyntaxKind.PropertyKeyword: 1844case SyntaxKind.TypeVarKeyword: 1846case SyntaxKind.GlobalKeyword: 1848case SyntaxKind.NameOfKeyword: 1850case SyntaxKind.AsyncKeyword: 1852case SyntaxKind.AwaitKeyword: 1854case SyntaxKind.WhenKeyword: 1856case SyntaxKind.InterpolatedStringStartToken: 1858case SyntaxKind.InterpolatedStringEndToken: 1860case SyntaxKind.InterpolatedVerbatimStringStartToken: 1862case SyntaxKind.UnderscoreToken: 1864case SyntaxKind.VarKeyword: 1866case SyntaxKind.AndKeyword: 1868case SyntaxKind.OrKeyword: 1870case SyntaxKind.NotKeyword: 1872case SyntaxKind.WithKeyword: 1874case SyntaxKind.InitKeyword: 1876case SyntaxKind.RecordKeyword: 1878case SyntaxKind.ManagedKeyword: 1880case SyntaxKind.UnmanagedKeyword: 1882case SyntaxKind.RequiredKeyword: 1884case SyntaxKind.ScopedKeyword: 1886case SyntaxKind.FileKeyword: 1888case SyntaxKind.AllowsKeyword: 1890case SyntaxKind.ExtensionKeyword: 1892case SyntaxKind.UnionKeyword: 1894case SyntaxKind.ClosedKeyword: 1896case SyntaxKind.SafeKeyword: 1903public static bool IsTypeParameterVarianceKeyword(SyntaxKind kind) 1905return kind == SyntaxKind.OutKeyword || kind == SyntaxKind.InKeyword; 1908public static bool IsDocumentationCommentTrivia(SyntaxKind kind) 1910return kind == SyntaxKind.SingleLineDocumentationCommentTrivia || 1911kind == SyntaxKind.MultiLineDocumentationCommentTrivia;
Syntax\SyntaxNodeExtensions.cs (58)
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: 103case SyntaxKind.UnsafeExpression: 106case SyntaxKind.RecordStructDeclaration: 120case SyntaxKind.SimpleLambdaExpression: 121case SyntaxKind.ParenthesizedLambdaExpression: 124case SyntaxKind.SwitchStatement: 127case SyntaxKind.ForStatement: 131case SyntaxKind.ForEachStatement: 132case SyntaxKind.ForEachVariableStatement: 151if (node.Parent.IsKind(SyntaxKind.CastExpression)) 156while (node.Parent.IsKind(SyntaxKind.ConditionalExpression)) 171case SyntaxKind.EqualsValueClause: 175return variableDeclarator.IsKind(SyntaxKind.VariableDeclarator) && 176variableDeclarator.Parent.IsKind(SyntaxKind.VariableDeclaration); 179case SyntaxKind.SimpleAssignmentExpression: 181return parentNode.Parent.IsKind(SyntaxKind.ExpressionStatement); 201case SyntaxKind.IdentifierName: 204case SyntaxKind.SimpleMemberAccessExpression: 208case SyntaxKind.ConditionalAccessExpression: 210if (input.Kind() == SyntaxKind.MemberBindingExpression) 251if (syntax.Kind() == SyntaxKind.RefType) 254refKind = refType.ReadOnlyKeyword.Kind() == SyntaxKind.ReadOnlyKeyword 354if (expression.Kind() == SyntaxKind.InvocationExpression) 359return 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 (2441)
src\4a7f0d7dc40edd75\CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\984dec8966cb7923\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\a6db168d9ad5d460\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
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.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\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\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsDiagnosticAnalyzer.cs (2)
38context.RegisterSyntaxNodeAction(AnalyzeStatement, SyntaxKind.GotoStatement, SyntaxKind.BreakStatement);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsHelpers_FlagVariable.cs (7)
48Declaration.Variables: [{ Initializer.Value: LiteralExpressionSyntax(SyntaxKind.FalseLiteralExpression) } declarator], 263Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 266Right: LiteralExpressionSyntax(SyntaxKind.TrueLiteralExpression), 310if (name.Parent is not AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 312Right: LiteralExpressionSyntax(SyntaxKind.TrueLiteralExpression), 336if (name.Parent is not AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 338Right: LiteralExpressionSyntax(SyntaxKind.FalseLiteralExpression),
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsHelpers.cs (1)
169if (gotoStatement is GotoStatementSyntax(SyntaxKind.GotoStatement) { Expression: IdentifierNameSyntax identifier })
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 (52)
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); 396=> node.IsContinuableConstruct() || node?.Kind() is SyntaxKind.SwitchStatement; 402case SyntaxKind.DoStatement: 403case SyntaxKind.WhileStatement: 404case SyntaxKind.ForStatement: 405case SyntaxKind.ForEachStatement: 406case SyntaxKind.ForEachVariableStatement: 417case SyntaxKind.AnonymousMethodExpression: 418case SyntaxKind.SimpleLambdaExpression: 419case SyntaxKind.ParenthesizedLambdaExpression: 420case SyntaxKind.LocalFunctionStatement: 421case SyntaxKind.MethodDeclaration: 422case SyntaxKind.ConstructorDeclaration: 423case SyntaxKind.DestructorDeclaration: 424case SyntaxKind.GetAccessorDeclaration: 425case SyntaxKind.SetAccessorDeclaration: 426case SyntaxKind.InitAccessorDeclaration: 427case SyntaxKind.OperatorDeclaration: 428case SyntaxKind.ConversionOperatorDeclaration: 429case SyntaxKind.AddAccessorDeclaration: 430case SyntaxKind.RemoveAccessorDeclaration: 441=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 543if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 557else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 885while (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\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 (1409)
src\50a3a051b0fef0d6\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\cef93d2425d77fca\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
86parenthesizedExpression.GetAncestor<InterpolatedStringExpressionSyntax>()?.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
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\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"; 195var 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_CollectionInitializer.cs (2)
80if (addLineBreak && item.GetTrailingTrivia() is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 134SyntaxKind.ComplexElementInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
23SyntaxKind,
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\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsCodeFixProvider.cs (2)
133candidate is GotoStatementSyntax(SyntaxKind.GotoStatement) { Expression: IdentifierNameSyntax identifier } && 239SyntaxFactory.Token(SyntaxKind.ColonToken).WithTrailingTrivia(SyntaxFactory.Space),
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_DocComments.cs (3)
132var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)] 159SyntaxKind.SingleLineDocumentationCommentTrivia, 220Trivia(DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. allContent])));
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\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 (447)
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)) 2159return token.Kind() is SyntaxKind.GotoKeyword or SyntaxKind.BreakKeyword or SyntaxKind.ContinueKeyword && 2198is SyntaxKind.DotToken 2199or SyntaxKind.ColonColonToken 2200or SyntaxKind.MinusGreaterThanToken) 2207if (token.IsKind(SyntaxKind.EqualsToken)) 2209if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2210token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2230is SyntaxKind.EqualsToken 2231or SyntaxKind.MinusEqualsToken 2232or SyntaxKind.AsteriskEqualsToken 2233or SyntaxKind.PlusEqualsToken 2234or SyntaxKind.SlashEqualsToken 2235or SyntaxKind.ExclamationEqualsToken 2236or SyntaxKind.CaretEqualsToken 2237or SyntaxKind.AmpersandEqualsToken 2238or SyntaxKind.BarEqualsToken 2239or SyntaxKind.PercentEqualsToken 2240or SyntaxKind.LessThanLessThanEqualsToken 2241or SyntaxKind.GreaterThanGreaterThanEqualsToken 2242or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2243or SyntaxKind.QuestionQuestionEqualsToken) 2249if (token.IsKind(SyntaxKind.OpenParenToken)) 2251if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2324if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2341tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2344if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2345previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2348if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2367if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2368token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2375if (token.IsKind(SyntaxKind.DotDotToken) && 2376token.Parent.IsKind(SyntaxKind.RangeExpression) && 2383if (token.IsKind(SyntaxKind.QuestionToken) && 2392if (token.IsKind(SyntaxKind.ColonToken) && 2393token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2401if (token.IsKind(SyntaxKind.OpenParenToken)) 2403if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2412if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2423if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2424token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2433if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2435if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2446if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2448if (token.Parent.IsKind(SyntaxKind.Argument)) 2452else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2456if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2466if (token.IsKind(SyntaxKind.ColonToken) && 2467token.Parent.IsKind(SyntaxKind.NameColon) && 2468token.Parent.IsParentKind(SyntaxKind.Argument)) 2474if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2481if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2487if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2490if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2517if (token.IsKind(SyntaxKind.SemicolonToken) && 2528if (token.IsKind(SyntaxKind.OpenParenToken) && 2537if (token.IsKind(SyntaxKind.CommaToken) && 2538token.Parent.IsKind(SyntaxKind.ForStatement)) 2547if (token.IsKind(SyntaxKind.InKeyword)) 2550SyntaxKind.ForEachStatement or 2551SyntaxKind.ForEachVariableStatement or 2552SyntaxKind.FromClause or 2553SyntaxKind.JoinClause)) 2561if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2562token.Parent.IsKind(SyntaxKind.JoinClause)) 2568if (token.IsKind(SyntaxKind.WhereKeyword) && 2569token.Parent.IsKind(SyntaxKind.WhereClause)) 2576if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2577token.Parent.IsKind(SyntaxKind.OrderByClause)) 2583if (token.IsKind(SyntaxKind.SelectKeyword) && 2584token.Parent.IsKind(SyntaxKind.SelectClause)) 2591if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2592token.Parent.IsKind(SyntaxKind.GroupClause)) 2600if (token.IsKind(SyntaxKind.ReturnKeyword)) 2602if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2609if (token.IsKind(SyntaxKind.ThrowKeyword)) 2615if (token.IsKind(SyntaxKind.OpenParenToken) && 2616token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2625if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2631if (token.IsKind(SyntaxKind.OpenParenToken) && 2632token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2673if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2690if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2691token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2699if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2700token.Parent.IsKind(SyntaxKind.ListPattern)) 2708if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2709token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2717if (token.Kind() is SyntaxKind.DotDotToken && 2718token.Parent.IsKind(SyntaxKind.SpreadElement)) 2729if (token.IsKind(SyntaxKind.OpenBraceToken)) 2750if (token.IsKind(SyntaxKind.DotToken)) 2753if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2756while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2761if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2769if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2772while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2777if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2788if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2822if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2852if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2867if (token.IsKind(SyntaxKind.IdentifierToken) && 2868token.Parent.IsKind(SyntaxKind.IdentifierName) && 2869token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2875if (token.Kind() is SyntaxKind.IdentifierToken && 2876token.Parent.IsKind(SyntaxKind.IdentifierName)) 2878if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2882if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2900if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2918case SyntaxKind.QualifiedName: 2920case SyntaxKind.AliasQualifiedName: 2922case SyntaxKind.SimpleMemberAccessExpression: 2951if (token.IsKind(SyntaxKind.CloseBraceToken)) 2957block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2977if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2982if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2983token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3000targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3011targetToken.IsKind(SyntaxKind.ColonToken) && 3012targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3013targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3022if (!token.IsKind(SyntaxKind.DotToken)) 3028if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3034token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3073return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3074targetToken.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\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 (4115)
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)
123return token.Kind() is SyntaxKind.DoubleQuoteToken or SyntaxKind.SingleQuoteToken && 124token.Parent.IsKind(SyntaxKind.XmlCrefAttribute); 139if (token.Parent?.Kind() is not (SyntaxKind.CrefParameterList or SyntaxKind.CrefBracketedParameterList)) 142if (token.IsKind(SyntaxKind.OpenParenToken) && 143token.Parent.IsKind(SyntaxKind.CrefParameterList)) 148if (token.IsKind(SyntaxKind.OpenBracketToken) && 149token.Parent.IsKind(SyntaxKind.CrefBracketedParameterList)) 154return token is (kind: SyntaxKind.CommaToken or SyntaxKind.RefKeyword or SyntaxKind.OutKeyword); 162return token.IsKind(SyntaxKind.DotToken) 163&& token.Parent.IsKind(SyntaxKind.QualifiedCref); 278if (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)
49if (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_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\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (2)
84var expression = dotToken.Kind() == SyntaxKind.DotToken 189var questionToken = dotToken.GetPreviousToken().Kind() == SyntaxKind.QuestionToken
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 (12)
12internal sealed class FixedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FixedKeyword) 14private static readonly ISet<SyntaxKind> s_structDeclaration = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.StructDeclaration, 19private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 21SyntaxKind.NewKeyword, 22SyntaxKind.PublicKeyword, 23SyntaxKind.ProtectedKeyword, 24SyntaxKind.InternalKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.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_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))
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),
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_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\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\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 (10)
33case SyntaxKind.ContinueKeyword: 36case SyntaxKind.BreakKeyword: 37if (token.GetPreviousToken().IsKind(SyntaxKind.YieldKeyword)) 38goto case SyntaxKind.YieldKeyword; 42case SyntaxKind.YieldKeyword: 43case SyntaxKind.ReturnKeyword: 61case SyntaxKind.GotoKeyword: 62case SyntaxKind.DefaultKeyword: 63case SyntaxKind.CaseKeyword: 108if (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); 77if (gotoStatement.Kind() is SyntaxKind.GotoCaseStatement or SyntaxKind.GotoDefaultStatement || 81var end = !gotoStatement.CaseOrDefaultKeyword.IsKind(SyntaxKind.None) 97var 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_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);
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);
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_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\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\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\4a7f0d7dc40edd75\CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\984dec8966cb7923\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\cef93d2425d77fca\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
86parenthesizedExpression.GetAncestor<InterpolatedStringExpressionSyntax>()?.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
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.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\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\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsDiagnosticAnalyzer.cs (2)
38context.RegisterSyntaxNodeAction(AnalyzeStatement, SyntaxKind.GotoStatement, SyntaxKind.BreakStatement);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsHelpers_FlagVariable.cs (7)
48Declaration.Variables: [{ Initializer.Value: LiteralExpressionSyntax(SyntaxKind.FalseLiteralExpression) } declarator], 263Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 266Right: LiteralExpressionSyntax(SyntaxKind.TrueLiteralExpression), 310if (name.Parent is not AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 312Right: LiteralExpressionSyntax(SyntaxKind.TrueLiteralExpression), 336if (name.Parent is not AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 338Right: LiteralExpressionSyntax(SyntaxKind.FalseLiteralExpression),
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsHelpers.cs (1)
169if (gotoStatement is GotoStatementSyntax(SyntaxKind.GotoStatement) { Expression: IdentifierNameSyntax identifier })
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\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"; 195var 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_CollectionInitializer.cs (2)
80if (addLineBreak && item.GetTrailingTrivia() is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 134SyntaxKind.ComplexElementInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
23SyntaxKind,
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\UseLabeledJumpStatements\CSharpUseLabeledJumpStatementsCodeFixProvider.cs (2)
133candidate is GotoStatementSyntax(SyntaxKind.GotoStatement) { Expression: IdentifierNameSyntax identifier } && 239SyntaxFactory.Token(SyntaxKind.ColonToken).WithTrailingTrivia(SyntaxFactory.Space),
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_DocComments.cs (3)
132var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)] 159SyntaxKind.SingleLineDocumentationCommentTrivia, 220Trivia(DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. allContent])));
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\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: 120goto case SyntaxKind.InterfaceDeclaration; 122case SyntaxKind.InterfaceDeclaration: 123case SyntaxKind.ExtensionBlockDeclaration: 140case SyntaxKind.EnumDeclaration: 156case SyntaxKind.EnumMemberDeclaration: 168case SyntaxKind.DelegateDeclaration: 182case SyntaxKind.EventDeclaration: 199case SyntaxKind.EventFieldDeclaration: 200case SyntaxKind.FieldDeclaration: 218case SyntaxKind.ArrowExpressionClause: 229case SyntaxKind.PropertyDeclaration: 253case SyntaxKind.IndexerDeclaration: 278case SyntaxKind.AddAccessorDeclaration: 279case SyntaxKind.RemoveAccessorDeclaration: 280case SyntaxKind.GetAccessorDeclaration: 281case SyntaxKind.SetAccessorDeclaration: 282case SyntaxKind.InitAccessorDeclaration: 294case SyntaxKind.ConstructorDeclaration: 295case SyntaxKind.ConversionOperatorDeclaration: 296case SyntaxKind.DestructorDeclaration: 297case SyntaxKind.MethodDeclaration: 298case SyntaxKind.OperatorDeclaration: 327case SyntaxKind.CompilationUnit: 427case SyntaxKind.ArrowExpressionClause: 430case SyntaxKind.MethodDeclaration: 433case SyntaxKind.OperatorDeclaration: 436case SyntaxKind.ConversionOperatorDeclaration: 439case SyntaxKind.PropertyDeclaration: 442case SyntaxKind.IndexerDeclaration: 445case SyntaxKind.ConstructorDeclaration: 448case 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 (31)
29var parentKind = parent.Kind(); 91else if (parentKind is SyntaxKind.ElseClause or SyntaxKind.CatchClause or SyntaxKind.FinallyClause || 98if (parentKind == SyntaxKind.LocalFunctionStatement) 102parent.IsParentKind(SyntaxKind.GlobalStatement); 135if (parentKind is SyntaxKind.Block or SyntaxKind.SwitchSection) 153=> node is StatementSyntax(kind: not SyntaxKind.Block); 158if (parent.IsKind(SyntaxKind.IfStatement) && parent.IsParentKind(SyntaxKind.ElseClause)) 171if (previousToken.IsKind(SyntaxKind.None)) 181if (node.Parent.IsKind(SyntaxKind.IfStatement) || node.Parent.IsKind(SyntaxKind.TryStatement)) 209SyntaxKind.ForStatement => BlockTypes.Loop, 210SyntaxKind.ForEachStatement => BlockTypes.Loop, 211SyntaxKind.ForEachVariableStatement => BlockTypes.Loop, 212SyntaxKind.WhileStatement => BlockTypes.Loop, 213SyntaxKind.DoStatement => BlockTypes.Loop, 214SyntaxKind.TryStatement => BlockTypes.Statement, 215SyntaxKind.CatchClause => BlockTypes.Statement, 216SyntaxKind.FinallyClause => BlockTypes.Statement, 217SyntaxKind.UnsafeStatement => BlockTypes.Statement, 218SyntaxKind.FixedStatement => BlockTypes.Statement, 219SyntaxKind.LockStatement => BlockTypes.Statement, 220SyntaxKind.UsingStatement => BlockTypes.Statement, 221SyntaxKind.IfStatement => BlockTypes.Conditional, 222SyntaxKind.ElseClause => BlockTypes.Conditional, 223SyntaxKind.SwitchSection => BlockTypes.Conditional, 224SyntaxKind.Block => BlockTypes.Statement, 225SyntaxKind.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)) 63var content = structure.ChildTokens().FirstOrDefault(static token => token.IsKind(SyntaxKind.StringLiteralToken)); 64if (!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 (3869)
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_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)
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)
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) 1539private static DeclarationModifiers GetAllowedModifiers(SyntaxKind kind) 1543case SyntaxKind.RecordDeclaration: 1545case SyntaxKind.ClassDeclaration: 1548case SyntaxKind.EnumDeclaration: 1551case SyntaxKind.DelegateDeclaration: 1554case SyntaxKind.InterfaceDeclaration: 1557case SyntaxKind.StructDeclaration: 1558case SyntaxKind.RecordStructDeclaration: 1561case SyntaxKind.MethodDeclaration: 1562case SyntaxKind.OperatorDeclaration: 1563case SyntaxKind.ConversionOperatorDeclaration: 1566case SyntaxKind.ConstructorDeclaration: 1569case SyntaxKind.DestructorDeclaration: 1572case SyntaxKind.FieldDeclaration: 1575case SyntaxKind.PropertyDeclaration: 1578case SyntaxKind.IndexerDeclaration: 1581case SyntaxKind.EventFieldDeclaration: 1582case SyntaxKind.EventDeclaration: 1585case SyntaxKind.GetAccessorDeclaration: 1586case SyntaxKind.SetAccessorDeclaration: 1589case SyntaxKind.AddAccessorDeclaration: 1590case SyntaxKind.RemoveAccessorDeclaration: 1593case SyntaxKind.LocalFunctionStatement: 1595case SyntaxKind.ParenthesizedLambdaExpression: 1596case SyntaxKind.SimpleLambdaExpression: 1597case SyntaxKind.AnonymousMethodExpression: 1600case SyntaxKind.EnumMemberDeclaration: 1601case SyntaxKind.Parameter: 1602case SyntaxKind.LocalDeclarationStatement: 1635(modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration))) 1677SyntaxKind kind, 1859constraints = constraints.Insert(0, SyntaxFactory.ClassOrStructConstraint(isReferenceType ? SyntaxKind.ClassConstraint : SyntaxKind.StructConstraint)); 1893case SyntaxKind.ClassDeclaration: 1894case SyntaxKind.RecordDeclaration: 1896case SyntaxKind.StructDeclaration: 1897case SyntaxKind.RecordStructDeclaration: 1899case SyntaxKind.InterfaceDeclaration: 1901case SyntaxKind.EnumDeclaration: 1903case SyntaxKind.DelegateDeclaration: 1906case SyntaxKind.MethodDeclaration: 1908case SyntaxKind.OperatorDeclaration: 1910case SyntaxKind.ConversionOperatorDeclaration: 1912case SyntaxKind.ConstructorDeclaration: 1914case SyntaxKind.DestructorDeclaration: 1917case SyntaxKind.PropertyDeclaration: 1919case SyntaxKind.IndexerDeclaration: 1921case SyntaxKind.EventDeclaration: 1923case SyntaxKind.EnumMemberDeclaration: 1925case SyntaxKind.CompilationUnit: 1927case SyntaxKind.NamespaceDeclaration: 1928case SyntaxKind.FileScopedNamespaceDeclaration: 1930case SyntaxKind.UsingDirective: 1932case SyntaxKind.Parameter: 1935case SyntaxKind.ParenthesizedLambdaExpression: 1936case SyntaxKind.SimpleLambdaExpression: 1939case SyntaxKind.FieldDeclaration: 1951case SyntaxKind.EventFieldDeclaration: 1963case SyntaxKind.LocalDeclarationStatement: 1975case SyntaxKind.VariableDeclaration: 1989case SyntaxKind.VariableDeclarator: 2013case SyntaxKind.AttributeList: 2022case SyntaxKind.Attribute: 2030case SyntaxKind.GetAccessorDeclaration: 2032case SyntaxKind.SetAccessorDeclaration: 2033case SyntaxKind.InitAccessorDeclaration: 2035case SyntaxKind.AddAccessorDeclaration: 2037case SyntaxKind.RemoveAccessorDeclaration: 2045=> node?.Parent.IsKind(SyntaxKind.FieldDeclaration) ?? false; 2048=> node?.Parent.IsKind(SyntaxKind.EventFieldDeclaration) ?? false; 2051=> node?.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) ?? false; 2119case SyntaxKind.DelegateDeclaration: 2121case SyntaxKind.MethodDeclaration: 2123case SyntaxKind.FieldDeclaration: 2125case SyntaxKind.PropertyDeclaration: 2127case SyntaxKind.IndexerDeclaration: 2129case SyntaxKind.EventFieldDeclaration: 2131case SyntaxKind.EventDeclaration: 2133case SyntaxKind.Parameter: 2135case SyntaxKind.LocalDeclarationStatement: 2137case SyntaxKind.VariableDeclaration: 2139case SyntaxKind.VariableDeclarator: 2152=> type is PredefinedTypeSyntax pd && pd.Keyword.IsKind(SyntaxKind.VoidKeyword) ? null : type; 2160SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2161SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2162SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(((FieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2163SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2164SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2165SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(((EventFieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2166SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2167SyntaxKind.Parameter => ((ParameterSyntax)declaration).WithType((TypeSyntax)type), 2168SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(((LocalDeclarationStatementSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2169SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2180case SyntaxKind.VariableDeclaration: 2189case SyntaxKind.VariableDeclarator: 2198case SyntaxKind.Attribute: 2226SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration, 2227SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration, 2228SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration, 2235SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(variables), 2236SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(variables), 2237SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(variables), 2245case SyntaxKind.VariableDeclaration: 2259case SyntaxKind.VariableDeclarator: 2260case SyntaxKind.Attribute: 2312currentList ??= declaration.IsKind(SyntaxKind.IndexerDeclaration) 2380case SyntaxKind.DelegateDeclaration: 2382case SyntaxKind.MethodDeclaration: 2384case SyntaxKind.OperatorDeclaration: 2386case SyntaxKind.ConversionOperatorDeclaration: 2388case SyntaxKind.ConstructorDeclaration: 2390case SyntaxKind.DestructorDeclaration: 2392case SyntaxKind.IndexerDeclaration: 2394case SyntaxKind.LocalFunctionStatement: 2396case SyntaxKind.ParenthesizedLambdaExpression: 2398case SyntaxKind.SimpleLambdaExpression: 2411case SyntaxKind.RecordDeclaration: 2412case SyntaxKind.RecordStructDeclaration: 2413case SyntaxKind.ClassDeclaration: 2414case SyntaxKind.StructDeclaration: 2415case SyntaxKind.InterfaceDeclaration: 2426case SyntaxKind.ParenthesizedLambdaExpression: 2428case SyntaxKind.SimpleLambdaExpression: 2431case SyntaxKind.PropertyDeclaration: 2440case SyntaxKind.IndexerDeclaration: 2449case SyntaxKind.MethodDeclaration: 2458case SyntaxKind.LocalFunctionStatement: 2481case SyntaxKind.ParenthesizedLambdaExpression: 2484case SyntaxKind.SimpleLambdaExpression: 2487case SyntaxKind.PropertyDeclaration: 2496case SyntaxKind.IndexerDeclaration: 2505case SyntaxKind.MethodDeclaration: 2514case SyntaxKind.LocalFunctionStatement: 2552case SyntaxKind.FieldDeclaration: 2560case SyntaxKind.PropertyDeclaration: 2563case SyntaxKind.LocalDeclarationStatement: 2571case SyntaxKind.VariableDeclaration: 2579case SyntaxKind.VariableDeclarator: 2581case SyntaxKind.Parameter: 2592case SyntaxKind.FieldDeclaration: 2600case SyntaxKind.PropertyDeclaration: 2603case SyntaxKind.LocalDeclarationStatement: 2611case SyntaxKind.VariableDeclaration: 2619case SyntaxKind.VariableDeclarator: 2621case SyntaxKind.Parameter: 2632SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).Body?.Statements, 2633SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).Body?.Statements, 2634SyntaxKind.ConversionOperatorDeclaration => ((ConversionOperatorDeclarationSyntax)declaration).Body?.Statements, 2635SyntaxKind.ConstructorDeclaration => ((ConstructorDeclarationSyntax)declaration).Body?.Statements, 2636SyntaxKind.DestructorDeclaration => ((DestructorDeclarationSyntax)declaration).Body?.Statements, 2637SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).Body?.Statements, 2638SyntaxKind.AnonymousMethodExpression => (((AnonymousMethodExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2639SyntaxKind.ParenthesizedLambdaExpression => (((ParenthesizedLambdaExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2640SyntaxKind.SimpleLambdaExpression => (((SimpleLambdaExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2641SyntaxKind.GetAccessorDeclaration or 2642SyntaxKind.SetAccessorDeclaration or 2643SyntaxKind.AddAccessorDeclaration or 2644SyntaxKind.RemoveAccessorDeclaration => ((AccessorDeclarationSyntax)declaration).Body?.Statements, 2708SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).ExpressionBody == null, 2709SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).ExpressionBody == null, 2710SyntaxKind.EventDeclaration => true, 2721private static AccessorListSyntax AsAccessorList(IEnumerable<SyntaxNode> nodes, SyntaxKind parentKind) 2724private static AccessorDeclarationSyntax? AsAccessor(SyntaxNode node, SyntaxKind parentKind) 2728case SyntaxKind.PropertyDeclaration: 2729case SyntaxKind.IndexerDeclaration: 2732case SyntaxKind.GetAccessorDeclaration: 2733case SyntaxKind.SetAccessorDeclaration: 2738case SyntaxKind.EventDeclaration: 2741case SyntaxKind.AddAccessorDeclaration: 2742case SyntaxKind.RemoveAccessorDeclaration: 2752private static AccessorDeclarationSyntax? GetAccessor(SyntaxNode declaration, SyntaxKind kind) 2758private SyntaxNode WithAccessor(SyntaxNode declaration, SyntaxKind kind, AccessorDeclarationSyntax accessor) 2761private SyntaxNode WithAccessor(SyntaxNode declaration, AccessorListSyntax? accessorList, SyntaxKind kind, AccessorDeclarationSyntax? accessor) 2781var accessor = GetAccessor(declaration, SyntaxKind.GetAccessorDeclaration); 2787var accessor = GetAccessor(declaration, SyntaxKind.SetAccessorDeclaration); 2792=> this.WithAccessorStatements(declaration, SyntaxKind.GetAccessorDeclaration, statements); 2795=> this.WithAccessorStatements(declaration, SyntaxKind.SetAccessorDeclaration, statements); 2797private SyntaxNode WithAccessorStatements(SyntaxNode declaration, SyntaxKind kind, IEnumerable<SyntaxNode> statements) 2924var kind = decl1.Kind(); 2929case SyntaxKind.Attribute: 2930case SyntaxKind.VariableDeclarator: 2950var kind = decl1.Kind(); 2955case SyntaxKind.FieldDeclaration: 2961case SyntaxKind.EventFieldDeclaration: 2967case SyntaxKind.LocalDeclarationStatement: 2972case SyntaxKind.AttributeList: 2976case SyntaxKind.VariableDeclaration: 3019if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 3058if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 3114SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration.Variables, 3115SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration.Variables, 3116SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables, 3117SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).Variables, 3118SyntaxKind.AttributeList => ((AttributeListSyntax)declaration).Attributes, 3129if (node.Parent.IsKind(SyntaxKind.GlobalStatement)) 3152case SyntaxKind.Attribute: 3162case SyntaxKind.AttributeArgument: 3171case SyntaxKind.VariableDeclarator: 3181case SyntaxKind.SimpleBaseType: 3196case SyntaxKind.SimpleBaseType: 3235=> SyntaxFactory.AssignmentExpression(SyntaxKind.AddAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)ParenthesizeNonSimple(handler)); 3238=> SyntaxFactory.AssignmentExpression(SyntaxKind.SubtractAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)ParenthesizeNonSimple(handler)); 3333var initializer = SyntaxFactory.InitializerExpression(SyntaxKind.ArrayInitializerExpression, AsExpressionList(elements)); 3368=> SyntaxFactory.BinaryExpression(SyntaxKind.IsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3374=> SyntaxFactory.BinaryExpression(SyntaxKind.AsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3377=> SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, (ExpressionSyntax)left, (ExpressionSyntax)ParenthesizeNonSimple(right)); 3379private static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right) 3383=> CreateBinaryExpression(SyntaxKind.EqualsExpression, left, right); 3386=> CreateBinaryExpression(SyntaxKind.EqualsExpression, left, right); 3389=> CreateBinaryExpression(SyntaxKind.NotEqualsExpression, left, right); 3392=> CreateBinaryExpression(SyntaxKind.NotEqualsExpression, left, right); 3395=> CreateBinaryExpression(SyntaxKind.LessThanExpression, left, right); 3398=> CreateBinaryExpression(SyntaxKind.LessThanOrEqualExpression, left, right); 3401=> CreateBinaryExpression(SyntaxKind.GreaterThanExpression, left, right); 3404=> CreateBinaryExpression(SyntaxKind.GreaterThanOrEqualExpression, left, right); 3407=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression)); 3410=> CreateBinaryExpression(SyntaxKind.AddExpression, left, right); 3413=> CreateBinaryExpression(SyntaxKind.SubtractExpression, left, right); 3416=> CreateBinaryExpression(SyntaxKind.MultiplyExpression, left, right); 3419=> CreateBinaryExpression(SyntaxKind.DivideExpression, left, right); 3422=> CreateBinaryExpression(SyntaxKind.ModuloExpression, left, right); 3425=> CreateBinaryExpression(SyntaxKind.BitwiseAndExpression, left, right); 3428=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.BitwiseNotExpression, (ExpressionSyntax)ParenthesizeNonSimple(operand)); 3431=> CreateBinaryExpression(SyntaxKind.LogicalAndExpression, left, right); 3434=> CreateBinaryExpression(SyntaxKind.LogicalOrExpression, left, right); 3438SyntaxKind.LogicalNotExpression, 3445=> CreateBinaryExpression(SyntaxKind.CoalesceExpression, left, right); 3470case SyntaxKind.IdentifierName: 3474case SyntaxKind.GenericName: 3478case SyntaxKind.QualifiedName: 3482case SyntaxKind.AliasQualifiedName: 3486case SyntaxKind.SimpleMemberAccessExpression: 3487case 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 (22)
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) 302if (token.IsKind(SyntaxKind.BreakKeyword) || token.IsKind(SyntaxKind.ContinueKeyword)) 307(position, isBreak: token.IsKind(SyntaxKind.BreakKeyword), cancellationToken: _cancellationToken)); 314.Kind() is SyntaxKind.LabeledStatement or SyntaxKind.DefaultSwitchLabel); 550AnonymousFunctionExpressionSyntax anonymousFunction => anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword), 551LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.StaticKeyword), 608return new RecommendedSymbols(usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword) 802var originalExpressionKind = originalExpression.Kind(); 806if (originalExpressionKind is SyntaxKind.ParenthesizedExpression && 814originalExpressionKind 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\50a3a051b0fef0d6\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\a6db168d9ad5d460\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\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 (52)
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); 396=> node.IsContinuableConstruct() || node?.Kind() is SyntaxKind.SwitchStatement; 402case SyntaxKind.DoStatement: 403case SyntaxKind.WhileStatement: 404case SyntaxKind.ForStatement: 405case SyntaxKind.ForEachStatement: 406case SyntaxKind.ForEachVariableStatement: 417case SyntaxKind.AnonymousMethodExpression: 418case SyntaxKind.SimpleLambdaExpression: 419case SyntaxKind.ParenthesizedLambdaExpression: 420case SyntaxKind.LocalFunctionStatement: 421case SyntaxKind.MethodDeclaration: 422case SyntaxKind.ConstructorDeclaration: 423case SyntaxKind.DestructorDeclaration: 424case SyntaxKind.GetAccessorDeclaration: 425case SyntaxKind.SetAccessorDeclaration: 426case SyntaxKind.InitAccessorDeclaration: 427case SyntaxKind.OperatorDeclaration: 428case SyntaxKind.ConversionOperatorDeclaration: 429case SyntaxKind.AddAccessorDeclaration: 430case SyntaxKind.RemoveAccessorDeclaration: 441=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 543if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 557else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 885while (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\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 (447)
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)) 2159return token.Kind() is SyntaxKind.GotoKeyword or SyntaxKind.BreakKeyword or SyntaxKind.ContinueKeyword && 2198is SyntaxKind.DotToken 2199or SyntaxKind.ColonColonToken 2200or SyntaxKind.MinusGreaterThanToken) 2207if (token.IsKind(SyntaxKind.EqualsToken)) 2209if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2210token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2230is SyntaxKind.EqualsToken 2231or SyntaxKind.MinusEqualsToken 2232or SyntaxKind.AsteriskEqualsToken 2233or SyntaxKind.PlusEqualsToken 2234or SyntaxKind.SlashEqualsToken 2235or SyntaxKind.ExclamationEqualsToken 2236or SyntaxKind.CaretEqualsToken 2237or SyntaxKind.AmpersandEqualsToken 2238or SyntaxKind.BarEqualsToken 2239or SyntaxKind.PercentEqualsToken 2240or SyntaxKind.LessThanLessThanEqualsToken 2241or SyntaxKind.GreaterThanGreaterThanEqualsToken 2242or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2243or SyntaxKind.QuestionQuestionEqualsToken) 2249if (token.IsKind(SyntaxKind.OpenParenToken)) 2251if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2324if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2341tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2344if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2345previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2348if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2367if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2368token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2375if (token.IsKind(SyntaxKind.DotDotToken) && 2376token.Parent.IsKind(SyntaxKind.RangeExpression) && 2383if (token.IsKind(SyntaxKind.QuestionToken) && 2392if (token.IsKind(SyntaxKind.ColonToken) && 2393token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2401if (token.IsKind(SyntaxKind.OpenParenToken)) 2403if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2412if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2423if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2424token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2433if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2435if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2446if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2448if (token.Parent.IsKind(SyntaxKind.Argument)) 2452else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2456if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2466if (token.IsKind(SyntaxKind.ColonToken) && 2467token.Parent.IsKind(SyntaxKind.NameColon) && 2468token.Parent.IsParentKind(SyntaxKind.Argument)) 2474if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2481if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2487if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2490if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2517if (token.IsKind(SyntaxKind.SemicolonToken) && 2528if (token.IsKind(SyntaxKind.OpenParenToken) && 2537if (token.IsKind(SyntaxKind.CommaToken) && 2538token.Parent.IsKind(SyntaxKind.ForStatement)) 2547if (token.IsKind(SyntaxKind.InKeyword)) 2550SyntaxKind.ForEachStatement or 2551SyntaxKind.ForEachVariableStatement or 2552SyntaxKind.FromClause or 2553SyntaxKind.JoinClause)) 2561if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2562token.Parent.IsKind(SyntaxKind.JoinClause)) 2568if (token.IsKind(SyntaxKind.WhereKeyword) && 2569token.Parent.IsKind(SyntaxKind.WhereClause)) 2576if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2577token.Parent.IsKind(SyntaxKind.OrderByClause)) 2583if (token.IsKind(SyntaxKind.SelectKeyword) && 2584token.Parent.IsKind(SyntaxKind.SelectClause)) 2591if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2592token.Parent.IsKind(SyntaxKind.GroupClause)) 2600if (token.IsKind(SyntaxKind.ReturnKeyword)) 2602if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2609if (token.IsKind(SyntaxKind.ThrowKeyword)) 2615if (token.IsKind(SyntaxKind.OpenParenToken) && 2616token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2625if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2631if (token.IsKind(SyntaxKind.OpenParenToken) && 2632token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2673if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2690if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2691token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2699if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2700token.Parent.IsKind(SyntaxKind.ListPattern)) 2708if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2709token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2717if (token.Kind() is SyntaxKind.DotDotToken && 2718token.Parent.IsKind(SyntaxKind.SpreadElement)) 2729if (token.IsKind(SyntaxKind.OpenBraceToken)) 2750if (token.IsKind(SyntaxKind.DotToken)) 2753if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2756while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2761if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2769if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2772while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2777if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2788if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2822if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2852if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2867if (token.IsKind(SyntaxKind.IdentifierToken) && 2868token.Parent.IsKind(SyntaxKind.IdentifierName) && 2869token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2875if (token.Kind() is SyntaxKind.IdentifierToken && 2876token.Parent.IsKind(SyntaxKind.IdentifierName)) 2878if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2882if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2900if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2918case SyntaxKind.QualifiedName: 2920case SyntaxKind.AliasQualifiedName: 2922case SyntaxKind.SimpleMemberAccessExpression: 2951if (token.IsKind(SyntaxKind.CloseBraceToken)) 2957block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2977if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2982if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2983token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3000targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3011targetToken.IsKind(SyntaxKind.ColonToken) && 3012targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3013targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3022if (!token.IsKind(SyntaxKind.DotToken)) 3028if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3034token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3073return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3074targetToken.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\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); 1740string.Equals(CurrentToken.Content, CSharpSyntaxFacts.GetText(CSharpSyntaxKind.WhereKeyword), StringComparison.Ordinal)) 1785CSharpSyntaxFacts.GetText(CSharpSyntaxKind.WhereKeyword))); 2124return _tokenizer.Tokenizer.GetTokenKeyword(CurrentToken) is CSharpSyntaxKind.TrueKeyword or CSharpSyntaxKind.FalseKeyword; 2130Assert(CSharpSyntaxKind.AwaitKeyword); 2149if (At(CSharpSyntaxKind.ForEachKeyword)) 2276Debug.Assert(result is CSharpSyntaxKind.CaseKeyword or CSharpSyntaxKind.DefaultKeyword); 2298Assert(CSharpSyntaxKind.IfKeyword); 2315if (At(CSharpSyntaxKind.ElseKeyword)) 2318Assert(CSharpSyntaxKind.ElseKeyword); 2332if (!At(CSharpSyntaxKind.ElseKeyword)) 2340if (At(CSharpSyntaxKind.IfKeyword)) 2356Assert(CSharpSyntaxKind.TryKeyword); 2378if (At(CSharpSyntaxKind.CatchKeyword)) 2381Assert(CSharpSyntaxKind.CatchKeyword); 2385else if (At(CSharpSyntaxKind.FinallyKeyword)) 2388Assert(CSharpSyntaxKind.FinallyKeyword); 2402Assert(CSharpSyntaxKind.CatchKeyword); 2415if (At(CSharpSyntaxKind.WhenKeyword)) 2437Assert(CSharpSyntaxKind.DoKeyword); 2458if (At(CSharpSyntaxKind.WhileKeyword)) 2461Assert(CSharpSyntaxKind.WhileKeyword); 2478Assert(CSharpSyntaxKind.UsingKeyword); 2486var atStaticOrGlobal = At(CSharpSyntaxKind.StaticKeyword, CSharpSyntaxKind.GlobalKeyword); 2548Assert(CSharpSyntaxKind.UsingKeyword); 2575Assert(CSharpSyntaxKind.UsingKeyword); 2581if (At(SyntaxKind.Identifier) || At(CSharpSyntaxKind.GlobalKeyword)) 2606else if (At(CSharpSyntaxKind.StaticKeyword)) 3112internal void Assert(CSharpSyntaxKind expectedKeyword) 3120protected internal bool At(params ReadOnlySpan<CSharpSyntaxKind> keywords) 3128foreach (var search in keywords) 3142if (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: 636case CSharpSyntaxKind.ConflictMarkerTrivia: 677if (!csharpToken.IsKind(CSharpSyntaxKind.IdentifierToken) || result.ContextualKind is not (CSharpSyntaxKind.None or CSharpSyntaxKind.IdentifierToken)) 710internal override CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token) 714return CSharpSyntaxKind.None; 718return SyntaxFacts.GetKeywordKind(content) is var kind and not CSharpSyntaxKind.None 748if (!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.Configuration.Binder.SourceGeneration (4)
ConfigurationBindingGenerator.Suppressor.cs (4)
143filePathLiteral.IsKind(SyntaxKind.StringLiteralExpression) && 145lineLiteral.IsKind(SyntaxKind.NumericLiteralExpression) && 147colLiteral.IsKind(SyntaxKind.NumericLiteralExpression)) 157dataLiteral.IsKind(SyntaxKind.StringLiteralExpression))
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.Extensions.Validation.ValidationsGenerator (2)
Parsers\ValidationsGenerator.AttributeParser.cs (2)
16return syntaxNode.IsKind(SyntaxKind.ClassDeclaration) || syntaxNode.IsKind(SyntaxKind.RecordDeclaration);
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 (70)
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 (10)
384new SyntaxTokenList(methodSyntax.Modifiers.Where(static m => !m.IsKind(SyntaxKind.NewKeyword) && !m.IsKind(SyntaxKind.PartialKeyword) && !m.IsKind(SyntaxKind.VirtualKeyword))).StripAccessibilityModifiers(), 385SyntaxKind.MethodDeclaration, 392SyntaxKind.MethodDeclaration, 727bool isGetter = basePropertyDecl.AccessorList!.Accessors[0].Kind() is SyntaxKind.GetAccessorDeclaration; 839isSetter ? SyntaxKind.SetAccessorDeclaration : SyntaxKind.GetAccessorDeclaration) 844.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); 893writer.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 (12)
122|| comMethodDeclaringSyntax.Modifiers.Any(SyntaxKind.SealedKeyword)) 220bool shadowsBaseMethod = comMethodDeclaringSyntax.Modifiers.Any(SyntaxKind.NewKeyword); 310bool shadowsBaseProperty = propertyDeclaringSyntax.Modifiers.Any(SyntaxKind.NewKeyword); 414case SyntaxKind.PublicKeyword: 415case SyntaxKind.PrivateKeyword: 416case SyntaxKind.ProtectedKeyword: 417case SyntaxKind.InternalKeyword: 418case SyntaxKind.UnsafeKeyword: 419case SyntaxKind.NewKeyword: 421case SyntaxKind.ExternKeyword: 422case SyntaxKind.RequiredKeyword: 448if (accessor.Keyword.IsKind(SyntaxKind.InitKeyword))
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 (11)
75Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(methodStub.VtableIndexData.Index)))), 126FunctionPointerCallingConvention(Token(SyntaxKind.UnmanagedKeyword), callConv.IsEmpty ? null : FunctionPointerUnmanagedCallingConventionList(SeparatedList(callConv))), 174SyntaxKind accessorKind = isSetter 175? SyntaxKind.SetAccessorDeclaration 176: SyntaxKind.GetAccessorDeclaration; 227SyntaxKind.SimpleMemberAccessExpression, 237MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 252InitializerExpression(SyntaxKind.CollectionInitializerExpression, 260.WithModifiers(TokenList(Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword))) 347FunctionPointerCallingConvention(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 (171)
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 (4)
140SyntaxKind.SimpleAssignmentExpression, 168SyntaxKind.SimpleAssignmentExpression, 192SyntaxKind.SimpleAssignmentExpression, 201SyntaxKind.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 (3045)
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\50a3a051b0fef0d6\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\a6db168d9ad5d460\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\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 (52)
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); 396=> node.IsContinuableConstruct() || node?.Kind() is SyntaxKind.SwitchStatement; 402case SyntaxKind.DoStatement: 403case SyntaxKind.WhileStatement: 404case SyntaxKind.ForStatement: 405case SyntaxKind.ForEachStatement: 406case SyntaxKind.ForEachVariableStatement: 417case SyntaxKind.AnonymousMethodExpression: 418case SyntaxKind.SimpleLambdaExpression: 419case SyntaxKind.ParenthesizedLambdaExpression: 420case SyntaxKind.LocalFunctionStatement: 421case SyntaxKind.MethodDeclaration: 422case SyntaxKind.ConstructorDeclaration: 423case SyntaxKind.DestructorDeclaration: 424case SyntaxKind.GetAccessorDeclaration: 425case SyntaxKind.SetAccessorDeclaration: 426case SyntaxKind.InitAccessorDeclaration: 427case SyntaxKind.OperatorDeclaration: 428case SyntaxKind.ConversionOperatorDeclaration: 429case SyntaxKind.AddAccessorDeclaration: 430case SyntaxKind.RemoveAccessorDeclaration: 441=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 543if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 557else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 885while (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\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 (447)
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)) 2159return token.Kind() is SyntaxKind.GotoKeyword or SyntaxKind.BreakKeyword or SyntaxKind.ContinueKeyword && 2198is SyntaxKind.DotToken 2199or SyntaxKind.ColonColonToken 2200or SyntaxKind.MinusGreaterThanToken) 2207if (token.IsKind(SyntaxKind.EqualsToken)) 2209if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2210token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2230is SyntaxKind.EqualsToken 2231or SyntaxKind.MinusEqualsToken 2232or SyntaxKind.AsteriskEqualsToken 2233or SyntaxKind.PlusEqualsToken 2234or SyntaxKind.SlashEqualsToken 2235or SyntaxKind.ExclamationEqualsToken 2236or SyntaxKind.CaretEqualsToken 2237or SyntaxKind.AmpersandEqualsToken 2238or SyntaxKind.BarEqualsToken 2239or SyntaxKind.PercentEqualsToken 2240or SyntaxKind.LessThanLessThanEqualsToken 2241or SyntaxKind.GreaterThanGreaterThanEqualsToken 2242or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2243or SyntaxKind.QuestionQuestionEqualsToken) 2249if (token.IsKind(SyntaxKind.OpenParenToken)) 2251if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2324if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2341tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2344if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2345previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2348if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2367if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2368token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2375if (token.IsKind(SyntaxKind.DotDotToken) && 2376token.Parent.IsKind(SyntaxKind.RangeExpression) && 2383if (token.IsKind(SyntaxKind.QuestionToken) && 2392if (token.IsKind(SyntaxKind.ColonToken) && 2393token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2401if (token.IsKind(SyntaxKind.OpenParenToken)) 2403if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2412if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2423if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2424token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2433if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2435if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2446if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2448if (token.Parent.IsKind(SyntaxKind.Argument)) 2452else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2456if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2466if (token.IsKind(SyntaxKind.ColonToken) && 2467token.Parent.IsKind(SyntaxKind.NameColon) && 2468token.Parent.IsParentKind(SyntaxKind.Argument)) 2474if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2481if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2487if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2490if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2517if (token.IsKind(SyntaxKind.SemicolonToken) && 2528if (token.IsKind(SyntaxKind.OpenParenToken) && 2537if (token.IsKind(SyntaxKind.CommaToken) && 2538token.Parent.IsKind(SyntaxKind.ForStatement)) 2547if (token.IsKind(SyntaxKind.InKeyword)) 2550SyntaxKind.ForEachStatement or 2551SyntaxKind.ForEachVariableStatement or 2552SyntaxKind.FromClause or 2553SyntaxKind.JoinClause)) 2561if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2562token.Parent.IsKind(SyntaxKind.JoinClause)) 2568if (token.IsKind(SyntaxKind.WhereKeyword) && 2569token.Parent.IsKind(SyntaxKind.WhereClause)) 2576if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2577token.Parent.IsKind(SyntaxKind.OrderByClause)) 2583if (token.IsKind(SyntaxKind.SelectKeyword) && 2584token.Parent.IsKind(SyntaxKind.SelectClause)) 2591if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2592token.Parent.IsKind(SyntaxKind.GroupClause)) 2600if (token.IsKind(SyntaxKind.ReturnKeyword)) 2602if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2609if (token.IsKind(SyntaxKind.ThrowKeyword)) 2615if (token.IsKind(SyntaxKind.OpenParenToken) && 2616token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2625if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2631if (token.IsKind(SyntaxKind.OpenParenToken) && 2632token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2673if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2690if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2691token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2699if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2700token.Parent.IsKind(SyntaxKind.ListPattern)) 2708if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2709token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2717if (token.Kind() is SyntaxKind.DotDotToken && 2718token.Parent.IsKind(SyntaxKind.SpreadElement)) 2729if (token.IsKind(SyntaxKind.OpenBraceToken)) 2750if (token.IsKind(SyntaxKind.DotToken)) 2753if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2756while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2761if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2769if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2772while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2777if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2788if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2822if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2852if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2867if (token.IsKind(SyntaxKind.IdentifierToken) && 2868token.Parent.IsKind(SyntaxKind.IdentifierName) && 2869token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2875if (token.Kind() is SyntaxKind.IdentifierToken && 2876token.Parent.IsKind(SyntaxKind.IdentifierName)) 2878if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2882if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2900if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2918case SyntaxKind.QualifiedName: 2920case SyntaxKind.AliasQualifiedName: 2922case SyntaxKind.SimpleMemberAccessExpression: 2951if (token.IsKind(SyntaxKind.CloseBraceToken)) 2957block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2977if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2982if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2983token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3000targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3011targetToken.IsKind(SyntaxKind.ColonToken) && 3012targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3013targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3022if (!token.IsKind(SyntaxKind.DotToken)) 3028if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3034token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3073return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3074targetToken.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\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)
637=> SyntaxFacts.GetKeywordKind(symbol.Name) != SyntaxKind.None || SyntaxFacts.GetContextualKeywordKind(symbol.Name) != SyntaxKind.None; 672case SyntaxKind.ClassDeclaration: 674case SyntaxKind.InterfaceDeclaration: 676case SyntaxKind.StructDeclaration: 678case SyntaxKind.RecordDeclaration: 680case SyntaxKind.RecordStructDeclaration: 682case SyntaxKind.EnumDeclaration: 684case 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);